author | zautrix <zautrix> | 2005-06-29 10:36:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-29 10:36:31 (UTC) |
commit | b7044dfc9516d546683973985555c481d59fc677 (patch) (unidiff) | |
tree | b521090cfc8eb6c8c6a6f6f8167c83058ea1361b /libkcal | |
parent | f226b4cd2ce06a6948811fe04d80fe3ffa44f695 (diff) | |
download | kdepimpi-b7044dfc9516d546683973985555c481d59fc677.zip kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.gz kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.bz2 |
journal fixxx
-rw-r--r-- | libkcal/calendar.h | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 14 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 1 |
3 files changed, 10 insertions, 6 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 2efa355..4652fe5 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -1,376 +1,377 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 1998 Preston Brown | 3 | Copyright (c) 1998 Preston Brown |
4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifndef CALENDAR_H | 22 | #ifndef CALENDAR_H |
23 | #define CALENDAR_H | 23 | #define CALENDAR_H |
24 | 24 | ||
25 | #include <qobject.h> | 25 | #include <qobject.h> |
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | #include <qdatetime.h> | 27 | #include <qdatetime.h> |
28 | #include <qptrlist.h> | 28 | #include <qptrlist.h> |
29 | #include <qdict.h> | 29 | #include <qdict.h> |
30 | 30 | ||
31 | #include "customproperties.h" | 31 | #include "customproperties.h" |
32 | #include "event.h" | 32 | #include "event.h" |
33 | #include "todo.h" | 33 | #include "todo.h" |
34 | #include "journal.h" | 34 | #include "journal.h" |
35 | #include "calfilter.h" | 35 | #include "calfilter.h" |
36 | 36 | ||
37 | //#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ | 37 | //#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ |
38 | 38 | ||
39 | class KConfig; | 39 | class KConfig; |
40 | 40 | ||
41 | namespace KCal { | 41 | namespace KCal { |
42 | 42 | ||
43 | 43 | ||
44 | /** | 44 | /** |
45 | This is the main "calendar" object class for KOrganizer. It holds | 45 | This is the main "calendar" object class for KOrganizer. It holds |
46 | information like all appointments/events, user information, etc. etc. | 46 | information like all appointments/events, user information, etc. etc. |
47 | one calendar is associated with each CalendarView (@see calendarview.h). | 47 | one calendar is associated with each CalendarView (@see calendarview.h). |
48 | This is an abstract base class defining the interface to a calendar. It is | 48 | This is an abstract base class defining the interface to a calendar. It is |
49 | implemented by subclasses like @see CalendarLocal, which use different | 49 | implemented by subclasses like @see CalendarLocal, which use different |
50 | methods to store and access the data. | 50 | methods to store and access the data. |
51 | 51 | ||
52 | Ownership of events etc. is handled by the following policy: As soon as an | 52 | Ownership of events etc. is handled by the following policy: As soon as an |
53 | event (or any other subclass of IncidenceBase) object is added to the | 53 | event (or any other subclass of IncidenceBase) object is added to the |
54 | Calendar by addEvent() it is owned by the Calendar object. The Calendar takes | 54 | Calendar by addEvent() it is owned by the Calendar object. The Calendar takes |
55 | care of deleting it. All Events returned by the query functions are returned | 55 | care of deleting it. All Events returned by the query functions are returned |
56 | as pointers, that means all changes to the returned events are immediately | 56 | as pointers, that means all changes to the returned events are immediately |
57 | visible in the Calendar. You shouldn't delete any Event object you get from | 57 | visible in the Calendar. You shouldn't delete any Event object you get from |
58 | Calendar. | 58 | Calendar. |
59 | */ | 59 | */ |
60 | class Calendar : public QObject, public CustomProperties, | 60 | class Calendar : public QObject, public CustomProperties, |
61 | public IncidenceBase::Observer | 61 | public IncidenceBase::Observer |
62 | { | 62 | { |
63 | Q_OBJECT | 63 | Q_OBJECT |
64 | public: | 64 | public: |
65 | Calendar(); | 65 | Calendar(); |
66 | Calendar(const QString &timeZoneId); | 66 | Calendar(const QString &timeZoneId); |
67 | virtual ~Calendar(); | 67 | virtual ~Calendar(); |
68 | Incidence * undoIncidence() { return mUndoIncidence; }; | 68 | Incidence * undoIncidence() { return mUndoIncidence; }; |
69 | bool undoDeleteIncidence(); | 69 | bool undoDeleteIncidence(); |
70 | void deleteIncidence(Incidence *in); | 70 | void deleteIncidence(Incidence *in); |
71 | void resetTempSyncStat(); | 71 | void resetTempSyncStat(); |
72 | void resetPilotStat(int id); | 72 | void resetPilotStat(int id); |
73 | /** | 73 | /** |
74 | Clears out the current calendar, freeing all used memory etc. | 74 | Clears out the current calendar, freeing all used memory etc. |
75 | */ | 75 | */ |
76 | virtual void close() = 0; | 76 | virtual void close() = 0; |
77 | virtual void addCalendar( Calendar* ) = 0; | 77 | virtual void addCalendar( Calendar* ) = 0; |
78 | virtual bool addCalendarFile( QString name, int id ) = 0; | 78 | virtual bool addCalendarFile( QString name, int id ) = 0; |
79 | virtual void setSyncEventsReadOnly() = 0; | 79 | virtual void setSyncEventsReadOnly() = 0; |
80 | virtual void stopAllTodos() = 0; | 80 | virtual void stopAllTodos() = 0; |
81 | 81 | ||
82 | /** | 82 | /** |
83 | Sync changes in memory to persistant storage. | 83 | Sync changes in memory to persistant storage. |
84 | */ | 84 | */ |
85 | virtual void save() = 0; | 85 | virtual void save() = 0; |
86 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; | 86 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; |
87 | virtual void removeSyncInfo( QString syncProfile) = 0; | 87 | virtual void removeSyncInfo( QString syncProfile) = 0; |
88 | virtual bool isSaving() { return false; } | 88 | virtual bool isSaving() { return false; } |
89 | 89 | ||
90 | /** | 90 | /** |
91 | Return the owner of the calendar's full name. | 91 | Return the owner of the calendar's full name. |
92 | */ | 92 | */ |
93 | const QString &getOwner() const; | 93 | const QString &getOwner() const; |
94 | /** | 94 | /** |
95 | Set the owner of the calendar. Should be owner's full name. | 95 | Set the owner of the calendar. Should be owner's full name. |
96 | */ | 96 | */ |
97 | void setOwner( const QString &os ); | 97 | void setOwner( const QString &os ); |
98 | /** | 98 | /** |
99 | Return the email address of the calendar owner. | 99 | Return the email address of the calendar owner. |
100 | */ | 100 | */ |
101 | const QString &getEmail(); | 101 | const QString &getEmail(); |
102 | /** | 102 | /** |
103 | Set the email address of the calendar owner. | 103 | Set the email address of the calendar owner. |
104 | */ | 104 | */ |
105 | void setEmail( const QString & ); | 105 | void setEmail( const QString & ); |
106 | 106 | ||
107 | /** | 107 | /** |
108 | Set time zone from a timezone string (e.g. -2:00) | 108 | Set time zone from a timezone string (e.g. -2:00) |
109 | */ | 109 | */ |
110 | void setTimeZone( const QString &tz ); | 110 | void setTimeZone( const QString &tz ); |
111 | /** | 111 | /** |
112 | Set time zone from a minutes value (e.g. -60) | 112 | Set time zone from a minutes value (e.g. -60) |
113 | */ | 113 | */ |
114 | void setTimeZone( int tz ); | 114 | void setTimeZone( int tz ); |
115 | /** | 115 | /** |
116 | Return time zone as offest in minutes. | 116 | Return time zone as offest in minutes. |
117 | */ | 117 | */ |
118 | int getTimeZone() const; | 118 | int getTimeZone() const; |
119 | /** | 119 | /** |
120 | Compute an ISO 8601 format string from the time zone. | 120 | Compute an ISO 8601 format string from the time zone. |
121 | */ | 121 | */ |
122 | QString getTimeZoneStr() const; | 122 | QString getTimeZoneStr() const; |
123 | /** | 123 | /** |
124 | Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal | 124 | Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal |
125 | values). | 125 | values). |
126 | */ | 126 | */ |
127 | void setTimeZoneId( const QString & ); | 127 | void setTimeZoneId( const QString & ); |
128 | /** | 128 | /** |
129 | Return time zone id. | 129 | Return time zone id. |
130 | */ | 130 | */ |
131 | QString timeZoneId() const; | 131 | QString timeZoneId() const; |
132 | /** | 132 | /** |
133 | Use local time, not UTC or a time zone. | 133 | Use local time, not UTC or a time zone. |
134 | */ | 134 | */ |
135 | void setLocalTime(); | 135 | void setLocalTime(); |
136 | /** | 136 | /** |
137 | Return whether local time is being used. | 137 | Return whether local time is being used. |
138 | */ | 138 | */ |
139 | bool isLocalTime() const; | 139 | bool isLocalTime() const; |
140 | 140 | ||
141 | /** | 141 | /** |
142 | Add an incidence to calendar. | 142 | Add an incidence to calendar. |
143 | 143 | ||
144 | @return true on success, false on error. | 144 | @return true on success, false on error. |
145 | */ | 145 | */ |
146 | virtual bool addIncidence( Incidence * ); | 146 | virtual bool addIncidence( Incidence * ); |
147 | 147 | ||
148 | // Adds an incidence and all relatedto incidences to the cal | 148 | // Adds an incidence and all relatedto incidences to the cal |
149 | void addIncidenceBranch( Incidence * ); | 149 | void addIncidenceBranch( Incidence * ); |
150 | /** | 150 | /** |
151 | Return filtered list of all incidences of this calendar. | 151 | Return filtered list of all incidences of this calendar. |
152 | */ | 152 | */ |
153 | virtual QPtrList<Incidence> incidences(); | 153 | virtual QPtrList<Incidence> incidences(); |
154 | 154 | ||
155 | /** | 155 | /** |
156 | Return unfiltered list of all incidences of this calendar. | 156 | Return unfiltered list of all incidences of this calendar. |
157 | */ | 157 | */ |
158 | virtual QPtrList<Incidence> rawIncidences(); | 158 | virtual QPtrList<Incidence> rawIncidences(); |
159 | 159 | ||
160 | /** | 160 | /** |
161 | Adds a Event to this calendar object. | 161 | Adds a Event to this calendar object. |
162 | @param anEvent a pointer to the event to add | 162 | @param anEvent a pointer to the event to add |
163 | 163 | ||
164 | @return true on success, false on error. | 164 | @return true on success, false on error. |
165 | */ | 165 | */ |
166 | virtual bool addEventNoDup( Event *event ) = 0; | 166 | virtual bool addEventNoDup( Event *event ) = 0; |
167 | virtual bool addAnniversaryNoDup( Event *event ) = 0; | 167 | virtual bool addAnniversaryNoDup( Event *event ) = 0; |
168 | virtual bool addEvent( Event *anEvent ) = 0; | 168 | virtual bool addEvent( Event *anEvent ) = 0; |
169 | /** | 169 | /** |
170 | Delete event from calendar. | 170 | Delete event from calendar. |
171 | */ | 171 | */ |
172 | virtual void deleteEvent( Event * ) = 0; | 172 | virtual void deleteEvent( Event * ) = 0; |
173 | /** | 173 | /** |
174 | Retrieves an event on the basis of the unique string ID. | 174 | Retrieves an event on the basis of the unique string ID. |
175 | */ | 175 | */ |
176 | virtual Event *event( const QString &UniqueStr ) = 0; | 176 | virtual Event *event( const QString &UniqueStr ) = 0; |
177 | virtual Event *event( QString, QString ) = 0; | 177 | virtual Event *event( QString, QString ) = 0; |
178 | /** | 178 | /** |
179 | Builds and then returns a list of all events that match for the | 179 | Builds and then returns a list of all events that match for the |
180 | date specified. useful for dayView, etc. etc. | 180 | date specified. useful for dayView, etc. etc. |
181 | The calendar filter is applied. | 181 | The calendar filter is applied. |
182 | */ | 182 | */ |
183 | QPtrList<Event> events( const QDate &date, bool sorted = false); | 183 | QPtrList<Event> events( const QDate &date, bool sorted = false); |
184 | /** | 184 | /** |
185 | Get events, which occur on the given date. | 185 | Get events, which occur on the given date. |
186 | The calendar filter is applied. | 186 | The calendar filter is applied. |
187 | */ | 187 | */ |
188 | QPtrList<Event> events( const QDateTime &qdt ); | 188 | QPtrList<Event> events( const QDateTime &qdt ); |
189 | /** | 189 | /** |
190 | Get events in a range of dates. If inclusive is set to true, only events | 190 | Get events in a range of dates. If inclusive is set to true, only events |
191 | are returned, which are completely included in the range. | 191 | are returned, which are completely included in the range. |
192 | The calendar filter is applied. | 192 | The calendar filter is applied. |
193 | */ | 193 | */ |
194 | QPtrList<Event> events( const QDate &start, const QDate &end, | 194 | QPtrList<Event> events( const QDate &start, const QDate &end, |
195 | bool inclusive = false); | 195 | bool inclusive = false); |
196 | /** | 196 | /** |
197 | Return filtered list of all events in calendar. | 197 | Return filtered list of all events in calendar. |
198 | */ | 198 | */ |
199 | virtual QPtrList<Event> events(); | 199 | virtual QPtrList<Event> events(); |
200 | /** | 200 | /** |
201 | Return unfiltered list of all events in calendar. | 201 | Return unfiltered list of all events in calendar. |
202 | */ | 202 | */ |
203 | virtual QPtrList<Event> rawEvents() = 0; | 203 | virtual QPtrList<Event> rawEvents() = 0; |
204 | 204 | ||
205 | /** | 205 | /** |
206 | Add a todo to the todolist. | 206 | Add a todo to the todolist. |
207 | 207 | ||
208 | @return true on success, false on error. | 208 | @return true on success, false on error. |
209 | */ | 209 | */ |
210 | virtual bool addTodo( Todo *todo ) = 0; | 210 | virtual bool addTodo( Todo *todo ) = 0; |
211 | virtual bool addTodoNoDup( Todo *todo ) = 0; | 211 | virtual bool addTodoNoDup( Todo *todo ) = 0; |
212 | /** | 212 | /** |
213 | Remove a todo from the todolist. | 213 | Remove a todo from the todolist. |
214 | */ | 214 | */ |
215 | virtual void deleteTodo( Todo * ) = 0; | 215 | virtual void deleteTodo( Todo * ) = 0; |
216 | virtual void deleteJournal( Journal * ) = 0; | 216 | virtual void deleteJournal( Journal * ) = 0; |
217 | /** | 217 | /** |
218 | Return filterd list of todos. | 218 | Return filterd list of todos. |
219 | */ | 219 | */ |
220 | virtual QPtrList<Todo> todos(); | 220 | virtual QPtrList<Todo> todos(); |
221 | /** | 221 | /** |
222 | Searches todolist for an event with this unique string identifier, | 222 | Searches todolist for an event with this unique string identifier, |
223 | returns a pointer or null. | 223 | returns a pointer or null. |
224 | */ | 224 | */ |
225 | virtual Todo *todo( const QString &uid ) = 0; | 225 | virtual Todo *todo( const QString &uid ) = 0; |
226 | virtual Todo *todo( QString, QString ) = 0; | 226 | virtual Todo *todo( QString, QString ) = 0; |
227 | /** | 227 | /** |
228 | Returns list of todos due on the specified date. | 228 | Returns list of todos due on the specified date. |
229 | */ | 229 | */ |
230 | virtual QPtrList<Todo> todos( const QDate &date ) = 0; | 230 | virtual QPtrList<Todo> todos( const QDate &date ) = 0; |
231 | /** | 231 | /** |
232 | Return unfiltered list of todos. | 232 | Return unfiltered list of todos. |
233 | */ | 233 | */ |
234 | virtual QPtrList<Todo> rawTodos() = 0; | 234 | virtual QPtrList<Todo> rawTodos() = 0; |
235 | 235 | ||
236 | /** | 236 | /** |
237 | Add a Journal entry to calendar. | 237 | Add a Journal entry to calendar. |
238 | 238 | ||
239 | @return true on success, false on error. | 239 | @return true on success, false on error. |
240 | */ | 240 | */ |
241 | virtual bool addJournal( Journal * ) = 0; | 241 | virtual bool addJournal( Journal * ) = 0; |
242 | /** | 242 | /** |
243 | Return Journal for given date. | 243 | Return Journal for given date. |
244 | */ | 244 | */ |
245 | virtual Journal *journal( const QDate & ) = 0; | 245 | virtual Journal *journal( const QDate & ) = 0; |
246 | virtual QPtrList<Journal> journals4Date( const QDate & ) = 0; | ||
246 | /** | 247 | /** |
247 | Return Journal with given UID. | 248 | Return Journal with given UID. |
248 | */ | 249 | */ |
249 | virtual Journal *journal( const QString &UID ) = 0; | 250 | virtual Journal *journal( const QString &UID ) = 0; |
250 | /** | 251 | /** |
251 | Return list of all Journal entries. | 252 | Return list of all Journal entries. |
252 | */ | 253 | */ |
253 | virtual QPtrList<Journal> journals() = 0; | 254 | virtual QPtrList<Journal> journals() = 0; |
254 | 255 | ||
255 | /** | 256 | /** |
256 | Searches all incidence types for an incidence with this unique | 257 | Searches all incidence types for an incidence with this unique |
257 | string identifier, returns a pointer or null. | 258 | string identifier, returns a pointer or null. |
258 | */ | 259 | */ |
259 | Incidence* incidence( const QString&UID ); | 260 | Incidence* incidence( const QString&UID ); |
260 | 261 | ||
261 | /** | 262 | /** |
262 | Setup relations for an incidence. | 263 | Setup relations for an incidence. |
263 | */ | 264 | */ |
264 | virtual void setupRelations( Incidence * ); | 265 | virtual void setupRelations( Incidence * ); |
265 | /** | 266 | /** |
266 | Remove all relations to an incidence | 267 | Remove all relations to an incidence |
267 | */ | 268 | */ |
268 | virtual void removeRelations( Incidence * ); | 269 | virtual void removeRelations( Incidence * ); |
269 | 270 | ||
270 | /** | 271 | /** |
271 | Set calendar filter, which filters events for the events() functions. | 272 | Set calendar filter, which filters events for the events() functions. |
272 | The Filter object is owned by the caller. | 273 | The Filter object is owned by the caller. |
273 | */ | 274 | */ |
274 | void setFilter( CalFilter * ); | 275 | void setFilter( CalFilter * ); |
275 | /** | 276 | /** |
276 | Return calendar filter. | 277 | Return calendar filter. |
277 | */ | 278 | */ |
278 | CalFilter *filter(); | 279 | CalFilter *filter(); |
279 | virtual QDateTime nextAlarm( int daysTo ) = 0; | 280 | virtual QDateTime nextAlarm( int daysTo ) = 0; |
280 | virtual QString nextSummary( ) const = 0; | 281 | virtual QString nextSummary( ) const = 0; |
281 | virtual void reInitAlarmSettings() = 0; | 282 | virtual void reInitAlarmSettings() = 0; |
282 | virtual QDateTime nextAlarmEventDateTime() const = 0; | 283 | virtual QDateTime nextAlarmEventDateTime() const = 0; |
283 | virtual void checkAlarmForIncidence( Incidence *, bool ) = 0; | 284 | virtual void checkAlarmForIncidence( Incidence *, bool ) = 0; |
284 | /** | 285 | /** |
285 | Return all alarms, which ocur in the given time interval. | 286 | Return all alarms, which ocur in the given time interval. |
286 | */ | 287 | */ |
287 | virtual Alarm::List alarms( const QDateTime &from, | 288 | virtual Alarm::List alarms( const QDateTime &from, |
288 | const QDateTime &to ) = 0; | 289 | const QDateTime &to ) = 0; |
289 | 290 | ||
290 | class Observer { | 291 | class Observer { |
291 | public: | 292 | public: |
292 | virtual void calendarModified( bool, Calendar * ) = 0; | 293 | virtual void calendarModified( bool, Calendar * ) = 0; |
293 | }; | 294 | }; |
294 | 295 | ||
295 | void registerObserver( Observer * ); | 296 | void registerObserver( Observer * ); |
296 | 297 | ||
297 | void setModified( bool ); | 298 | void setModified( bool ); |
298 | 299 | ||
299 | /** | 300 | /** |
300 | Set product id returned by loadedProductId(). This function is only | 301 | Set product id returned by loadedProductId(). This function is only |
301 | useful for the calendar loading code. | 302 | useful for the calendar loading code. |
302 | */ | 303 | */ |
303 | void setLoadedProductId( const QString & ); | 304 | void setLoadedProductId( const QString & ); |
304 | /** | 305 | /** |
305 | Return product id taken from file that has been loaded. Returns | 306 | Return product id taken from file that has been loaded. Returns |
306 | QString::null, if no calendar has been loaded. | 307 | QString::null, if no calendar has been loaded. |
307 | */ | 308 | */ |
308 | QString loadedProductId(); | 309 | QString loadedProductId(); |
309 | int defaultCalendar(); | 310 | int defaultCalendar(); |
310 | void setDontDeleteIncidencesOnClose (); | 311 | void setDontDeleteIncidencesOnClose (); |
311 | public slots: | 312 | public slots: |
312 | void setDefaultCalendar( int ); | 313 | void setDefaultCalendar( int ); |
313 | virtual void setCalendarEnabled( int id, bool enable ) = 0; | 314 | virtual void setCalendarEnabled( int id, bool enable ) = 0; |
314 | virtual void setAlarmEnabled( int id, bool enable ) = 0; | 315 | virtual void setAlarmEnabled( int id, bool enable ) = 0; |
315 | virtual void setReadOnly( int id, bool enable ) = 0; | 316 | virtual void setReadOnly( int id, bool enable ) = 0; |
316 | virtual void setDefaultCalendarEnabledOnly() = 0; | 317 | virtual void setDefaultCalendarEnabledOnly() = 0; |
317 | virtual void setCalendarRemove( int id ) = 0; | 318 | virtual void setCalendarRemove( int id ) = 0; |
318 | signals: | 319 | signals: |
319 | void calendarChanged(); | 320 | void calendarChanged(); |
320 | void calendarSaved(); | 321 | void calendarSaved(); |
321 | void calendarLoaded(); | 322 | void calendarLoaded(); |
322 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 323 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
323 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 324 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
324 | 325 | ||
325 | protected: | 326 | protected: |
326 | /** | 327 | /** |
327 | Get unfiltered events, which occur on the given date. | 328 | Get unfiltered events, which occur on the given date. |
328 | */ | 329 | */ |
329 | virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0; | 330 | virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0; |
330 | /** | 331 | /** |
331 | Get unfiltered events, which occur on the given date. | 332 | Get unfiltered events, which occur on the given date. |
332 | */ | 333 | */ |
333 | virtual QPtrList<Event> rawEventsForDate( const QDate &date, | 334 | virtual QPtrList<Event> rawEventsForDate( const QDate &date, |
334 | bool sorted = false ) = 0; | 335 | bool sorted = false ) = 0; |
335 | /** | 336 | /** |
336 | Get events in a range of dates. If inclusive is set to true, only events | 337 | Get events in a range of dates. If inclusive is set to true, only events |
337 | are returned, which are completely included in the range. | 338 | are returned, which are completely included in the range. |
338 | */ | 339 | */ |
339 | virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, | 340 | virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, |
340 | bool inclusive = false ) = 0; | 341 | bool inclusive = false ) = 0; |
341 | 342 | ||
342 | Incidence *mNextAlarmIncidence; | 343 | Incidence *mNextAlarmIncidence; |
343 | Incidence *mUndoIncidence; | 344 | Incidence *mUndoIncidence; |
344 | int mDefaultCalendar; | 345 | int mDefaultCalendar; |
345 | bool mDeleteIncidencesOnClose; | 346 | bool mDeleteIncidencesOnClose; |
346 | 347 | ||
347 | private: | 348 | private: |
348 | void init(); | 349 | void init(); |
349 | 350 | ||
350 | QString mOwner; // who the calendar belongs to | 351 | QString mOwner; // who the calendar belongs to |
351 | QString mOwnerEmail; // email address of the owner | 352 | QString mOwnerEmail; // email address of the owner |
352 | int mTimeZone; // timezone OFFSET from GMT (MINUTES) | 353 | int mTimeZone; // timezone OFFSET from GMT (MINUTES) |
353 | bool mLocalTime; // use local time, not UTC or a time zone | 354 | bool mLocalTime; // use local time, not UTC or a time zone |
354 | 355 | ||
355 | 356 | ||
356 | CalFilter *mFilter; | 357 | CalFilter *mFilter; |
357 | CalFilter *mDefaultFilter; | 358 | CalFilter *mDefaultFilter; |
358 | 359 | ||
359 | 360 | ||
360 | QString mTimeZoneId; | 361 | QString mTimeZoneId; |
361 | 362 | ||
362 | Observer *mObserver; | 363 | Observer *mObserver; |
363 | bool mNewObserver; | 364 | bool mNewObserver; |
364 | 365 | ||
365 | bool mModified; | 366 | bool mModified; |
366 | 367 | ||
367 | QString mLoadedProductId; | 368 | QString mLoadedProductId; |
368 | 369 | ||
369 | // This list is used to put together related todos | 370 | // This list is used to put together related todos |
370 | QDict<Incidence> mOrphans; | 371 | QDict<Incidence> mOrphans; |
371 | QDict<Incidence> mOrphanUids; | 372 | QDict<Incidence> mOrphanUids; |
372 | }; | 373 | }; |
373 | 374 | ||
374 | } | 375 | } |
375 | 376 | ||
376 | #endif | 377 | #endif |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 418bfca..ca64e66 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -267,659 +267,661 @@ bool CalendarLocal::addTodoNoDup( Todo *todo ) | |||
267 | } | 267 | } |
268 | return addTodo( todo ); | 268 | return addTodo( todo ); |
269 | } | 269 | } |
270 | bool CalendarLocal::addTodo( Todo *todo ) | 270 | bool CalendarLocal::addTodo( Todo *todo ) |
271 | { | 271 | { |
272 | mTodoList.append( todo ); | 272 | mTodoList.append( todo ); |
273 | 273 | ||
274 | todo->registerObserver( this ); | 274 | todo->registerObserver( this ); |
275 | 275 | ||
276 | // Set up subtask relations | 276 | // Set up subtask relations |
277 | setupRelations( todo ); | 277 | setupRelations( todo ); |
278 | 278 | ||
279 | setModified( true ); | 279 | setModified( true ); |
280 | todo->setCalID( mDefaultCalendar ); | 280 | todo->setCalID( mDefaultCalendar ); |
281 | todo->setCalEnabled( true ); | 281 | todo->setCalEnabled( true ); |
282 | return true; | 282 | return true; |
283 | } | 283 | } |
284 | 284 | ||
285 | void CalendarLocal::deleteTodo( Todo *todo ) | 285 | void CalendarLocal::deleteTodo( Todo *todo ) |
286 | { | 286 | { |
287 | // Handle orphaned children | 287 | // Handle orphaned children |
288 | if ( mUndoIncidence ) delete mUndoIncidence; | 288 | if ( mUndoIncidence ) delete mUndoIncidence; |
289 | removeRelations( todo ); | 289 | removeRelations( todo ); |
290 | mUndoIncidence = todo->clone(); | 290 | mUndoIncidence = todo->clone(); |
291 | 291 | ||
292 | if ( mTodoList.removeRef( todo ) ) { | 292 | if ( mTodoList.removeRef( todo ) ) { |
293 | setModified( true ); | 293 | setModified( true ); |
294 | } | 294 | } |
295 | } | 295 | } |
296 | 296 | ||
297 | QPtrList<Todo> CalendarLocal::rawTodos() | 297 | QPtrList<Todo> CalendarLocal::rawTodos() |
298 | { | 298 | { |
299 | QPtrList<Todo> el; | 299 | QPtrList<Todo> el; |
300 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 300 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
301 | if ( it->calEnabled() ) el.append( it ); | 301 | if ( it->calEnabled() ) el.append( it ); |
302 | return el; | 302 | return el; |
303 | } | 303 | } |
304 | Todo *CalendarLocal::todo( QString syncProf, QString id ) | 304 | Todo *CalendarLocal::todo( QString syncProf, QString id ) |
305 | { | 305 | { |
306 | Todo *todo; | 306 | Todo *todo; |
307 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 307 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
308 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; | 308 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; |
309 | } | 309 | } |
310 | 310 | ||
311 | return 0; | 311 | return 0; |
312 | } | 312 | } |
313 | void CalendarLocal::removeSyncInfo( QString syncProfile) | 313 | void CalendarLocal::removeSyncInfo( QString syncProfile) |
314 | { | 314 | { |
315 | QPtrList<Incidence> all = rawIncidences() ; | 315 | QPtrList<Incidence> all = rawIncidences() ; |
316 | Incidence *inc; | 316 | Incidence *inc; |
317 | for ( inc = all.first(); inc; inc = all.next() ) { | 317 | for ( inc = all.first(); inc; inc = all.next() ) { |
318 | inc->removeID( syncProfile ); | 318 | inc->removeID( syncProfile ); |
319 | } | 319 | } |
320 | if ( syncProfile.isEmpty() ) { | 320 | if ( syncProfile.isEmpty() ) { |
321 | QPtrList<Event> el; | 321 | QPtrList<Event> el; |
322 | Event *todo; | 322 | Event *todo; |
323 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 323 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
324 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | 324 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) |
325 | el.append( todo ); | 325 | el.append( todo ); |
326 | } | 326 | } |
327 | for ( todo = el.first(); todo; todo = el.next() ) { | 327 | for ( todo = el.first(); todo; todo = el.next() ) { |
328 | deleteIncidence ( todo ); | 328 | deleteIncidence ( todo ); |
329 | } | 329 | } |
330 | } else { | 330 | } else { |
331 | Event *lse = event( "last-syncEvent-"+ syncProfile); | 331 | Event *lse = event( "last-syncEvent-"+ syncProfile); |
332 | if ( lse ) | 332 | if ( lse ) |
333 | deleteIncidence ( lse ); | 333 | deleteIncidence ( lse ); |
334 | } | 334 | } |
335 | } | 335 | } |
336 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() | 336 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() |
337 | { | 337 | { |
338 | QPtrList<Event> el; | 338 | QPtrList<Event> el; |
339 | Event *todo; | 339 | Event *todo; |
340 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 340 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
341 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | 341 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) |
342 | if ( todo->summary().left(3) == "E: " ) | 342 | if ( todo->summary().left(3) == "E: " ) |
343 | el.append( todo ); | 343 | el.append( todo ); |
344 | } | 344 | } |
345 | 345 | ||
346 | return el; | 346 | return el; |
347 | 347 | ||
348 | } | 348 | } |
349 | Event *CalendarLocal::event( QString syncProf, QString id ) | 349 | Event *CalendarLocal::event( QString syncProf, QString id ) |
350 | { | 350 | { |
351 | Event *todo; | 351 | Event *todo; |
352 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 352 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
353 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; | 353 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; |
354 | } | 354 | } |
355 | 355 | ||
356 | return 0; | 356 | return 0; |
357 | } | 357 | } |
358 | Todo *CalendarLocal::todo( const QString &uid ) | 358 | Todo *CalendarLocal::todo( const QString &uid ) |
359 | { | 359 | { |
360 | Todo *todo;; | 360 | Todo *todo;; |
361 | Todo *retVal = 0; | 361 | Todo *retVal = 0; |
362 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 362 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
363 | if ( todo->calEnabled() && todo->uid() == uid ) { | 363 | if ( todo->calEnabled() && todo->uid() == uid ) { |
364 | if ( retVal ) { | 364 | if ( retVal ) { |
365 | if ( retVal->calID() > todo->calID() ) { | 365 | if ( retVal->calID() > todo->calID() ) { |
366 | retVal = todo; | 366 | retVal = todo; |
367 | } | 367 | } |
368 | } else { | 368 | } else { |
369 | retVal = todo; | 369 | retVal = todo; |
370 | } | 370 | } |
371 | } | 371 | } |
372 | } | 372 | } |
373 | return retVal; | 373 | return retVal; |
374 | } | 374 | } |
375 | QString CalendarLocal::nextSummary() const | 375 | QString CalendarLocal::nextSummary() const |
376 | { | 376 | { |
377 | return mNextSummary; | 377 | return mNextSummary; |
378 | } | 378 | } |
379 | QDateTime CalendarLocal::nextAlarmEventDateTime() const | 379 | QDateTime CalendarLocal::nextAlarmEventDateTime() const |
380 | { | 380 | { |
381 | return mNextAlarmEventDateTime; | 381 | return mNextAlarmEventDateTime; |
382 | } | 382 | } |
383 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) | 383 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) |
384 | { | 384 | { |
385 | //mNextAlarmIncidence | 385 | //mNextAlarmIncidence |
386 | //mNextAlarmDateTime | 386 | //mNextAlarmDateTime |
387 | //return mNextSummary; | 387 | //return mNextSummary; |
388 | //return mNextAlarmEventDateTime; | 388 | //return mNextAlarmEventDateTime; |
389 | bool newNextAlarm = false; | 389 | bool newNextAlarm = false; |
390 | bool computeNextAlarm = false; | 390 | bool computeNextAlarm = false; |
391 | bool ok; | 391 | bool ok; |
392 | int offset; | 392 | int offset; |
393 | QDateTime nextA; | 393 | QDateTime nextA; |
394 | // QString nextSum; | 394 | // QString nextSum; |
395 | //QDateTime nextEvent; | 395 | //QDateTime nextEvent; |
396 | if ( mNextAlarmIncidence == 0 || incidence == 0 ) { | 396 | if ( mNextAlarmIncidence == 0 || incidence == 0 ) { |
397 | computeNextAlarm = true; | 397 | computeNextAlarm = true; |
398 | } else { | 398 | } else { |
399 | if ( ! deleted ) { | 399 | if ( ! deleted ) { |
400 | nextA = incidence->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; | 400 | nextA = incidence->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
401 | if ( ok ) { | 401 | if ( ok ) { |
402 | if ( nextA < mNextAlarmDateTime ) { | 402 | if ( nextA < mNextAlarmDateTime ) { |
403 | deRegisterAlarm(); | 403 | deRegisterAlarm(); |
404 | mNextAlarmDateTime = nextA; | 404 | mNextAlarmDateTime = nextA; |
405 | mNextSummary = incidence->summary(); | 405 | mNextSummary = incidence->summary(); |
406 | mNextAlarmEventDateTime = nextA.addSecs(offset ) ; | 406 | mNextAlarmEventDateTime = nextA.addSecs(offset ) ; |
407 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); | 407 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); |
408 | newNextAlarm = true; | 408 | newNextAlarm = true; |
409 | mNextAlarmIncidence = incidence; | 409 | mNextAlarmIncidence = incidence; |
410 | } else { | 410 | } else { |
411 | if ( incidence == mNextAlarmIncidence ) { | 411 | if ( incidence == mNextAlarmIncidence ) { |
412 | computeNextAlarm = true; | 412 | computeNextAlarm = true; |
413 | } | 413 | } |
414 | } | 414 | } |
415 | } else { | 415 | } else { |
416 | if ( mNextAlarmIncidence == incidence ) { | 416 | if ( mNextAlarmIncidence == incidence ) { |
417 | computeNextAlarm = true; | 417 | computeNextAlarm = true; |
418 | } | 418 | } |
419 | } | 419 | } |
420 | } else { // deleted | 420 | } else { // deleted |
421 | if ( incidence == mNextAlarmIncidence ) { | 421 | if ( incidence == mNextAlarmIncidence ) { |
422 | computeNextAlarm = true; | 422 | computeNextAlarm = true; |
423 | } | 423 | } |
424 | } | 424 | } |
425 | } | 425 | } |
426 | if ( computeNextAlarm ) { | 426 | if ( computeNextAlarm ) { |
427 | deRegisterAlarm(); | 427 | deRegisterAlarm(); |
428 | nextA = nextAlarm( 1000 ); | 428 | nextA = nextAlarm( 1000 ); |
429 | if (! mNextAlarmIncidence ) { | 429 | if (! mNextAlarmIncidence ) { |
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | newNextAlarm = true; | 432 | newNextAlarm = true; |
433 | } | 433 | } |
434 | if ( newNextAlarm ) | 434 | if ( newNextAlarm ) |
435 | registerAlarm(); | 435 | registerAlarm(); |
436 | } | 436 | } |
437 | QString CalendarLocal:: getAlarmNotification() | 437 | QString CalendarLocal:: getAlarmNotification() |
438 | { | 438 | { |
439 | QString ret; | 439 | QString ret; |
440 | // this should not happen | 440 | // this should not happen |
441 | if (! mNextAlarmIncidence ) | 441 | if (! mNextAlarmIncidence ) |
442 | return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString; | 442 | return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString; |
443 | Alarm* alarm = mNextAlarmIncidence->alarms().first(); | 443 | Alarm* alarm = mNextAlarmIncidence->alarms().first(); |
444 | if ( alarm->type() == Alarm::Procedure ) { | 444 | if ( alarm->type() == Alarm::Procedure ) { |
445 | ret = "proc_alarm" + alarm->programFile()+"+++"; | 445 | ret = "proc_alarm" + alarm->programFile()+"+++"; |
446 | } else { | 446 | } else { |
447 | ret = "audio_alarm" +alarm->audioFile() +"+++"; | 447 | ret = "audio_alarm" +alarm->audioFile() +"+++"; |
448 | } | 448 | } |
449 | ret += "cal_alarm"+ mNextSummary.left( 25 ); | 449 | ret += "cal_alarm"+ mNextSummary.left( 25 ); |
450 | if ( mNextSummary.length() > 25 ) | 450 | if ( mNextSummary.length() > 25 ) |
451 | ret += "\n" + mNextSummary.mid(25, 25 ); | 451 | ret += "\n" + mNextSummary.mid(25, 25 ); |
452 | ret+= "\n"+mNextAlarmEventDateTimeString; | 452 | ret+= "\n"+mNextAlarmEventDateTimeString; |
453 | return ret; | 453 | return ret; |
454 | } | 454 | } |
455 | void CalendarLocal::registerAlarm() | 455 | void CalendarLocal::registerAlarm() |
456 | { | 456 | { |
457 | mLastAlarmNotificationString = getAlarmNotification(); | 457 | mLastAlarmNotificationString = getAlarmNotification(); |
458 | // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() ); | 458 | // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() ); |
459 | emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); | 459 | emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); |
460 | // #ifndef DESKTOP_VERSION | 460 | // #ifndef DESKTOP_VERSION |
461 | // AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() ); | 461 | // AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() ); |
462 | // #endif | 462 | // #endif |
463 | } | 463 | } |
464 | void CalendarLocal::deRegisterAlarm() | 464 | void CalendarLocal::deRegisterAlarm() |
465 | { | 465 | { |
466 | if ( mLastAlarmNotificationString.isNull() ) | 466 | if ( mLastAlarmNotificationString.isNull() ) |
467 | return; | 467 | return; |
468 | //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() ); | 468 | //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() ); |
469 | 469 | ||
470 | emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); | 470 | emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); |
471 | mNextAlarmEventDateTime = QDateTime(); | 471 | mNextAlarmEventDateTime = QDateTime(); |
472 | // #ifndef DESKTOP_VERSION | 472 | // #ifndef DESKTOP_VERSION |
473 | // AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() ); | 473 | // AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() ); |
474 | // #endif | 474 | // #endif |
475 | } | 475 | } |
476 | 476 | ||
477 | QPtrList<Todo> CalendarLocal::todos( const QDate &date ) | 477 | QPtrList<Todo> CalendarLocal::todos( const QDate &date ) |
478 | { | 478 | { |
479 | QPtrList<Todo> todos; | 479 | QPtrList<Todo> todos; |
480 | 480 | ||
481 | Todo *todo; | 481 | Todo *todo; |
482 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 482 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
483 | if ( !todo->calEnabled() ) continue; | 483 | if ( !todo->calEnabled() ) continue; |
484 | if ( todo->hasDueDate() && todo->dtDue().date() == date ) { | 484 | if ( todo->hasDueDate() && todo->dtDue().date() == date ) { |
485 | todos.append( todo ); | 485 | todos.append( todo ); |
486 | } | 486 | } |
487 | } | 487 | } |
488 | 488 | ||
489 | filter()->apply( &todos ); | 489 | filter()->apply( &todos ); |
490 | return todos; | 490 | return todos; |
491 | } | 491 | } |
492 | void CalendarLocal::reInitAlarmSettings() | 492 | void CalendarLocal::reInitAlarmSettings() |
493 | { | 493 | { |
494 | if ( !mNextAlarmIncidence ) { | 494 | if ( !mNextAlarmIncidence ) { |
495 | nextAlarm( 1000 ); | 495 | nextAlarm( 1000 ); |
496 | } | 496 | } |
497 | deRegisterAlarm(); | 497 | deRegisterAlarm(); |
498 | mNextAlarmIncidence = 0; | 498 | mNextAlarmIncidence = 0; |
499 | checkAlarmForIncidence( 0, false ); | 499 | checkAlarmForIncidence( 0, false ); |
500 | 500 | ||
501 | } | 501 | } |
502 | 502 | ||
503 | 503 | ||
504 | 504 | ||
505 | QDateTime CalendarLocal::nextAlarm( int daysTo ) | 505 | QDateTime CalendarLocal::nextAlarm( int daysTo ) |
506 | { | 506 | { |
507 | QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo ); | 507 | QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo ); |
508 | QDateTime start = QDateTime::currentDateTime().addSecs( 30 ); | 508 | QDateTime start = QDateTime::currentDateTime().addSecs( 30 ); |
509 | QDateTime next; | 509 | QDateTime next; |
510 | Event *e; | 510 | Event *e; |
511 | bool ok; | 511 | bool ok; |
512 | bool found = false; | 512 | bool found = false; |
513 | int offset; | 513 | int offset; |
514 | mNextAlarmIncidence = 0; | 514 | mNextAlarmIncidence = 0; |
515 | for( e = mEventList.first(); e; e = mEventList.next() ) { | 515 | for( e = mEventList.first(); e; e = mEventList.next() ) { |
516 | if ( !e->calEnabled() ) continue; | 516 | if ( !e->calEnabled() ) continue; |
517 | next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; | 517 | next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
518 | if ( ok ) { | 518 | if ( ok ) { |
519 | if ( next < nextA ) { | 519 | if ( next < nextA ) { |
520 | nextA = next; | 520 | nextA = next; |
521 | found = true; | 521 | found = true; |
522 | mNextSummary = e->summary(); | 522 | mNextSummary = e->summary(); |
523 | mNextAlarmEventDateTime = next.addSecs(offset ) ; | 523 | mNextAlarmEventDateTime = next.addSecs(offset ) ; |
524 | mNextAlarmIncidence = (Incidence *) e; | 524 | mNextAlarmIncidence = (Incidence *) e; |
525 | } | 525 | } |
526 | } | 526 | } |
527 | } | 527 | } |
528 | Todo *t; | 528 | Todo *t; |
529 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { | 529 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { |
530 | if ( !t->calEnabled() ) continue; | 530 | if ( !t->calEnabled() ) continue; |
531 | next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; | 531 | next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
532 | if ( ok ) { | 532 | if ( ok ) { |
533 | if ( next < nextA ) { | 533 | if ( next < nextA ) { |
534 | nextA = next; | 534 | nextA = next; |
535 | found = true; | 535 | found = true; |
536 | mNextSummary = t->summary(); | 536 | mNextSummary = t->summary(); |
537 | mNextAlarmEventDateTime = next.addSecs(offset ); | 537 | mNextAlarmEventDateTime = next.addSecs(offset ); |
538 | mNextAlarmIncidence = (Incidence *) t; | 538 | mNextAlarmIncidence = (Incidence *) t; |
539 | } | 539 | } |
540 | } | 540 | } |
541 | } | 541 | } |
542 | if ( mNextAlarmIncidence ) { | 542 | if ( mNextAlarmIncidence ) { |
543 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); | 543 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); |
544 | mNextAlarmDateTime = nextA; | 544 | mNextAlarmDateTime = nextA; |
545 | } | 545 | } |
546 | return nextA; | 546 | return nextA; |
547 | } | 547 | } |
548 | Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) | 548 | Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) |
549 | { | 549 | { |
550 | return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); | 550 | return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); |
551 | } | 551 | } |
552 | 552 | ||
553 | Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) | 553 | Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) |
554 | { | 554 | { |
555 | 555 | ||
556 | Alarm::List alarms; | 556 | Alarm::List alarms; |
557 | 557 | ||
558 | Event *e; | 558 | Event *e; |
559 | 559 | ||
560 | for( e = mEventList.first(); e; e = mEventList.next() ) { | 560 | for( e = mEventList.first(); e; e = mEventList.next() ) { |
561 | if ( !e->calEnabled() ) continue; | 561 | if ( !e->calEnabled() ) continue; |
562 | if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); | 562 | if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); |
563 | else appendAlarms( alarms, e, from, to ); | 563 | else appendAlarms( alarms, e, from, to ); |
564 | } | 564 | } |
565 | 565 | ||
566 | Todo *t; | 566 | Todo *t; |
567 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { | 567 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { |
568 | if ( !t->calEnabled() ) continue; | 568 | if ( !t->calEnabled() ) continue; |
569 | appendAlarms( alarms, t, from, to ); | 569 | appendAlarms( alarms, t, from, to ); |
570 | } | 570 | } |
571 | 571 | ||
572 | return alarms; | 572 | return alarms; |
573 | } | 573 | } |
574 | 574 | ||
575 | void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, | 575 | void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, |
576 | const QDateTime &from, const QDateTime &to ) | 576 | const QDateTime &from, const QDateTime &to ) |
577 | { | 577 | { |
578 | QPtrList<Alarm> alarmList = incidence->alarms(); | 578 | QPtrList<Alarm> alarmList = incidence->alarms(); |
579 | Alarm *alarm; | 579 | Alarm *alarm; |
580 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { | 580 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { |
581 | // kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() | 581 | // kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() |
582 | // << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; | 582 | // << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; |
583 | if ( alarm->enabled() ) { | 583 | if ( alarm->enabled() ) { |
584 | if ( alarm->time() >= from && alarm->time() <= to ) { | 584 | if ( alarm->time() >= from && alarm->time() <= to ) { |
585 | alarms.append( alarm ); | 585 | alarms.append( alarm ); |
586 | } | 586 | } |
587 | } | 587 | } |
588 | } | 588 | } |
589 | } | 589 | } |
590 | 590 | ||
591 | void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms, | 591 | void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms, |
592 | Incidence *incidence, | 592 | Incidence *incidence, |
593 | const QDateTime &from, | 593 | const QDateTime &from, |
594 | const QDateTime &to ) | 594 | const QDateTime &to ) |
595 | { | 595 | { |
596 | 596 | ||
597 | QPtrList<Alarm> alarmList = incidence->alarms(); | 597 | QPtrList<Alarm> alarmList = incidence->alarms(); |
598 | Alarm *alarm; | 598 | Alarm *alarm; |
599 | QDateTime qdt; | 599 | QDateTime qdt; |
600 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { | 600 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { |
601 | if (incidence->recursOn(from.date())) { | 601 | if (incidence->recursOn(from.date())) { |
602 | qdt.setTime(alarm->time().time()); | 602 | qdt.setTime(alarm->time().time()); |
603 | qdt.setDate(from.date()); | 603 | qdt.setDate(from.date()); |
604 | } | 604 | } |
605 | else qdt = alarm->time(); | 605 | else qdt = alarm->time(); |
606 | // qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1()); | 606 | // qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1()); |
607 | if ( alarm->enabled() ) { | 607 | if ( alarm->enabled() ) { |
608 | if ( qdt >= from && qdt <= to ) { | 608 | if ( qdt >= from && qdt <= to ) { |
609 | alarms.append( alarm ); | 609 | alarms.append( alarm ); |
610 | } | 610 | } |
611 | } | 611 | } |
612 | } | 612 | } |
613 | } | 613 | } |
614 | 614 | ||
615 | 615 | ||
616 | /****************************** PROTECTED METHODS ****************************/ | 616 | /****************************** PROTECTED METHODS ****************************/ |
617 | 617 | ||
618 | // after changes are made to an event, this should be called. | 618 | // after changes are made to an event, this should be called. |
619 | void CalendarLocal::update( IncidenceBase *incidence ) | 619 | void CalendarLocal::update( IncidenceBase *incidence ) |
620 | { | 620 | { |
621 | incidence->setSyncStatus( Event::SYNCMOD ); | 621 | incidence->setSyncStatus( Event::SYNCMOD ); |
622 | incidence->setLastModified( QDateTime::currentDateTime() ); | 622 | incidence->setLastModified( QDateTime::currentDateTime() ); |
623 | // we should probably update the revision number here, | 623 | // we should probably update the revision number here, |
624 | // or internally in the Event itself when certain things change. | 624 | // or internally in the Event itself when certain things change. |
625 | // need to verify with ical documentation. | 625 | // need to verify with ical documentation. |
626 | 626 | ||
627 | setModified( true ); | 627 | setModified( true ); |
628 | } | 628 | } |
629 | 629 | ||
630 | void CalendarLocal::insertEvent( Event *event ) | 630 | void CalendarLocal::insertEvent( Event *event ) |
631 | { | 631 | { |
632 | if ( mEventList.findRef( event ) < 0 ) mEventList.append( event ); | 632 | if ( mEventList.findRef( event ) < 0 ) mEventList.append( event ); |
633 | } | 633 | } |
634 | 634 | ||
635 | 635 | ||
636 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted ) | 636 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted ) |
637 | { | 637 | { |
638 | QPtrList<Event> eventList; | 638 | QPtrList<Event> eventList; |
639 | 639 | ||
640 | Event *event; | 640 | Event *event; |
641 | for( event = mEventList.first(); event; event = mEventList.next() ) { | 641 | for( event = mEventList.first(); event; event = mEventList.next() ) { |
642 | if ( !event->calEnabled() ) continue; | 642 | if ( !event->calEnabled() ) continue; |
643 | if ( event->doesRecur() ) { | 643 | if ( event->doesRecur() ) { |
644 | if ( event->isMultiDay() ) { | 644 | if ( event->isMultiDay() ) { |
645 | int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() ); | 645 | int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() ); |
646 | int i; | 646 | int i; |
647 | for ( i = 0; i <= extraDays; i++ ) { | 647 | for ( i = 0; i <= extraDays; i++ ) { |
648 | if ( event->recursOn( qd.addDays( -i ) ) ) { | 648 | if ( event->recursOn( qd.addDays( -i ) ) ) { |
649 | eventList.append( event ); | 649 | eventList.append( event ); |
650 | break; | 650 | break; |
651 | } | 651 | } |
652 | } | 652 | } |
653 | } else { | 653 | } else { |
654 | if ( event->recursOn( qd ) ) | 654 | if ( event->recursOn( qd ) ) |
655 | eventList.append( event ); | 655 | eventList.append( event ); |
656 | } | 656 | } |
657 | } else { | 657 | } else { |
658 | if ( event->dtStart().date() <= qd && event->dtEnd().date() >= qd ) { | 658 | if ( event->dtStart().date() <= qd && event->dtEnd().date() >= qd ) { |
659 | eventList.append( event ); | 659 | eventList.append( event ); |
660 | } | 660 | } |
661 | } | 661 | } |
662 | } | 662 | } |
663 | 663 | ||
664 | if ( !sorted ) { | 664 | if ( !sorted ) { |
665 | return eventList; | 665 | return eventList; |
666 | } | 666 | } |
667 | 667 | ||
668 | // kdDebug(5800) << "Sorting events for date\n" << endl; | 668 | // kdDebug(5800) << "Sorting events for date\n" << endl; |
669 | // now, we have to sort it based on dtStart.time() | 669 | // now, we have to sort it based on dtStart.time() |
670 | QPtrList<Event> eventListSorted; | 670 | QPtrList<Event> eventListSorted; |
671 | Event *sortEvent; | 671 | Event *sortEvent; |
672 | for ( event = eventList.first(); event; event = eventList.next() ) { | 672 | for ( event = eventList.first(); event; event = eventList.next() ) { |
673 | sortEvent = eventListSorted.first(); | 673 | sortEvent = eventListSorted.first(); |
674 | int i = 0; | 674 | int i = 0; |
675 | while ( sortEvent && event->dtStart().time()>=sortEvent->dtStart().time() ) | 675 | while ( sortEvent && event->dtStart().time()>=sortEvent->dtStart().time() ) |
676 | { | 676 | { |
677 | i++; | 677 | i++; |
678 | sortEvent = eventListSorted.next(); | 678 | sortEvent = eventListSorted.next(); |
679 | } | 679 | } |
680 | eventListSorted.insert( i, event ); | 680 | eventListSorted.insert( i, event ); |
681 | } | 681 | } |
682 | return eventListSorted; | 682 | return eventListSorted; |
683 | } | 683 | } |
684 | 684 | ||
685 | 685 | ||
686 | QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end, | 686 | QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end, |
687 | bool inclusive ) | 687 | bool inclusive ) |
688 | { | 688 | { |
689 | Event *event = 0; | 689 | Event *event = 0; |
690 | 690 | ||
691 | QPtrList<Event> eventList; | 691 | QPtrList<Event> eventList; |
692 | 692 | ||
693 | // Get non-recurring events | 693 | // Get non-recurring events |
694 | for( event = mEventList.first(); event; event = mEventList.next() ) { | 694 | for( event = mEventList.first(); event; event = mEventList.next() ) { |
695 | if ( !event->calEnabled() ) continue; | 695 | if ( !event->calEnabled() ) continue; |
696 | if ( event->doesRecur() ) { | 696 | if ( event->doesRecur() ) { |
697 | QDate rStart = event->dtStart().date(); | 697 | QDate rStart = event->dtStart().date(); |
698 | bool found = false; | 698 | bool found = false; |
699 | if ( inclusive ) { | 699 | if ( inclusive ) { |
700 | if ( rStart >= start && rStart <= end ) { | 700 | if ( rStart >= start && rStart <= end ) { |
701 | // Start date of event is in range. Now check for end date. | 701 | // Start date of event is in range. Now check for end date. |
702 | // if duration is negative, event recurs forever, so do not include it. | 702 | // if duration is negative, event recurs forever, so do not include it. |
703 | if ( event->recurrence()->duration() == 0 ) { // End date set | 703 | if ( event->recurrence()->duration() == 0 ) { // End date set |
704 | QDate rEnd = event->recurrence()->endDate(); | 704 | QDate rEnd = event->recurrence()->endDate(); |
705 | if ( rEnd >= start && rEnd <= end ) { // End date within range | 705 | if ( rEnd >= start && rEnd <= end ) { // End date within range |
706 | found = true; | 706 | found = true; |
707 | } | 707 | } |
708 | } else if ( event->recurrence()->duration() > 0 ) { // Duration set | 708 | } else if ( event->recurrence()->duration() > 0 ) { // Duration set |
709 | // TODO: Calculate end date from duration. Should be done in Event | 709 | // TODO: Calculate end date from duration. Should be done in Event |
710 | // For now exclude all events with a duration. | 710 | // For now exclude all events with a duration. |
711 | } | 711 | } |
712 | } | 712 | } |
713 | } else { | 713 | } else { |
714 | bool founOne; | 714 | bool founOne; |
715 | QDate next = event->getNextOccurence( start, &founOne ).date(); | 715 | QDate next = event->getNextOccurence( start, &founOne ).date(); |
716 | if ( founOne ) { | 716 | if ( founOne ) { |
717 | if ( next <= end ) { | 717 | if ( next <= end ) { |
718 | found = true; | 718 | found = true; |
719 | } | 719 | } |
720 | } | 720 | } |
721 | 721 | ||
722 | /* | 722 | /* |
723 | // crap !!! | 723 | // crap !!! |
724 | if ( rStart <= end ) { // Start date not after range | 724 | if ( rStart <= end ) { // Start date not after range |
725 | if ( rStart >= start ) { // Start date within range | 725 | if ( rStart >= start ) { // Start date within range |
726 | found = true; | 726 | found = true; |
727 | } else if ( event->recurrence()->duration() == -1 ) { // Recurs forever | 727 | } else if ( event->recurrence()->duration() == -1 ) { // Recurs forever |
728 | found = true; | 728 | found = true; |
729 | } else if ( event->recurrence()->duration() == 0 ) { // End date set | 729 | } else if ( event->recurrence()->duration() == 0 ) { // End date set |
730 | QDate rEnd = event->recurrence()->endDate(); | 730 | QDate rEnd = event->recurrence()->endDate(); |
731 | if ( rEnd >= start && rEnd <= end ) { // End date within range | 731 | if ( rEnd >= start && rEnd <= end ) { // End date within range |
732 | found = true; | 732 | found = true; |
733 | } | 733 | } |
734 | } else { // Duration set | 734 | } else { // Duration set |
735 | // TODO: Calculate end date from duration. Should be done in Event | 735 | // TODO: Calculate end date from duration. Should be done in Event |
736 | // For now include all events with a duration. | 736 | // For now include all events with a duration. |
737 | found = true; | 737 | found = true; |
738 | } | 738 | } |
739 | } | 739 | } |
740 | */ | 740 | */ |
741 | 741 | ||
742 | } | 742 | } |
743 | 743 | ||
744 | if ( found ) eventList.append( event ); | 744 | if ( found ) eventList.append( event ); |
745 | } else { | 745 | } else { |
746 | QDate s = event->dtStart().date(); | 746 | QDate s = event->dtStart().date(); |
747 | QDate e = event->dtEnd().date(); | 747 | QDate e = event->dtEnd().date(); |
748 | 748 | ||
749 | if ( inclusive ) { | 749 | if ( inclusive ) { |
750 | if ( s >= start && e <= end ) { | 750 | if ( s >= start && e <= end ) { |
751 | eventList.append( event ); | 751 | eventList.append( event ); |
752 | } | 752 | } |
753 | } else { | 753 | } else { |
754 | if ( ( e >= start && s <= end ) ) { | 754 | if ( ( e >= start && s <= end ) ) { |
755 | eventList.append( event ); | 755 | eventList.append( event ); |
756 | } | 756 | } |
757 | } | 757 | } |
758 | } | 758 | } |
759 | } | 759 | } |
760 | 760 | ||
761 | return eventList; | 761 | return eventList; |
762 | } | 762 | } |
763 | 763 | ||
764 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) | 764 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) |
765 | { | 765 | { |
766 | return rawEventsForDate( qdt.date() ); | 766 | return rawEventsForDate( qdt.date() ); |
767 | } | 767 | } |
768 | 768 | ||
769 | QPtrList<Event> CalendarLocal::rawEvents() | 769 | QPtrList<Event> CalendarLocal::rawEvents() |
770 | { | 770 | { |
771 | QPtrList<Event> el; | 771 | QPtrList<Event> el; |
772 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 772 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
773 | if ( it->calEnabled() ) el.append( it ); | 773 | if ( it->calEnabled() ) el.append( it ); |
774 | return el; | 774 | return el; |
775 | } | 775 | } |
776 | 776 | ||
777 | bool CalendarLocal::addJournal(Journal *journal) | 777 | bool CalendarLocal::addJournal(Journal *journal) |
778 | { | 778 | { |
779 | if ( journal->dtStart().isValid()) | 779 | mJournalList.append(journal); |
780 | kdDebug(5800) << "Adding Journal on " << journal->dtStart().toString() << endl; | ||
781 | else | ||
782 | kdDebug(5800) << "Adding Journal without a DTSTART" << endl; | ||
783 | |||
784 | mJournalList.append(journal); | ||
785 | 780 | ||
786 | journal->registerObserver( this ); | 781 | journal->registerObserver( this ); |
787 | 782 | ||
788 | setModified( true ); | 783 | setModified( true ); |
789 | journal->setCalID( mDefaultCalendar ); | 784 | journal->setCalID( mDefaultCalendar ); |
790 | journal->setCalEnabled( true ); | 785 | journal->setCalEnabled( true ); |
791 | return true; | 786 | return true; |
792 | } | 787 | } |
793 | 788 | ||
794 | void CalendarLocal::deleteJournal( Journal *journal ) | 789 | void CalendarLocal::deleteJournal( Journal *journal ) |
795 | { | 790 | { |
796 | if ( mUndoIncidence ) delete mUndoIncidence; | 791 | if ( mUndoIncidence ) delete mUndoIncidence; |
797 | mUndoIncidence = journal->clone(); | 792 | mUndoIncidence = journal->clone(); |
798 | mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); | 793 | mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); |
799 | if ( mJournalList.removeRef(journal) ) { | 794 | if ( mJournalList.removeRef(journal) ) { |
800 | setModified( true ); | 795 | setModified( true ); |
801 | } | 796 | } |
802 | } | 797 | } |
803 | 798 | ||
799 | QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date ) | ||
800 | { | ||
801 | QPtrList<Journal> el; | ||
802 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | ||
803 | if ( it->calEnabled() && it->dtStart().date() == date) el.append( it ); | ||
804 | return el; | ||
805 | } | ||
804 | Journal *CalendarLocal::journal( const QDate &date ) | 806 | Journal *CalendarLocal::journal( const QDate &date ) |
805 | { | 807 | { |
806 | // kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; | 808 | // kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; |
807 | 809 | ||
808 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 810 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
809 | if ( it->calEnabled() && it->dtStart().date() == date ) | 811 | if ( it->calEnabled() && it->dtStart().date() == date ) |
810 | return it; | 812 | return it; |
811 | 813 | ||
812 | return 0; | 814 | return 0; |
813 | } | 815 | } |
814 | 816 | ||
815 | Journal *CalendarLocal::journal( const QString &uid ) | 817 | Journal *CalendarLocal::journal( const QString &uid ) |
816 | { | 818 | { |
817 | Journal * retVal = 0; | 819 | Journal * retVal = 0; |
818 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 820 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
819 | if ( it->calEnabled() && it->uid() == uid ) { | 821 | if ( it->calEnabled() && it->uid() == uid ) { |
820 | if ( retVal ) { | 822 | if ( retVal ) { |
821 | if ( retVal->calID() > it->calID() ) { | 823 | if ( retVal->calID() > it->calID() ) { |
822 | retVal = it; | 824 | retVal = it; |
823 | } | 825 | } |
824 | } else { | 826 | } else { |
825 | retVal = it; | 827 | retVal = it; |
826 | } | 828 | } |
827 | } | 829 | } |
828 | return retVal; | 830 | return retVal; |
829 | } | 831 | } |
830 | 832 | ||
831 | QPtrList<Journal> CalendarLocal::journals() | 833 | QPtrList<Journal> CalendarLocal::journals() |
832 | { | 834 | { |
833 | QPtrList<Journal> el; | 835 | QPtrList<Journal> el; |
834 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 836 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
835 | if ( it->calEnabled() ) el.append( it ); | 837 | if ( it->calEnabled() ) el.append( it ); |
836 | return el; | 838 | return el; |
837 | } | 839 | } |
838 | void CalendarLocal::setCalendarRemove( int id ) | 840 | void CalendarLocal::setCalendarRemove( int id ) |
839 | { | 841 | { |
840 | 842 | ||
841 | { | 843 | { |
842 | QPtrList<Event> EventList = mEventList; | 844 | QPtrList<Event> EventList = mEventList; |
843 | Event * ev = EventList.first(); | 845 | Event * ev = EventList.first(); |
844 | while ( ev ) { | 846 | while ( ev ) { |
845 | if ( ev->calID() == id ) | 847 | if ( ev->calID() == id ) |
846 | deleteEvent( ev ); | 848 | deleteEvent( ev ); |
847 | ev = EventList.next(); | 849 | ev = EventList.next(); |
848 | } | 850 | } |
849 | } | 851 | } |
850 | { | 852 | { |
851 | 853 | ||
852 | QPtrList<Todo> TodoList = mTodoList; | 854 | QPtrList<Todo> TodoList = mTodoList; |
853 | Todo * ev = TodoList.first(); | 855 | Todo * ev = TodoList.first(); |
854 | while ( ev ) { | 856 | while ( ev ) { |
855 | if ( ev->calID() == id ) | 857 | if ( ev->calID() == id ) |
856 | deleteTodo( ev ); | 858 | deleteTodo( ev ); |
857 | ev = TodoList.next(); | 859 | ev = TodoList.next(); |
858 | } | 860 | } |
859 | } | 861 | } |
860 | { | 862 | { |
861 | QPtrList<Journal> JournalList = mJournalList; | 863 | QPtrList<Journal> JournalList = mJournalList; |
862 | Journal * ev = JournalList.first(); | 864 | Journal * ev = JournalList.first(); |
863 | while ( ev ) { | 865 | while ( ev ) { |
864 | if ( ev->calID() == id ) | 866 | if ( ev->calID() == id ) |
865 | deleteJournal( ev ); | 867 | deleteJournal( ev ); |
866 | ev = JournalList.next(); | 868 | ev = JournalList.next(); |
867 | } | 869 | } |
868 | } | 870 | } |
869 | 871 | ||
870 | if ( mUndoIncidence ) delete mUndoIncidence; | 872 | if ( mUndoIncidence ) delete mUndoIncidence; |
871 | mUndoIncidence = 0; | 873 | mUndoIncidence = 0; |
872 | 874 | ||
873 | } | 875 | } |
874 | 876 | ||
875 | void CalendarLocal::setCalendarEnabled( int id, bool enable ) | 877 | void CalendarLocal::setCalendarEnabled( int id, bool enable ) |
876 | { | 878 | { |
877 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 879 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
878 | if ( it->calID() == id ) it->setCalEnabled( enable ); | 880 | if ( it->calID() == id ) it->setCalEnabled( enable ); |
879 | 881 | ||
880 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 882 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
881 | if ( it->calID() == id ) it->setCalEnabled( enable ); | 883 | if ( it->calID() == id ) it->setCalEnabled( enable ); |
882 | 884 | ||
883 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 885 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
884 | if ( it->calID() == id ) it->setCalEnabled( enable ); | 886 | if ( it->calID() == id ) it->setCalEnabled( enable ); |
885 | 887 | ||
886 | } | 888 | } |
887 | 889 | ||
888 | void CalendarLocal::setReadOnly( int id, bool enable ) | 890 | void CalendarLocal::setReadOnly( int id, bool enable ) |
889 | { | 891 | { |
890 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 892 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
891 | if ( it->calID() == id ) it->setReadOnly( enable ); | 893 | if ( it->calID() == id ) it->setReadOnly( enable ); |
892 | 894 | ||
893 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 895 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
894 | if ( it->calID() == id ) it->setReadOnly( enable ); | 896 | if ( it->calID() == id ) it->setReadOnly( enable ); |
895 | 897 | ||
896 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 898 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
897 | if ( it->calID() == id ) it->setReadOnly( enable ); | 899 | if ( it->calID() == id ) it->setReadOnly( enable ); |
898 | 900 | ||
899 | } | 901 | } |
900 | 902 | ||
901 | void CalendarLocal::setAlarmEnabled( int id, bool enable ) | 903 | void CalendarLocal::setAlarmEnabled( int id, bool enable ) |
902 | { | 904 | { |
903 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 905 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
904 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); | 906 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); |
905 | 907 | ||
906 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 908 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
907 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); | 909 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); |
908 | 910 | ||
909 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 911 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
910 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); | 912 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); |
911 | reInitAlarmSettings(); | 913 | reInitAlarmSettings(); |
912 | 914 | ||
913 | } | 915 | } |
914 | void CalendarLocal::setDefaultCalendarEnabledOnly() | 916 | void CalendarLocal::setDefaultCalendarEnabledOnly() |
915 | { | 917 | { |
916 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 918 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
917 | it->setCalEnabled( it->calID() == mDefaultCalendar ); | 919 | it->setCalEnabled( it->calID() == mDefaultCalendar ); |
918 | 920 | ||
919 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 921 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
920 | it->setCalEnabled( it->calID() == mDefaultCalendar); | 922 | it->setCalEnabled( it->calID() == mDefaultCalendar); |
921 | 923 | ||
922 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 924 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
923 | it->setCalEnabled( it->calID() == mDefaultCalendar); | 925 | it->setCalEnabled( it->calID() == mDefaultCalendar); |
924 | 926 | ||
925 | } | 927 | } |
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index d32597f..98d16a3 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -1,226 +1,227 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | 3 | ||
4 | Copyright (c) 1998 Preston Brown | 4 | Copyright (c) 1998 Preston Brown |
5 | Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> | 5 | Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This library is free software; you can redistribute it and/or | 7 | This library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Library General Public | 8 | modify it under the terms of the GNU Library General Public |
9 | License as published by the Free Software Foundation; either | 9 | License as published by the Free Software Foundation; either |
10 | version 2 of the License, or (at your option) any later version. | 10 | version 2 of the License, or (at your option) any later version. |
11 | 11 | ||
12 | This library is distributed in the hope that it will be useful, | 12 | This library is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. | 15 | Library General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU Library General Public License | 17 | You should have received a copy of the GNU Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to | 18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | #ifndef KCAL_CALENDARLOCAL_H | 22 | #ifndef KCAL_CALENDARLOCAL_H |
23 | #define KCAL_CALENDARLOCAL_H | 23 | #define KCAL_CALENDARLOCAL_H |
24 | 24 | ||
25 | #include "calendar.h" | 25 | #include "calendar.h" |
26 | 26 | ||
27 | namespace KCal { | 27 | namespace KCal { |
28 | 28 | ||
29 | class CalFormat; | 29 | class CalFormat; |
30 | 30 | ||
31 | /** | 31 | /** |
32 | This class provides a calendar stored as a local file. | 32 | This class provides a calendar stored as a local file. |
33 | */ | 33 | */ |
34 | class CalendarLocal : public Calendar | 34 | class CalendarLocal : public Calendar |
35 | { | 35 | { |
36 | public: | 36 | public: |
37 | /** | 37 | /** |
38 | Constructs a new calendar, with variables initialized to sane values. | 38 | Constructs a new calendar, with variables initialized to sane values. |
39 | */ | 39 | */ |
40 | CalendarLocal(); | 40 | CalendarLocal(); |
41 | /** | 41 | /** |
42 | Constructs a new calendar, with variables initialized to sane values. | 42 | Constructs a new calendar, with variables initialized to sane values. |
43 | */ | 43 | */ |
44 | CalendarLocal( const QString &timeZoneId ); | 44 | CalendarLocal( const QString &timeZoneId ); |
45 | ~CalendarLocal(); | 45 | ~CalendarLocal(); |
46 | void addCalendar( Calendar* ); | 46 | void addCalendar( Calendar* ); |
47 | bool addCalendarFile( QString name, int id ); | 47 | bool addCalendarFile( QString name, int id ); |
48 | void setSyncEventsReadOnly(); | 48 | void setSyncEventsReadOnly(); |
49 | void stopAllTodos(); | 49 | void stopAllTodos(); |
50 | /** | 50 | /** |
51 | Loads a calendar on disk in vCalendar or iCalendar format into the current | 51 | Loads a calendar on disk in vCalendar or iCalendar format into the current |
52 | calendar. Any information already present is lost. | 52 | calendar. Any information already present is lost. |
53 | @return true, if successfull, false on error. | 53 | @return true, if successfull, false on error. |
54 | @param fileName the name of the calendar on disk. | 54 | @param fileName the name of the calendar on disk. |
55 | */ | 55 | */ |
56 | bool load( const QString &fileName ); | 56 | bool load( const QString &fileName ); |
57 | /** | 57 | /** |
58 | Writes out the calendar to disk in the specified \a format. | 58 | Writes out the calendar to disk in the specified \a format. |
59 | CalendarLocal takes ownership of the CalFormat object. | 59 | CalendarLocal takes ownership of the CalFormat object. |
60 | @return true, if successfull, false on error. | 60 | @return true, if successfull, false on error. |
61 | @param fileName the name of the file | 61 | @param fileName the name of the file |
62 | */ | 62 | */ |
63 | bool save( const QString &fileName, CalFormat *format = 0 ); | 63 | bool save( const QString &fileName, CalFormat *format = 0 ); |
64 | 64 | ||
65 | /** | 65 | /** |
66 | Clears out the current calendar, freeing all used memory etc. etc. | 66 | Clears out the current calendar, freeing all used memory etc. etc. |
67 | */ | 67 | */ |
68 | void close(); | 68 | void close(); |
69 | 69 | ||
70 | void save() {} | 70 | void save() {} |
71 | 71 | ||
72 | /** | 72 | /** |
73 | Add Event to calendar. | 73 | Add Event to calendar. |
74 | */ | 74 | */ |
75 | void removeSyncInfo( QString syncProfile); | 75 | void removeSyncInfo( QString syncProfile); |
76 | bool addAnniversaryNoDup( Event *event ); | 76 | bool addAnniversaryNoDup( Event *event ); |
77 | bool addEventNoDup( Event *event ); | 77 | bool addEventNoDup( Event *event ); |
78 | bool addEvent( Event *event ); | 78 | bool addEvent( Event *event ); |
79 | /** | 79 | /** |
80 | Deletes an event from this calendar. | 80 | Deletes an event from this calendar. |
81 | */ | 81 | */ |
82 | void deleteEvent( Event *event ); | 82 | void deleteEvent( Event *event ); |
83 | 83 | ||
84 | /** | 84 | /** |
85 | Retrieves an event on the basis of the unique string ID. | 85 | Retrieves an event on the basis of the unique string ID. |
86 | */ | 86 | */ |
87 | Event *event( const QString &uid ); | 87 | Event *event( const QString &uid ); |
88 | /** | 88 | /** |
89 | Return unfiltered list of all events in calendar. | 89 | Return unfiltered list of all events in calendar. |
90 | */ | 90 | */ |
91 | QPtrList<Event> rawEvents(); | 91 | QPtrList<Event> rawEvents(); |
92 | QPtrList<Event> getExternLastSyncEvents(); | 92 | QPtrList<Event> getExternLastSyncEvents(); |
93 | /** | 93 | /** |
94 | Add a todo to the todolist. | 94 | Add a todo to the todolist. |
95 | */ | 95 | */ |
96 | bool addTodo( Todo *todo ); | 96 | bool addTodo( Todo *todo ); |
97 | bool addTodoNoDup( Todo *todo ); | 97 | bool addTodoNoDup( Todo *todo ); |
98 | /** | 98 | /** |
99 | Remove a todo from the todolist. | 99 | Remove a todo from the todolist. |
100 | */ | 100 | */ |
101 | void deleteTodo( Todo * ); | 101 | void deleteTodo( Todo * ); |
102 | /** | 102 | /** |
103 | Searches todolist for an event with this unique string identifier, | 103 | Searches todolist for an event with this unique string identifier, |
104 | returns a pointer or null. | 104 | returns a pointer or null. |
105 | */ | 105 | */ |
106 | Todo *todo( const QString &uid ); | 106 | Todo *todo( const QString &uid ); |
107 | /** | 107 | /** |
108 | Return list of all todos. | 108 | Return list of all todos. |
109 | */ | 109 | */ |
110 | QPtrList<Todo> rawTodos(); | 110 | QPtrList<Todo> rawTodos(); |
111 | /** | 111 | /** |
112 | Returns list of todos due on the specified date. | 112 | Returns list of todos due on the specified date. |
113 | */ | 113 | */ |
114 | QPtrList<Todo> todos( const QDate &date ); | 114 | QPtrList<Todo> todos( const QDate &date ); |
115 | /** | 115 | /** |
116 | Return list of all todos. | 116 | Return list of all todos. |
117 | 117 | ||
118 | Workaround because compiler does not recognize function of base class. | 118 | Workaround because compiler does not recognize function of base class. |
119 | */ | 119 | */ |
120 | QPtrList<Todo> todos() { return Calendar::todos(); } | 120 | QPtrList<Todo> todos() { return Calendar::todos(); } |
121 | 121 | ||
122 | /** | 122 | /** |
123 | Add a Journal entry to calendar. | 123 | Add a Journal entry to calendar. |
124 | */ | 124 | */ |
125 | bool addJournal( Journal * ); | 125 | bool addJournal( Journal * ); |
126 | /** | 126 | /** |
127 | Remove a Journal from the calendar. | 127 | Remove a Journal from the calendar. |
128 | */ | 128 | */ |
129 | void deleteJournal( Journal * ); | 129 | void deleteJournal( Journal * ); |
130 | /** | 130 | /** |
131 | Return Journal for given date. | 131 | Return Journal for given date. |
132 | */ | 132 | */ |
133 | Journal *journal( const QDate & ); | 133 | Journal *journal( const QDate & ); |
134 | QPtrList<Journal> journals4Date( const QDate & ); | ||
134 | /** | 135 | /** |
135 | Return Journal with given UID. | 136 | Return Journal with given UID. |
136 | */ | 137 | */ |
137 | Journal *journal( const QString &uid ); | 138 | Journal *journal( const QString &uid ); |
138 | /** | 139 | /** |
139 | Return list of all Journals stored in calendar. | 140 | Return list of all Journals stored in calendar. |
140 | */ | 141 | */ |
141 | QPtrList<Journal> journals(); | 142 | QPtrList<Journal> journals(); |
142 | 143 | ||
143 | /** | 144 | /** |
144 | Return all alarms, which ocur in the given time interval. | 145 | Return all alarms, which ocur in the given time interval. |
145 | */ | 146 | */ |
146 | Alarm::List alarms( const QDateTime &from, const QDateTime &to ); | 147 | Alarm::List alarms( const QDateTime &from, const QDateTime &to ); |
147 | 148 | ||
148 | /** | 149 | /** |
149 | Return all alarms, which ocur before given date. | 150 | Return all alarms, which ocur before given date. |
150 | */ | 151 | */ |
151 | Alarm::List alarmsTo( const QDateTime &to ); | 152 | Alarm::List alarmsTo( const QDateTime &to ); |
152 | 153 | ||
153 | QDateTime nextAlarm( int daysTo ) ; | 154 | QDateTime nextAlarm( int daysTo ) ; |
154 | QDateTime nextAlarmEventDateTime() const; | 155 | QDateTime nextAlarmEventDateTime() const; |
155 | void checkAlarmForIncidence( Incidence *, bool deleted ) ; | 156 | void checkAlarmForIncidence( Incidence *, bool deleted ) ; |
156 | void registerAlarm(); | 157 | void registerAlarm(); |
157 | void deRegisterAlarm(); | 158 | void deRegisterAlarm(); |
158 | QString getAlarmNotification(); | 159 | QString getAlarmNotification(); |
159 | QString nextSummary() const ; | 160 | QString nextSummary() const ; |
160 | /** | 161 | /** |
161 | This method should be called whenever a Event is modified directly | 162 | This method should be called whenever a Event is modified directly |
162 | via it's pointer. It makes sure that the calendar is internally | 163 | via it's pointer. It makes sure that the calendar is internally |
163 | consistent. | 164 | consistent. |
164 | */ | 165 | */ |
165 | void update( IncidenceBase *incidence ); | 166 | void update( IncidenceBase *incidence ); |
166 | 167 | ||
167 | /** | 168 | /** |
168 | Builds and then returns a list of all events that match for the | 169 | Builds and then returns a list of all events that match for the |
169 | date specified. useful for dayView, etc. etc. | 170 | date specified. useful for dayView, etc. etc. |
170 | */ | 171 | */ |
171 | QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false ); | 172 | QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false ); |
172 | /** | 173 | /** |
173 | Get unfiltered events for date \a qdt. | 174 | Get unfiltered events for date \a qdt. |
174 | */ | 175 | */ |
175 | QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); | 176 | QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); |
176 | /** | 177 | /** |
177 | Get unfiltered events in a range of dates. If inclusive is set to true, | 178 | Get unfiltered events in a range of dates. If inclusive is set to true, |
178 | only events are returned, which are completely included in the range. | 179 | only events are returned, which are completely included in the range. |
179 | */ | 180 | */ |
180 | QPtrList<Event> rawEvents( const QDate &start, const QDate &end, | 181 | QPtrList<Event> rawEvents( const QDate &start, const QDate &end, |
181 | bool inclusive = false ); | 182 | bool inclusive = false ); |
182 | Todo *todo( QString, QString ); | 183 | Todo *todo( QString, QString ); |
183 | Event *event( QString, QString ); | 184 | Event *event( QString, QString ); |
184 | 185 | ||
185 | public slots: | 186 | public slots: |
186 | void setCalendarEnabled( int id, bool enable ); | 187 | void setCalendarEnabled( int id, bool enable ); |
187 | void setAlarmEnabled( int id, bool enable ); | 188 | void setAlarmEnabled( int id, bool enable ); |
188 | void setReadOnly( int id, bool enable ); | 189 | void setReadOnly( int id, bool enable ); |
189 | void setDefaultCalendarEnabledOnly(); | 190 | void setDefaultCalendarEnabledOnly(); |
190 | void setCalendarRemove( int id ); | 191 | void setCalendarRemove( int id ); |
191 | 192 | ||
192 | protected: | 193 | protected: |
193 | 194 | ||
194 | // Event* mNextAlarmEvent; | 195 | // Event* mNextAlarmEvent; |
195 | QString mNextSummary; | 196 | QString mNextSummary; |
196 | QString mNextAlarmEventDateTimeString; | 197 | QString mNextAlarmEventDateTimeString; |
197 | QString mLastAlarmNotificationString; | 198 | QString mLastAlarmNotificationString; |
198 | QDateTime mNextAlarmEventDateTime; | 199 | QDateTime mNextAlarmEventDateTime; |
199 | QDateTime mNextAlarmDateTime; | 200 | QDateTime mNextAlarmDateTime; |
200 | void reInitAlarmSettings(); | 201 | void reInitAlarmSettings(); |
201 | 202 | ||
202 | /** Notification function of IncidenceBase::Observer. */ | 203 | /** Notification function of IncidenceBase::Observer. */ |
203 | void incidenceUpdated( IncidenceBase *i ) { update( i ); } | 204 | void incidenceUpdated( IncidenceBase *i ) { update( i ); } |
204 | 205 | ||
205 | /** inserts an event into its "proper place" in the calendar. */ | 206 | /** inserts an event into its "proper place" in the calendar. */ |
206 | void insertEvent( Event *event ); | 207 | void insertEvent( Event *event ); |
207 | 208 | ||
208 | /** Append alarms of incidence in interval to list of alarms. */ | 209 | /** Append alarms of incidence in interval to list of alarms. */ |
209 | void appendAlarms( Alarm::List &alarms, Incidence *incidence, | 210 | void appendAlarms( Alarm::List &alarms, Incidence *incidence, |
210 | const QDateTime &from, const QDateTime &to ); | 211 | const QDateTime &from, const QDateTime &to ); |
211 | 212 | ||
212 | /** Append alarms of recurring events in interval to list of alarms. */ | 213 | /** Append alarms of recurring events in interval to list of alarms. */ |
213 | void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence, | 214 | void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence, |
214 | const QDateTime &from, const QDateTime &to ); | 215 | const QDateTime &from, const QDateTime &to ); |
215 | 216 | ||
216 | private: | 217 | private: |
217 | void init(); | 218 | void init(); |
218 | 219 | ||
219 | QPtrList<Event> mEventList; | 220 | QPtrList<Event> mEventList; |
220 | QPtrList<Todo> mTodoList; | 221 | QPtrList<Todo> mTodoList; |
221 | QPtrList<Journal> mJournalList; | 222 | QPtrList<Journal> mJournalList; |
222 | }; | 223 | }; |
223 | 224 | ||
224 | } | 225 | } |
225 | 226 | ||
226 | #endif | 227 | #endif |