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