summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendar.cpp16
-rw-r--r--libkcal/calendar.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index a3977d7..eeb5f48 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -203,96 +203,112 @@ void Calendar::setLocalTime()
203 203
204 setModified( true ); 204 setModified( true );
205} 205}
206 206
207bool Calendar::isLocalTime() const 207bool Calendar::isLocalTime() const
208{ 208{
209 return mLocalTime; 209 return mLocalTime;
210} 210}
211 211
212const QString &Calendar::getEmail() 212const QString &Calendar::getEmail()
213{ 213{
214 return mOwnerEmail; 214 return mOwnerEmail;
215} 215}
216 216
217void Calendar::setEmail(const QString &e) 217void Calendar::setEmail(const QString &e)
218{ 218{
219 mOwnerEmail = e; 219 mOwnerEmail = e;
220 220
221 setModified( true ); 221 setModified( true );
222} 222}
223 223
224void Calendar::setFilter(CalFilter *filter) 224void Calendar::setFilter(CalFilter *filter)
225{ 225{
226 mFilter = filter; 226 mFilter = filter;
227} 227}
228 228
229CalFilter *Calendar::filter() 229CalFilter *Calendar::filter()
230{ 230{
231 return mFilter; 231 return mFilter;
232} 232}
233 233
234QPtrList<Incidence> Calendar::incidences() 234QPtrList<Incidence> Calendar::incidences()
235{ 235{
236 QPtrList<Incidence> incidences; 236 QPtrList<Incidence> incidences;
237 237
238 Incidence *i; 238 Incidence *i;
239 239
240 QPtrList<Event> e = events(); 240 QPtrList<Event> e = events();
241 for( i = e.first(); i; i = e.next() ) incidences.append( i ); 241 for( i = e.first(); i; i = e.next() ) incidences.append( i );
242 242
243 QPtrList<Todo> t = todos(); 243 QPtrList<Todo> t = todos();
244 for( i = t.first(); i; i = t.next() ) incidences.append( i ); 244 for( i = t.first(); i; i = t.next() ) incidences.append( i );
245 245
246 QPtrList<Journal> j = journals(); 246 QPtrList<Journal> j = journals();
247 for( i = j.first(); i; i = j.next() ) incidences.append( i ); 247 for( i = j.first(); i; i = j.next() ) incidences.append( i );
248 248
249 return incidences; 249 return incidences;
250} 250}
251
252void Calendar::resetPilotStat()
253{
254 QPtrList<Incidence> incidences;
255
256 Incidence *i;
257
258 QPtrList<Event> e = rawEvents();
259 for( i = e.first(); i; i = e.next() ) i->setPilotId( 0 );
260
261 QPtrList<Todo> t = rawTodos();
262 for( i = t.first(); i; i = t.next() ) i->setPilotId( 0 );
263
264 QPtrList<Journal> j = journals();
265 for( i = j.first(); i; i = j.next() ) i->setPilotId( 0 );
266}
251void Calendar::resetTempSyncStat() 267void Calendar::resetTempSyncStat()
252{ 268{
253 QPtrList<Incidence> incidences; 269 QPtrList<Incidence> incidences;
254 270
255 Incidence *i; 271 Incidence *i;
256 272
257 QPtrList<Event> e = rawEvents(); 273 QPtrList<Event> e = rawEvents();
258 for( i = e.first(); i; i = e.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 274 for( i = e.first(); i; i = e.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
259 275
260 QPtrList<Todo> t = rawTodos(); 276 QPtrList<Todo> t = rawTodos();
261 for( i = t.first(); i; i = t.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 277 for( i = t.first(); i; i = t.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
262 278
263 QPtrList<Journal> j = journals(); 279 QPtrList<Journal> j = journals();
264 for( i = j.first(); i; i = j.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 280 for( i = j.first(); i; i = j.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
265} 281}
266QPtrList<Incidence> Calendar::rawIncidences() 282QPtrList<Incidence> Calendar::rawIncidences()
267{ 283{
268 QPtrList<Incidence> incidences; 284 QPtrList<Incidence> incidences;
269 285
270 Incidence *i; 286 Incidence *i;
271 287
272 QPtrList<Event> e = rawEvents(); 288 QPtrList<Event> e = rawEvents();
273 for( i = e.first(); i; i = e.next() ) incidences.append( i ); 289 for( i = e.first(); i; i = e.next() ) incidences.append( i );
274 290
275 QPtrList<Todo> t = rawTodos(); 291 QPtrList<Todo> t = rawTodos();
276 for( i = t.first(); i; i = t.next() ) incidences.append( i ); 292 for( i = t.first(); i; i = t.next() ) incidences.append( i );
277 293
278 QPtrList<Journal> j = journals(); 294 QPtrList<Journal> j = journals();
279 for( i = j.first(); i; i = j.next() ) incidences.append( i ); 295 for( i = j.first(); i; i = j.next() ) incidences.append( i );
280 296
281 return incidences; 297 return incidences;
282} 298}
283 299
284QPtrList<Event> Calendar::events( const QDate &date, bool sorted ) 300QPtrList<Event> Calendar::events( const QDate &date, bool sorted )
285{ 301{
286 QPtrList<Event> el = rawEventsForDate(date,sorted); 302 QPtrList<Event> el = rawEventsForDate(date,sorted);
287 mFilter->apply(&el); 303 mFilter->apply(&el);
288 return el; 304 return el;
289} 305}
290 306
291QPtrList<Event> Calendar::events( const QDateTime &qdt ) 307QPtrList<Event> Calendar::events( const QDateTime &qdt )
292{ 308{
293 QPtrList<Event> el = rawEventsForDate(qdt); 309 QPtrList<Event> el = rawEventsForDate(qdt);
294 mFilter->apply(&el); 310 mFilter->apply(&el);
295 return el; 311 return el;
296} 312}
297 313
298QPtrList<Event> Calendar::events( const QDate &start, const QDate &end, 314QPtrList<Event> Calendar::events( const QDate &start, const QDate &end,
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index c45d81f..d5294eb 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -22,96 +22,97 @@
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 void deleteIncidence(Incidence *in); 68 void deleteIncidence(Incidence *in);
69 void resetTempSyncStat(); 69 void resetTempSyncStat();
70 void resetPilotStat();
70 /** 71 /**
71 Clears out the current calendar, freeing all used memory etc. 72 Clears out the current calendar, freeing all used memory etc.
72 */ 73 */
73 virtual void close() = 0; 74 virtual void close() = 0;
74 75
75 /** 76 /**
76 Sync changes in memory to persistant storage. 77 Sync changes in memory to persistant storage.
77 */ 78 */
78 virtual void save() = 0; 79 virtual void save() = 0;
79 virtual QPtrList<Event> getExternLastSyncEvents() = 0; 80 virtual QPtrList<Event> getExternLastSyncEvents() = 0;
80 virtual bool isSaving() { return false; } 81 virtual bool isSaving() { return false; }
81 82
82 /** 83 /**
83 Return the owner of the calendar's full name. 84 Return the owner of the calendar's full name.
84 */ 85 */
85 const QString &getOwner() const; 86 const QString &getOwner() const;
86 /** 87 /**
87 Set the owner of the calendar. Should be owner's full name. 88 Set the owner of the calendar. Should be owner's full name.
88 */ 89 */
89 void setOwner( const QString &os ); 90 void setOwner( const QString &os );
90 /** 91 /**
91 Return the email address of the calendar owner. 92 Return the email address of the calendar owner.
92 */ 93 */
93 const QString &getEmail(); 94 const QString &getEmail();
94 /** 95 /**
95 Set the email address of the calendar owner. 96 Set the email address of the calendar owner.
96 */ 97 */
97 void setEmail( const QString & ); 98 void setEmail( const QString & );
98 99
99 /** 100 /**
100 Set time zone from a timezone string (e.g. -2:00) 101 Set time zone from a timezone string (e.g. -2:00)
101 */ 102 */
102 void setTimeZone( const QString &tz ); 103 void setTimeZone( const QString &tz );
103 /** 104 /**
104 Set time zone from a minutes value (e.g. -60) 105 Set time zone from a minutes value (e.g. -60)
105 */ 106 */
106 void setTimeZone( int tz ); 107 void setTimeZone( int tz );
107 /** 108 /**
108 Return time zone as offest in minutes. 109 Return time zone as offest in minutes.
109 */ 110 */
110 int getTimeZone() const; 111 int getTimeZone() const;
111 /** 112 /**
112 Compute an ISO 8601 format string from the time zone. 113 Compute an ISO 8601 format string from the time zone.
113 */ 114 */
114 QString getTimeZoneStr() const; 115 QString getTimeZoneStr() const;
115 /** 116 /**
116 Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal 117 Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal
117 values). 118 values).