summaryrefslogtreecommitdiffabout
path: root/libkcal/calendar.h
authorzautrix <zautrix>2004-12-07 09:55:57 (UTC)
committer zautrix <zautrix>2004-12-07 09:55:57 (UTC)
commit17b25691f0332e648dd1d800e89ccf4e1da8955d (patch) (unidiff)
treeb7bc28e6c57c043fc49328a7ebd86e1b5cd0f17a /libkcal/calendar.h
parentdcd2bbbc8d3064b35f268a831c567feaafea5fd8 (diff)
downloadkdepimpi-17b25691f0332e648dd1d800e89ccf4e1da8955d.zip
kdepimpi-17b25691f0332e648dd1d800e89ccf4e1da8955d.tar.gz
kdepimpi-17b25691f0332e648dd1d800e89ccf4e1da8955d.tar.bz2
some kopi usebility fixes
Diffstat (limited to 'libkcal/calendar.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendar.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index b7d6a1f..2f2c3aa 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -20,96 +20,98 @@
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
39class KConfig; 39class KConfig;
40 40
41namespace KCal { 41namespace 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*/
60class Calendar : public QObject, public CustomProperties, 60class Calendar : public QObject, public CustomProperties,
61 public IncidenceBase::Observer 61 public IncidenceBase::Observer
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64public: 64public:
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; };
69 bool undoDeleteIncidence();
68 void deleteIncidence(Incidence *in); 70 void deleteIncidence(Incidence *in);
69 void resetTempSyncStat(); 71 void resetTempSyncStat();
70 void resetPilotStat(int id); 72 void resetPilotStat(int id);
71 /** 73 /**
72 Clears out the current calendar, freeing all used memory etc. 74 Clears out the current calendar, freeing all used memory etc.
73 */ 75 */
74 virtual void close() = 0; 76 virtual void close() = 0;
75 77
76 /** 78 /**
77 Sync changes in memory to persistant storage. 79 Sync changes in memory to persistant storage.
78 */ 80 */
79 virtual void save() = 0; 81 virtual void save() = 0;
80 virtual QPtrList<Event> getExternLastSyncEvents() = 0; 82 virtual QPtrList<Event> getExternLastSyncEvents() = 0;
81 virtual void removeSyncInfo( QString syncProfile) = 0; 83 virtual void removeSyncInfo( QString syncProfile) = 0;
82 virtual bool isSaving() { return false; } 84 virtual bool isSaving() { return false; }
83 85
84 /** 86 /**
85 Return the owner of the calendar's full name. 87 Return the owner of the calendar's full name.
86 */ 88 */
87 const QString &getOwner() const; 89 const QString &getOwner() const;
88 /** 90 /**
89 Set the owner of the calendar. Should be owner's full name. 91 Set the owner of the calendar. Should be owner's full name.
90 */ 92 */
91 void setOwner( const QString &os ); 93 void setOwner( const QString &os );
92 /** 94 /**
93 Return the email address of the calendar owner. 95 Return the email address of the calendar owner.
94 */ 96 */
95 const QString &getEmail(); 97 const QString &getEmail();
96 /** 98 /**
97 Set the email address of the calendar owner. 99 Set the email address of the calendar owner.
98 */ 100 */
99 void setEmail( const QString & ); 101 void setEmail( const QString & );
100 102
101 /** 103 /**
102 Set time zone from a timezone string (e.g. -2:00) 104 Set time zone from a timezone string (e.g. -2:00)
103 */ 105 */
104 void setTimeZone( const QString &tz ); 106 void setTimeZone( const QString &tz );
105 /** 107 /**
106 Set time zone from a minutes value (e.g. -60) 108 Set time zone from a minutes value (e.g. -60)
107 */ 109 */
108 void setTimeZone( int tz ); 110 void setTimeZone( int tz );
109 /** 111 /**
110 Return time zone as offest in minutes. 112 Return time zone as offest in minutes.
111 */ 113 */
112 int getTimeZone() const; 114 int getTimeZone() const;
113 /** 115 /**
114 Compute an ISO 8601 format string from the time zone. 116 Compute an ISO 8601 format string from the time zone.
115 */ 117 */
@@ -277,77 +279,78 @@ public:
277 */ 279 */
278 virtual Alarm::List alarms( const QDateTime &from, 280 virtual Alarm::List alarms( const QDateTime &from,
279 const QDateTime &to ) = 0; 281 const QDateTime &to ) = 0;
280 282
281 class Observer { 283 class Observer {
282 public: 284 public:
283 virtual void calendarModified( bool, Calendar * ) = 0; 285 virtual void calendarModified( bool, Calendar * ) = 0;
284 }; 286 };
285 287
286 void registerObserver( Observer * ); 288 void registerObserver( Observer * );
287 289
288 void setModified( bool ); 290 void setModified( bool );
289 291
290 /** 292 /**
291 Set product id returned by loadedProductId(). This function is only 293 Set product id returned by loadedProductId(). This function is only
292 useful for the calendar loading code. 294 useful for the calendar loading code.
293 */ 295 */
294 void setLoadedProductId( const QString & ); 296 void setLoadedProductId( const QString & );
295 /** 297 /**
296 Return product id taken from file that has been loaded. Returns 298 Return product id taken from file that has been loaded. Returns
297 QString::null, if no calendar has been loaded. 299 QString::null, if no calendar has been loaded.
298 */ 300 */
299 QString loadedProductId(); 301 QString loadedProductId();
300 302
301 signals: 303 signals:
302 void calendarChanged(); 304 void calendarChanged();
303 void calendarSaved(); 305 void calendarSaved();
304 void calendarLoaded(); 306 void calendarLoaded();
305 void addAlarm(const QDateTime &qdt, const QString &noti ); 307 void addAlarm(const QDateTime &qdt, const QString &noti );
306 void removeAlarm(const QDateTime &qdt, const QString &noti ); 308 void removeAlarm(const QDateTime &qdt, const QString &noti );
307 309
308 protected: 310 protected:
309 /** 311 /**
310 Get unfiltered events, which occur on the given date. 312 Get unfiltered events, which occur on the given date.
311 */ 313 */
312 virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0; 314 virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0;
313 /** 315 /**
314 Get unfiltered events, which occur on the given date. 316 Get unfiltered events, which occur on the given date.
315 */ 317 */
316 virtual QPtrList<Event> rawEventsForDate( const QDate &date, 318 virtual QPtrList<Event> rawEventsForDate( const QDate &date,
317 bool sorted = false ) = 0; 319 bool sorted = false ) = 0;
318 /** 320 /**
319 Get events in a range of dates. If inclusive is set to true, only events 321 Get events in a range of dates. If inclusive is set to true, only events
320 are returned, which are completely included in the range. 322 are returned, which are completely included in the range.
321 */ 323 */
322 virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, 324 virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
323 bool inclusive = false ) = 0; 325 bool inclusive = false ) = 0;
324 Incidence *mNextAlarmIncidence; 326 Incidence *mNextAlarmIncidence;
327 Incidence *mUndoIncidence;
325 328
326private: 329private:
327 void init(); 330 void init();
328 331
329 QString mOwner; // who the calendar belongs to 332 QString mOwner; // who the calendar belongs to
330 QString mOwnerEmail; // email address of the owner 333 QString mOwnerEmail; // email address of the owner
331 int mTimeZone; // timezone OFFSET from GMT (MINUTES) 334 int mTimeZone; // timezone OFFSET from GMT (MINUTES)
332 bool mLocalTime; // use local time, not UTC or a time zone 335 bool mLocalTime; // use local time, not UTC or a time zone
333 336
334 CalFilter *mFilter; 337 CalFilter *mFilter;
335 CalFilter *mDefaultFilter; 338 CalFilter *mDefaultFilter;
336 339
337 QString mTimeZoneId; 340 QString mTimeZoneId;
338 341
339 Observer *mObserver; 342 Observer *mObserver;
340 bool mNewObserver; 343 bool mNewObserver;
341 344
342 bool mModified; 345 bool mModified;
343 346
344 QString mLoadedProductId; 347 QString mLoadedProductId;
345 348
346 // This list is used to put together related todos 349 // This list is used to put together related todos
347 QDict<Incidence> mOrphans; 350 QDict<Incidence> mOrphans;
348 QDict<Incidence> mOrphanUids; 351 QDict<Incidence> mOrphanUids;
349}; 352};
350 353
351} 354}
352 355
353#endif 356#endif