-rw-r--r-- | libkcal/calendar.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 4c6760f..73f82bb 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -53,48 +53,50 @@ namespace KCal { | |||
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; | ||
78 | virtual bool addCalendarFile( QString name, int id ) = 0; | ||
77 | 79 | ||
78 | /** | 80 | /** |
79 | Sync changes in memory to persistant storage. | 81 | Sync changes in memory to persistant storage. |
80 | */ | 82 | */ |
81 | virtual void save() = 0; | 83 | virtual void save() = 0; |
82 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; | 84 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; |
83 | virtual void removeSyncInfo( QString syncProfile) = 0; | 85 | virtual void removeSyncInfo( QString syncProfile) = 0; |
84 | virtual bool isSaving() { return false; } | 86 | virtual bool isSaving() { return false; } |
85 | 87 | ||
86 | /** | 88 | /** |
87 | Return the owner of the calendar's full name. | 89 | Return the owner of the calendar's full name. |
88 | */ | 90 | */ |
89 | const QString &getOwner() const; | 91 | const QString &getOwner() const; |
90 | /** | 92 | /** |
91 | Set the owner of the calendar. Should be owner's full name. | 93 | Set the owner of the calendar. Should be owner's full name. |
92 | */ | 94 | */ |
93 | void setOwner( const QString &os ); | 95 | void setOwner( const QString &os ); |
94 | /** | 96 | /** |
95 | Return the email address of the calendar owner. | 97 | Return the email address of the calendar owner. |
96 | */ | 98 | */ |
97 | const QString &getEmail(); | 99 | const QString &getEmail(); |
98 | /** | 100 | /** |
99 | Set the email address of the calendar owner. | 101 | Set the email address of the calendar owner. |
100 | */ | 102 | */ |
@@ -281,86 +283,91 @@ public: | |||
281 | Return all alarms, which ocur in the given time interval. | 283 | Return all alarms, which ocur in the given time interval. |
282 | */ | 284 | */ |
283 | virtual Alarm::List alarms( const QDateTime &from, | 285 | virtual Alarm::List alarms( const QDateTime &from, |
284 | const QDateTime &to ) = 0; | 286 | const QDateTime &to ) = 0; |
285 | 287 | ||
286 | class Observer { | 288 | class Observer { |
287 | public: | 289 | public: |
288 | virtual void calendarModified( bool, Calendar * ) = 0; | 290 | virtual void calendarModified( bool, Calendar * ) = 0; |
289 | }; | 291 | }; |
290 | 292 | ||
291 | void registerObserver( Observer * ); | 293 | void registerObserver( Observer * ); |
292 | 294 | ||
293 | void setModified( bool ); | 295 | void setModified( bool ); |
294 | 296 | ||
295 | /** | 297 | /** |
296 | Set product id returned by loadedProductId(). This function is only | 298 | Set product id returned by loadedProductId(). This function is only |
297 | useful for the calendar loading code. | 299 | useful for the calendar loading code. |
298 | */ | 300 | */ |
299 | void setLoadedProductId( const QString & ); | 301 | void setLoadedProductId( const QString & ); |
300 | /** | 302 | /** |
301 | Return product id taken from file that has been loaded. Returns | 303 | Return product id taken from file that has been loaded. Returns |
302 | QString::null, if no calendar has been loaded. | 304 | QString::null, if no calendar has been loaded. |
303 | */ | 305 | */ |
304 | QString loadedProductId(); | 306 | QString loadedProductId(); |
305 | void setDefaultCalendar( int ); | ||
306 | int defaultCalendar(); | 307 | int defaultCalendar(); |
308 | void setDontDeleteIncidencesOnClose (); | ||
309 | public slots: | ||
310 | void setDefaultCalendar( int ); | ||
307 | virtual void setCalendarEnabled( int id, bool enable ) = 0; | 311 | virtual void setCalendarEnabled( int id, bool enable ) = 0; |
308 | virtual void setAlarmEnabled( int id, bool enable ) = 0; | 312 | virtual void setAlarmEnabled( int id, bool enable ) = 0; |
313 | virtual void setReadOnly( int id, bool enable ) = 0; | ||
309 | virtual void setDefaultCalendarEnabledOnly() = 0; | 314 | virtual void setDefaultCalendarEnabledOnly() = 0; |
310 | signals: | 315 | signals: |
311 | void calendarChanged(); | 316 | void calendarChanged(); |
312 | void calendarSaved(); | 317 | void calendarSaved(); |
313 | void calendarLoaded(); | 318 | void calendarLoaded(); |
314 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 319 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
315 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 320 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
316 | 321 | ||
317 | protected: | 322 | protected: |
318 | /** | 323 | /** |
319 | Get unfiltered events, which occur on the given date. | 324 | Get unfiltered events, which occur on the given date. |
320 | */ | 325 | */ |
321 | virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0; | 326 | virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0; |
322 | /** | 327 | /** |
323 | Get unfiltered events, which occur on the given date. | 328 | Get unfiltered events, which occur on the given date. |
324 | */ | 329 | */ |
325 | virtual QPtrList<Event> rawEventsForDate( const QDate &date, | 330 | virtual QPtrList<Event> rawEventsForDate( const QDate &date, |
326 | bool sorted = false ) = 0; | 331 | bool sorted = false ) = 0; |
327 | /** | 332 | /** |
328 | Get events in a range of dates. If inclusive is set to true, only events | 333 | Get events in a range of dates. If inclusive is set to true, only events |
329 | are returned, which are completely included in the range. | 334 | are returned, which are completely included in the range. |
330 | */ | 335 | */ |
331 | virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, | 336 | virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, |
332 | bool inclusive = false ) = 0; | 337 | bool inclusive = false ) = 0; |
333 | 338 | ||
334 | Incidence *mNextAlarmIncidence; | 339 | Incidence *mNextAlarmIncidence; |
335 | Incidence *mUndoIncidence; | 340 | Incidence *mUndoIncidence; |
336 | int mDefaultCalendar; | 341 | int mDefaultCalendar; |
342 | bool mDeleteIncidencesOnClose; | ||
337 | 343 | ||
338 | private: | 344 | private: |
339 | void init(); | 345 | void init(); |
340 | 346 | ||
341 | QString mOwner; // who the calendar belongs to | 347 | QString mOwner; // who the calendar belongs to |
342 | QString mOwnerEmail; // email address of the owner | 348 | QString mOwnerEmail; // email address of the owner |
343 | int mTimeZone; // timezone OFFSET from GMT (MINUTES) | 349 | int mTimeZone; // timezone OFFSET from GMT (MINUTES) |
344 | bool mLocalTime; // use local time, not UTC or a time zone | 350 | bool mLocalTime; // use local time, not UTC or a time zone |
345 | 351 | ||
352 | |||
346 | CalFilter *mFilter; | 353 | CalFilter *mFilter; |
347 | CalFilter *mDefaultFilter; | 354 | CalFilter *mDefaultFilter; |
348 | 355 | ||
349 | 356 | ||
350 | QString mTimeZoneId; | 357 | QString mTimeZoneId; |
351 | 358 | ||
352 | Observer *mObserver; | 359 | Observer *mObserver; |
353 | bool mNewObserver; | 360 | bool mNewObserver; |
354 | 361 | ||
355 | bool mModified; | 362 | bool mModified; |
356 | 363 | ||
357 | QString mLoadedProductId; | 364 | QString mLoadedProductId; |
358 | 365 | ||
359 | // This list is used to put together related todos | 366 | // This list is used to put together related todos |
360 | QDict<Incidence> mOrphans; | 367 | QDict<Incidence> mOrphans; |
361 | QDict<Incidence> mOrphanUids; | 368 | QDict<Incidence> mOrphanUids; |
362 | }; | 369 | }; |
363 | 370 | ||
364 | } | 371 | } |
365 | 372 | ||
366 | #endif | 373 | #endif |