author | zautrix <zautrix> | 2005-07-30 14:43:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-30 14:43:57 (UTC) |
commit | 9ca2cd947f22d33543e065f54c6487e86d80befa (patch) (unidiff) | |
tree | 549192e9e27e8972e2b48cf40e1599118df12da5 /libkcal/incidence.h | |
parent | 055928e26613f4ab249bd82be86890ed278372f6 (diff) | |
download | kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.zip kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.tar.gz kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.tar.bz2 |
fixxx
-rw-r--r-- | libkcal/incidence.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index 88df217..eef9e64 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -21,192 +21,193 @@ | |||
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 | ||
36 | namespace KCal { | 36 | namespace KCal { |
37 | 37 | ||
38 | class Event; | 38 | class Event; |
39 | class Todo; | 39 | class Todo; |
40 | class Journal; | 40 | class 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 | */ |
45 | class Incidence : public IncidenceBase | 45 | class 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 | void addRelationsToList(QPtrList<Incidence> *rel); | 116 | void addRelationsToList(QPtrList<Incidence> *rel); |
117 | void clearRelations(); | ||
117 | virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0; | 118 | virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0; |
118 | void setReadOnly( bool ); | 119 | void setReadOnly( bool ); |
119 | 120 | ||
120 | /** | 121 | /** |
121 | Recreate event. The event is made a new unique event, but already stored | 122 | Recreate event. The event is made a new unique event, but already stored |
122 | event information is preserved. Sets uniquie id, creation date, last | 123 | event information is preserved. Sets uniquie id, creation date, last |
123 | modification date and revision number. | 124 | modification date and revision number. |
124 | */ | 125 | */ |
125 | void recreate(); | 126 | void recreate(); |
126 | Incidence* recreateCloneException(QDate); | 127 | Incidence* recreateCloneException(QDate); |
127 | 128 | ||
128 | /** set creation date */ | 129 | /** set creation date */ |
129 | void setCreated(QDateTime); | 130 | void setCreated(QDateTime); |
130 | /** return time and date of creation. */ | 131 | /** return time and date of creation. */ |
131 | QDateTime created() const; | 132 | QDateTime created() const; |
132 | 133 | ||
133 | /** set the number of revisions this event has seen */ | 134 | /** set the number of revisions this event has seen */ |
134 | void setRevision(int rev); | 135 | void setRevision(int rev); |
135 | /** return the number of revisions this event has seen */ | 136 | /** return the number of revisions this event has seen */ |
136 | int revision() const; | 137 | int revision() const; |
137 | 138 | ||
138 | /** Set starting date/time. */ | 139 | /** Set starting date/time. */ |
139 | virtual void setDtStart(const QDateTime &dtStart); | 140 | virtual void setDtStart(const QDateTime &dtStart); |
140 | /** Return the incidence's ending date/time as a QDateTime. */ | 141 | /** Return the incidence's ending date/time as a QDateTime. */ |
141 | virtual QDateTime dtEnd() const { return QDateTime(); } | 142 | virtual QDateTime dtEnd() const { return QDateTime(); } |
142 | 143 | ||
143 | /** sets the event's lengthy description. */ | 144 | /** sets the event's lengthy description. */ |
144 | void setDescription(const QString &description); | 145 | void setDescription(const QString &description); |
145 | /** returns a reference to the event's description. */ | 146 | /** returns a reference to the event's description. */ |
146 | QString description() const; | 147 | QString description() const; |
147 | 148 | ||
148 | /** sets the event's short summary. */ | 149 | /** sets the event's short summary. */ |
149 | void setSummary(const QString &summary); | 150 | void setSummary(const QString &summary); |
150 | /** returns a reference to the event's summary. */ | 151 | /** returns a reference to the event's summary. */ |
151 | QString summary() const; | 152 | QString summary() const; |
152 | 153 | ||
153 | /** set event's applicable categories */ | 154 | /** set event's applicable categories */ |
154 | void setCategories(const QStringList &categories, bool setForRelations = false); | 155 | void setCategories(const QStringList &categories, bool setForRelations = false); |
155 | void addCategories(const QStringList &categories, bool addToRelations = false); | 156 | void addCategories(const QStringList &categories, bool addToRelations = false); |
156 | /** set event's categories based on a comma delimited string */ | 157 | /** set event's categories based on a comma delimited string */ |
157 | void setCategories(const QString &catStr); | 158 | void setCategories(const QString &catStr); |
158 | /** return categories in a list */ | 159 | /** return categories in a list */ |
159 | QStringList categories() const; | 160 | QStringList categories() const; |
160 | QStringList* categoriesP(); | 161 | QStringList* categoriesP(); |
161 | /** return categories as a comma separated string */ | 162 | /** return categories as a comma separated string */ |
162 | QString categoriesStr(); | 163 | QString categoriesStr(); |
163 | QString categoriesStrWithSpace(); | 164 | QString categoriesStrWithSpace(); |
164 | 165 | ||
165 | /** point at some other event to which the event relates. This function should | 166 | /** point at some other event to which the event relates. 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 | void setRelatedToUid(const QString &); | 169 | void setRelatedToUid(const QString &); |
169 | /** what event does this one relate to? This function should | 170 | /** what event does this one relate to? This function should |
170 | * only be used when constructing a calendar before the related Event | 171 | * only be used when constructing a calendar before the related Event |
171 | * exists. */ | 172 | * exists. */ |
172 | QString relatedToUid() const; | 173 | QString relatedToUid() const; |
173 | /** point at some other event to which the event relates */ | 174 | /** point at some other event to which the event relates */ |
174 | void setRelatedTo(Incidence *relatedTo); | 175 | void setRelatedTo(Incidence *relatedTo); |
175 | /** what event does this one relate to? */ | 176 | /** what event does this one relate to? */ |
176 | Incidence *relatedTo() const; | 177 | Incidence *relatedTo() const; |
177 | /** All events that are related to this event */ | 178 | /** All events that are related to this event */ |
178 | QPtrList<Incidence> relations() const; | 179 | QPtrList<Incidence> relations() const; |
179 | /** Add an event which is related to this event */ | 180 | /** Add an event which is related to this event */ |
180 | void addRelation(Incidence *); | 181 | void addRelation(Incidence *); |
181 | /** Remove event that is related to this event */ | 182 | /** Remove event that is related to this event */ |
182 | void removeRelation(Incidence *); | 183 | void removeRelation(Incidence *); |
183 | 184 | ||
184 | /** returns the list of dates which are exceptions to the recurrence rule */ | 185 | /** returns the list of dates which are exceptions to the recurrence rule */ |
185 | DateList exDates() const; | 186 | DateList exDates() const; |
186 | /** sets the list of dates which are exceptions to the recurrence rule */ | 187 | /** sets the list of dates which are exceptions to the recurrence rule */ |
187 | void setExDates(const DateList &_exDates); | 188 | void setExDates(const DateList &_exDates); |
188 | void setExDates(const char *dates); | 189 | void setExDates(const char *dates); |
189 | /** Add a date to the list of exceptions of the recurrence rule. */ | 190 | /** Add a date to the list of exceptions of the recurrence rule. */ |
190 | void addExDate(const QDate &date); | 191 | void addExDate(const QDate &date); |
191 | 192 | ||
192 | /** returns true if there is an exception for this date in the recurrence | 193 | /** returns true if there is an exception for this date in the recurrence |
193 | rule set, or false otherwise. */ | 194 | rule set, or false otherwise. */ |
194 | bool isException(const QDate &qd) const; | 195 | bool isException(const QDate &qd) const; |
195 | 196 | ||
196 | /** add attachment to this event */ | 197 | /** add attachment to this event */ |
197 | void addAttachment(Attachment *attachment); | 198 | void addAttachment(Attachment *attachment); |
198 | /** remove and delete a specific attachment */ | 199 | /** remove and delete a specific attachment */ |
199 | void deleteAttachment(Attachment *attachment); | 200 | void deleteAttachment(Attachment *attachment); |
200 | /** remove and delete all attachments with this mime type */ | 201 | /** remove and delete all attachments with this mime type */ |
201 | void deleteAttachments(const QString& mime); | 202 | void deleteAttachments(const QString& mime); |
202 | /** return list of all associated attachments */ | 203 | /** return list of all associated attachments */ |
203 | QPtrList<Attachment> attachments() const; | 204 | QPtrList<Attachment> attachments() const; |
204 | /** find a list of attachments with this mime type */ | 205 | /** find a list of attachments with this mime type */ |
205 | QPtrList<Attachment> attachments(const QString& mime) const; | 206 | QPtrList<Attachment> attachments(const QString& mime) const; |
206 | 207 | ||
207 | /** sets the event's status the value specified. See the enumeration | 208 | /** sets the event's status the value specified. See the enumeration |
208 | * above for possible values. */ | 209 | * above for possible values. */ |
209 | void setSecrecy(int); | 210 | void setSecrecy(int); |
210 | /** return the event's secrecy. */ | 211 | /** return the event's secrecy. */ |
211 | int secrecy() const; | 212 | int secrecy() const; |
212 | /** return the event's secrecy in string format. */ | 213 | /** return the event's secrecy in string format. */ |