author | zautrix <zautrix> | 2005-01-16 11:22:49 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-16 11:22:49 (UTC) |
commit | d57ed4438bbd6e3d9a7a0e46283d3e7645b4e47b (patch) (unidiff) | |
tree | 522438ce187845f6d74d7888be203759138615fa /libkcal | |
parent | 92b8de5ff678bddf69b9f0a45c1d90829c50c592 (diff) | |
download | kdepimpi-d57ed4438bbd6e3d9a7a0e46283d3e7645b4e47b.zip kdepimpi-d57ed4438bbd6e3d9a7a0e46283d3e7645b4e47b.tar.gz kdepimpi-d57ed4438bbd6e3d9a7a0e46283d3e7645b4e47b.tar.bz2 |
filter impl
-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 | |||
@@ -63,11 +63,8 @@ void CalFilter::apply(QPtrList<Event> *eventlist) | |||
63 | // TODO: avoid duplicating apply() code | 63 | // TODO: avoid duplicating apply() code |
64 | void CalFilter::apply(QPtrList<Todo> *eventlist) | 64 | void CalFilter::apply(QPtrList<Todo> *eventlist) |
65 | { | 65 | { |
66 | if (!mEnabled) return; | 66 | if (!mEnabled) return; |
67 | |||
68 | // kdDebug(5800) << "CalFilter::apply()" << endl; | ||
69 | |||
70 | Todo *event = eventlist->first(); | 67 | Todo *event = eventlist->first(); |
71 | while(event) { | 68 | while(event) { |
72 | if (!filterTodo(event)) { | 69 | if (!filterTodo(event)) { |
73 | eventlist->remove(); | 70 | eventlist->remove(); |
@@ -78,24 +75,38 @@ void CalFilter::apply(QPtrList<Todo> *eventlist) | |||
78 | } | 75 | } |
79 | 76 | ||
80 | // kdDebug(5800) << "CalFilter::apply() done" << endl; | 77 | // kdDebug(5800) << "CalFilter::apply() done" << endl; |
81 | } | 78 | } |
82 | 79 | bool CalFilter::filterCalendarItem(Incidence *in) | |
80 | { | ||
81 | if ( in->type() == "Event" ) | ||
82 | return filterEvent( (Event*) in ); | ||
83 | else if ( in->type() =="Todo" ) | ||
84 | return filterTodo( (Todo*) in); | ||
85 | else if ( in->type() =="Journal" ) | ||
86 | return filterJournal( (Journal*) in ); | ||
87 | return false; | ||
88 | } | ||
83 | bool CalFilter::filterEvent(Event *event) | 89 | bool CalFilter::filterEvent(Event *event) |
84 | { | 90 | { |
85 | // kdDebug(5800) << "CalFilter::filterEvent(): " << event->getSummary() << endl; | 91 | if (mCriteria & HideEvents) |
86 | 92 | return false; | |
87 | if (mCriteria & HideRecurring) { | 93 | if (mCriteria & HideRecurring) { |
88 | if (event->recurrence()->doesRecur()) return false; | 94 | if (event->recurrence()->doesRecur()) return false; |
89 | } | 95 | } |
90 | 96 | ||
91 | return filterIncidence(event); | 97 | return filterIncidence(event); |
92 | } | 98 | } |
93 | 99 | bool CalFilter::filterJournal(Journal *j) | |
100 | { | ||
101 | if (mCriteria & HideJournals) | ||
102 | return false; | ||
103 | return true; | ||
104 | } | ||
94 | bool CalFilter::filterTodo(Todo *todo) | 105 | bool CalFilter::filterTodo(Todo *todo) |
95 | { | 106 | { |
96 | // kdDebug(5800) << "CalFilter::filterEvent(): " << event->getSummary() << endl; | 107 | if (mCriteria & HideTodos) |
97 | 108 | return false; | |
98 | if (mCriteria & HideCompleted) { | 109 | if (mCriteria & HideCompleted) { |
99 | if (todo->isCompleted()) return false; | 110 | if (todo->isCompleted()) return false; |
100 | } | 111 | } |
101 | 112 | ||
diff --git a/libkcal/calfilter.h b/libkcal/calfilter.h index 5ad0064..29db441 100644 --- a/libkcal/calfilter.h +++ b/libkcal/calfilter.h | |||
@@ -60,9 +60,10 @@ class CalFilter { | |||
60 | Apply filter to todolist, all todos not matching filter criterias are | 60 | Apply filter to todolist, all todos not matching filter criterias are |
61 | removed from the list. | 61 | removed from the list. |
62 | */ | 62 | */ |
63 | void apply(QPtrList<Todo> *todolist); | 63 | void apply(QPtrList<Todo> *todolist); |
64 | 64 | bool CalFilter::filterCalendarItem(Incidence *in); | |
65 | bool CalFilter::filterJournal(Journal *in); | ||
65 | /** | 66 | /** |
66 | Apply filter criteria on the specified event. Return true, if event passes | 67 | Apply filter criteria on the specified event. Return true, if event passes |
67 | criteria, otherwise return false. | 68 | criteria, otherwise return false. |
68 | */ | 69 | */ |