author | zautrix <zautrix> | 2005-04-18 10:41:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-18 10:41:31 (UTC) |
commit | 409e329447a7d00a93a56855fcddadbb0f793163 (patch) (unidiff) | |
tree | 1c92498d2dfb4c89358c64a6944aca1300a27d11 /libkcal | |
parent | 0ff0dca7ccb94ebb1381351e4e4081fe0bac500a (diff) | |
download | kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.zip kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.tar.gz kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.tar.bz2 |
morefixes
-rw-r--r-- | libkcal/incidence.cpp | 28 | ||||
-rw-r--r-- | libkcal/incidence.h | 3 |
2 files changed, 29 insertions, 2 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 9c35b1d..762103f 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -1,718 +1,744 @@ | |||
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 | 20 | ||
21 | #include <kglobal.h> | 21 | #include <kglobal.h> |
22 | #include <klocale.h> | 22 | #include <klocale.h> |
23 | #include <kdebug.h> | 23 | #include <kdebug.h> |
24 | 24 | ||
25 | #include "calformat.h" | 25 | #include "calformat.h" |
26 | 26 | ||
27 | #include "incidence.h" | 27 | #include "incidence.h" |
28 | #include "todo.h" | 28 | #include "todo.h" |
29 | 29 | ||
30 | using namespace KCal; | 30 | using namespace KCal; |
31 | 31 | ||
32 | Incidence::Incidence() : | 32 | Incidence::Incidence() : |
33 | IncidenceBase(), | 33 | IncidenceBase(), |
34 | mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) | 34 | mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) |
35 | { | 35 | { |
36 | mRecurrence = new Recurrence(this); | 36 | mRecurrence = new Recurrence(this); |
37 | mCancelled = false; | 37 | mCancelled = false; |
38 | recreate(); | 38 | recreate(); |
39 | mHasStartDate = true; | 39 | mHasStartDate = true; |
40 | mAlarms.setAutoDelete(true); | 40 | mAlarms.setAutoDelete(true); |
41 | mAttachments.setAutoDelete(true); | 41 | mAttachments.setAutoDelete(true); |
42 | mHasRecurrenceID = false; | 42 | mHasRecurrenceID = false; |
43 | mHoliday = false; | 43 | mHoliday = false; |
44 | mBirthday = false; | 44 | mBirthday = false; |
45 | mAnniversary = false; | 45 | mAnniversary = false; |
46 | 46 | ||
47 | } | 47 | } |
48 | 48 | ||
49 | Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) | 49 | Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) |
50 | { | 50 | { |
51 | // TODO: reenable attributes currently commented out. | 51 | // TODO: reenable attributes currently commented out. |
52 | mRevision = i.mRevision; | 52 | mRevision = i.mRevision; |
53 | mCreated = i.mCreated; | 53 | mCreated = i.mCreated; |
54 | mDescription = i.mDescription; | 54 | mDescription = i.mDescription; |
55 | mSummary = i.mSummary; | 55 | mSummary = i.mSummary; |
56 | mCategories = i.mCategories; | 56 | mCategories = i.mCategories; |
57 | // Incidence *mRelatedTo; Incidence *mRelatedTo; | 57 | // Incidence *mRelatedTo; Incidence *mRelatedTo; |
58 | mRelatedTo = 0; | 58 | mRelatedTo = 0; |
59 | mRelatedToUid = i.mRelatedToUid; | 59 | mRelatedToUid = i.mRelatedToUid; |
60 | // QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations; | 60 | // QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations; |
61 | mExDates = i.mExDates; | 61 | mExDates = i.mExDates; |
62 | mAttachments = i.mAttachments; | 62 | mAttachments = i.mAttachments; |
63 | mResources = i.mResources; | 63 | mResources = i.mResources; |
64 | mSecrecy = i.mSecrecy; | 64 | mSecrecy = i.mSecrecy; |
65 | mPriority = i.mPriority; | 65 | mPriority = i.mPriority; |
66 | mLocation = i.mLocation; | 66 | mLocation = i.mLocation; |
67 | mCancelled = i.mCancelled; | 67 | mCancelled = i.mCancelled; |
68 | mHasStartDate = i.mHasStartDate; | 68 | mHasStartDate = i.mHasStartDate; |
69 | QPtrListIterator<Alarm> it( i.mAlarms ); | 69 | QPtrListIterator<Alarm> it( i.mAlarms ); |
70 | const Alarm *a; | 70 | const Alarm *a; |
71 | while( (a = it.current()) ) { | 71 | while( (a = it.current()) ) { |
72 | Alarm *b = new Alarm( *a ); | 72 | Alarm *b = new Alarm( *a ); |
73 | b->setParent( this ); | 73 | b->setParent( this ); |
74 | mAlarms.append( b ); | 74 | mAlarms.append( b ); |
75 | 75 | ||
76 | ++it; | 76 | ++it; |
77 | } | 77 | } |
78 | mAlarms.setAutoDelete(true); | 78 | mAlarms.setAutoDelete(true); |
79 | mHasRecurrenceID = i.mHasRecurrenceID; | 79 | mHasRecurrenceID = i.mHasRecurrenceID; |
80 | mRecurrenceID = i.mRecurrenceID; | 80 | mRecurrenceID = i.mRecurrenceID; |
81 | mRecurrence = new Recurrence( *(i.mRecurrence), this ); | 81 | mRecurrence = new Recurrence( *(i.mRecurrence), this ); |
82 | mHoliday = i.mHoliday ; | 82 | mHoliday = i.mHoliday ; |
83 | mBirthday = i.mBirthday; | 83 | mBirthday = i.mBirthday; |
84 | mAnniversary = i.mAnniversary; | 84 | mAnniversary = i.mAnniversary; |
85 | } | 85 | } |
86 | 86 | ||
87 | Incidence::~Incidence() | 87 | Incidence::~Incidence() |
88 | { | 88 | { |
89 | 89 | ||
90 | Incidence *ev; | 90 | Incidence *ev; |
91 | QPtrList<Incidence> Relations = relations(); | 91 | QPtrList<Incidence> Relations = relations(); |
92 | for (ev=Relations.first();ev;ev=Relations.next()) { | 92 | for (ev=Relations.first();ev;ev=Relations.next()) { |
93 | if (ev->relatedTo() == this) ev->setRelatedTo(0); | 93 | if (ev->relatedTo() == this) ev->setRelatedTo(0); |
94 | } | 94 | } |
95 | if (relatedTo()) relatedTo()->removeRelation(this); | 95 | if (relatedTo()) relatedTo()->removeRelation(this); |
96 | delete mRecurrence; | 96 | delete mRecurrence; |
97 | 97 | ||
98 | } | 98 | } |
99 | 99 | ||
100 | bool Incidence::isHoliday() const | 100 | bool Incidence::isHoliday() const |
101 | { | 101 | { |
102 | return mHoliday; | 102 | return mHoliday; |
103 | } | 103 | } |
104 | bool Incidence::isBirthday() const | 104 | bool Incidence::isBirthday() const |
105 | { | 105 | { |
106 | 106 | ||
107 | return mBirthday ; | 107 | return mBirthday ; |
108 | } | 108 | } |
109 | bool Incidence::isAnniversary() const | 109 | bool Incidence::isAnniversary() const |
110 | { | 110 | { |
111 | return mAnniversary ; | 111 | return mAnniversary ; |
112 | 112 | ||
113 | } | 113 | } |
114 | 114 | ||
115 | bool Incidence::hasRecurrenceID() const | 115 | bool Incidence::hasRecurrenceID() const |
116 | { | 116 | { |
117 | return mHasRecurrenceID; | 117 | return mHasRecurrenceID; |
118 | } | 118 | } |
119 | 119 | ||
120 | void Incidence::setHasRecurrenceID( bool b ) | 120 | void Incidence::setHasRecurrenceID( bool b ) |
121 | { | 121 | { |
122 | mHasRecurrenceID = b; | 122 | mHasRecurrenceID = b; |
123 | } | 123 | } |
124 | 124 | ||
125 | void Incidence::setRecurrenceID(QDateTime d) | 125 | void Incidence::setRecurrenceID(QDateTime d) |
126 | { | 126 | { |
127 | mRecurrenceID = d; | 127 | mRecurrenceID = d; |
128 | mHasRecurrenceID = true; | 128 | mHasRecurrenceID = true; |
129 | updated(); | 129 | updated(); |
130 | } | 130 | } |
131 | QDateTime Incidence::recurrenceID () const | 131 | QDateTime Incidence::recurrenceID () const |
132 | { | 132 | { |
133 | return mRecurrenceID; | 133 | return mRecurrenceID; |
134 | } | 134 | } |
135 | 135 | ||
136 | bool Incidence::cancelled() const | 136 | bool Incidence::cancelled() const |
137 | { | 137 | { |
138 | return mCancelled; | 138 | return mCancelled; |
139 | } | 139 | } |
140 | void Incidence::setCancelled( bool b ) | 140 | void Incidence::setCancelled( bool b ) |
141 | { | 141 | { |
142 | mCancelled = b; | 142 | mCancelled = b; |
143 | updated(); | 143 | updated(); |
144 | } | 144 | } |
145 | bool Incidence::hasStartDate() const | 145 | bool Incidence::hasStartDate() const |
146 | { | 146 | { |
147 | return mHasStartDate; | 147 | return mHasStartDate; |
148 | } | 148 | } |
149 | 149 | ||
150 | void Incidence::setHasStartDate(bool f) | 150 | void Incidence::setHasStartDate(bool f) |
151 | { | 151 | { |
152 | if (mReadOnly) return; | 152 | if (mReadOnly) return; |
153 | mHasStartDate = f; | 153 | mHasStartDate = f; |
154 | updated(); | 154 | updated(); |
155 | } | 155 | } |
156 | 156 | ||
157 | // A string comparison that considers that null and empty are the same | 157 | // A string comparison that considers that null and empty are the same |
158 | static bool stringCompare( const QString& s1, const QString& s2 ) | 158 | static bool stringCompare( const QString& s1, const QString& s2 ) |
159 | { | 159 | { |
160 | if ( s1.isEmpty() && s2.isEmpty() ) | 160 | if ( s1.isEmpty() && s2.isEmpty() ) |
161 | return true; | 161 | return true; |
162 | return s1 == s2; | 162 | return s1 == s2; |
163 | } | 163 | } |
164 | 164 | ||
165 | bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | 165 | bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) |
166 | { | 166 | { |
167 | 167 | ||
168 | if( i1.alarms().count() != i2.alarms().count() ) { | 168 | if( i1.alarms().count() != i2.alarms().count() ) { |
169 | return false; // no need to check further | 169 | return false; // no need to check further |
170 | } | 170 | } |
171 | if ( i1.alarms().count() > 0 ) { | 171 | if ( i1.alarms().count() > 0 ) { |
172 | if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) ) | 172 | if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) ) |
173 | { | 173 | { |
174 | qDebug("alarm not equal "); | 174 | qDebug("alarm not equal "); |
175 | return false; | 175 | return false; |
176 | } | 176 | } |
177 | } | 177 | } |
178 | #if 0 | 178 | #if 0 |
179 | QPtrListIterator<Alarm> a1( i1.alarms() ); | 179 | QPtrListIterator<Alarm> a1( i1.alarms() ); |
180 | QPtrListIterator<Alarm> a2( i2.alarms() ); | 180 | QPtrListIterator<Alarm> a2( i2.alarms() ); |
181 | for( ; a1.current() && a2.current(); ++a1, ++a2 ) { | 181 | for( ; a1.current() && a2.current(); ++a1, ++a2 ) { |
182 | if( *a1.current() == *a2.current() ) { | 182 | if( *a1.current() == *a2.current() ) { |
183 | continue; | 183 | continue; |
184 | } | 184 | } |
185 | else { | 185 | else { |
186 | return false; | 186 | return false; |
187 | } | 187 | } |
188 | } | 188 | } |
189 | #endif | 189 | #endif |
190 | 190 | ||
191 | if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) { | 191 | if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) { |
192 | if ( i1.hasRecurrenceID() ) { | 192 | if ( i1.hasRecurrenceID() ) { |
193 | if ( i1.recurrenceID() != i2.recurrenceID() ) | 193 | if ( i1.recurrenceID() != i2.recurrenceID() ) |
194 | return false; | 194 | return false; |
195 | } | 195 | } |
196 | 196 | ||
197 | } else { | 197 | } else { |
198 | return false; | 198 | return false; |
199 | } | 199 | } |
200 | 200 | ||
201 | if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) ) | 201 | if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) ) |
202 | return false; | 202 | return false; |
203 | if ( i1.hasStartDate() == i2.hasStartDate() ) { | 203 | if ( i1.hasStartDate() == i2.hasStartDate() ) { |
204 | if ( i1.hasStartDate() ) { | 204 | if ( i1.hasStartDate() ) { |
205 | if ( i1.dtStart() != i2.dtStart() ) | 205 | if ( i1.dtStart() != i2.dtStart() ) |
206 | return false; | 206 | return false; |
207 | } | 207 | } |
208 | } else { | 208 | } else { |
209 | return false; | 209 | return false; |
210 | } | 210 | } |
211 | if (!( *i1.recurrence() == *i2.recurrence()) ) { | 211 | if (!( *i1.recurrence() == *i2.recurrence()) ) { |
212 | qDebug("recurrence is NOT equal "); | 212 | qDebug("recurrence is NOT equal "); |
213 | return false; | 213 | return false; |
214 | } | 214 | } |
215 | return | 215 | return |
216 | // i1.created() == i2.created() && | 216 | // i1.created() == i2.created() && |
217 | stringCompare( i1.description(), i2.description() ) && | 217 | stringCompare( i1.description(), i2.description() ) && |
218 | stringCompare( i1.summary(), i2.summary() ) && | 218 | stringCompare( i1.summary(), i2.summary() ) && |
219 | i1.categories() == i2.categories() && | 219 | i1.categories() == i2.categories() && |
220 | // no need to compare mRelatedTo | 220 | // no need to compare mRelatedTo |
221 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && | 221 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && |
222 | // i1.relations() == i2.relations() && | 222 | // i1.relations() == i2.relations() && |
223 | i1.exDates() == i2.exDates() && | 223 | i1.exDates() == i2.exDates() && |
224 | i1.attachments() == i2.attachments() && | 224 | i1.attachments() == i2.attachments() && |
225 | i1.resources() == i2.resources() && | 225 | i1.resources() == i2.resources() && |
226 | i1.secrecy() == i2.secrecy() && | 226 | i1.secrecy() == i2.secrecy() && |
227 | i1.priority() == i2.priority() && | 227 | i1.priority() == i2.priority() && |
228 | i1.cancelled() == i2.cancelled() && | 228 | i1.cancelled() == i2.cancelled() && |
229 | stringCompare( i1.location(), i2.location() ); | 229 | stringCompare( i1.location(), i2.location() ); |
230 | } | 230 | } |
231 | 231 | ||
232 | Incidence* Incidence::recreateCloneException( QDate d ) | 232 | Incidence* Incidence::recreateCloneException( QDate d ) |
233 | { | 233 | { |
234 | Incidence* newInc = clone(); | 234 | Incidence* newInc = clone(); |
235 | newInc->recreate(); | 235 | newInc->recreate(); |
236 | if ( doesRecur() ) { | 236 | if ( doesRecur() ) { |
237 | addExDate( d ); | 237 | addExDate( d ); |
238 | newInc->recurrence()->unsetRecurs(); | 238 | newInc->recurrence()->unsetRecurs(); |
239 | if ( type() == "Event") { | 239 | if ( type() == "Event") { |
240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); | 240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); |
241 | QTime tim = dtStart().time(); | 241 | QTime tim = dtStart().time(); |
242 | newInc->setDtStart( QDateTime(d, tim) ); | 242 | newInc->setDtStart( QDateTime(d, tim) ); |
243 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 243 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
244 | } else { | 244 | } else { |
245 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); | 245 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); |
246 | QTime tim = ((Todo*)this)->dtDue().time(); | 246 | QTime tim = ((Todo*)this)->dtDue().time(); |
247 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); | 247 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); |
248 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); | 248 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); |
249 | ((Todo*)this)->setRecurDates(); | 249 | ((Todo*)this)->setRecurDates(); |
250 | } | 250 | } |
251 | newInc->setExDates( DateList () ); | 251 | newInc->setExDates( DateList () ); |
252 | } | 252 | } |
253 | return newInc; | 253 | return newInc; |
254 | } | 254 | } |
255 | 255 | ||
256 | void Incidence::recreate() | 256 | void Incidence::recreate() |
257 | { | 257 | { |
258 | setCreated(QDateTime::currentDateTime()); | 258 | setCreated(QDateTime::currentDateTime()); |
259 | 259 | ||
260 | setUid(CalFormat::createUniqueId()); | 260 | setUid(CalFormat::createUniqueId()); |
261 | 261 | ||
262 | setRevision(0); | 262 | setRevision(0); |
263 | setIDStr( ":" ); | 263 | setIDStr( ":" ); |
264 | setLastModified(QDateTime::currentDateTime()); | 264 | setLastModified(QDateTime::currentDateTime()); |
265 | } | 265 | } |
266 | void Incidence::cloneRelations( Incidence * newInc ) | 266 | void Incidence::cloneRelations( Incidence * newInc ) |
267 | { | 267 | { |
268 | // newInc is already a clone of this incidence | 268 | // newInc is already a clone of this incidence |
269 | Incidence * inc; | 269 | Incidence * inc; |
270 | Incidence * cloneInc; | 270 | Incidence * cloneInc; |
271 | QPtrList<Incidence> Relations = relations(); | 271 | QPtrList<Incidence> Relations = relations(); |
272 | for (inc=Relations.first();inc;inc=Relations.next()) { | 272 | for (inc=Relations.first();inc;inc=Relations.next()) { |
273 | cloneInc = inc->clone(); | 273 | cloneInc = inc->clone(); |
274 | cloneInc->recreate(); | 274 | cloneInc->recreate(); |
275 | cloneInc->setRelatedTo( newInc ); | 275 | cloneInc->setRelatedTo( newInc ); |
276 | inc->cloneRelations( cloneInc ); | 276 | inc->cloneRelations( cloneInc ); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | void Incidence::setReadOnly( bool readOnly ) | 279 | void Incidence::setReadOnly( bool readOnly ) |
280 | { | 280 | { |
281 | IncidenceBase::setReadOnly( readOnly ); | 281 | IncidenceBase::setReadOnly( readOnly ); |
282 | recurrence()->setRecurReadOnly( readOnly); | 282 | recurrence()->setRecurReadOnly( readOnly); |
283 | } | 283 | } |
284 | 284 | ||
285 | void Incidence::setCreated(QDateTime created) | 285 | void Incidence::setCreated(QDateTime created) |
286 | { | 286 | { |
287 | if (mReadOnly) return; | 287 | if (mReadOnly) return; |
288 | mCreated = getEvenTime(created); | 288 | mCreated = getEvenTime(created); |
289 | } | 289 | } |
290 | 290 | ||
291 | QDateTime Incidence::created() const | 291 | QDateTime Incidence::created() const |
292 | { | 292 | { |
293 | return mCreated; | 293 | return mCreated; |
294 | } | 294 | } |
295 | 295 | ||
296 | void Incidence::setRevision(int rev) | 296 | void Incidence::setRevision(int rev) |
297 | { | 297 | { |
298 | if (mReadOnly) return; | 298 | if (mReadOnly) return; |
299 | mRevision = rev; | 299 | mRevision = rev; |
300 | 300 | ||
301 | updated(); | 301 | updated(); |
302 | } | 302 | } |
303 | 303 | ||
304 | int Incidence::revision() const | 304 | int Incidence::revision() const |
305 | { | 305 | { |
306 | return mRevision; | 306 | return mRevision; |
307 | } | 307 | } |
308 | 308 | ||
309 | void Incidence::setDtStart(const QDateTime &dtStart) | 309 | void Incidence::setDtStart(const QDateTime &dtStart) |
310 | { | 310 | { |
311 | 311 | ||
312 | QDateTime dt = getEvenTime(dtStart); | 312 | QDateTime dt = getEvenTime(dtStart); |
313 | recurrence()->setRecurStart( dt); | 313 | recurrence()->setRecurStart( dt); |
314 | IncidenceBase::setDtStart( dt ); | 314 | IncidenceBase::setDtStart( dt ); |
315 | } | 315 | } |
316 | 316 | ||
317 | void Incidence::setDescription(const QString &description) | 317 | void Incidence::setDescription(const QString &description) |
318 | { | 318 | { |
319 | if (mReadOnly) return; | 319 | if (mReadOnly) return; |
320 | mDescription = description; | 320 | mDescription = description; |
321 | updated(); | 321 | updated(); |
322 | } | 322 | } |
323 | 323 | ||
324 | QString Incidence::description() const | 324 | QString Incidence::description() const |
325 | { | 325 | { |
326 | return mDescription; | 326 | return mDescription; |
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | void Incidence::setSummary(const QString &summary) | 330 | void Incidence::setSummary(const QString &summary) |
331 | { | 331 | { |
332 | if (mReadOnly) return; | 332 | if (mReadOnly) return; |
333 | mSummary = summary; | 333 | mSummary = summary; |
334 | updated(); | 334 | updated(); |
335 | } | 335 | } |
336 | 336 | ||
337 | QString Incidence::summary() const | 337 | QString Incidence::summary() const |
338 | { | 338 | { |
339 | return mSummary; | 339 | return mSummary; |
340 | } | 340 | } |
341 | void Incidence::checkCategories() | 341 | void Incidence::checkCategories() |
342 | { | 342 | { |
343 | mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); | 343 | mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); |
344 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); | 344 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); |
345 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); | 345 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); |
346 | } | 346 | } |
347 | 347 | ||
348 | void Incidence::setCategories(const QStringList &categories) | 348 | void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false |
349 | { | ||
350 | if (mReadOnly) return; | ||
351 | int i; | ||
352 | for( i = 0; i < categories.count(); ++i ) { | ||
353 | if ( !mCategories.contains (categories[i])) | ||
354 | mCategories.append( categories[i] ); | ||
355 | } | ||
356 | checkCategories(); | ||
357 | updated(); | ||
358 | if ( addToRelations ) { | ||
359 | Incidence * inc; | ||
360 | QPtrList<Incidence> Relations = relations(); | ||
361 | for (inc=Relations.first();inc;inc=Relations.next()) { | ||
362 | inc->addCategories( categories, true ); | ||
363 | } | ||
364 | } | ||
365 | } | ||
366 | |||
367 | void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false | ||
349 | { | 368 | { |
350 | if (mReadOnly) return; | 369 | if (mReadOnly) return; |
351 | mCategories = categories; | 370 | mCategories = categories; |
352 | checkCategories(); | 371 | checkCategories(); |
353 | updated(); | 372 | updated(); |
373 | if ( setForRelations ) { | ||
374 | Incidence * inc; | ||
375 | QPtrList<Incidence> Relations = relations(); | ||
376 | for (inc=Relations.first();inc;inc=Relations.next()) { | ||
377 | inc->setCategories( categories, true ); | ||
378 | } | ||
379 | } | ||
354 | } | 380 | } |
355 | 381 | ||
356 | // TODO: remove setCategories(QString) function | 382 | // TODO: remove setCategories(QString) function |
357 | void Incidence::setCategories(const QString &catStr) | 383 | void Incidence::setCategories(const QString &catStr) |
358 | { | 384 | { |
359 | if (mReadOnly) return; | 385 | if (mReadOnly) return; |
360 | mCategories.clear(); | 386 | mCategories.clear(); |
361 | 387 | ||
362 | if (catStr.isEmpty()) return; | 388 | if (catStr.isEmpty()) return; |
363 | 389 | ||
364 | mCategories = QStringList::split(",",catStr); | 390 | mCategories = QStringList::split(",",catStr); |
365 | 391 | ||
366 | QStringList::Iterator it; | 392 | QStringList::Iterator it; |
367 | for(it = mCategories.begin();it != mCategories.end(); ++it) { | 393 | for(it = mCategories.begin();it != mCategories.end(); ++it) { |
368 | *it = (*it).stripWhiteSpace(); | 394 | *it = (*it).stripWhiteSpace(); |
369 | } | 395 | } |
370 | checkCategories(); | 396 | checkCategories(); |
371 | updated(); | 397 | updated(); |
372 | } | 398 | } |
373 | 399 | ||
374 | QStringList Incidence::categories() const | 400 | QStringList Incidence::categories() const |
375 | { | 401 | { |
376 | return mCategories; | 402 | return mCategories; |
377 | } | 403 | } |
378 | 404 | ||
379 | QString Incidence::categoriesStr() | 405 | QString Incidence::categoriesStr() |
380 | { | 406 | { |
381 | return mCategories.join(","); | 407 | return mCategories.join(","); |
382 | } | 408 | } |
383 | QString Incidence::categoriesStrWithSpace() | 409 | QString Incidence::categoriesStrWithSpace() |
384 | { | 410 | { |
385 | return mCategories.join(", "); | 411 | return mCategories.join(", "); |
386 | } | 412 | } |
387 | 413 | ||
388 | void Incidence::setRelatedToUid(const QString &relatedToUid) | 414 | void Incidence::setRelatedToUid(const QString &relatedToUid) |
389 | { | 415 | { |
390 | if (mReadOnly) return; | 416 | if (mReadOnly) return; |
391 | mRelatedToUid = relatedToUid; | 417 | mRelatedToUid = relatedToUid; |
392 | } | 418 | } |
393 | 419 | ||
394 | QString Incidence::relatedToUid() const | 420 | QString Incidence::relatedToUid() const |
395 | { | 421 | { |
396 | return mRelatedToUid; | 422 | return mRelatedToUid; |
397 | } | 423 | } |
398 | 424 | ||
399 | void Incidence::setRelatedTo(Incidence *relatedTo) | 425 | void Incidence::setRelatedTo(Incidence *relatedTo) |
400 | { | 426 | { |
401 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); | 427 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); |
402 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); | 428 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); |
403 | if (mReadOnly || mRelatedTo == relatedTo) return; | 429 | if (mReadOnly || mRelatedTo == relatedTo) return; |
404 | if(mRelatedTo) { | 430 | if(mRelatedTo) { |
405 | // updated(); | 431 | // updated(); |
406 | mRelatedTo->removeRelation(this); | 432 | mRelatedTo->removeRelation(this); |
407 | } | 433 | } |
408 | mRelatedTo = relatedTo; | 434 | mRelatedTo = relatedTo; |
409 | if (mRelatedTo) { | 435 | if (mRelatedTo) { |
410 | mRelatedTo->addRelation(this); | 436 | mRelatedTo->addRelation(this); |
411 | mRelatedToUid = mRelatedTo->uid(); | 437 | mRelatedToUid = mRelatedTo->uid(); |
412 | } else { | 438 | } else { |
413 | mRelatedToUid = ""; | 439 | mRelatedToUid = ""; |
414 | } | 440 | } |
415 | } | 441 | } |
416 | 442 | ||
417 | Incidence *Incidence::relatedTo() const | 443 | Incidence *Incidence::relatedTo() const |
418 | { | 444 | { |
419 | return mRelatedTo; | 445 | return mRelatedTo; |
420 | } | 446 | } |
421 | 447 | ||
422 | QPtrList<Incidence> Incidence::relations() const | 448 | QPtrList<Incidence> Incidence::relations() const |
423 | { | 449 | { |
424 | return mRelations; | 450 | return mRelations; |
425 | } | 451 | } |
426 | 452 | ||
427 | void Incidence::addRelation(Incidence *event) | 453 | void Incidence::addRelation(Incidence *event) |
428 | { | 454 | { |
429 | if( mRelations.findRef( event ) == -1 ) { | 455 | if( mRelations.findRef( event ) == -1 ) { |
430 | mRelations.append(event); | 456 | mRelations.append(event); |
431 | //updated(); | 457 | //updated(); |
432 | } | 458 | } |
433 | } | 459 | } |
434 | 460 | ||
435 | void Incidence::removeRelation(Incidence *event) | 461 | void Incidence::removeRelation(Incidence *event) |
436 | { | 462 | { |
437 | 463 | ||
438 | mRelations.removeRef(event); | 464 | mRelations.removeRef(event); |
439 | 465 | ||
440 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); | 466 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); |
441 | } | 467 | } |
442 | 468 | ||
443 | bool Incidence::recursOn(const QDate &qd) const | 469 | bool Incidence::recursOn(const QDate &qd) const |
444 | { | 470 | { |
445 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; | 471 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; |
446 | else return false; | 472 | else return false; |
447 | } | 473 | } |
448 | 474 | ||
449 | void Incidence::setExDates(const DateList &exDates) | 475 | void Incidence::setExDates(const DateList &exDates) |
450 | { | 476 | { |
451 | if (mReadOnly) return; | 477 | if (mReadOnly) return; |
452 | mExDates = exDates; | 478 | mExDates = exDates; |
453 | 479 | ||
454 | recurrence()->setRecurExDatesCount(mExDates.count()); | 480 | recurrence()->setRecurExDatesCount(mExDates.count()); |
455 | 481 | ||
456 | updated(); | 482 | updated(); |
457 | } | 483 | } |
458 | 484 | ||
459 | void Incidence::addExDate(const QDate &date) | 485 | void Incidence::addExDate(const QDate &date) |
460 | { | 486 | { |
461 | if (mReadOnly) return; | 487 | if (mReadOnly) return; |
462 | mExDates.append(date); | 488 | mExDates.append(date); |
463 | 489 | ||
464 | recurrence()->setRecurExDatesCount(mExDates.count()); | 490 | recurrence()->setRecurExDatesCount(mExDates.count()); |
465 | 491 | ||
466 | updated(); | 492 | updated(); |
467 | } | 493 | } |
468 | 494 | ||
469 | DateList Incidence::exDates() const | 495 | DateList Incidence::exDates() const |
470 | { | 496 | { |
471 | return mExDates; | 497 | return mExDates; |
472 | } | 498 | } |
473 | 499 | ||
474 | bool Incidence::isException(const QDate &date) const | 500 | bool Incidence::isException(const QDate &date) const |
475 | { | 501 | { |
476 | DateList::ConstIterator it; | 502 | DateList::ConstIterator it; |
477 | for( it = mExDates.begin(); it != mExDates.end(); ++it ) { | 503 | for( it = mExDates.begin(); it != mExDates.end(); ++it ) { |
478 | if ( (*it) == date ) { | 504 | if ( (*it) == date ) { |
479 | return true; | 505 | return true; |
480 | } | 506 | } |
481 | } | 507 | } |
482 | 508 | ||
483 | return false; | 509 | return false; |
484 | } | 510 | } |
485 | 511 | ||
486 | void Incidence::addAttachment(Attachment *attachment) | 512 | void Incidence::addAttachment(Attachment *attachment) |
487 | { | 513 | { |
488 | if (mReadOnly || !attachment) return; | 514 | if (mReadOnly || !attachment) return; |
489 | mAttachments.append(attachment); | 515 | mAttachments.append(attachment); |
490 | updated(); | 516 | updated(); |
491 | } | 517 | } |
492 | 518 | ||
493 | void Incidence::deleteAttachment(Attachment *attachment) | 519 | void Incidence::deleteAttachment(Attachment *attachment) |
494 | { | 520 | { |
495 | mAttachments.removeRef(attachment); | 521 | mAttachments.removeRef(attachment); |
496 | } | 522 | } |
497 | 523 | ||
498 | void Incidence::deleteAttachments(const QString& mime) | 524 | void Incidence::deleteAttachments(const QString& mime) |
499 | { | 525 | { |
500 | Attachment *at = mAttachments.first(); | 526 | Attachment *at = mAttachments.first(); |
501 | while (at) { | 527 | while (at) { |
502 | if (at->mimeType() == mime) | 528 | if (at->mimeType() == mime) |
503 | mAttachments.remove(); | 529 | mAttachments.remove(); |
504 | else | 530 | else |
505 | at = mAttachments.next(); | 531 | at = mAttachments.next(); |
506 | } | 532 | } |
507 | } | 533 | } |
508 | 534 | ||
509 | QPtrList<Attachment> Incidence::attachments() const | 535 | QPtrList<Attachment> Incidence::attachments() const |
510 | { | 536 | { |
511 | return mAttachments; | 537 | return mAttachments; |
512 | } | 538 | } |
513 | 539 | ||
514 | QPtrList<Attachment> Incidence::attachments(const QString& mime) const | 540 | QPtrList<Attachment> Incidence::attachments(const QString& mime) const |
515 | { | 541 | { |
516 | QPtrList<Attachment> attachments; | 542 | QPtrList<Attachment> attachments; |
517 | QPtrListIterator<Attachment> it( mAttachments ); | 543 | QPtrListIterator<Attachment> it( mAttachments ); |
518 | Attachment *at; | 544 | Attachment *at; |
519 | while ( (at = it.current()) ) { | 545 | while ( (at = it.current()) ) { |
520 | if (at->mimeType() == mime) | 546 | if (at->mimeType() == mime) |
521 | attachments.append(at); | 547 | attachments.append(at); |
522 | ++it; | 548 | ++it; |
523 | } | 549 | } |
524 | 550 | ||
525 | return attachments; | 551 | return attachments; |
526 | } | 552 | } |
527 | 553 | ||
528 | void Incidence::setResources(const QStringList &resources) | 554 | void Incidence::setResources(const QStringList &resources) |
529 | { | 555 | { |
530 | if (mReadOnly) return; | 556 | if (mReadOnly) return; |
531 | mResources = resources; | 557 | mResources = resources; |
532 | updated(); | 558 | updated(); |
533 | } | 559 | } |
534 | 560 | ||
535 | QStringList Incidence::resources() const | 561 | QStringList Incidence::resources() const |
536 | { | 562 | { |
537 | return mResources; | 563 | return mResources; |
538 | } | 564 | } |
539 | 565 | ||
540 | 566 | ||
541 | void Incidence::setPriority(int priority) | 567 | void Incidence::setPriority(int priority) |
542 | { | 568 | { |
543 | if (mReadOnly) return; | 569 | if (mReadOnly) return; |
544 | mPriority = priority; | 570 | mPriority = priority; |
545 | updated(); | 571 | updated(); |
546 | } | 572 | } |
547 | 573 | ||
548 | int Incidence::priority() const | 574 | int Incidence::priority() const |
549 | { | 575 | { |
550 | return mPriority; | 576 | return mPriority; |
551 | } | 577 | } |
552 | 578 | ||
553 | void Incidence::setSecrecy(int sec) | 579 | void Incidence::setSecrecy(int sec) |
554 | { | 580 | { |
555 | if (mReadOnly) return; | 581 | if (mReadOnly) return; |
556 | mSecrecy = sec; | 582 | mSecrecy = sec; |
557 | updated(); | 583 | updated(); |
558 | } | 584 | } |
559 | 585 | ||
560 | int Incidence::secrecy() const | 586 | int Incidence::secrecy() const |
561 | { | 587 | { |
562 | return mSecrecy; | 588 | return mSecrecy; |
563 | } | 589 | } |
564 | 590 | ||
565 | QString Incidence::secrecyStr() const | 591 | QString Incidence::secrecyStr() const |
566 | { | 592 | { |
567 | return secrecyName(mSecrecy); | 593 | return secrecyName(mSecrecy); |
568 | } | 594 | } |
569 | 595 | ||
570 | QString Incidence::secrecyName(int secrecy) | 596 | QString Incidence::secrecyName(int secrecy) |
571 | { | 597 | { |
572 | switch (secrecy) { | 598 | switch (secrecy) { |
573 | case SecrecyPublic: | 599 | case SecrecyPublic: |
574 | return i18n("Public"); | 600 | return i18n("Public"); |
575 | break; | 601 | break; |
576 | case SecrecyPrivate: | 602 | case SecrecyPrivate: |
577 | return i18n("Private"); | 603 | return i18n("Private"); |
578 | break; | 604 | break; |
579 | case SecrecyConfidential: | 605 | case SecrecyConfidential: |
580 | return i18n("Confidential"); | 606 | return i18n("Confidential"); |
581 | break; | 607 | break; |
582 | default: | 608 | default: |
583 | return i18n("Undefined"); | 609 | return i18n("Undefined"); |
584 | break; | 610 | break; |
585 | } | 611 | } |
586 | } | 612 | } |
587 | 613 | ||
588 | QStringList Incidence::secrecyList() | 614 | QStringList Incidence::secrecyList() |
589 | { | 615 | { |
590 | QStringList list; | 616 | QStringList list; |
591 | list << secrecyName(SecrecyPublic); | 617 | list << secrecyName(SecrecyPublic); |
592 | list << secrecyName(SecrecyPrivate); | 618 | list << secrecyName(SecrecyPrivate); |
593 | list << secrecyName(SecrecyConfidential); | 619 | list << secrecyName(SecrecyConfidential); |
594 | 620 | ||
595 | return list; | 621 | return list; |
596 | } | 622 | } |
597 | 623 | ||
598 | 624 | ||
599 | QPtrList<Alarm> Incidence::alarms() const | 625 | QPtrList<Alarm> Incidence::alarms() const |
600 | { | 626 | { |
601 | return mAlarms; | 627 | return mAlarms; |
602 | } | 628 | } |
603 | 629 | ||
604 | Alarm* Incidence::newAlarm() | 630 | Alarm* Incidence::newAlarm() |
605 | { | 631 | { |
606 | Alarm* alarm = new Alarm(this); | 632 | Alarm* alarm = new Alarm(this); |
607 | mAlarms.append(alarm); | 633 | mAlarms.append(alarm); |
608 | // updated(); | 634 | // updated(); |
609 | return alarm; | 635 | return alarm; |
610 | } | 636 | } |
611 | 637 | ||
612 | void Incidence::addAlarm(Alarm *alarm) | 638 | void Incidence::addAlarm(Alarm *alarm) |
613 | { | 639 | { |
614 | mAlarms.append(alarm); | 640 | mAlarms.append(alarm); |
615 | updated(); | 641 | updated(); |
616 | } | 642 | } |
617 | 643 | ||
618 | void Incidence::removeAlarm(Alarm *alarm) | 644 | void Incidence::removeAlarm(Alarm *alarm) |
619 | { | 645 | { |
620 | mAlarms.removeRef(alarm); | 646 | mAlarms.removeRef(alarm); |
621 | updated(); | 647 | updated(); |
622 | } | 648 | } |
623 | 649 | ||
624 | void Incidence::clearAlarms() | 650 | void Incidence::clearAlarms() |
625 | { | 651 | { |
626 | mAlarms.clear(); | 652 | mAlarms.clear(); |
627 | updated(); | 653 | updated(); |
628 | } | 654 | } |
629 | 655 | ||
630 | bool Incidence::isAlarmEnabled() const | 656 | bool Incidence::isAlarmEnabled() const |
631 | { | 657 | { |
632 | Alarm* alarm; | 658 | Alarm* alarm; |
633 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { | 659 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { |
634 | if (alarm->enabled()) | 660 | if (alarm->enabled()) |
635 | return true; | 661 | return true; |
636 | } | 662 | } |
637 | return false; | 663 | return false; |
638 | } | 664 | } |
639 | 665 | ||
640 | Recurrence *Incidence::recurrence() const | 666 | Recurrence *Incidence::recurrence() const |
641 | { | 667 | { |
642 | return mRecurrence; | 668 | return mRecurrence; |
643 | } | 669 | } |
644 | void Incidence::setRecurrence( Recurrence * r) | 670 | void Incidence::setRecurrence( Recurrence * r) |
645 | { | 671 | { |
646 | delete mRecurrence; | 672 | delete mRecurrence; |
647 | mRecurrence = r; | 673 | mRecurrence = r; |
648 | } | 674 | } |
649 | 675 | ||
650 | void Incidence::setLocation(const QString &location) | 676 | void Incidence::setLocation(const QString &location) |
651 | { | 677 | { |
652 | if (mReadOnly) return; | 678 | if (mReadOnly) return; |
653 | mLocation = location; | 679 | mLocation = location; |
654 | updated(); | 680 | updated(); |
655 | } | 681 | } |
656 | 682 | ||
657 | QString Incidence::location() const | 683 | QString Incidence::location() const |
658 | { | 684 | { |
659 | return mLocation; | 685 | return mLocation; |
660 | } | 686 | } |
661 | 687 | ||
662 | ushort Incidence::doesRecur() const | 688 | ushort Incidence::doesRecur() const |
663 | { | 689 | { |
664 | if ( mRecurrence ) return mRecurrence->doesRecur(); | 690 | if ( mRecurrence ) return mRecurrence->doesRecur(); |
665 | else return Recurrence::rNone; | 691 | else return Recurrence::rNone; |
666 | } | 692 | } |
667 | 693 | ||
668 | QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const | 694 | QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const |
669 | { | 695 | { |
670 | QDateTime incidenceStart = dt; | 696 | QDateTime incidenceStart = dt; |
671 | *ok = false; | 697 | *ok = false; |
672 | if ( doesRecur() ) { | 698 | if ( doesRecur() ) { |
673 | bool last; | 699 | bool last; |
674 | recurrence()->getPreviousDateTime( incidenceStart , &last ); | 700 | recurrence()->getPreviousDateTime( incidenceStart , &last ); |
675 | int count = 0; | 701 | int count = 0; |
676 | if ( !last ) { | 702 | if ( !last ) { |
677 | while ( !last ) { | 703 | while ( !last ) { |
678 | ++count; | 704 | ++count; |
679 | incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last ); | 705 | incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last ); |
680 | if ( recursOn( incidenceStart.date() ) ) { | 706 | if ( recursOn( incidenceStart.date() ) ) { |
681 | last = true; // exit while llop | 707 | last = true; // exit while llop |
682 | } else { | 708 | } else { |
683 | if ( last ) { // no alarm on last recurrence | 709 | if ( last ) { // no alarm on last recurrence |
684 | return QDateTime (); | 710 | return QDateTime (); |
685 | } | 711 | } |
686 | int year = incidenceStart.date().year(); | 712 | int year = incidenceStart.date().year(); |
687 | // workaround for bug in recurrence | 713 | // workaround for bug in recurrence |
688 | if ( count == 100 || year < 1000 || year > 5000 ) { | 714 | if ( count == 100 || year < 1000 || year > 5000 ) { |
689 | return QDateTime (); | 715 | return QDateTime (); |
690 | } | 716 | } |
691 | incidenceStart = incidenceStart.addSecs( 1 ); | 717 | incidenceStart = incidenceStart.addSecs( 1 ); |
692 | } | 718 | } |
693 | } | 719 | } |
694 | } else { | 720 | } else { |
695 | return QDateTime (); | 721 | return QDateTime (); |
696 | } | 722 | } |
697 | } else { | 723 | } else { |
698 | if ( hasStartDate () ) { | 724 | if ( hasStartDate () ) { |
699 | incidenceStart = dtStart(); | 725 | incidenceStart = dtStart(); |
700 | } | 726 | } |
701 | if ( type() =="Todo" ) { | 727 | if ( type() =="Todo" ) { |
702 | if ( ((Todo*)this)->hasDueDate() ) | 728 | if ( ((Todo*)this)->hasDueDate() ) |
703 | incidenceStart = ((Todo*)this)->dtDue(); | 729 | incidenceStart = ((Todo*)this)->dtDue(); |
704 | } | 730 | } |
705 | } | 731 | } |
706 | if ( incidenceStart > dt ) | 732 | if ( incidenceStart > dt ) |
707 | *ok = true; | 733 | *ok = true; |
708 | return incidenceStart; | 734 | return incidenceStart; |
709 | } | 735 | } |
710 | QDateTime Incidence::dtStart() const | 736 | QDateTime Incidence::dtStart() const |
711 | { | 737 | { |
712 | if ( doesRecur() ) { | 738 | if ( doesRecur() ) { |
713 | if ( type() == "Todo" ) { | 739 | if ( type() == "Todo" ) { |
714 | ((Todo*)this)->checkSetCompletedFalse(); | 740 | ((Todo*)this)->checkSetCompletedFalse(); |
715 | } | 741 | } |
716 | } | 742 | } |
717 | return mDtStart; | 743 | return mDtStart; |
718 | } | 744 | } |
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index 327e7dd..ebd50d0 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -1,316 +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 | ||
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 | 116 | ||
117 | virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const = 0; | 117 | virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) 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); | 154 | void setCategories(const QStringList &categories, bool setForRelations = false); |
155 | void addCategories(const QStringList &categories, bool addToRelations = false); | ||
155 | /** set event's categories based on a comma delimited string */ | 156 | /** set event's categories based on a comma delimited string */ |
156 | void setCategories(const QString &catStr); | 157 | void setCategories(const QString &catStr); |
157 | /** return categories in a list */ | 158 | /** return categories in a list */ |
158 | QStringList categories() const; | 159 | QStringList categories() const; |
159 | /** return categories as a comma separated string */ | 160 | /** return categories as a comma separated string */ |
160 | QString categoriesStr(); | 161 | QString categoriesStr(); |
161 | QString categoriesStrWithSpace(); | 162 | QString categoriesStrWithSpace(); |
162 | 163 | ||
163 | /** 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 |
164 | * only be used when constructing a calendar before the related Event | 165 | * only be used when constructing a calendar before the related Event |
165 | * exists. */ | 166 | * exists. */ |
166 | void setRelatedToUid(const QString &); | 167 | void setRelatedToUid(const QString &); |
167 | /** what event does this one relate to? This function should | 168 | /** what event does this one relate to? This function should |
168 | * only be used when constructing a calendar before the related Event | 169 | * only be used when constructing a calendar before the related Event |
169 | * exists. */ | 170 | * exists. */ |
170 | QString relatedToUid() const; | 171 | QString relatedToUid() const; |
171 | /** point at some other event to which the event relates */ | 172 | /** point at some other event to which the event relates */ |
172 | void setRelatedTo(Incidence *relatedTo); | 173 | void setRelatedTo(Incidence *relatedTo); |
173 | /** what event does this one relate to? */ | 174 | /** what event does this one relate to? */ |
174 | Incidence *relatedTo() const; | 175 | Incidence *relatedTo() const; |
175 | /** All events that are related to this event */ | 176 | /** All events that are related to this event */ |
176 | QPtrList<Incidence> relations() const; | 177 | QPtrList<Incidence> relations() const; |
177 | /** Add an event which is related to this event */ | 178 | /** Add an event which is related to this event */ |
178 | void addRelation(Incidence *); | 179 | void addRelation(Incidence *); |
179 | /** Remove event that is related to this event */ | 180 | /** Remove event that is related to this event */ |
180 | void removeRelation(Incidence *); | 181 | void removeRelation(Incidence *); |
181 | 182 | ||
182 | /** 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 */ |
183 | DateList exDates() const; | 184 | DateList exDates() const; |
184 | /** 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 */ |
185 | void setExDates(const DateList &_exDates); | 186 | void setExDates(const DateList &_exDates); |
186 | void setExDates(const char *dates); | 187 | void setExDates(const char *dates); |
187 | /** 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. */ |
188 | void addExDate(const QDate &date); | 189 | void addExDate(const QDate &date); |
189 | 190 | ||
190 | /** 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 |
191 | rule set, or false otherwise. */ | 192 | rule set, or false otherwise. */ |
192 | bool isException(const QDate &qd) const; | 193 | bool isException(const QDate &qd) const; |
193 | 194 | ||
194 | /** add attachment to this event */ | 195 | /** add attachment to this event */ |
195 | void addAttachment(Attachment *attachment); | 196 | void addAttachment(Attachment *attachment); |
196 | /** remove and delete a specific attachment */ | 197 | /** remove and delete a specific attachment */ |
197 | void deleteAttachment(Attachment *attachment); | 198 | void deleteAttachment(Attachment *attachment); |
198 | /** remove and delete all attachments with this mime type */ | 199 | /** remove and delete all attachments with this mime type */ |
199 | void deleteAttachments(const QString& mime); | 200 | void deleteAttachments(const QString& mime); |
200 | /** return list of all associated attachments */ | 201 | /** return list of all associated attachments */ |
201 | QPtrList<Attachment> attachments() const; | 202 | QPtrList<Attachment> attachments() const; |
202 | /** find a list of attachments with this mime type */ | 203 | /** find a list of attachments with this mime type */ |
203 | QPtrList<Attachment> attachments(const QString& mime) const; | 204 | QPtrList<Attachment> attachments(const QString& mime) const; |
204 | 205 | ||
205 | /** sets the event's status the value specified. See the enumeration | 206 | /** sets the event's status the value specified. See the enumeration |
206 | * above for possible values. */ | 207 | * above for possible values. */ |
207 | void setSecrecy(int); | 208 | void setSecrecy(int); |
208 | /** return the event's secrecy. */ | 209 | /** return the event's secrecy. */ |
209 | int secrecy() const; | 210 | int secrecy() const; |
210 | /** return the event's secrecy in string format. */ | 211 | /** return the event's secrecy in string format. */ |
211 | QString secrecyStr() const; | 212 | QString secrecyStr() const; |
212 | /** return list of all availbale secrecy classes */ | 213 | /** return list of all availbale secrecy classes */ |
213 | static QStringList secrecyList(); | 214 | static QStringList secrecyList(); |
214 | /** return human-readable name of secrecy class */ | 215 | /** return human-readable name of secrecy class */ |
215 | static QString secrecyName(int); | 216 | static QString secrecyName(int); |
216 | 217 | ||
217 | /** 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 |
218 | * recur. */ | 219 | * recur. */ |
219 | bool recursOn(const QDate &qd) const; | 220 | bool recursOn(const QDate &qd) const; |
220 | 221 | ||
221 | // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): | 222 | // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): |
222 | 223 | ||
223 | /** set resources used, such as Office, Car, etc. */ | 224 | /** set resources used, such as Office, Car, etc. */ |
224 | void setResources(const QStringList &resources); | 225 | void setResources(const QStringList &resources); |
225 | /** return list of current resources */ | 226 | /** return list of current resources */ |
226 | QStringList resources() const; | 227 | QStringList resources() const; |
227 | 228 | ||
228 | /** 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) */ |
229 | void setPriority(int priority); | 230 | void setPriority(int priority); |
230 | /** get the event's priority */ | 231 | /** get the event's priority */ |
231 | int priority() const; | 232 | int priority() const; |
232 | 233 | ||
233 | /** All alarms that are associated with this incidence */ | 234 | /** All alarms that are associated with this incidence */ |
234 | QPtrList<Alarm> alarms() const; | 235 | QPtrList<Alarm> alarms() const; |
235 | /** Create a new alarm which is associated with this incidence */ | 236 | /** Create a new alarm which is associated with this incidence */ |
236 | Alarm* newAlarm(); | 237 | Alarm* newAlarm(); |
237 | /** Add an alarm which is associated with this incidence */ | 238 | /** Add an alarm which is associated with this incidence */ |
238 | void addAlarm(Alarm*); | 239 | void addAlarm(Alarm*); |
239 | /** Remove an alarm that is associated with this incidence */ | 240 | /** Remove an alarm that is associated with this incidence */ |
240 | void removeAlarm(Alarm*); | 241 | void removeAlarm(Alarm*); |
241 | /** Remove all alarms that are associated with this incidence */ | 242 | /** Remove all alarms that are associated with this incidence */ |
242 | void clearAlarms(); | 243 | void clearAlarms(); |
243 | /** return whether any alarm associated with this incidence is enabled */ | 244 | /** return whether any alarm associated with this incidence is enabled */ |
244 | bool isAlarmEnabled() const; | 245 | bool isAlarmEnabled() const; |
245 | 246 | ||
246 | /** | 247 | /** |
247 | Return the recurrence rule associated with this incidence. If there is | 248 | Return the recurrence rule associated with this incidence. If there is |
248 | none, returns an appropriate (non-0) object. | 249 | none, returns an appropriate (non-0) object. |
249 | */ | 250 | */ |
250 | Recurrence *recurrence() const; | 251 | Recurrence *recurrence() const; |
251 | void setRecurrence(Recurrence * r); | 252 | void setRecurrence(Recurrence * r); |
252 | /** | 253 | /** |
253 | Forward to Recurrence::doesRecur(). | 254 | Forward to Recurrence::doesRecur(). |
254 | */ | 255 | */ |
255 | ushort doesRecur() const; | 256 | ushort doesRecur() const; |
256 | 257 | ||
257 | /** 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 */ |
258 | void setLocation(const QString &location); | 259 | void setLocation(const QString &location); |
259 | /** 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 */ |
260 | QString location() const; | 261 | QString location() const; |
261 | /** 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 */ |
262 | bool hasStartDate() const; | 263 | bool hasStartDate() const; |
263 | /** sets the event's hasStartDate value. */ | 264 | /** sets the event's hasStartDate value. */ |
264 | void setHasStartDate(bool f); | 265 | void setHasStartDate(bool f); |
265 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; | 266 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; |
266 | bool cancelled() const; | 267 | bool cancelled() const; |
267 | void setCancelled( bool b ); | 268 | void setCancelled( bool b ); |
268 | 269 | ||
269 | bool hasRecurrenceID() const; | 270 | bool hasRecurrenceID() const; |
270 | void setHasRecurrenceID( bool b ); | 271 | void setHasRecurrenceID( bool b ); |
271 | 272 | ||
272 | void setRecurrenceID(QDateTime); | 273 | void setRecurrenceID(QDateTime); |
273 | QDateTime recurrenceID () const; | 274 | QDateTime recurrenceID () const; |
274 | QDateTime dtStart() const; | 275 | QDateTime dtStart() const; |
275 | bool isHoliday() const; | 276 | bool isHoliday() const; |
276 | bool isBirthday() const; | 277 | bool isBirthday() const; |
277 | bool isAnniversary() const; | 278 | bool isAnniversary() const; |
278 | 279 | ||
279 | 280 | ||
280 | protected: | 281 | protected: |
281 | QPtrList<Alarm> mAlarms; | 282 | QPtrList<Alarm> mAlarms; |
282 | QPtrList<Incidence> mRelations; | 283 | QPtrList<Incidence> mRelations; |
283 | QDateTime mRecurrenceID; | 284 | QDateTime mRecurrenceID; |
284 | bool mHasRecurrenceID; | 285 | bool mHasRecurrenceID; |
285 | private: | 286 | private: |
286 | void checkCategories(); | 287 | void checkCategories(); |
287 | bool mHoliday, mBirthday, mAnniversary; | 288 | bool mHoliday, mBirthday, mAnniversary; |
288 | int mRevision; | 289 | int mRevision; |
289 | bool mCancelled; | 290 | bool mCancelled; |
290 | 291 | ||
291 | // base components of jounal, event and todo | 292 | // base components of jounal, event and todo |
292 | QDateTime mCreated; | 293 | QDateTime mCreated; |
293 | QString mDescription; | 294 | QString mDescription; |
294 | QString mSummary; | 295 | QString mSummary; |
295 | QStringList mCategories; | 296 | QStringList mCategories; |
296 | Incidence *mRelatedTo; | 297 | Incidence *mRelatedTo; |
297 | QString mRelatedToUid; | 298 | QString mRelatedToUid; |
298 | DateList mExDates; | 299 | DateList mExDates; |
299 | QPtrList<Attachment> mAttachments; | 300 | QPtrList<Attachment> mAttachments; |
300 | QStringList mResources; | 301 | QStringList mResources; |
301 | bool mHasStartDate; // if todo has associated start date | 302 | bool mHasStartDate; // if todo has associated start date |
302 | 303 | ||
303 | int mSecrecy; | 304 | int mSecrecy; |
304 | int mPriority; // 1 = highest, 2 = less, etc. | 305 | int mPriority; // 1 = highest, 2 = less, etc. |
305 | 306 | ||
306 | //QPtrList<Alarm> mAlarms; | 307 | //QPtrList<Alarm> mAlarms; |
307 | Recurrence *mRecurrence; | 308 | Recurrence *mRecurrence; |
308 | 309 | ||
309 | QString mLocation; | 310 | QString mLocation; |
310 | }; | 311 | }; |
311 | 312 | ||
312 | bool operator==( const Incidence&, const Incidence& ); | 313 | bool operator==( const Incidence&, const Incidence& ); |
313 | 314 | ||
314 | } | 315 | } |
315 | 316 | ||
316 | #endif | 317 | #endif |