-rw-r--r-- | libkcal/calendar.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 0a94914..66836a1 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -63,321 +63,322 @@ class Calendar : public QObject, public CustomProperties, | |||
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 bool mergeCalendarFile( QString name ) = 0; | 79 | virtual bool mergeCalendarFile( QString name ) = 0; |
80 | virtual Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates ) = 0; | 80 | virtual Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates ) = 0; |
81 | virtual void setSyncEventsReadOnly() = 0; | 81 | virtual void setSyncEventsReadOnly() = 0; |
82 | virtual void setSyncEventsEnabled() = 0; | 82 | virtual void setSyncEventsEnabled() = 0; |
83 | virtual void stopAllTodos() = 0; | 83 | virtual void stopAllTodos() = 0; |
84 | virtual void clearUndo( Incidence * newUndo ); | 84 | virtual void clearUndo( Incidence * newUndo ); |
85 | 85 | ||
86 | /** | 86 | /** |
87 | Sync changes in memory to persistant storage. | 87 | Sync changes in memory to persistant storage. |
88 | */ | 88 | */ |
89 | virtual void save() = 0; | 89 | virtual void save() = 0; |
90 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; | 90 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; |
91 | virtual void removeSyncInfo( QString syncProfile) = 0; | 91 | virtual void removeSyncInfo( QString syncProfile) = 0; |
92 | virtual bool isSaving() { return false; } | 92 | virtual bool isSaving() { return false; } |
93 | 93 | ||
94 | /** | 94 | /** |
95 | Return the owner of the calendar's full name. | 95 | Return the owner of the calendar's full name. |
96 | */ | 96 | */ |
97 | const QString &getOwner() const; | 97 | const QString &getOwner() const; |
98 | /** | 98 | /** |
99 | Set the owner of the calendar. Should be owner's full name. | 99 | Set the owner of the calendar. Should be owner's full name. |
100 | */ | 100 | */ |
101 | void setOwner( const QString &os ); | 101 | void setOwner( const QString &os ); |
102 | /** | 102 | /** |
103 | Return the email address of the calendar owner. | 103 | Return the email address of the calendar owner. |
104 | */ | 104 | */ |
105 | const QString &getEmail(); | 105 | const QString &getEmail(); |
106 | /** | 106 | /** |
107 | Set the email address of the calendar owner. | 107 | Set the email address of the calendar owner. |
108 | */ | 108 | */ |
109 | void setEmail( const QString & ); | 109 | void setEmail( const QString & ); |
110 | 110 | ||
111 | /** | 111 | /** |
112 | Set time zone from a timezone string (e.g. -2:00) | 112 | Set time zone from a timezone string (e.g. -2:00) |
113 | */ | 113 | */ |
114 | void setTimeZone( const QString &tz ); | 114 | void setTimeZone( const QString &tz ); |
115 | /** | 115 | /** |
116 | Set time zone from a minutes value (e.g. -60) | 116 | Set time zone from a minutes value (e.g. -60) |
117 | */ | 117 | */ |
118 | void setTimeZone( int tz ); | 118 | void setTimeZone( int tz ); |
119 | /** | 119 | /** |
120 | Return time zone as offest in minutes. | 120 | Return time zone as offest in minutes. |
121 | */ | 121 | */ |
122 | int getTimeZone() const; | 122 | int getTimeZone() const; |
123 | /** | 123 | /** |
124 | Compute an ISO 8601 format string from the time zone. | 124 | Compute an ISO 8601 format string from the time zone. |
125 | */ | 125 | */ |
126 | QString getTimeZoneStr() const; | 126 | QString getTimeZoneStr() const; |
127 | /** | 127 | /** |
128 | Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal | 128 | Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal |
129 | values). | 129 | values). |
130 | */ | 130 | */ |
131 | void setTimeZoneId( const QString & ); | 131 | void setTimeZoneId( const QString & ); |
132 | /** | 132 | /** |
133 | Return time zone id. | 133 | Return time zone id. |
134 | */ | 134 | */ |
135 | QString timeZoneId() const; | 135 | QString timeZoneId() const; |
136 | /** | 136 | /** |
137 | Use local time, not UTC or a time zone. | 137 | Use local time, not UTC or a time zone. |
138 | */ | 138 | */ |
139 | void setLocalTime(); | 139 | void setLocalTime(); |
140 | /** | 140 | /** |
141 | Return whether local time is being used. | 141 | Return whether local time is being used. |
142 | */ | 142 | */ |
143 | bool isLocalTime() const; | 143 | bool isLocalTime() const; |
144 | 144 | ||
145 | /** | 145 | /** |
146 | Add an incidence to calendar. | 146 | Add an incidence to calendar. |
147 | 147 | ||
148 | @return true on success, false on error. | 148 | @return true on success, false on error. |
149 | */ | 149 | */ |
150 | virtual bool addIncidence( Incidence * ); | 150 | virtual bool addIncidence( Incidence * ); |
151 | 151 | ||
152 | // Adds an incidence and all relatedto incidences to the cal | 152 | // Adds an incidence and all relatedto incidences to the cal |
153 | void addIncidenceBranch( Incidence * ); | 153 | void addIncidenceBranch( Incidence * ); |
154 | /** | 154 | /** |
155 | Return filtered list of all incidences of this calendar. | 155 | Return filtered list of all incidences of this calendar. |
156 | */ | 156 | */ |
157 | virtual QPtrList<Incidence> incidences(); | 157 | virtual QPtrList<Incidence> incidences(); |
158 | 158 | ||
159 | /** | 159 | /** |
160 | Return unfiltered list of all incidences of this calendar. | 160 | Return unfiltered list of all incidences of this calendar. |
161 | */ | 161 | */ |
162 | virtual QPtrList<Incidence> rawIncidences(); | 162 | virtual QPtrList<Incidence> rawIncidences(); |
163 | 163 | ||
164 | /** | 164 | /** |
165 | Adds a Event to this calendar object. | 165 | Adds a Event to this calendar object. |
166 | @param anEvent a pointer to the event to add | 166 | @param anEvent a pointer to the event to add |
167 | 167 | ||
168 | @return true on success, false on error. | 168 | @return true on success, false on error. |
169 | */ | 169 | */ |
170 | virtual bool addEventNoDup( Event *event ) = 0; | 170 | virtual bool addEventNoDup( Event *event ) = 0; |
171 | virtual bool addAnniversaryNoDup( Event *event ) = 0; | 171 | virtual bool addAnniversaryNoDup( Event *event ) = 0; |
172 | virtual bool addEvent( Event *anEvent ) = 0; | 172 | virtual bool addEvent( Event *anEvent ) = 0; |
173 | /** | 173 | /** |
174 | Delete event from calendar. | 174 | Delete event from calendar. |
175 | */ | 175 | */ |
176 | virtual void deleteEvent( Event * ) = 0; | 176 | virtual void deleteEvent( Event * ) = 0; |
177 | /** | 177 | /** |
178 | Retrieves an event on the basis of the unique string ID. | 178 | Retrieves an event on the basis of the unique string ID. |
179 | */ | 179 | */ |
180 | virtual Event *event( const QString &UniqueStr ) = 0; | 180 | virtual Event *event( const QString &UniqueStr ) = 0; |
181 | virtual Event *event( QString, QString ) = 0; | 181 | virtual Event *event( QString, QString ) = 0; |
182 | /** | 182 | /** |
183 | Builds and then returns a list of all events that match for the | 183 | Builds and then returns a list of all events that match for the |
184 | date specified. useful for dayView, etc. etc. | 184 | date specified. useful for dayView, etc. etc. |
185 | The calendar filter is applied. | 185 | The calendar filter is applied. |
186 | */ | 186 | */ |
187 | QPtrList<Event> events( const QDate &date, bool sorted = false); | 187 | QPtrList<Event> events( const QDate &date, bool sorted = false); |
188 | /** | 188 | /** |
189 | Get events, which occur on the given date. | 189 | Get events, which occur on the given date. |
190 | The calendar filter is applied. | 190 | The calendar filter is applied. |
191 | */ | 191 | */ |
192 | QPtrList<Event> events( const QDateTime &qdt ); | 192 | QPtrList<Event> events( const QDateTime &qdt ); |
193 | /** | 193 | /** |
194 | Get events in a range of dates. If inclusive is set to true, only events | 194 | Get events in a range of dates. If inclusive is set to true, only events |
195 | are returned, which are completely included in the range. | 195 | are returned, which are completely included in the range. |
196 | The calendar filter is applied. | 196 | The calendar filter is applied. |
197 | */ | 197 | */ |
198 | QPtrList<Event> events( const QDate &start, const QDate &end, | 198 | QPtrList<Event> events( const QDate &start, const QDate &end, |
199 | bool inclusive = false); | 199 | bool inclusive = false); |
200 | /** | 200 | /** |
201 | Return filtered list of all events in calendar. | 201 | Return filtered list of all events in calendar. |
202 | */ | 202 | */ |
203 | virtual QPtrList<Event> events(); | 203 | virtual QPtrList<Event> events(); |
204 | /** | 204 | /** |
205 | Return unfiltered list of all events in calendar. | 205 | Return unfiltered list of all events in calendar. |
206 | */ | 206 | */ |
207 | virtual QPtrList<Event> rawEvents() = 0; | 207 | virtual QPtrList<Event> rawEvents() = 0; |
208 | 208 | ||
209 | /** | 209 | /** |
210 | Add a todo to the todolist. | 210 | Add a todo to the todolist. |
211 | 211 | ||
212 | @return true on success, false on error. | 212 | @return true on success, false on error. |
213 | */ | 213 | */ |
214 | virtual bool addTodo( Todo *todo ) = 0; | 214 | virtual bool addTodo( Todo *todo ) = 0; |
215 | virtual bool addTodoNoDup( Todo *todo ) = 0; | 215 | virtual bool addTodoNoDup( Todo *todo ) = 0; |
216 | /** | 216 | /** |
217 | Remove a todo from the todolist. | 217 | Remove a todo from the todolist. |
218 | */ | 218 | */ |
219 | virtual void deleteTodo( Todo * ) = 0; | 219 | virtual void deleteTodo( Todo * ) = 0; |
220 | virtual void deleteJournal( Journal * ) = 0; | 220 | virtual void deleteJournal( Journal * ) = 0; |
221 | /** | 221 | /** |
222 | Return filterd list of todos. | 222 | Return filterd list of todos. |
223 | */ | 223 | */ |
224 | virtual QPtrList<Todo> todos(); | 224 | virtual QPtrList<Todo> todos(); |
225 | /** | 225 | /** |
226 | Searches todolist for an event with this unique string identifier, | 226 | Searches todolist for an event with this unique string identifier, |
227 | returns a pointer or null. | 227 | returns a pointer or null. |
228 | */ | 228 | */ |
229 | virtual Todo *todo( const QString &uid ) = 0; | 229 | virtual Todo *todo( const QString &uid ) = 0; |
230 | virtual Todo *todo( QString, QString ) = 0; | 230 | virtual Todo *todo( QString, QString ) = 0; |
231 | /** | 231 | /** |
232 | Returns list of todos due on the specified date. | 232 | Returns list of todos due on the specified date. |
233 | */ | 233 | */ |
234 | virtual QPtrList<Todo> todos( const QDate &date ) = 0; | 234 | virtual QPtrList<Todo> todos( const QDate &date ) = 0; |
235 | /** | 235 | /** |
236 | Return unfiltered list of todos. | 236 | Return unfiltered list of todos. |
237 | */ | 237 | */ |
238 | virtual QPtrList<Todo> rawTodos() = 0; | 238 | virtual QPtrList<Todo> rawTodos() = 0; |
239 | 239 | ||
240 | /** | 240 | /** |
241 | Add a Journal entry to calendar. | 241 | Add a Journal entry to calendar. |
242 | 242 | ||
243 | @return true on success, false on error. | 243 | @return true on success, false on error. |
244 | */ | 244 | */ |
245 | virtual bool addJournal( Journal * ) = 0; | 245 | virtual bool addJournal( Journal * ) = 0; |
246 | /** | 246 | /** |
247 | Return Journal for given date. | 247 | Return Journal for given date. |
248 | */ | 248 | */ |
249 | virtual Journal *journal( const QDate & ) = 0; | 249 | virtual Journal *journal( const QDate & ) = 0; |
250 | virtual QPtrList<Journal> journals4Date( const QDate & ) = 0; | 250 | virtual QPtrList<Journal> journals4Date( const QDate & ) = 0; |
251 | /** | 251 | /** |
252 | Return Journal with given UID. | 252 | Return Journal with given UID. |
253 | */ | 253 | */ |
254 | virtual Journal *journal( const QString &UID ) = 0; | 254 | virtual Journal *journal( const QString &UID ) = 0; |
255 | /** | 255 | /** |
256 | Return list of all Journal entries. | 256 | Return list of all Journal entries. |
257 | */ | 257 | */ |
258 | virtual QPtrList<Journal> journals() = 0; | 258 | virtual QPtrList<Journal> journals() = 0; |
259 | 259 | ||
260 | /** | 260 | /** |
261 | Searches all incidence types for an incidence with this unique | 261 | Searches all incidence types for an incidence with this unique |
262 | string identifier, returns a pointer or null. | 262 | string identifier, returns a pointer or null. |
263 | */ | 263 | */ |
264 | Incidence* incidence( const QString&UID ); | 264 | Incidence* incidence( const QString&UID ); |
265 | 265 | ||
266 | /** | 266 | /** |
267 | Setup relations for an incidence. | 267 | Setup relations for an incidence. |
268 | */ | 268 | */ |
269 | virtual void setupRelations( Incidence * ); | 269 | virtual void setupRelations( Incidence * ); |
270 | /** | 270 | /** |
271 | Remove all relations to an incidence | 271 | Remove all relations to an incidence |
272 | */ | 272 | */ |
273 | virtual void removeRelations( Incidence * ); | 273 | virtual void removeRelations( Incidence * ); |
274 | 274 | ||
275 | /** | 275 | /** |
276 | Set calendar filter, which filters events for the events() functions. | 276 | Set calendar filter, which filters events for the events() functions. |
277 | The Filter object is owned by the caller. | 277 | The Filter object is owned by the caller. |
278 | */ | 278 | */ |
279 | void setFilter( CalFilter * ); | 279 | void setFilter( CalFilter * ); |
280 | /** | 280 | /** |
281 | Return calendar filter. | 281 | Return calendar filter. |
282 | */ | 282 | */ |
283 | CalFilter *filter(); | 283 | CalFilter *filter(); |
284 | virtual QDateTime nextAlarm( int daysTo ) = 0; | 284 | virtual QDateTime nextAlarm( int daysTo ) = 0; |
285 | virtual QString nextSummary( ) const = 0; | 285 | virtual QString nextSummary( ) const = 0; |
286 | virtual void reInitAlarmSettings() = 0; | 286 | virtual void reInitAlarmSettings() = 0; |
287 | virtual QDateTime nextAlarmEventDateTime() const = 0; | 287 | virtual QDateTime nextAlarmEventDateTime() const = 0; |
288 | virtual void checkAlarmForIncidence( Incidence *, bool ) = 0; | 288 | virtual void checkAlarmForIncidence( Incidence *, bool ) = 0; |
289 | /** | 289 | /** |
290 | Return all alarms, which ocur in the given time interval. | 290 | Return all alarms, which ocur in the given time interval. |
291 | */ | 291 | */ |
292 | virtual Alarm::List alarms( const QDateTime &from, | 292 | virtual Alarm::List alarms( const QDateTime &from, |
293 | const QDateTime &to ) = 0; | 293 | const QDateTime &to ) = 0; |
294 | 294 | ||
295 | class Observer { | 295 | class Observer { |
296 | public: | 296 | public: |
297 | virtual void calendarModified( bool, Calendar * ) = 0; | 297 | virtual void calendarModified( bool, Calendar * ) = 0; |
298 | }; | 298 | }; |
299 | 299 | ||
300 | void registerObserver( Observer * ); | 300 | void registerObserver( Observer * ); |
301 | 301 | ||
302 | void setModified( bool ); | 302 | void setModified( bool ); |
303 | 303 | ||
304 | /** | 304 | /** |
305 | Set product id returned by loadedProductId(). This function is only | 305 | Set product id returned by loadedProductId(). This function is only |
306 | useful for the calendar loading code. | 306 | useful for the calendar loading code. |
307 | */ | 307 | */ |
308 | void setLoadedProductId( const QString & ); | 308 | void setLoadedProductId( const QString & ); |
309 | /** | 309 | /** |
310 | Return product id taken from file that has been loaded. Returns | 310 | Return product id taken from file that has been loaded. Returns |
311 | QString::null, if no calendar has been loaded. | 311 | QString::null, if no calendar has been loaded. |
312 | */ | 312 | */ |
313 | QString loadedProductId(); | 313 | QString loadedProductId(); |
314 | int defaultCalendar(); | 314 | int defaultCalendar(); |
315 | void setDontDeleteIncidencesOnClose (); | 315 | void setDontDeleteIncidencesOnClose (); |
316 | public slots: | 316 | public slots: |
317 | void setDefaultCalendar( int ); | 317 | void setDefaultCalendar( int ); |
318 | virtual void setCalendarEnabled( int id, bool enable ) = 0; | 318 | virtual void setCalendarEnabled( int id, bool enable ) = 0; |
319 | virtual void setAllCalendarEnabled( bool enable ) = 0; | ||
319 | virtual void setAlarmEnabled( int id, bool enable ) = 0; | 320 | virtual void setAlarmEnabled( int id, bool enable ) = 0; |
320 | virtual void setReadOnly( int id, bool enable ) = 0; | 321 | virtual void setReadOnly( int id, bool enable ) = 0; |
321 | virtual void setDefaultCalendarEnabledOnly() = 0; | 322 | virtual void setDefaultCalendarEnabledOnly() = 0; |
322 | virtual void setCalendarRemove( int id ) = 0; | 323 | virtual void setCalendarRemove( int id ) = 0; |
323 | virtual void getIncidenceCount( int calId, int& events, int & todos, int & journals) = 0; | 324 | virtual void getIncidenceCount( int calId, int& events, int & todos, int & journals) = 0; |
324 | 325 | ||
325 | signals: | 326 | signals: |
326 | void calendarChanged(); | 327 | void calendarChanged(); |
327 | void calendarSaved(); | 328 | void calendarSaved(); |
328 | void calendarLoaded(); | 329 | void calendarLoaded(); |
329 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 330 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
330 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 331 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
331 | 332 | ||
332 | protected: | 333 | protected: |
333 | /** | 334 | /** |
334 | Get unfiltered events, which occur on the given date. | 335 | Get unfiltered events, which occur on the given date. |
335 | */ | 336 | */ |
336 | virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0; | 337 | virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0; |
337 | /** | 338 | /** |
338 | Get unfiltered events, which occur on the given date. | 339 | Get unfiltered events, which occur on the given date. |
339 | */ | 340 | */ |
340 | virtual QPtrList<Event> rawEventsForDate( const QDate &date, | 341 | virtual QPtrList<Event> rawEventsForDate( const QDate &date, |
341 | bool sorted = false ) = 0; | 342 | bool sorted = false ) = 0; |
342 | /** | 343 | /** |
343 | Get events in a range of dates. If inclusive is set to true, only events | 344 | Get events in a range of dates. If inclusive is set to true, only events |
344 | are returned, which are completely included in the range. | 345 | are returned, which are completely included in the range. |
345 | */ | 346 | */ |
346 | virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, | 347 | virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, |
347 | bool inclusive = false ) = 0; | 348 | bool inclusive = false ) = 0; |
348 | 349 | ||
349 | Incidence *mNextAlarmIncidence; | 350 | Incidence *mNextAlarmIncidence; |
350 | Incidence *mUndoIncidence; | 351 | Incidence *mUndoIncidence; |
351 | int mDefaultCalendar; | 352 | int mDefaultCalendar; |
352 | bool mDeleteIncidencesOnClose; | 353 | bool mDeleteIncidencesOnClose; |
353 | 354 | ||
354 | private: | 355 | private: |
355 | void init(); | 356 | void init(); |
356 | 357 | ||
357 | QString mOwner; // who the calendar belongs to | 358 | QString mOwner; // who the calendar belongs to |
358 | QString mOwnerEmail; // email address of the owner | 359 | QString mOwnerEmail; // email address of the owner |
359 | int mTimeZone; // timezone OFFSET from GMT (MINUTES) | 360 | int mTimeZone; // timezone OFFSET from GMT (MINUTES) |
360 | bool mLocalTime; // use local time, not UTC or a time zone | 361 | bool mLocalTime; // use local time, not UTC or a time zone |
361 | 362 | ||
362 | 363 | ||
363 | CalFilter *mFilter; | 364 | CalFilter *mFilter; |
364 | CalFilter *mDefaultFilter; | 365 | CalFilter *mDefaultFilter; |
365 | 366 | ||
366 | 367 | ||
367 | QString mTimeZoneId; | 368 | QString mTimeZoneId; |
368 | 369 | ||
369 | Observer *mObserver; | 370 | Observer *mObserver; |
370 | bool mNewObserver; | 371 | bool mNewObserver; |
371 | 372 | ||
372 | bool mModified; | 373 | bool mModified; |
373 | 374 | ||
374 | QString mLoadedProductId; | 375 | QString mLoadedProductId; |
375 | 376 | ||
376 | // This list is used to put together related todos | 377 | // This list is used to put together related todos |
377 | QDict<Incidence> mOrphans; | 378 | QDict<Incidence> mOrphans; |
378 | QDict<Incidence> mOrphanUids; | 379 | QDict<Incidence> mOrphanUids; |
379 | }; | 380 | }; |
380 | 381 | ||
381 | } | 382 | } |
382 | 383 | ||
383 | #endif | 384 | #endif |