-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 @@ -320,4 +320,6 @@ public: virtual void setDefaultCalendarEnabledOnly() = 0; virtual void setCalendarRemove( int id ) = 0; + virtual void getIncidenceCount( int calId, int& events, int & todos, int & journals) = 0; + signals: void calendarChanged(); diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 1a1c6be..0ddfeca 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -453,5 +453,5 @@ Event *CalendarLocal::event( QString syncProf, QString id ) Todo *CalendarLocal::todo( const QString &uid ) { - Todo *todo;; + Todo *todo; Todo *retVal = 0; for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { @@ -468,4 +468,28 @@ Todo *CalendarLocal::todo( const QString &uid ) return retVal; } +void CalendarLocal::getIncidenceCount( int calId, int& events, int & todos, int & journals) +{ + events = 0; + todos = 0; + journals = 0; + { + Todo *todo; + for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { + if ( todo->calID() == calId ) + ++todos; + } + } + { + Event *todo; + for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { + if ( todo->calID() == calId ) + ++events; + + } + } + for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) + if ( it->calID() == calId ) ++journals; + +} QString CalendarLocal::nextSummary() const { diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index a7a85c8..ca0bd98 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h @@ -186,4 +186,5 @@ class CalendarLocal : public Calendar Todo *todo( QString, QString ); Event *event( QString, QString ); + void getIncidenceCount( int calId, int& events, int & todos, int & journals); public slots: |