-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 | |||
@@ -319,6 +319,8 @@ public: | |||
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(); |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 1a1c6be..0ddfeca 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -452,7 +452,7 @@ Event *CalendarLocal::event( QString syncProf, QString id ) | |||
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 ) { |
@@ -467,6 +467,30 @@ Todo *CalendarLocal::todo( const QString &uid ) | |||
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; |
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index a7a85c8..ca0bd98 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -185,6 +185,7 @@ class CalendarLocal : public Calendar | |||
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 ); |