summaryrefslogtreecommitdiffabout
path: root/libkcal/calendar.h
Unidiff
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 3b7b183..2efa355 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -1,271 +1,272 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 1998 Preston Brown 3 Copyright (c) 1998 Preston Brown
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 <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; }; 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 81
81 /** 82 /**
82 Sync changes in memory to persistant storage. 83 Sync changes in memory to persistant storage.
83 */ 84 */
84 virtual void save() = 0; 85 virtual void save() = 0;
85 virtual QPtrList<Event> getExternLastSyncEvents() = 0; 86 virtual QPtrList<Event> getExternLastSyncEvents() = 0;
86 virtual void removeSyncInfo( QString syncProfile) = 0; 87 virtual void removeSyncInfo( QString syncProfile) = 0;
87 virtual bool isSaving() { return false; } 88 virtual bool isSaving() { return false; }
88 89
89 /** 90 /**
90 Return the owner of the calendar's full name. 91 Return the owner of the calendar's full name.
91 */ 92 */
92 const QString &getOwner() const; 93 const QString &getOwner() const;
93 /** 94 /**
94 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.
95 */ 96 */
96 void setOwner( const QString &os ); 97 void setOwner( const QString &os );
97 /** 98 /**
98 Return the email address of the calendar owner. 99 Return the email address of the calendar owner.
99 */ 100 */
100 const QString &getEmail(); 101 const QString &getEmail();
101 /** 102 /**
102 Set the email address of the calendar owner. 103 Set the email address of the calendar owner.
103 */ 104 */
104 void setEmail( const QString & ); 105 void setEmail( const QString & );
105 106
106 /** 107 /**
107 Set time zone from a timezone string (e.g. -2:00) 108 Set time zone from a timezone string (e.g. -2:00)
108 */ 109 */
109 void setTimeZone( const QString &tz ); 110 void setTimeZone( const QString &tz );
110 /** 111 /**
111 Set time zone from a minutes value (e.g. -60) 112 Set time zone from a minutes value (e.g. -60)
112 */ 113 */
113 void setTimeZone( int tz ); 114 void setTimeZone( int tz );
114 /** 115 /**
115 Return time zone as offest in minutes. 116 Return time zone as offest in minutes.
116 */ 117 */
117 int getTimeZone() const; 118 int getTimeZone() const;
118 /** 119 /**
119 Compute an ISO 8601 format string from the time zone. 120 Compute an ISO 8601 format string from the time zone.
120 */ 121 */
121 QString getTimeZoneStr() const; 122 QString getTimeZoneStr() const;
122 /** 123 /**
123 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
124 values). 125 values).
125 */ 126 */
126 void setTimeZoneId( const QString & ); 127 void setTimeZoneId( const QString & );
127 /** 128 /**
128 Return time zone id. 129 Return time zone id.
129 */ 130 */
130 QString timeZoneId() const; 131 QString timeZoneId() const;
131 /** 132 /**
132 Use local time, not UTC or a time zone. 133 Use local time, not UTC or a time zone.
133 */ 134 */
134 void setLocalTime(); 135 void setLocalTime();
135 /** 136 /**
136 Return whether local time is being used. 137 Return whether local time is being used.
137 */ 138 */
138 bool isLocalTime() const; 139 bool isLocalTime() const;
139 140
140 /** 141 /**
141 Add an incidence to calendar. 142 Add an incidence to calendar.
142 143
143 @return true on success, false on error. 144 @return true on success, false on error.
144 */ 145 */
145 virtual bool addIncidence( Incidence * ); 146 virtual bool addIncidence( Incidence * );
146 147
147 // Adds an incidence and all relatedto incidences to the cal 148 // Adds an incidence and all relatedto incidences to the cal
148 void addIncidenceBranch( Incidence * ); 149 void addIncidenceBranch( Incidence * );
149 /** 150 /**
150 Return filtered list of all incidences of this calendar. 151 Return filtered list of all incidences of this calendar.
151 */ 152 */
152 virtual QPtrList<Incidence> incidences(); 153 virtual QPtrList<Incidence> incidences();
153 154
154 /** 155 /**
155 Return unfiltered list of all incidences of this calendar. 156 Return unfiltered list of all incidences of this calendar.
156 */ 157 */
157 virtual QPtrList<Incidence> rawIncidences(); 158 virtual QPtrList<Incidence> rawIncidences();
158 159
159 /** 160 /**
160 Adds a Event to this calendar object. 161 Adds a Event to this calendar object.
161 @param anEvent a pointer to the event to add 162 @param anEvent a pointer to the event to add
162 163
163 @return true on success, false on error. 164 @return true on success, false on error.
164 */ 165 */
165 virtual bool addEventNoDup( Event *event ) = 0; 166 virtual bool addEventNoDup( Event *event ) = 0;
166 virtual bool addAnniversaryNoDup( Event *event ) = 0; 167 virtual bool addAnniversaryNoDup( Event *event ) = 0;
167 virtual bool addEvent( Event *anEvent ) = 0; 168 virtual bool addEvent( Event *anEvent ) = 0;
168 /** 169 /**
169 Delete event from calendar. 170 Delete event from calendar.
170 */ 171 */
171 virtual void deleteEvent( Event * ) = 0; 172 virtual void deleteEvent( Event * ) = 0;
172 /** 173 /**
173 Retrieves an event on the basis of the unique string ID. 174 Retrieves an event on the basis of the unique string ID.
174 */ 175 */
175 virtual Event *event( const QString &UniqueStr ) = 0; 176 virtual Event *event( const QString &UniqueStr ) = 0;
176 virtual Event *event( QString, QString ) = 0; 177 virtual Event *event( QString, QString ) = 0;
177 /** 178 /**
178 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
179 date specified. useful for dayView, etc. etc. 180 date specified. useful for dayView, etc. etc.
180 The calendar filter is applied. 181 The calendar filter is applied.
181 */ 182 */
182 QPtrList<Event> events( const QDate &date, bool sorted = false); 183 QPtrList<Event> events( const QDate &date, bool sorted = false);
183 /** 184 /**
184 Get events, which occur on the given date. 185 Get events, which occur on the given date.
185 The calendar filter is applied. 186 The calendar filter is applied.
186 */ 187 */
187 QPtrList<Event> events( const QDateTime &qdt ); 188 QPtrList<Event> events( const QDateTime &qdt );
188 /** 189 /**
189 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
190 are returned, which are completely included in the range. 191 are returned, which are completely included in the range.
191 The calendar filter is applied. 192 The calendar filter is applied.
192 */ 193 */
193 QPtrList<Event> events( const QDate &start, const QDate &end, 194 QPtrList<Event> events( const QDate &start, const QDate &end,
194 bool inclusive = false); 195 bool inclusive = false);
195 /** 196 /**
196 Return filtered list of all events in calendar. 197 Return filtered list of all events in calendar.
197 */ 198 */
198 virtual QPtrList<Event> events(); 199 virtual QPtrList<Event> events();
199 /** 200 /**
200 Return unfiltered list of all events in calendar. 201 Return unfiltered list of all events in calendar.
201 */ 202 */
202 virtual QPtrList<Event> rawEvents() = 0; 203 virtual QPtrList<Event> rawEvents() = 0;
203 204
204 /** 205 /**
205 Add a todo to the todolist. 206 Add a todo to the todolist.
206 207
207 @return true on success, false on error. 208 @return true on success, false on error.
208 */ 209 */
209 virtual bool addTodo( Todo *todo ) = 0; 210 virtual bool addTodo( Todo *todo ) = 0;
210 virtual bool addTodoNoDup( Todo *todo ) = 0; 211 virtual bool addTodoNoDup( Todo *todo ) = 0;
211 /** 212 /**
212 Remove a todo from the todolist. 213 Remove a todo from the todolist.
213 */ 214 */
214 virtual void deleteTodo( Todo * ) = 0; 215 virtual void deleteTodo( Todo * ) = 0;
215 virtual void deleteJournal( Journal * ) = 0; 216 virtual void deleteJournal( Journal * ) = 0;
216 /** 217 /**
217 Return filterd list of todos. 218 Return filterd list of todos.
218 */ 219 */
219 virtual QPtrList<Todo> todos(); 220 virtual QPtrList<Todo> todos();
220 /** 221 /**
221 Searches todolist for an event with this unique string identifier, 222 Searches todolist for an event with this unique string identifier,
222 returns a pointer or null. 223 returns a pointer or null.
223 */ 224 */
224 virtual Todo *todo( const QString &uid ) = 0; 225 virtual Todo *todo( const QString &uid ) = 0;
225 virtual Todo *todo( QString, QString ) = 0; 226 virtual Todo *todo( QString, QString ) = 0;
226 /** 227 /**
227 Returns list of todos due on the specified date. 228 Returns list of todos due on the specified date.
228 */ 229 */
229 virtual QPtrList<Todo> todos( const QDate &date ) = 0; 230 virtual QPtrList<Todo> todos( const QDate &date ) = 0;
230 /** 231 /**
231 Return unfiltered list of todos. 232 Return unfiltered list of todos.
232 */ 233 */
233 virtual QPtrList<Todo> rawTodos() = 0; 234 virtual QPtrList<Todo> rawTodos() = 0;
234 235
235 /** 236 /**
236 Add a Journal entry to calendar. 237 Add a Journal entry to calendar.
237 238
238 @return true on success, false on error. 239 @return true on success, false on error.
239 */ 240 */
240 virtual bool addJournal( Journal * ) = 0; 241 virtual bool addJournal( Journal * ) = 0;
241 /** 242 /**
242 Return Journal for given date. 243 Return Journal for given date.
243 */ 244 */
244 virtual Journal *journal( const QDate & ) = 0; 245 virtual Journal *journal( const QDate & ) = 0;
245 /** 246 /**
246 Return Journal with given UID. 247 Return Journal with given UID.
247 */ 248 */
248 virtual Journal *journal( const QString &UID ) = 0; 249 virtual Journal *journal( const QString &UID ) = 0;
249 /** 250 /**
250 Return list of all Journal entries. 251 Return list of all Journal entries.
251 */ 252 */
252 virtual QPtrList<Journal> journals() = 0; 253 virtual QPtrList<Journal> journals() = 0;
253 254
254 /** 255 /**
255 Searches all incidence types for an incidence with this unique 256 Searches all incidence types for an incidence with this unique
256 string identifier, returns a pointer or null. 257 string identifier, returns a pointer or null.
257 */ 258 */
258 Incidence* incidence( const QString&UID ); 259 Incidence* incidence( const QString&UID );
259 260
260 /** 261 /**
261 Setup relations for an incidence. 262 Setup relations for an incidence.
262 */ 263 */
263 virtual void setupRelations( Incidence * ); 264 virtual void setupRelations( Incidence * );
264 /** 265 /**
265 Remove all relations to an incidence 266 Remove all relations to an incidence
266 */ 267 */
267 virtual void removeRelations( Incidence * ); 268 virtual void removeRelations( Incidence * );
268 269
269 /** 270 /**
270 Set calendar filter, which filters events for the events() functions. 271 Set calendar filter, which filters events for the events() functions.
271 The Filter object is owned by the caller. 272 The Filter object is owned by the caller.