summaryrefslogtreecommitdiffabout
path: root/libkcal/calendar.h
authorzautrix <zautrix>2005-06-29 10:36:31 (UTC)
committer zautrix <zautrix>2005-06-29 10:36:31 (UTC)
commitb7044dfc9516d546683973985555c481d59fc677 (patch) (unidiff)
treeb521090cfc8eb6c8c6a6f6f8167c83058ea1361b /libkcal/calendar.h
parentf226b4cd2ce06a6948811fe04d80fe3ffa44f695 (diff)
downloadkdepimpi-b7044dfc9516d546683973985555c481d59fc677.zip
kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.gz
kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.bz2
journal fixxx
Diffstat (limited to 'libkcal/calendar.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendar.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 2efa355..4652fe5 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -54,323 +54,324 @@ namespace KCal {
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; }; 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 &noti ); 323 void addAlarm(const QDateTime &qdt, const QString &noti );
323 void removeAlarm(const QDateTime &qdt, const QString &noti ); 324 void removeAlarm(const QDateTime &qdt, const QString &noti );
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
347private: 348private:
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