-rw-r--r-- | libkcal/calfilter.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libkcal/calfilter.cpp b/libkcal/calfilter.cpp index 72f70c2..fa1dbd5 100644 --- a/libkcal/calfilter.cpp +++ b/libkcal/calfilter.cpp | |||
@@ -1,112 +1,114 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <kdebug.h> | 21 | #include <kdebug.h> |
22 | 22 | ||
23 | #include "calfilter.h" | 23 | #include "calfilter.h" |
24 | //Added by qt3to4: | ||
25 | #include <Q3PtrList> | ||
24 | 26 | ||
25 | using namespace KCal; | 27 | using namespace KCal; |
26 | 28 | ||
27 | CalFilter::CalFilter() | 29 | CalFilter::CalFilter() |
28 | { | 30 | { |
29 | mEnabled = true; | 31 | mEnabled = true; |
30 | mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; | 32 | mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; |
31 | } | 33 | } |
32 | 34 | ||
33 | CalFilter::CalFilter(const QString &name) | 35 | CalFilter::CalFilter(const QString &name) |
34 | { | 36 | { |
35 | mName = name; | 37 | mName = name; |
36 | mEnabled = true; | 38 | mEnabled = true; |
37 | mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; | 39 | mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; |
38 | } | 40 | } |
39 | 41 | ||
40 | CalFilter::~CalFilter() | 42 | CalFilter::~CalFilter() |
41 | { | 43 | { |
42 | } | 44 | } |
43 | 45 | ||
44 | void CalFilter::apply(QPtrList<Event> *eventlist) | 46 | void CalFilter::apply(Q3PtrList<Event> *eventlist) |
45 | { | 47 | { |
46 | if (!mEnabled) return; | 48 | if (!mEnabled) return; |
47 | 49 | ||
48 | // kdDebug(5800) << "CalFilter::apply()" << endl; | 50 | // kdDebug(5800) << "CalFilter::apply()" << endl; |
49 | 51 | ||
50 | Event *event = eventlist->first(); | 52 | Event *event = eventlist->first(); |
51 | while(event) { | 53 | while(event) { |
52 | if (!filterEvent(event)) { | 54 | if (!filterEvent(event)) { |
53 | eventlist->remove(); | 55 | eventlist->remove(); |
54 | event = eventlist->current(); | 56 | event = eventlist->current(); |
55 | } else { | 57 | } else { |
56 | event = eventlist->next(); | 58 | event = eventlist->next(); |
57 | } | 59 | } |
58 | } | 60 | } |
59 | 61 | ||
60 | // kdDebug(5800) << "CalFilter::apply() done" << endl; | 62 | // kdDebug(5800) << "CalFilter::apply() done" << endl; |
61 | } | 63 | } |
62 | 64 | ||
63 | // TODO: avoid duplicating apply() code | 65 | // TODO: avoid duplicating apply() code |
64 | void CalFilter::apply(QPtrList<Todo> *eventlist) | 66 | void CalFilter::apply(Q3PtrList<Todo> *eventlist) |
65 | { | 67 | { |
66 | if (!mEnabled) return; | 68 | if (!mEnabled) return; |
67 | Todo *event = eventlist->first(); | 69 | Todo *event = eventlist->first(); |
68 | while(event) { | 70 | while(event) { |
69 | if (!filterTodo(event)) { | 71 | if (!filterTodo(event)) { |
70 | eventlist->remove(); | 72 | eventlist->remove(); |
71 | event = eventlist->current(); | 73 | event = eventlist->current(); |
72 | } else { | 74 | } else { |
73 | event = eventlist->next(); | 75 | event = eventlist->next(); |
74 | } | 76 | } |
75 | } | 77 | } |
76 | 78 | ||
77 | // kdDebug(5800) << "CalFilter::apply() done" << endl; | 79 | // kdDebug(5800) << "CalFilter::apply() done" << endl; |
78 | } | 80 | } |
79 | bool CalFilter::filterCalendarItem(Incidence *in) | 81 | bool CalFilter::filterCalendarItem(Incidence *in) |
80 | { | 82 | { |
81 | if ( !in->calEnabled() ) | 83 | if ( !in->calEnabled() ) |
82 | return false; | 84 | return false; |
83 | if ( in->typeID() == eventID ) | 85 | if ( in->typeID() == eventID ) |
84 | return filterEvent( (Event*) in ); | 86 | return filterEvent( (Event*) in ); |
85 | else if ( in->typeID() == todoID ) | 87 | else if ( in->typeID() == todoID ) |
86 | return filterTodo( (Todo*) in); | 88 | return filterTodo( (Todo*) in); |
87 | else if ( in->typeID () == journalID ) | 89 | else if ( in->typeID () == journalID ) |
88 | return filterJournal( (Journal*) in ); | 90 | return filterJournal( (Journal*) in ); |
89 | return false; | 91 | return false; |
90 | } | 92 | } |
91 | bool CalFilter::filterEvent(Event *event) | 93 | bool CalFilter::filterEvent(Event *event) |
92 | { | 94 | { |
93 | 95 | ||
94 | if ( !event->calEnabled() ) | 96 | if ( !event->calEnabled() ) |
95 | return false; | 97 | return false; |
96 | if (mCriteria & HideEvents) | 98 | if (mCriteria & HideEvents) |
97 | return false; | 99 | return false; |
98 | if (mCriteria & HideRecurring) { | 100 | if (mCriteria & HideRecurring) { |
99 | if (event->recurrence()->doesRecur()) return false; | 101 | if (event->recurrence()->doesRecur()) return false; |
100 | } | 102 | } |
101 | 103 | ||
102 | return filterIncidence(event); | 104 | return filterIncidence(event); |
103 | } | 105 | } |
104 | bool CalFilter::filterJournal(Journal *j) | 106 | bool CalFilter::filterJournal(Journal *j) |
105 | { | 107 | { |
106 | if ( !j->calEnabled() ) | 108 | if ( !j->calEnabled() ) |
107 | return false; | 109 | return false; |
108 | if (mCriteria & HideJournals) | 110 | if (mCriteria & HideJournals) |
109 | return false; | 111 | return false; |
110 | return true; | 112 | return true; |
111 | } | 113 | } |
112 | bool CalFilter::filterTodo(Todo *todo) | 114 | bool CalFilter::filterTodo(Todo *todo) |