-rw-r--r-- | libkcal/calfilter.cpp | 29 | ||||
-rw-r--r-- | libkcal/calfilter.h | 3 |
2 files changed, 22 insertions, 10 deletions
diff --git a/libkcal/calfilter.cpp b/libkcal/calfilter.cpp index c182db5..c425dfc 100644 --- a/libkcal/calfilter.cpp +++ b/libkcal/calfilter.cpp @@ -61,43 +61,54 @@ void CalFilter::apply(QPtrList<Event> *eventlist) } // TODO: avoid duplicating apply() code void CalFilter::apply(QPtrList<Todo> *eventlist) { if (!mEnabled) return; - -// kdDebug(5800) << "CalFilter::apply()" << endl; - Todo *event = eventlist->first(); while(event) { if (!filterTodo(event)) { eventlist->remove(); event = eventlist->current(); } else { event = eventlist->next(); } } // kdDebug(5800) << "CalFilter::apply() done" << endl; } - +bool CalFilter::filterCalendarItem(Incidence *in) +{ + if ( in->type() == "Event" ) + return filterEvent( (Event*) in ); + else if ( in->type() =="Todo" ) + return filterTodo( (Todo*) in); + else if ( in->type() =="Journal" ) + return filterJournal( (Journal*) in ); + return false; +} bool CalFilter::filterEvent(Event *event) { -// kdDebug(5800) << "CalFilter::filterEvent(): " << event->getSummary() << endl; - + if (mCriteria & HideEvents) + return false; if (mCriteria & HideRecurring) { if (event->recurrence()->doesRecur()) return false; } return filterIncidence(event); } - +bool CalFilter::filterJournal(Journal *j) +{ + if (mCriteria & HideJournals) + return false; + return true; +} bool CalFilter::filterTodo(Todo *todo) { -// kdDebug(5800) << "CalFilter::filterEvent(): " << event->getSummary() << endl; - + if (mCriteria & HideTodos) + return false; if (mCriteria & HideCompleted) { if (todo->isCompleted()) return false; } return filterIncidence(todo); } diff --git a/libkcal/calfilter.h b/libkcal/calfilter.h index 5ad0064..29db441 100644 --- a/libkcal/calfilter.h +++ b/libkcal/calfilter.h @@ -58,13 +58,14 @@ class CalFilter { /** Apply filter to todolist, all todos not matching filter criterias are removed from the list. */ void apply(QPtrList<Todo> *todolist); - + bool CalFilter::filterCalendarItem(Incidence *in); + bool CalFilter::filterJournal(Journal *in); /** Apply filter criteria on the specified event. Return true, if event passes criteria, otherwise return false. */ bool filterEvent(Event *); |