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