-rw-r--r-- | libkcal/calendar.h | 2 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 26 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 1 |
3 files changed, 28 insertions, 1 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 3f6895d..4b8b3ff 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -310,24 +310,26 @@ public: | |||
310 | QString::null, if no calendar has been loaded. | 310 | QString::null, if no calendar has been loaded. |
311 | */ | 311 | */ |
312 | QString loadedProductId(); | 312 | QString loadedProductId(); |
313 | int defaultCalendar(); | 313 | int defaultCalendar(); |
314 | void setDontDeleteIncidencesOnClose (); | 314 | void setDontDeleteIncidencesOnClose (); |
315 | public slots: | 315 | public slots: |
316 | void setDefaultCalendar( int ); | 316 | void setDefaultCalendar( int ); |
317 | virtual void setCalendarEnabled( int id, bool enable ) = 0; | 317 | virtual void setCalendarEnabled( int id, bool enable ) = 0; |
318 | virtual void setAlarmEnabled( int id, bool enable ) = 0; | 318 | virtual void setAlarmEnabled( int id, bool enable ) = 0; |
319 | virtual void setReadOnly( int id, bool enable ) = 0; | 319 | virtual void setReadOnly( int id, bool enable ) = 0; |
320 | virtual void setDefaultCalendarEnabledOnly() = 0; | 320 | virtual void setDefaultCalendarEnabledOnly() = 0; |
321 | virtual void setCalendarRemove( int id ) = 0; | 321 | virtual void setCalendarRemove( int id ) = 0; |
322 | virtual void getIncidenceCount( int calId, int& events, int & todos, int & journals) = 0; | ||
323 | |||
322 | signals: | 324 | signals: |
323 | void calendarChanged(); | 325 | void calendarChanged(); |
324 | void calendarSaved(); | 326 | void calendarSaved(); |
325 | void calendarLoaded(); | 327 | void calendarLoaded(); |
326 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 328 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
327 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 329 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
328 | 330 | ||
329 | protected: | 331 | protected: |
330 | /** | 332 | /** |
331 | Get unfiltered events, which occur on the given date. | 333 | Get unfiltered events, which occur on the given date. |
332 | */ | 334 | */ |
333 | virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0; | 335 | virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0; |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 1a1c6be..0ddfeca 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -443,39 +443,63 @@ QPtrList<Event> CalendarLocal::getExternLastSyncEvents() | |||
443 | } | 443 | } |
444 | Event *CalendarLocal::event( QString syncProf, QString id ) | 444 | Event *CalendarLocal::event( QString syncProf, QString id ) |
445 | { | 445 | { |
446 | Event *todo; | 446 | Event *todo; |
447 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 447 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
448 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; | 448 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; |
449 | } | 449 | } |
450 | 450 | ||
451 | return 0; | 451 | return 0; |
452 | } | 452 | } |
453 | Todo *CalendarLocal::todo( const QString &uid ) | 453 | Todo *CalendarLocal::todo( const QString &uid ) |
454 | { | 454 | { |
455 | Todo *todo;; | 455 | Todo *todo; |
456 | Todo *retVal = 0; | 456 | Todo *retVal = 0; |
457 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 457 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
458 | if ( todo->calEnabled() && todo->uid() == uid ) { | 458 | if ( todo->calEnabled() && todo->uid() == uid ) { |
459 | if ( retVal ) { | 459 | if ( retVal ) { |
460 | if ( retVal->calID() > todo->calID() ) { | 460 | if ( retVal->calID() > todo->calID() ) { |
461 | retVal = todo; | 461 | retVal = todo; |
462 | } | 462 | } |
463 | } else { | 463 | } else { |
464 | retVal = todo; | 464 | retVal = todo; |
465 | } | 465 | } |
466 | } | 466 | } |
467 | } | 467 | } |
468 | return retVal; | 468 | return retVal; |
469 | } | 469 | } |
470 | void CalendarLocal::getIncidenceCount( int calId, int& events, int & todos, int & journals) | ||
471 | { | ||
472 | events = 0; | ||
473 | todos = 0; | ||
474 | journals = 0; | ||
475 | { | ||
476 | Todo *todo; | ||
477 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | ||
478 | if ( todo->calID() == calId ) | ||
479 | ++todos; | ||
480 | } | ||
481 | } | ||
482 | { | ||
483 | Event *todo; | ||
484 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | ||
485 | if ( todo->calID() == calId ) | ||
486 | ++events; | ||
487 | |||
488 | } | ||
489 | } | ||
490 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | ||
491 | if ( it->calID() == calId ) ++journals; | ||
492 | |||
493 | } | ||
470 | QString CalendarLocal::nextSummary() const | 494 | QString CalendarLocal::nextSummary() const |
471 | { | 495 | { |
472 | return mNextSummary; | 496 | return mNextSummary; |
473 | } | 497 | } |
474 | QDateTime CalendarLocal::nextAlarmEventDateTime() const | 498 | QDateTime CalendarLocal::nextAlarmEventDateTime() const |
475 | { | 499 | { |
476 | return mNextAlarmEventDateTime; | 500 | return mNextAlarmEventDateTime; |
477 | } | 501 | } |
478 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) | 502 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) |
479 | { | 503 | { |
480 | //mNextAlarmIncidence | 504 | //mNextAlarmIncidence |
481 | //mNextAlarmDateTime | 505 | //mNextAlarmDateTime |
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index a7a85c8..ca0bd98 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -176,24 +176,25 @@ class CalendarLocal : public Calendar | |||
176 | /** | 176 | /** |
177 | Get unfiltered events for date \a qdt. | 177 | Get unfiltered events for date \a qdt. |
178 | */ | 178 | */ |
179 | QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); | 179 | QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); |
180 | /** | 180 | /** |
181 | Get unfiltered events in a range of dates. If inclusive is set to true, | 181 | Get unfiltered events in a range of dates. If inclusive is set to true, |
182 | only events are returned, which are completely included in the range. | 182 | only events are returned, which are completely included in the range. |
183 | */ | 183 | */ |
184 | QPtrList<Event> rawEvents( const QDate &start, const QDate &end, | 184 | QPtrList<Event> rawEvents( const QDate &start, const QDate &end, |
185 | bool inclusive = false ); | 185 | bool inclusive = false ); |
186 | Todo *todo( QString, QString ); | 186 | Todo *todo( QString, QString ); |
187 | Event *event( QString, QString ); | 187 | Event *event( QString, QString ); |
188 | void getIncidenceCount( int calId, int& events, int & todos, int & journals); | ||
188 | 189 | ||
189 | public slots: | 190 | public slots: |
190 | void setCalendarEnabled( int id, bool enable ); | 191 | void setCalendarEnabled( int id, bool enable ); |
191 | void setAlarmEnabled( int id, bool enable ); | 192 | void setAlarmEnabled( int id, bool enable ); |
192 | void setReadOnly( int id, bool enable ); | 193 | void setReadOnly( int id, bool enable ); |
193 | void setDefaultCalendarEnabledOnly(); | 194 | void setDefaultCalendarEnabledOnly(); |
194 | void setCalendarRemove( int id ); | 195 | void setCalendarRemove( int id ); |
195 | 196 | ||
196 | protected: | 197 | protected: |
197 | 198 | ||
198 | // Event* mNextAlarmEvent; | 199 | // Event* mNextAlarmEvent; |
199 | QString mNextSummary; | 200 | QString mNextSummary; |