summaryrefslogtreecommitdiffabout
path: root/libkcal/incidence.h
Unidiff
Diffstat (limited to 'libkcal/incidence.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidence.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index f8da342..60070a2 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -1,242 +1,243 @@
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 116
116 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const = 0; 117 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const = 0;
117 void setReadOnly( bool ); 118 void setReadOnly( bool );
118 119
119 /** 120 /**
120 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
121 event information is preserved. Sets uniquie id, creation date, last 122 event information is preserved. Sets uniquie id, creation date, last
122 modification date and revision number. 123 modification date and revision number.
123 */ 124 */
124 void recreate(); 125 void recreate();
125 Incidence* recreateCloneException(QDate); 126 Incidence* recreateCloneException(QDate);
126 127
127 /** set creation date */ 128 /** set creation date */
128 void setCreated(QDateTime); 129 void setCreated(QDateTime);
129 /** return time and date of creation. */ 130 /** return time and date of creation. */
130 QDateTime created() const; 131 QDateTime created() const;
131 132
132 /** set the number of revisions this event has seen */ 133 /** set the number of revisions this event has seen */
133 void setRevision(int rev); 134 void setRevision(int rev);
134 /** return the number of revisions this event has seen */ 135 /** return the number of revisions this event has seen */
135 int revision() const; 136 int revision() const;
136 137
137 /** Set starting date/time. */ 138 /** Set starting date/time. */
138 virtual void setDtStart(const QDateTime &dtStart); 139 virtual void setDtStart(const QDateTime &dtStart);
139 /** Return the incidence's ending date/time as a QDateTime. */ 140 /** Return the incidence's ending date/time as a QDateTime. */
140 virtual QDateTime dtEnd() const { return QDateTime(); } 141 virtual QDateTime dtEnd() const { return QDateTime(); }
141 142
142 /** sets the event's lengthy description. */ 143 /** sets the event's lengthy description. */
143 void setDescription(const QString &description); 144 void setDescription(const QString &description);
144 /** returns a reference to the event's description. */ 145 /** returns a reference to the event's description. */
145 QString description() const; 146 QString description() const;
146 147
147 /** sets the event's short summary. */ 148 /** sets the event's short summary. */
148 void setSummary(const QString &summary); 149 void setSummary(const QString &summary);
149 /** returns a reference to the event's summary. */ 150 /** returns a reference to the event's summary. */
150 QString summary() const; 151 QString summary() const;
151 152
152 /** set event's applicable categories */ 153 /** set event's applicable categories */
153 void setCategories(const QStringList &categories); 154 void setCategories(const QStringList &categories);
154 /** set event's categories based on a comma delimited string */ 155 /** set event's categories based on a comma delimited string */
155 void setCategories(const QString &catStr); 156 void setCategories(const QString &catStr);
156 /** return categories in a list */ 157 /** return categories in a list */
157 QStringList categories() const; 158 QStringList categories() const;
158 /** return categories as a comma separated string */ 159 /** return categories as a comma separated string */
159 QString categoriesStr(); 160 QString categoriesStr();
160 161
161 /** point at some other event to which the event relates. This function should 162 /** point at some other event to which the event relates. This function should
162 * only be used when constructing a calendar before the related Event 163 * only be used when constructing a calendar before the related Event
163 * exists. */ 164 * exists. */
164 void setRelatedToUid(const QString &); 165 void setRelatedToUid(const QString &);
165 /** what event does this one relate to? This function should 166 /** what event does this one relate to? This function should
166 * only be used when constructing a calendar before the related Event 167 * only be used when constructing a calendar before the related Event
167 * exists. */ 168 * exists. */
168 QString relatedToUid() const; 169 QString relatedToUid() const;
169 /** point at some other event to which the event relates */ 170 /** point at some other event to which the event relates */
170 void setRelatedTo(Incidence *relatedTo); 171 void setRelatedTo(Incidence *relatedTo);
171 /** what event does this one relate to? */ 172 /** what event does this one relate to? */
172 Incidence *relatedTo() const; 173 Incidence *relatedTo() const;
173 /** All events that are related to this event */ 174 /** All events that are related to this event */
174 QPtrList<Incidence> relations() const; 175 QPtrList<Incidence> relations() const;
175 /** Add an event which is related to this event */ 176 /** Add an event which is related to this event */
176 void addRelation(Incidence *); 177 void addRelation(Incidence *);
177 /** Remove event that is related to this event */ 178 /** Remove event that is related to this event */
178 void removeRelation(Incidence *); 179 void removeRelation(Incidence *);
179 180
180 /** returns the list of dates which are exceptions to the recurrence rule */ 181 /** returns the list of dates which are exceptions to the recurrence rule */
181 DateList exDates() const; 182 DateList exDates() const;
182 /** sets the list of dates which are exceptions to the recurrence rule */ 183 /** sets the list of dates which are exceptions to the recurrence rule */
183 void setExDates(const DateList &_exDates); 184 void setExDates(const DateList &_exDates);
184 void setExDates(const char *dates); 185 void setExDates(const char *dates);
185 /** Add a date to the list of exceptions of the recurrence rule. */ 186 /** Add a date to the list of exceptions of the recurrence rule. */
186 void addExDate(const QDate &date); 187 void addExDate(const QDate &date);
187 188
188 /** returns true if there is an exception for this date in the recurrence 189 /** returns true if there is an exception for this date in the recurrence
189 rule set, or false otherwise. */ 190 rule set, or false otherwise. */
190 bool isException(const QDate &qd) const; 191 bool isException(const QDate &qd) const;
191 192
192 /** add attachment to this event */ 193 /** add attachment to this event */
193 void addAttachment(Attachment *attachment); 194 void addAttachment(Attachment *attachment);
194 /** remove and delete a specific attachment */ 195 /** remove and delete a specific attachment */
195 void deleteAttachment(Attachment *attachment); 196 void deleteAttachment(Attachment *attachment);
196 /** remove and delete all attachments with this mime type */ 197 /** remove and delete all attachments with this mime type */
197 void deleteAttachments(const QString& mime); 198 void deleteAttachments(const QString& mime);
198 /** return list of all associated attachments */ 199 /** return list of all associated attachments */
199 QPtrList<Attachment> attachments() const; 200 QPtrList<Attachment> attachments() const;
200 /** find a list of attachments with this mime type */ 201 /** find a list of attachments with this mime type */
201 QPtrList<Attachment> attachments(const QString& mime) const; 202 QPtrList<Attachment> attachments(const QString& mime) const;
202 203
203 /** sets the event's status the value specified. See the enumeration 204 /** sets the event's status the value specified. See the enumeration
204 * above for possible values. */ 205 * above for possible values. */
205 void setSecrecy(int); 206 void setSecrecy(int);
206 /** return the event's secrecy. */ 207 /** return the event's secrecy. */
207 int secrecy() const; 208 int secrecy() const;
208 /** return the event's secrecy in string format. */ 209 /** return the event's secrecy in string format. */
209 QString secrecyStr() const; 210 QString secrecyStr() const;
210 /** return list of all availbale secrecy classes */ 211 /** return list of all availbale secrecy classes */
211 static QStringList secrecyList(); 212 static QStringList secrecyList();
212 /** return human-readable name of secrecy class */ 213 /** return human-readable name of secrecy class */
213 static QString secrecyName(int); 214 static QString secrecyName(int);
214 215
215 /** returns TRUE if the date specified is one on which the event will 216 /** returns TRUE if the date specified is one on which the event will
216 * recur. */ 217 * recur. */
217 bool recursOn(const QDate &qd) const; 218 bool recursOn(const QDate &qd) const;
218 219
219 // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): 220 // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?):
220 221
221 /** set resources used, such as Office, Car, etc. */ 222 /** set resources used, such as Office, Car, etc. */
222 void setResources(const QStringList &resources); 223 void setResources(const QStringList &resources);
223 /** return list of current resources */ 224 /** return list of current resources */
224 QStringList resources() const; 225 QStringList resources() const;
225 226
226 /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ 227 /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */
227 void setPriority(int priority); 228 void setPriority(int priority);
228 /** get the event's priority */ 229 /** get the event's priority */
229 int priority() const; 230 int priority() const;
230 231
231 /** All alarms that are associated with this incidence */ 232 /** All alarms that are associated with this incidence */
232 QPtrList<Alarm> alarms() const; 233 QPtrList<Alarm> alarms() const;
233 /** Create a new alarm which is associated with this incidence */ 234 /** Create a new alarm which is associated with this incidence */
234 Alarm* newAlarm(); 235 Alarm* newAlarm();
235 /** Add an alarm which is associated with this incidence */ 236 /** Add an alarm which is associated with this incidence */
236 void addAlarm(Alarm*); 237 void addAlarm(Alarm*);
237 /** Remove an alarm that is associated with this incidence */ 238 /** Remove an alarm that is associated with this incidence */
238 void removeAlarm(Alarm*); 239 void removeAlarm(Alarm*);
239 /** Remove all alarms that are associated with this incidence */ 240 /** Remove all alarms that are associated with this incidence */
240 void clearAlarms(); 241 void clearAlarms();
241 /** return whether any alarm associated with this incidence is enabled */ 242 /** return whether any alarm associated with this incidence is enabled */
242 bool isAlarmEnabled() const; 243 bool isAlarmEnabled() const;