summaryrefslogtreecommitdiffabout
path: root/libkcal/calendar.h
Unidiff
Diffstat (limited to 'libkcal/calendar.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendar.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index fbc40ad..5845f44 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -4,50 +4,50 @@
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 <q3ptrlist.h>
29#include <qdict.h> 29#include <q3dict.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
@@ -67,49 +67,49 @@ public:
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 , bool enabledOnly = false ,int * isDup = 0 ) = 0; 80 virtual Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates , bool enabledOnly = false ,int * isDup = 0 ) = 0;
81 virtual Todo* todoForUid( const QString& uid, bool doNotCheckDuplicates = true, bool enabledOnly = false ,int * isDup = 0) = 0; 81 virtual Todo* todoForUid( const QString& uid, bool doNotCheckDuplicates = true, bool enabledOnly = false ,int * isDup = 0) = 0;
82 virtual void setSyncEventsReadOnly() = 0; 82 virtual void setSyncEventsReadOnly() = 0;
83 virtual void setSyncEventsEnabled() = 0; 83 virtual void setSyncEventsEnabled() = 0;
84 virtual void stopAllTodos() = 0; 84 virtual void stopAllTodos() = 0;
85 virtual void clearUndo( Incidence * newUndo ); 85 virtual void clearUndo( Incidence * newUndo );
86 86
87 /** 87 /**
88 Sync changes in memory to persistant storage. 88 Sync changes in memory to persistant storage.
89 */ 89 */
90 virtual void save() = 0; 90 virtual void save() = 0;
91 virtual QPtrList<Event> getExternLastSyncEvents() = 0; 91 virtual Q3PtrList<Event> getExternLastSyncEvents() = 0;
92 virtual void removeSyncInfo( QString syncProfile) = 0; 92 virtual void removeSyncInfo( QString syncProfile) = 0;
93 virtual bool isSaving() { return false; } 93 virtual bool isSaving() { return false; }
94 94
95 /** 95 /**
96 Return the owner of the calendar's full name. 96 Return the owner of the calendar's full name.
97 */ 97 */
98 const QString &getOwner() const; 98 const QString &getOwner() const;
99 /** 99 /**
100 Set the owner of the calendar. Should be owner's full name. 100 Set the owner of the calendar. Should be owner's full name.
101 */ 101 */
102 void setOwner( const QString &os ); 102 void setOwner( const QString &os );
103 /** 103 /**
104 Return the email address of the calendar owner. 104 Return the email address of the calendar owner.
105 */ 105 */
106 const QString &getEmail(); 106 const QString &getEmail();
107 /** 107 /**
108 Set the email address of the calendar owner. 108 Set the email address of the calendar owner.
109 */ 109 */
110 void setEmail( const QString & ); 110 void setEmail( const QString & );
111 111
112 /** 112 /**
113 Set time zone from a timezone string (e.g. -2:00) 113 Set time zone from a timezone string (e.g. -2:00)
114 */ 114 */
115 void setTimeZone( const QString &tz ); 115 void setTimeZone( const QString &tz );
@@ -134,150 +134,150 @@ public:
134 Return time zone id. 134 Return time zone id.
135 */ 135 */
136 QString timeZoneId() const; 136 QString timeZoneId() const;
137 /** 137 /**
138 Use local time, not UTC or a time zone. 138 Use local time, not UTC or a time zone.
139 */ 139 */
140 void setLocalTime(); 140 void setLocalTime();
141 /** 141 /**
142 Return whether local time is being used. 142 Return whether local time is being used.
143 */ 143 */
144 bool isLocalTime() const; 144 bool isLocalTime() const;
145 145
146 /** 146 /**
147 Add an incidence to calendar. 147 Add an incidence to calendar.
148 148
149 @return true on success, false on error. 149 @return true on success, false on error.
150 */ 150 */
151 virtual bool addIncidence( Incidence * ); 151 virtual bool addIncidence( Incidence * );
152 152
153 // Adds an incidence and all relatedto incidences to the cal 153 // Adds an incidence and all relatedto incidences to the cal
154 void addIncidenceBranch( Incidence * ); 154 void addIncidenceBranch( Incidence * );
155 /** 155 /**
156 Return filtered list of all incidences of this calendar. 156 Return filtered list of all incidences of this calendar.
157 */ 157 */
158 virtual QPtrList<Incidence> incidences(); 158 virtual Q3PtrList<Incidence> incidences();
159 159
160 /** 160 /**
161 Return unfiltered list of all incidences of this calendar. 161 Return unfiltered list of all incidences of this calendar.
162 */ 162 */
163 virtual QPtrList<Incidence> rawIncidences(); 163 virtual Q3PtrList<Incidence> rawIncidences();
164 164
165 /** 165 /**
166 Adds a Event to this calendar object. 166 Adds a Event to this calendar object.
167 @param anEvent a pointer to the event to add 167 @param anEvent a pointer to the event to add
168 168
169 @return true on success, false on error. 169 @return true on success, false on error.
170 */ 170 */
171 virtual bool addEventNoDup( Event *event ) = 0; 171 virtual bool addEventNoDup( Event *event ) = 0;
172 virtual bool addAnniversaryNoDup( Event *event ) = 0; 172 virtual bool addAnniversaryNoDup( Event *event ) = 0;
173 virtual bool addEvent( Event *anEvent ) = 0; 173 virtual bool addEvent( Event *anEvent ) = 0;
174 /** 174 /**
175 Delete event from calendar. 175 Delete event from calendar.
176 */ 176 */
177 virtual void deleteEvent( Event * ) = 0; 177 virtual void deleteEvent( Event * ) = 0;
178 /** 178 /**
179 Retrieves an event on the basis of the unique string ID. 179 Retrieves an event on the basis of the unique string ID.
180 */ 180 */
181 virtual Event *event( const QString &UniqueStr ) = 0; 181 virtual Event *event( const QString &UniqueStr ) = 0;
182 virtual Event *event( QString, QString ) = 0; 182 virtual Event *event( QString, QString ) = 0;
183 /** 183 /**
184 Builds and then returns a list of all events that match for the 184 Builds and then returns a list of all events that match for the
185 date specified. useful for dayView, etc. etc. 185 date specified. useful for dayView, etc. etc.
186 The calendar filter is applied. 186 The calendar filter is applied.
187 */ 187 */
188 QPtrList<Event> events( const QDate &date, bool sorted = false); 188 Q3PtrList<Event> events( const QDate &date, bool sorted = false);
189 /** 189 /**
190 Get events, which occur on the given date. 190 Get events, which occur on the given date.
191 The calendar filter is applied. 191 The calendar filter is applied.
192 */ 192 */
193 QPtrList<Event> events( const QDateTime &qdt ); 193 Q3PtrList<Event> events( const QDateTime &qdt );
194 /** 194 /**
195 Get events in a range of dates. If inclusive is set to true, only events 195 Get events in a range of dates. If inclusive is set to true, only events
196 are returned, which are completely included in the range. 196 are returned, which are completely included in the range.
197 The calendar filter is applied. 197 The calendar filter is applied.
198 */ 198 */
199 QPtrList<Event> events( const QDate &start, const QDate &end, 199 Q3PtrList<Event> events( const QDate &start, const QDate &end,
200 bool inclusive = false); 200 bool inclusive = false);
201 /** 201 /**
202 Return filtered list of all events in calendar. 202 Return filtered list of all events in calendar.
203 */ 203 */
204 virtual QPtrList<Event> events(); 204 virtual Q3PtrList<Event> events();
205 /** 205 /**
206 Return unfiltered list of all events in calendar. 206 Return unfiltered list of all events in calendar.
207 */ 207 */
208 virtual QPtrList<Event> rawEvents() = 0; 208 virtual Q3PtrList<Event> rawEvents() = 0;
209 209
210 /** 210 /**
211 Add a todo to the todolist. 211 Add a todo to the todolist.
212 212
213 @return true on success, false on error. 213 @return true on success, false on error.
214 */ 214 */
215 virtual bool addTodo( Todo *todo ) = 0; 215 virtual bool addTodo( Todo *todo ) = 0;
216 virtual bool addTodoNoDup( Todo *todo ) = 0; 216 virtual bool addTodoNoDup( Todo *todo ) = 0;
217 /** 217 /**
218 Remove a todo from the todolist. 218 Remove a todo from the todolist.
219 */ 219 */
220 virtual void deleteTodo( Todo * ) = 0; 220 virtual void deleteTodo( Todo * ) = 0;
221 virtual void deleteJournal( Journal * ) = 0; 221 virtual void deleteJournal( Journal * ) = 0;
222 /** 222 /**
223 Return filterd list of todos. 223 Return filterd list of todos.
224 */ 224 */
225 virtual QPtrList<Todo> todos(); 225 virtual Q3PtrList<Todo> todos();
226 /** 226 /**
227 Searches todolist for an event with this unique string identifier, 227 Searches todolist for an event with this unique string identifier,
228 returns a pointer or null. 228 returns a pointer or null.
229 */ 229 */
230 virtual Todo *todo( const QString &uid ) = 0; 230 virtual Todo *todo( const QString &uid ) = 0;
231 virtual Todo *todo( QString, QString ) = 0; 231 virtual Todo *todo( QString, QString ) = 0;
232 /** 232 /**
233 Returns list of todos due on the specified date. 233 Returns list of todos due on the specified date.
234 */ 234 */
235 virtual QPtrList<Todo> todos( const QDate &date ) = 0; 235 virtual Q3PtrList<Todo> todos( const QDate &date ) = 0;
236 /** 236 /**
237 Return unfiltered list of todos. 237 Return unfiltered list of todos.
238 */ 238 */
239 virtual QPtrList<Todo> rawTodos() = 0; 239 virtual Q3PtrList<Todo> rawTodos() = 0;
240 240
241 /** 241 /**
242 Add a Journal entry to calendar. 242 Add a Journal entry to calendar.
243 243
244 @return true on success, false on error. 244 @return true on success, false on error.
245 */ 245 */
246 virtual bool addJournal( Journal * ) = 0; 246 virtual bool addJournal( Journal * ) = 0;
247 /** 247 /**
248 Return Journal for given date. 248 Return Journal for given date.
249 */ 249 */
250 virtual Journal *journal( const QDate & ) = 0; 250 virtual Journal *journal( const QDate & ) = 0;
251 virtual QPtrList<Journal> journals4Date( const QDate & ) = 0; 251 virtual Q3PtrList<Journal> journals4Date( const QDate & ) = 0;
252 /** 252 /**
253 Return Journal with given UID. 253 Return Journal with given UID.
254 */ 254 */
255 virtual Journal *journal( const QString &UID ) = 0; 255 virtual Journal *journal( const QString &UID ) = 0;
256 /** 256 /**
257 Return list of all Journal entries. 257 Return list of all Journal entries.
258 */ 258 */
259 virtual QPtrList<Journal> journals() = 0; 259 virtual Q3PtrList<Journal> journals() = 0;
260 260
261 /** 261 /**
262 Searches all incidence types for an incidence with this unique 262 Searches all incidence types for an incidence with this unique
263 string identifier, returns a pointer or null. 263 string identifier, returns a pointer or null.
264 */ 264 */
265 Incidence* incidence( const QString&UID ); 265 Incidence* incidence( const QString&UID );
266 266
267 /** 267 /**
268 Setup relations for an incidence. 268 Setup relations for an incidence.
269 */ 269 */
270 virtual void setupRelations( Incidence * ); 270 virtual void setupRelations( Incidence * );
271 /** 271 /**
272 Remove all relations to an incidence 272 Remove all relations to an incidence
273 */ 273 */
274 virtual void removeRelations( Incidence * ); 274 virtual void removeRelations( Incidence * );
275 275
276 /** 276 /**
277 Set calendar filter, which filters events for the events() functions. 277 Set calendar filter, which filters events for the events() functions.
278 The Filter object is owned by the caller. 278 The Filter object is owned by the caller.
279 */ 279 */
280 void setFilter( CalFilter * ); 280 void setFilter( CalFilter * );
281 /** 281 /**
282 Return calendar filter. 282 Return calendar filter.
283 */ 283 */
@@ -314,72 +314,72 @@ public:
314 QString loadedProductId(); 314 QString loadedProductId();
315 int defaultCalendar(); 315 int defaultCalendar();
316 void setDontDeleteIncidencesOnClose (); 316 void setDontDeleteIncidencesOnClose ();
317 public slots: 317 public slots:
318 void setDefaultCalendar( int ); 318 void setDefaultCalendar( int );
319 virtual void setCalendarEnabled( int id, bool enable ) = 0; 319 virtual void setCalendarEnabled( int id, bool enable ) = 0;
320 virtual void setAllCalendarEnabled( bool enable ) = 0; 320 virtual void setAllCalendarEnabled( bool enable ) = 0;
321 virtual void setAlarmEnabled( int id, bool enable ) = 0; 321 virtual void setAlarmEnabled( int id, bool enable ) = 0;
322 virtual void setReadOnly( int id, bool enable ) = 0; 322 virtual void setReadOnly( int id, bool enable ) = 0;
323 virtual void setDefaultCalendarEnabledOnly() = 0; 323 virtual void setDefaultCalendarEnabledOnly() = 0;
324 virtual void setCalendarRemove( int id ) = 0; 324 virtual void setCalendarRemove( int id ) = 0;
325 virtual void getIncidenceCount( int calId, int& events, int & todos, int & journals) = 0; 325 virtual void getIncidenceCount( int calId, int& events, int & todos, int & journals) = 0;
326 326
327 signals: 327 signals:
328 void calendarChanged(); 328 void calendarChanged();
329 void calendarSaved(); 329 void calendarSaved();
330 void calendarLoaded(); 330 void calendarLoaded();
331 void addAlarm(const QDateTime &qdt, const QString &noti ); 331 void addAlarm(const QDateTime &qdt, const QString &noti );
332 void removeAlarm(const QDateTime &qdt, const QString &noti ); 332 void removeAlarm(const QDateTime &qdt, const QString &noti );
333 333
334 protected: 334 protected:
335 /** 335 /**
336 Get unfiltered events, which occur on the given date. 336 Get unfiltered events, which occur on the given date.
337 */ 337 */
338 virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0; 338 virtual Q3PtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0;
339 /** 339 /**
340 Get unfiltered events, which occur on the given date. 340 Get unfiltered events, which occur on the given date.
341 */ 341 */
342 virtual QPtrList<Event> rawEventsForDate( const QDate &date, 342 virtual Q3PtrList<Event> rawEventsForDate( const QDate &date,
343 bool sorted = false ) = 0; 343 bool sorted = false ) = 0;
344 /** 344 /**
345 Get events in a range of dates. If inclusive is set to true, only events 345 Get events in a range of dates. If inclusive is set to true, only events
346 are returned, which are completely included in the range. 346 are returned, which are completely included in the range.
347 */ 347 */
348 virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, 348 virtual Q3PtrList<Event> rawEvents( const QDate &start, const QDate &end,
349 bool inclusive = false ) = 0; 349 bool inclusive = false ) = 0;
350 350
351 Incidence *mNextAlarmIncidence; 351 Incidence *mNextAlarmIncidence;
352 Incidence *mUndoIncidence; 352 Incidence *mUndoIncidence;
353 int mDefaultCalendar; 353 int mDefaultCalendar;
354 bool mDeleteIncidencesOnClose; 354 bool mDeleteIncidencesOnClose;
355 355
356private: 356private:
357 void init(); 357 void init();
358 358
359 QString mOwner; // who the calendar belongs to 359 QString mOwner; // who the calendar belongs to
360 QString mOwnerEmail; // email address of the owner 360 QString mOwnerEmail; // email address of the owner
361 int mTimeZone; // timezone OFFSET from GMT (MINUTES) 361 int mTimeZone; // timezone OFFSET from GMT (MINUTES)
362 bool mLocalTime; // use local time, not UTC or a time zone 362 bool mLocalTime; // use local time, not UTC or a time zone
363 363
364 364
365 CalFilter *mFilter; 365 CalFilter *mFilter;
366 CalFilter *mDefaultFilter; 366 CalFilter *mDefaultFilter;
367 367
368 368
369 QString mTimeZoneId; 369 QString mTimeZoneId;
370 370
371 Observer *mObserver; 371 Observer *mObserver;
372 bool mNewObserver; 372 bool mNewObserver;
373 373
374 bool mModified; 374 bool mModified;
375 375
376 QString mLoadedProductId; 376 QString mLoadedProductId;
377 377
378 // This list is used to put together related todos 378 // This list is used to put together related todos
379 QDict<Incidence> mOrphans; 379 Q3Dict<Incidence> mOrphans;
380 QDict<Incidence> mOrphanUids; 380 Q3Dict<Incidence> mOrphanUids;
381}; 381};
382 382
383} 383}
384 384
385#endif 385#endif