summaryrefslogtreecommitdiffabout
path: root/libkcal/incidence.h
authorzautrix <zautrix>2005-06-03 23:10:45 (UTC)
committer zautrix <zautrix>2005-06-03 23:10:45 (UTC)
commit858b047efb5627824438cb3877e7bec0cebb3751 (patch) (unidiff)
tree7b36963344d4f5019f3a1ecb5eb9290f27c3b3c7 /libkcal/incidence.h
parent0207d193bdb6c66201562a17e68872e018ec223c (diff)
downloadkdepimpi-858b047efb5627824438cb3877e7bec0cebb3751.zip
kdepimpi-858b047efb5627824438cb3877e7bec0cebb3751.tar.gz
kdepimpi-858b047efb5627824438cb3877e7bec0cebb3751.tar.bz2
fixxx
Diffstat (limited to 'libkcal/incidence.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidence.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index ebd50d0..aa51e84 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -1,317 +1,317 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef INCIDENCE_H 20#ifndef INCIDENCE_H
21#define INCIDENCE_H 21#define INCIDENCE_H
22// 22//
23// Incidence - base class of calendaring components 23// Incidence - base class of calendaring components
24// 24//
25 25
26#include <qdatetime.h> 26#include <qdatetime.h>
27#include <qstringlist.h> 27#include <qstringlist.h>
28#include <qvaluelist.h> 28#include <qvaluelist.h>
29 29
30#include "recurrence.h" 30#include "recurrence.h"
31#include "alarm.h" 31#include "alarm.h"
32#include "attachment.h" 32#include "attachment.h"
33#include "listbase.h" 33#include "listbase.h"
34#include "incidencebase.h" 34#include "incidencebase.h"
35 35
36namespace KCal { 36namespace KCal {
37 37
38class Event; 38class Event;
39class Todo; 39class Todo;
40class Journal; 40class Journal;
41 41
42/** 42/**
43 This class provides the base class common to all calendar components. 43 This class provides the base class common to all calendar components.
44*/ 44*/
45class Incidence : public IncidenceBase 45class Incidence : public IncidenceBase
46{ 46{
47 public: 47 public:
48 /** 48 /**
49 This class provides the interface for a visitor of calendar components. It 49 This class provides the interface for a visitor of calendar components. It
50 serves as base class for concrete visitors, which implement certain actions on 50 serves as base class for concrete visitors, which implement certain actions on
51 calendar components. It allows to add functions, which operate on the concrete 51 calendar components. It allows to add functions, which operate on the concrete
52 types of calendar components, without changing the calendar component classes. 52 types of calendar components, without changing the calendar component classes.
53 */ 53 */
54 class Visitor 54 class Visitor
55 { 55 {
56 public: 56 public:
57 /** Destruct Incidence::Visitor */ 57 /** Destruct Incidence::Visitor */
58 virtual ~Visitor() {} 58 virtual ~Visitor() {}
59 59
60 /** 60 /**
61 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions 61 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions
62 on an Event object. 62 on an Event object.
63 */ 63 */
64 virtual bool visit(Event *) { return false; } 64 virtual bool visit(Event *) { return false; }
65 /** 65 /**
66 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions 66 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions
67 on an Todo object. 67 on an Todo object.
68 */ 68 */
69 virtual bool visit(Todo *) { return false; } 69 virtual bool visit(Todo *) { return false; }
70 /** 70 /**
71 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions 71 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions
72 on an Journal object. 72 on an Journal object.
73 */ 73 */
74 virtual bool visit(Journal *) { return false; } 74 virtual bool visit(Journal *) { return false; }
75 75
76 protected: 76 protected:
77 /** Constructor is protected to prevent direct creation of visitor base class. */ 77 /** Constructor is protected to prevent direct creation of visitor base class. */
78 Visitor() {} 78 Visitor() {}
79 }; 79 };
80 80
81 /** 81 /**
82 This class implements a visitor for adding an Incidence to a resource 82 This class implements a visitor for adding an Incidence to a resource
83 supporting addEvent(), addTodo() and addJournal() calls. 83 supporting addEvent(), addTodo() and addJournal() calls.
84 */ 84 */
85 template<class T> 85 template<class T>
86 class AddVisitor : public Visitor 86 class AddVisitor : public Visitor
87 { 87 {
88 public: 88 public:
89 AddVisitor( T *r ) : mResource( r ) {} 89 AddVisitor( T *r ) : mResource( r ) {}
90 bool visit( Event *e ) { return mResource->addEvent( e ); } 90 bool visit( Event *e ) { return mResource->addEvent( e ); }
91 bool visit( Todo *t ) { return mResource->addTodo( t ); } 91 bool visit( Todo *t ) { return mResource->addTodo( t ); }
92 bool visit( Journal *j ) { return mResource->addJournal( j ); } 92 bool visit( Journal *j ) { return mResource->addJournal( j ); }
93 93
94 private: 94 private:
95 T *mResource; 95 T *mResource;
96 }; 96 };
97 97
98 /** enumeration for describing an event's secrecy. */ 98 /** enumeration for describing an event's secrecy. */
99 enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 }; 99 enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 };
100 typedef ListBase<Incidence> List; 100 typedef ListBase<Incidence> List;
101 Incidence(); 101 Incidence();
102 Incidence(const Incidence &); 102 Incidence(const Incidence &);
103 ~Incidence(); 103 ~Incidence();
104 104
105 /** 105 /**
106 Accept IncidenceVisitor. A class taking part in the visitor mechanism has to 106 Accept IncidenceVisitor. A class taking part in the visitor mechanism has to
107 provide this implementation: 107 provide this implementation:
108 <pre> 108 <pre>
109 bool accept(Visitor &v) { return v.visit(this); } 109 bool accept(Visitor &v) { return v.visit(this); }
110 </pre> 110 </pre>
111 */ 111 */
112 virtual bool accept(Visitor &) { return false; } 112 virtual bool accept(Visitor &) { return false; }
113 113
114 virtual Incidence *clone() = 0; 114 virtual Incidence *clone() = 0;
115 virtual void cloneRelations( Incidence * ); 115 virtual void cloneRelations( Incidence * );
116 116
117 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const = 0; 117 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0;
118 void setReadOnly( bool ); 118 void setReadOnly( bool );
119 119
120 /** 120 /**
121 Recreate event. The event is made a new unique event, but already stored 121 Recreate event. The event is made a new unique event, but already stored
122 event information is preserved. Sets uniquie id, creation date, last 122 event information is preserved. Sets uniquie id, creation date, last
123 modification date and revision number. 123 modification date and revision number.
124 */ 124 */
125 void recreate(); 125 void recreate();
126 Incidence* recreateCloneException(QDate); 126 Incidence* recreateCloneException(QDate);
127 127
128 /** set creation date */ 128 /** set creation date */
129 void setCreated(QDateTime); 129 void setCreated(QDateTime);
130 /** return time and date of creation. */ 130 /** return time and date of creation. */
131 QDateTime created() const; 131 QDateTime created() const;
132 132
133 /** set the number of revisions this event has seen */ 133 /** set the number of revisions this event has seen */
134 void setRevision(int rev); 134 void setRevision(int rev);
135 /** return the number of revisions this event has seen */ 135 /** return the number of revisions this event has seen */
136 int revision() const; 136 int revision() const;
137 137
138 /** Set starting date/time. */ 138 /** Set starting date/time. */
139 virtual void setDtStart(const QDateTime &dtStart); 139 virtual void setDtStart(const QDateTime &dtStart);
140 /** Return the incidence's ending date/time as a QDateTime. */ 140 /** Return the incidence's ending date/time as a QDateTime. */
141 virtual QDateTime dtEnd() const { return QDateTime(); } 141 virtual QDateTime dtEnd() const { return QDateTime(); }
142 142
143 /** sets the event's lengthy description. */ 143 /** sets the event's lengthy description. */
144 void setDescription(const QString &description); 144 void setDescription(const QString &description);
145 /** returns a reference to the event's description. */ 145 /** returns a reference to the event's description. */
146 QString description() const; 146 QString description() const;
147 147
148 /** sets the event's short summary. */ 148 /** sets the event's short summary. */
149 void setSummary(const QString &summary); 149 void setSummary(const QString &summary);
150 /** returns a reference to the event's summary. */ 150 /** returns a reference to the event's summary. */
151 QString summary() const; 151 QString summary() const;
152 152
153 /** set event's applicable categories */ 153 /** set event's applicable categories */
154 void setCategories(const QStringList &categories, bool setForRelations = false); 154 void setCategories(const QStringList &categories, bool setForRelations = false);
155 void addCategories(const QStringList &categories, bool addToRelations = false); 155 void addCategories(const QStringList &categories, bool addToRelations = false);
156 /** set event's categories based on a comma delimited string */ 156 /** set event's categories based on a comma delimited string */
157 void setCategories(const QString &catStr); 157 void setCategories(const QString &catStr);
158 /** return categories in a list */ 158 /** return categories in a list */
159 QStringList categories() const; 159 QStringList categories() const;
160 /** return categories as a comma separated string */ 160 /** return categories as a comma separated string */
161 QString categoriesStr(); 161 QString categoriesStr();
162 QString categoriesStrWithSpace(); 162 QString categoriesStrWithSpace();
163 163
164 /** point at some other event to which the event relates. This function should 164 /** point at some other event to which the event relates. This function should
165 * only be used when constructing a calendar before the related Event 165 * only be used when constructing a calendar before the related Event
166 * exists. */ 166 * exists. */
167 void setRelatedToUid(const QString &); 167 void setRelatedToUid(const QString &);
168 /** what event does this one relate to? This function should 168 /** what event does this one relate to? This function should
169 * only be used when constructing a calendar before the related Event 169 * only be used when constructing a calendar before the related Event
170 * exists. */ 170 * exists. */
171 QString relatedToUid() const; 171 QString relatedToUid() const;
172 /** point at some other event to which the event relates */ 172 /** point at some other event to which the event relates */
173 void setRelatedTo(Incidence *relatedTo); 173 void setRelatedTo(Incidence *relatedTo);
174 /** what event does this one relate to? */ 174 /** what event does this one relate to? */
175 Incidence *relatedTo() const; 175 Incidence *relatedTo() const;
176 /** All events that are related to this event */ 176 /** All events that are related to this event */
177 QPtrList<Incidence> relations() const; 177 QPtrList<Incidence> relations() const;
178 /** Add an event which is related to this event */ 178 /** Add an event which is related to this event */
179 void addRelation(Incidence *); 179 void addRelation(Incidence *);
180 /** Remove event that is related to this event */ 180 /** Remove event that is related to this event */
181 void removeRelation(Incidence *); 181 void removeRelation(Incidence *);
182 182
183 /** returns the list of dates which are exceptions to the recurrence rule */ 183 /** returns the list of dates which are exceptions to the recurrence rule */
184 DateList exDates() const; 184 DateList exDates() const;
185 /** sets the list of dates which are exceptions to the recurrence rule */ 185 /** sets the list of dates which are exceptions to the recurrence rule */
186 void setExDates(const DateList &_exDates); 186 void setExDates(const DateList &_exDates);
187 void setExDates(const char *dates); 187 void setExDates(const char *dates);
188 /** Add a date to the list of exceptions of the recurrence rule. */ 188 /** Add a date to the list of exceptions of the recurrence rule. */
189 void addExDate(const QDate &date); 189 void addExDate(const QDate &date);
190 190
191 /** returns true if there is an exception for this date in the recurrence 191 /** returns true if there is an exception for this date in the recurrence
192 rule set, or false otherwise. */ 192 rule set, or false otherwise. */
193 bool isException(const QDate &qd) const; 193 bool isException(const QDate &qd) const;
194 194
195 /** add attachment to this event */ 195 /** add attachment to this event */
196 void addAttachment(Attachment *attachment); 196 void addAttachment(Attachment *attachment);
197 /** remove and delete a specific attachment */ 197 /** remove and delete a specific attachment */
198 void deleteAttachment(Attachment *attachment); 198 void deleteAttachment(Attachment *attachment);
199 /** remove and delete all attachments with this mime type */ 199 /** remove and delete all attachments with this mime type */
200 void deleteAttachments(const QString& mime); 200 void deleteAttachments(const QString& mime);
201 /** return list of all associated attachments */ 201 /** return list of all associated attachments */
202 QPtrList<Attachment> attachments() const; 202 QPtrList<Attachment> attachments() const;
203 /** find a list of attachments with this mime type */ 203 /** find a list of attachments with this mime type */
204 QPtrList<Attachment> attachments(const QString& mime) const; 204 QPtrList<Attachment> attachments(const QString& mime) const;
205 205
206 /** sets the event's status the value specified. See the enumeration 206 /** sets the event's status the value specified. See the enumeration
207 * above for possible values. */ 207 * above for possible values. */
208 void setSecrecy(int); 208 void setSecrecy(int);
209 /** return the event's secrecy. */ 209 /** return the event's secrecy. */
210 int secrecy() const; 210 int secrecy() const;
211 /** return the event's secrecy in string format. */ 211 /** return the event's secrecy in string format. */
212 QString secrecyStr() const; 212 QString secrecyStr() const;
213 /** return list of all availbale secrecy classes */ 213 /** return list of all availbale secrecy classes */
214 static QStringList secrecyList(); 214 static QStringList secrecyList();
215 /** return human-readable name of secrecy class */ 215 /** return human-readable name of secrecy class */
216 static QString secrecyName(int); 216 static QString secrecyName(int);
217 217
218 /** returns TRUE if the date specified is one on which the event will 218 /** returns TRUE if the date specified is one on which the event will
219 * recur. */ 219 * recur. */
220 bool recursOn(const QDate &qd) const; 220 bool recursOn(const QDate &qd) const;
221 221
222 // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): 222 // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?):
223 223
224 /** set resources used, such as Office, Car, etc. */ 224 /** set resources used, such as Office, Car, etc. */
225 void setResources(const QStringList &resources); 225 void setResources(const QStringList &resources);
226 /** return list of current resources */ 226 /** return list of current resources */
227 QStringList resources() const; 227 QStringList resources() const;
228 228
229 /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ 229 /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */
230 void setPriority(int priority); 230 void setPriority(int priority);
231 /** get the event's priority */ 231 /** get the event's priority */
232 int priority() const; 232 int priority() const;
233 233
234 /** All alarms that are associated with this incidence */ 234 /** All alarms that are associated with this incidence */
235 QPtrList<Alarm> alarms() const; 235 QPtrList<Alarm> alarms() const;
236 /** Create a new alarm which is associated with this incidence */ 236 /** Create a new alarm which is associated with this incidence */
237 Alarm* newAlarm(); 237 Alarm* newAlarm();
238 /** Add an alarm which is associated with this incidence */ 238 /** Add an alarm which is associated with this incidence */
239 void addAlarm(Alarm*); 239 void addAlarm(Alarm*);
240 /** Remove an alarm that is associated with this incidence */ 240 /** Remove an alarm that is associated with this incidence */
241 void removeAlarm(Alarm*); 241 void removeAlarm(Alarm*);
242 /** Remove all alarms that are associated with this incidence */ 242 /** Remove all alarms that are associated with this incidence */
243 void clearAlarms(); 243 void clearAlarms();
244 /** return whether any alarm associated with this incidence is enabled */ 244 /** return whether any alarm associated with this incidence is enabled */
245 bool isAlarmEnabled() const; 245 bool isAlarmEnabled() const;
246 246
247 /** 247 /**
248 Return the recurrence rule associated with this incidence. If there is 248 Return the recurrence rule associated with this incidence. If there is
249 none, returns an appropriate (non-0) object. 249 none, returns an appropriate (non-0) object.
250 */ 250 */
251 Recurrence *recurrence() const; 251 Recurrence *recurrence() const;
252 void setRecurrence(Recurrence * r); 252 void setRecurrence(Recurrence * r);
253 /** 253 /**
254 Forward to Recurrence::doesRecur(). 254 Forward to Recurrence::doesRecur().
255 */ 255 */
256 ushort doesRecur() const; 256 ushort doesRecur() const;
257 257
258 /** set the event's/todo's location. Do _not_ use it with journal */ 258 /** set the event's/todo's location. Do _not_ use it with journal */
259 void setLocation(const QString &location); 259 void setLocation(const QString &location);
260 /** return the event's/todo's location. Do _not_ use it with journal */ 260 /** return the event's/todo's location. Do _not_ use it with journal */
261 QString location() const; 261 QString location() const;
262 /** returns TRUE or FALSE depending on whether the todo has a start date */ 262 /** returns TRUE or FALSE depending on whether the todo has a start date */
263 bool hasStartDate() const; 263 bool hasStartDate() const;
264 /** sets the event's hasStartDate value. */ 264 /** sets the event's hasStartDate value. */
265 void setHasStartDate(bool f); 265 void setHasStartDate(bool f);
266 QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; 266 QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const;
267 bool cancelled() const; 267 bool cancelled() const;
268 void setCancelled( bool b ); 268 void setCancelled( bool b );
269 269
270 bool hasRecurrenceID() const; 270 bool hasRecurrenceID() const;
271 void setHasRecurrenceID( bool b ); 271 void setHasRecurrenceID( bool b );
272 272
273 void setRecurrenceID(QDateTime); 273 void setRecurrenceID(QDateTime);
274 QDateTime recurrenceID () const; 274 QDateTime recurrenceID () const;
275 QDateTime dtStart() const; 275 QDateTime dtStart() const;
276 bool isHoliday() const; 276 bool isHoliday() const;
277 bool isBirthday() const; 277 bool isBirthday() const;
278 bool isAnniversary() const; 278 bool isAnniversary() const;
279 279
280 280
281protected: 281protected:
282 QPtrList<Alarm> mAlarms; 282 QPtrList<Alarm> mAlarms;
283 QPtrList<Incidence> mRelations; 283 QPtrList<Incidence> mRelations;
284 QDateTime mRecurrenceID; 284 QDateTime mRecurrenceID;
285 bool mHasRecurrenceID; 285 bool mHasRecurrenceID;
286 private: 286 private:
287 void checkCategories(); 287 void checkCategories();
288 bool mHoliday, mBirthday, mAnniversary; 288 bool mHoliday, mBirthday, mAnniversary;
289 int mRevision; 289 int mRevision;
290 bool mCancelled; 290 bool mCancelled;
291 291
292 // base components of jounal, event and todo 292 // base components of jounal, event and todo
293 QDateTime mCreated; 293 QDateTime mCreated;
294 QString mDescription; 294 QString mDescription;
295 QString mSummary; 295 QString mSummary;
296 QStringList mCategories; 296 QStringList mCategories;
297 Incidence *mRelatedTo; 297 Incidence *mRelatedTo;
298 QString mRelatedToUid; 298 QString mRelatedToUid;
299 DateList mExDates; 299 DateList mExDates;
300 QPtrList<Attachment> mAttachments; 300 QPtrList<Attachment> mAttachments;
301 QStringList mResources; 301 QStringList mResources;
302 bool mHasStartDate; // if todo has associated start date 302 bool mHasStartDate; // if todo has associated start date
303 303
304 int mSecrecy; 304 int mSecrecy;
305 int mPriority; // 1 = highest, 2 = less, etc. 305 int mPriority; // 1 = highest, 2 = less, etc.
306 306
307 //QPtrList<Alarm> mAlarms; 307 //QPtrList<Alarm> mAlarms;
308 Recurrence *mRecurrence; 308 Recurrence *mRecurrence;
309 309
310 QString mLocation; 310 QString mLocation;
311}; 311};
312 312
313bool operator==( const Incidence&, const Incidence& ); 313bool operator==( const Incidence&, const Incidence& );
314 314
315} 315}
316 316
317#endif 317#endif