-rw-r--r-- | library/backend/event.cpp | 539 |
1 files changed, 512 insertions, 27 deletions
diff --git a/library/backend/event.cpp b/library/backend/event.cpp index 50a663d..7110717 100644 --- a/library/backend/event.cpp +++ b/library/backend/event.cpp | |||
@@ -1,830 +1,1315 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "event.h" | 21 | #include "event.h" |
22 | #include "qfiledirect_p.h" | 22 | #include "qfiledirect_p.h" |
23 | #include <qpe/timeconversion.h> | 23 | #include <qtopia/timeconversion.h> |
24 | #include <qpe/stringutil.h> | 24 | #include <qtopia/stringutil.h> |
25 | #include <qpe/recordfields.h> | 25 | #include <qtopia/private/recordfields.h> |
26 | #include <qbuffer.h> | 26 | #include <qbuffer.h> |
27 | #include <time.h> | 27 | #include <time.h> |
28 | #include "vobject_p.h" | 28 | #include "vobject_p.h" |
29 | 29 | ||
30 | #include <stdio.h> | 30 | #include <stdio.h> |
31 | 31 | ||
32 | using namespace Qtopia; | 32 | using namespace Qtopia; |
33 | 33 | ||
34 | static void write( QString& buf, const Event::RepeatPattern &r ) | 34 | static void write( QString& buf, const Event::RepeatPattern &r ) |
35 | { | 35 | { |
36 | buf += " rtype=\""; | 36 | buf += " rtype=\""; |
37 | switch ( r.type ) { | 37 | switch ( r.type ) { |
38 | case Event::Daily: | 38 | case Event::Daily: |
39 | buf += "Daily"; | 39 | buf += "Daily"; |
40 | break; | 40 | break; |
41 | case Event::Weekly: | 41 | case Event::Weekly: |
42 | buf += "Weekly"; | 42 | buf += "Weekly"; |
43 | break; | 43 | break; |
44 | case Event::MonthlyDay: | 44 | case Event::MonthlyDay: |
45 | buf += "MonthlyDay"; | 45 | buf += "MonthlyDay"; |
46 | break; | 46 | break; |
47 | case Event::MonthlyDate: | 47 | case Event::MonthlyDate: |
48 | buf += "MonthlyDate"; | 48 | buf += "MonthlyDate"; |
49 | break; | 49 | break; |
50 | case Event::Yearly: | 50 | case Event::Yearly: |
51 | buf += "Yearly"; | 51 | buf += "Yearly"; |
52 | break; | 52 | break; |
53 | default: | 53 | default: |
54 | buf += "NoRepeat"; | 54 | buf += "NoRepeat"; |
55 | break; | 55 | break; |
56 | } | 56 | } |
57 | buf += "\""; | 57 | buf += "\""; |
58 | if ( r.days > 0 ) | 58 | if ( r.days > 0 ) |
59 | buf += " rweekdays=\"" + QString::number( static_cast<int>( r.days ) ) + "\""; | 59 | buf += " rweekdays=\"" + QString::number( static_cast<int>( r.days ) ) + "\""; |
60 | if ( r.position != 0 ) | 60 | if ( r.position != 0 ) |
61 | buf += " rposition=\"" + QString::number( r.position ) + "\""; | 61 | buf += " rposition=\"" + QString::number( r.position ) + "\""; |
62 | 62 | ||
63 | buf += " rfreq=\"" + QString::number( r.frequency ) + "\""; | 63 | buf += " rfreq=\"" + QString::number( r.frequency ) + "\""; |
64 | buf += " rhasenddate=\"" + QString::number( static_cast<int>( r.hasEndDate ) ) + "\""; | 64 | buf += " rhasenddate=\"" + QString::number( static_cast<int>( r.hasEndDate ) ) + "\""; |
65 | if ( r.hasEndDate ) | 65 | if ( r.hasEndDate ) |
66 | buf += " enddt=\"" | 66 | buf += " enddt=\"" |
67 | + QString::number( r.endDateUTC ? r.endDateUTC : time( 0 ) ) | 67 | + QString::number( r.endDateUTC ? r.endDateUTC : time( 0 ) ) |
68 | + "\""; | 68 | + "\""; |
69 | buf += " created=\"" + QString::number( r.createTime ) + "\""; | 69 | buf += " created=\"" + QString::number( r.createTime ) + "\""; |
70 | } | 70 | } |
71 | 71 | ||
72 | Qtopia::UidGen Event::sUidGen( Qtopia::UidGen::Qtopia ); | 72 | Qtopia::UidGen Event::sUidGen( Qtopia::UidGen::Qtopia ); |
73 | 73 | ||
74 | /*! | ||
75 | \class Event event.h | ||
76 | \brief The Event class holds the data of a calendar event. | ||
77 | |||
78 | This data includes descriptive data of the event and schedualing information. | ||
79 | |||
80 | \ingroup qtopiaemb | ||
81 | \ingroup qtopiadesktop | ||
82 | */ | ||
83 | |||
84 | /*! | ||
85 | \class Event::RepeatPattern | ||
86 | \class The Event::RepeatPattern class is internal. | ||
87 | \internal | ||
88 | */ | ||
89 | |||
90 | /*! | ||
91 | \enum Event::Days | ||
92 | \internal | ||
93 | */ | ||
94 | |||
95 | /*! | ||
96 | \enum Event::Type | ||
97 | \internal | ||
98 | */ | ||
99 | |||
100 | /*! | ||
101 | \enum Event::SoundTypeChoice | ||
102 | |||
103 | This enum type defines what kind of sound is made when an alarm occurs | ||
104 | for an event. The currently defined types are: | ||
105 | |||
106 | <ul> | ||
107 | <li>\c Silent - No sound is produced. | ||
108 | <li>\c Loud - A loud sound is produced. | ||
109 | </ul> | ||
110 | */ | ||
111 | |||
112 | /*! | ||
113 | \fn bool Event::operator<( const Event & ) const | ||
114 | \internal | ||
115 | */ | ||
116 | |||
117 | /*! | ||
118 | \fn bool Event::operator<=( const Event & ) const | ||
119 | \internal | ||
120 | */ | ||
121 | |||
122 | /*! | ||
123 | \fn bool Event::operator!=( const Event & ) const | ||
124 | \internal | ||
125 | */ | ||
126 | |||
127 | /*! | ||
128 | \fn bool Event::operator>( const Event & ) const | ||
129 | \internal | ||
130 | */ | ||
131 | |||
132 | /*! | ||
133 | \fn bool Event::operator>=( const Event & ) const | ||
134 | \internal | ||
135 | */ | ||
136 | |||
137 | /*! | ||
138 | \enum Event::RepeatType | ||
139 | |||
140 | This enum defines how a event will repeat, if at all. | ||
141 | |||
142 | <ul> | ||
143 | <li>\c NoRepeat - Event does not repeat. | ||
144 | <li>\c Daily - Event occurs every n days. | ||
145 | <li>\c Weekly - Event occurs every n weeks. | ||
146 | <li>\c MonthlyDay - Event occurs every n months. Event will always occur in | ||
147 | the same week and same day of week as the first event. | ||
148 | <li>\c MonthlyDate - Event occurs every n months. Event will always occur | ||
149 | on the same day of the month as the first event. | ||
150 | <li>\c Yearly - Event occurs every n years. | ||
151 | </ul> | ||
152 | */ | ||
153 | |||
154 | /*! | ||
155 | \fn bool Event::isAllDay() const | ||
156 | |||
157 | Returns TRUE if the event is an all day event. Otherwise returns FALSE. | ||
158 | */ | ||
159 | |||
160 | /*! | ||
161 | \fn void Event::setAllDay(bool allday) | ||
162 | |||
163 | If \a allday is TRUE, will set the event to be an all day event. | ||
164 | Otherwise sets the event to not be an all day event. | ||
165 | |||
166 | \warning This function may affect the start and end times of the event. | ||
167 | */ | ||
168 | |||
169 | /*! | ||
170 | \fn QDateTime Event::start() const | ||
171 | |||
172 | Returns the start date and time of the first occurance of the event. | ||
173 | */ | ||
174 | |||
175 | /*! | ||
176 | \fn QDateTime Event::end() const | ||
177 | |||
178 | Returns the end date and time of the first occurance of the event. | ||
179 | */ | ||
180 | |||
181 | /*! | ||
182 | \fn time_t Event::startTime() const | ||
183 | \internal | ||
184 | */ | ||
185 | |||
186 | /*! | ||
187 | \fn time_t Event::endTime() const | ||
188 | \internal | ||
189 | */ | ||
190 | |||
191 | /*! | ||
192 | \fn void Event::setAlarm(int delay, SoundTypeChoice s) | ||
193 | |||
194 | Sets the alarm delay of the event to \a delay and the sound type of the | ||
195 | alarm to \a s. | ||
196 | */ | ||
197 | |||
198 | /*! | ||
199 | \fn void Event::clearAlarm() | ||
200 | |||
201 | Clears the alarm for the event. | ||
202 | */ | ||
203 | |||
204 | /*! | ||
205 | \fn int Event::alarmDelay() const | ||
206 | |||
207 | Returns the delay in minutes between the alarm for an event and the | ||
208 | start of the event. | ||
209 | */ | ||
210 | |||
211 | /*! | ||
212 | \fn Event::RepeatType Event::repeatType() const | ||
213 | |||
214 | Returns the repeat pattern type for the event. | ||
215 | |||
216 | \sa frequency() | ||
217 | */ | ||
218 | |||
219 | /*! | ||
220 | \fn int Event::weekOffset() const | ||
221 | |||
222 | Returns the number of weeks from the start of the month that this event | ||
223 | occurs. | ||
224 | */ | ||
225 | |||
226 | /*! | ||
227 | \fn QDate Event::repeatTill() const | ||
228 | |||
229 | Returns the date that the event will continue to repeat until. If the event | ||
230 | repeats forever the value returned is undefined. | ||
231 | |||
232 | \sa repeatForever() | ||
233 | */ | ||
234 | |||
235 | /*! | ||
236 | \fn bool Event::repeatForever() const | ||
237 | |||
238 | Returns FALSE if there is a date set for the event to continue until. | ||
239 | Otherwise returns TRUE. | ||
240 | */ | ||
241 | |||
242 | /*! | ||
243 | \fn bool Event::doRepeat() const | ||
244 | \internal | ||
245 | */ | ||
246 | |||
247 | /*! | ||
248 | \fn bool Event::repeatOnWeekDay(int day) const | ||
249 | |||
250 | Returns TRUE if the event has a RepeatType of Weekly and is set to occur on | ||
251 | \a day each week. Otherwise returns FALSE. | ||
252 | |||
253 | \sa QDate::dayName() | ||
254 | */ | ||
255 | |||
256 | /*! | ||
257 | \fn void Event::setRepeatOnWeekDay(int day, bool enable) | ||
258 | |||
259 | If \a enable is TRUE then sets the event to occur on \a day each week. | ||
260 | Otherwise sets the event not to occur on \a day. | ||
261 | |||
262 | \warning this function is only relavent for a event with RepeatType of | ||
263 | Weekly. | ||
264 | |||
265 | \sa QDate::dayName() | ||
266 | */ | ||
267 | |||
268 | /*! | ||
269 | \fn int Event::frequency() const | ||
270 | |||
271 | Returns how often the event repeats. | ||
272 | |||
273 | \sa repeatType() | ||
274 | */ | ||
275 | |||
276 | /*! | ||
277 | \fn void Event::setRepeatType(RepeatType t) | ||
278 | |||
279 | Sets the repeat pattern type of the event to \a t. | ||
280 | |||
281 | \sa setFrequency() | ||
282 | */ | ||
283 | |||
284 | /*! | ||
285 | \fn void Event::setFrequency(int n) | ||
286 | |||
287 | Sets how often the event occurs with in its repeat pattern. | ||
288 | |||
289 | \sa setRepeatType() | ||
290 | */ | ||
291 | |||
292 | /*! | ||
293 | \fn void Event::setRepeatTill(const QDate &d) | ||
294 | |||
295 | Sets the event to repeat until \a d. | ||
296 | */ | ||
297 | |||
298 | /*! | ||
299 | \fn void Event::setRepeatForever(bool enable) | ||
300 | |||
301 | If \a enable is TRUE, sets the event to repeat forever. Otherwise | ||
302 | sets the event to stop repeating at some date. | ||
303 | |||
304 | \warning This function may affect the specific date the event will repeat | ||
305 | till. | ||
306 | */ | ||
307 | |||
308 | /*! | ||
309 | \fn bool Event::match(const QRegExp &r) const | ||
310 | |||
311 | Returns TRUE if the event matches the regular expression \a r. | ||
312 | Otherwise returns FALSE. | ||
313 | */ | ||
314 | |||
315 | /*! | ||
316 | \fn char Event::day(int) | ||
317 | \internal | ||
318 | */ | ||
319 | |||
320 | /*! | ||
321 | Creates a new, empty event. | ||
322 | */ | ||
74 | Event::Event() : Record() | 323 | Event::Event() : Record() |
75 | { | 324 | { |
76 | startUTC = endUTC = time( 0 ); | 325 | startUTC = endUTC = time( 0 ); |
77 | typ = Normal; | 326 | typ = Normal; |
78 | hAlarm = FALSE; | 327 | hAlarm = FALSE; |
79 | hRepeat = FALSE; | 328 | hRepeat = FALSE; |
80 | aMinutes = 0; | 329 | aMinutes = 0; |
81 | aSound = Silent; | 330 | aSound = Silent; |
82 | pattern.type = NoRepeat; | 331 | pattern.type = NoRepeat; |
83 | pattern.frequency = -1; | 332 | pattern.frequency = -1; |
84 | } | 333 | } |
85 | 334 | ||
335 | /*! | ||
336 | \internal | ||
337 | */ | ||
86 | Event::Event( const QMap<int, QString> &map ) | 338 | Event::Event( const QMap<int, QString> &map ) |
87 | { | 339 | { |
88 | setDescription( map[DatebookDescription] ); | 340 | setDescription( map[DatebookDescription] ); |
89 | setLocation( map[Location] ); | 341 | setLocation( map[Location] ); |
90 | setCategories( idsFromString( map[DatebookCategory] ) ); | 342 | setCategories( idsFromString( map[DatebookCategory] ) ); |
91 | setTimeZone( map[TimeZone] ); | 343 | setTimeZone( map[TimeZone] ); |
92 | setNotes( map[Note] ); | 344 | setNotes( map[Note] ); |
93 | setStart( TimeConversion::fromUTC( map[StartDateTime].toUInt() ) ); | 345 | setStart( TimeConversion::fromUTC( map[StartDateTime].toUInt() ) ); |
94 | setEnd( TimeConversion::fromUTC( map[EndDateTime].toUInt() ) ); | 346 | setEnd( TimeConversion::fromUTC( map[EndDateTime].toUInt() ) ); |
95 | setType( (Event::Type) map[DatebookType].toInt() ); | 347 | setType( (Event::Type) map[DatebookType].toInt() ); |
96 | setAlarm( ( map[HasAlarm] == "1" ? TRUE : FALSE ), map[AlarmTime].toInt(), (Event::SoundTypeChoice)map[SoundType].toInt() ); | 348 | setAlarm( ( map[HasAlarm] == "1" ? TRUE : FALSE ), map[AlarmTime].toInt(), (Event::SoundTypeChoice)map[SoundType].toInt() ); |
97 | Event::RepeatPattern p; | 349 | Event::RepeatPattern p; |
98 | p.type = (Event::RepeatType) map[ RepeatPatternType ].toInt(); | 350 | p.type = (Event::RepeatType) map[ RepeatPatternType ].toInt(); |
99 | p.frequency = map[ RepeatPatternFrequency ].toInt(); | 351 | p.frequency = map[ RepeatPatternFrequency ].toInt(); |
100 | p.position = map[ RepeatPatternPosition ].toInt(); | 352 | p.position = map[ RepeatPatternPosition ].toInt(); |
101 | p.days = map[ RepeatPatternDays ].toInt(); | 353 | p.days = map[ RepeatPatternDays ].toInt(); |
102 | p.hasEndDate = map[ RepeatPatternHasEndDate ].toInt(); | 354 | p.hasEndDate = map[ RepeatPatternHasEndDate ].toInt(); |
103 | p.endDateUTC = map[ RepeatPatternEndDate ].toUInt(); | 355 | p.endDateUTC = map[ RepeatPatternEndDate ].toUInt(); |
104 | setRepeat( p ); | 356 | setRepeat( p ); |
105 | 357 | ||
106 | setUid( map[ DatebookUid ].toInt() ); | 358 | setUid( map[ DatebookUid ].toInt() ); |
107 | } | 359 | } |
108 | 360 | ||
361 | /*! | ||
362 | Destroys an event. | ||
363 | */ | ||
109 | Event::~Event() | 364 | Event::~Event() |
110 | { | 365 | { |
111 | } | 366 | } |
112 | 367 | ||
368 | /*! | ||
369 | \internal | ||
370 | */ | ||
113 | int Event::week( const QDate& date ) | 371 | int Event::week( const QDate& date ) |
114 | { | 372 | { |
115 | // Calculates the week this date is in within that | 373 | // Calculates the week this date is in within that |
116 | // month. Equals the "row" is is in in the month view | 374 | // month. Equals the "row" is is in in the month view |
117 | int week = 1; | 375 | int week = 1; |
118 | QDate tmp( date.year(), date.month(), 1 ); | 376 | QDate tmp( date.year(), date.month(), 1 ); |
119 | 377 | ||
120 | if ( date.dayOfWeek() < tmp.dayOfWeek() ) | 378 | if ( date.dayOfWeek() < tmp.dayOfWeek() ) |
121 | ++week; | 379 | ++week; |
122 | 380 | ||
123 | week += ( date.day() - 1 ) / 7; | 381 | week += ( date.day() - 1 ) / 7; |
124 | return week; | 382 | return week; |
125 | } | 383 | } |
126 | 384 | ||
385 | /*! | ||
386 | \internal | ||
387 | */ | ||
127 | int Event::occurrence( const QDate& date ) | 388 | int Event::occurrence( const QDate& date ) |
128 | { | 389 | { |
129 | // calculates the number of occurrances of this day of the | 390 | // calculates the number of occurrances of this day of the |
130 | // week till the given date (e.g 3rd Wednesday of the month) | 391 | // week till the given date (e.g 3rd Wednesday of the month) |
131 | return ( date.day() - 1 ) / 7 + 1; | 392 | return ( date.day() - 1 ) / 7 + 1; |
132 | } | 393 | } |
133 | 394 | ||
395 | /*! | ||
396 | \internal | ||
397 | */ | ||
134 | int Event::dayOfWeek( char day ) | 398 | int Event::dayOfWeek( char day ) |
135 | { | 399 | { |
136 | int dayOfWeek = 1; | 400 | int dayOfWeek = 1; |
137 | char i = Event::MON; | 401 | char i = Event::MON; |
138 | while ( !( i & day ) && i <= Event::SUN ) { | 402 | while ( !( i & day ) && i <= Event::SUN ) { |
139 | i <<= 1; | 403 | i <<= 1; |
140 | ++dayOfWeek; | 404 | ++dayOfWeek; |
141 | } | 405 | } |
142 | return dayOfWeek; | 406 | return dayOfWeek; |
143 | } | 407 | } |
144 | 408 | ||
409 | /*! | ||
410 | \internal | ||
411 | */ | ||
145 | int Event::monthDiff( const QDate& first, const QDate& second ) | 412 | int Event::monthDiff( const QDate& first, const QDate& second ) |
146 | { | 413 | { |
147 | return ( second.year() - first.year() ) * 12 + | 414 | return ( second.year() - first.year() ) * 12 + |
148 | second.month() - first.month(); | 415 | second.month() - first.month(); |
149 | } | 416 | } |
150 | 417 | ||
418 | /*! | ||
419 | \internal | ||
420 | */ | ||
151 | QMap<int, QString> Event::toMap() const | 421 | QMap<int, QString> Event::toMap() const |
152 | { | 422 | { |
153 | QMap<int, QString> m; | 423 | QMap<int, QString> m; |
154 | m.insert( DatebookDescription, description() ); | 424 | |
155 | m.insert ( Location, location() ); | 425 | if ( !description().isEmpty() ) |
156 | m.insert ( DatebookCategory, idsToString( categories() ) ); | 426 | m.insert( DatebookDescription, description() ); |
157 | m.insert ( TimeZone, timeZone() ); | 427 | if ( !location().isEmpty() ) |
158 | m.insert ( Note, notes() ); | 428 | m.insert ( Location, location() ); |
429 | if ( categories().count() ) | ||
430 | m.insert ( DatebookCategory, idsToString( categories() ) ); | ||
431 | if ( !timeZone().isEmpty() ) | ||
432 | m.insert ( TimeZone, timeZone() ); | ||
433 | if ( !notes().isEmpty() ) | ||
434 | m.insert ( Note, notes() ); | ||
435 | |||
159 | m.insert ( StartDateTime, QString::number( TimeConversion::toUTC( start() ) ) ); | 436 | m.insert ( StartDateTime, QString::number( TimeConversion::toUTC( start() ) ) ); |
160 | m.insert ( EndDateTime, QString::number( TimeConversion::toUTC( end() ) ) ); | 437 | m.insert ( EndDateTime, QString::number( TimeConversion::toUTC( end() ) ) ); |
161 | m.insert ( DatebookType, QString::number( (int)type() ) ); | 438 | m.insert ( DatebookType, QString::number( (int)type() ) ); |
162 | m.insert ( HasAlarm, ( hasAlarm() ? "1" : "0" ) ); | 439 | m.insert ( HasAlarm, ( hasAlarm() ? "1" : "0" ) ); |
163 | m.insert ( SoundType, QString::number( (int)alarmSound() ) ); | 440 | m.insert ( SoundType, QString::number( (int)alarmSound() ) ); |
164 | m.insert ( AlarmTime, QString::number( alarmTime() ) ); | 441 | m.insert ( AlarmTime, QString::number( alarmTime() ) ); |
165 | m.insert ( RepeatPatternType, QString::number( static_cast<int>( repeatPattern().type ) ) ); | 442 | m.insert ( RepeatPatternType, QString::number( static_cast<int>( repeatPattern().type ) ) ); |
166 | m.insert ( RepeatPatternFrequency, QString::number( repeatPattern().frequency ) ); | 443 | m.insert ( RepeatPatternFrequency, QString::number( repeatPattern().frequency ) ); |
167 | m.insert ( RepeatPatternPosition, QString::number( repeatPattern().position ) ); | 444 | m.insert ( RepeatPatternPosition, QString::number( repeatPattern().position ) ); |
168 | m.insert ( RepeatPatternDays, QString::number( repeatPattern().days ) ); | 445 | m.insert ( RepeatPatternDays, QString::number( repeatPattern().days ) ); |
169 | m.insert ( RepeatPatternHasEndDate, QString::number( static_cast<int>( repeatPattern().hasEndDate ) ) ); | 446 | m.insert ( RepeatPatternHasEndDate, QString::number( static_cast<int>( repeatPattern().hasEndDate ) ) ); |
170 | m.insert ( RepeatPatternEndDate, QString::number( repeatPattern().endDateUTC ) ); | 447 | m.insert ( RepeatPatternEndDate, QString::number( repeatPattern().endDateUTC ) ); |
171 | 448 | ||
172 | m.insert( DatebookUid, QString::number( uid()) ); | 449 | m.insert( DatebookUid, QString::number( uid()) ); |
173 | 450 | ||
174 | return m; | 451 | return m; |
175 | } | 452 | } |
176 | 453 | ||
454 | /*! | ||
455 | \internal | ||
456 | */ | ||
177 | void Event::setRepeat( const RepeatPattern &p ) | 457 | void Event::setRepeat( const RepeatPattern &p ) |
178 | { | 458 | { |
179 | setRepeat( p.type != NoRepeat, p ); | 459 | setRepeat( p.type != NoRepeat, p ); |
180 | } | 460 | } |
181 | 461 | ||
462 | /*! | ||
463 | Sets the description of the event to \a s. | ||
464 | */ | ||
182 | void Event::setDescription( const QString &s ) | 465 | void Event::setDescription( const QString &s ) |
183 | { | 466 | { |
184 | descript = s; | 467 | descript = s; |
185 | } | 468 | } |
186 | 469 | ||
470 | /*! | ||
471 | Sets the location of the event to \a s. | ||
472 | */ | ||
187 | void Event::setLocation( const QString &s ) | 473 | void Event::setLocation( const QString &s ) |
188 | { | 474 | { |
189 | locat = s; | 475 | locat = s; |
190 | } | 476 | } |
191 | 477 | ||
192 | // void Event::setCategory( const QString &s ) | 478 | // void Event::setCategory( const QString &s ) |
193 | // { | 479 | // { |
194 | // categ = s; | 480 | // categ = s; |
195 | // } | 481 | // } |
196 | 482 | ||
483 | /*! | ||
484 | \internal | ||
485 | */ | ||
197 | void Event::setType( Type t ) | 486 | void Event::setType( Type t ) |
198 | { | 487 | { |
199 | typ = t; | 488 | typ = t; |
200 | } | 489 | } |
201 | 490 | ||
491 | /*! | ||
492 | Sets the start date and time of the first or only occurance of this event | ||
493 | to the date and time \a d. \a d should be in local time. | ||
494 | */ | ||
202 | void Event::setStart( const QDateTime &d ) | 495 | void Event::setStart( const QDateTime &d ) |
203 | { | 496 | { |
204 | startUTC = TimeConversion::toUTC( d ); | 497 | startUTC = TimeConversion::toUTC( d ); |
205 | } | 498 | } |
206 | 499 | ||
500 | /*! | ||
501 | \internal | ||
502 | */ | ||
207 | void Event::setStart( time_t time ) | 503 | void Event::setStart( time_t time ) |
208 | { | 504 | { |
209 | startUTC = time; | 505 | startUTC = time; |
210 | } | 506 | } |
211 | 507 | ||
508 | /*! | ||
509 | Sets the end date and time of the first or only occurance of this event | ||
510 | to the date and time \a d. \a d should be in local time. | ||
511 | */ | ||
212 | void Event::setEnd( const QDateTime &d ) | 512 | void Event::setEnd( const QDateTime &d ) |
213 | { | 513 | { |
214 | endUTC = TimeConversion::toUTC( d ); | 514 | endUTC = TimeConversion::toUTC( d ); |
215 | } | 515 | } |
216 | 516 | ||
517 | /*! | ||
518 | \internal | ||
519 | */ | ||
217 | void Event::setEnd( time_t time ) | 520 | void Event::setEnd( time_t time ) |
218 | { | 521 | { |
219 | endUTC = time; | 522 | endUTC = time; |
220 | } | 523 | } |
221 | 524 | ||
525 | /*! | ||
526 | \internal | ||
527 | */ | ||
222 | void Event::setTimeZone( const QString &z ) | 528 | void Event::setTimeZone( const QString &z ) |
223 | { | 529 | { |
224 | tz = z; | 530 | tz = z; |
225 | } | 531 | } |
226 | 532 | ||
533 | /*! | ||
534 | \internal | ||
535 | */ | ||
227 | void Event::setAlarm( bool b, int minutes, SoundTypeChoice s ) | 536 | void Event::setAlarm( bool b, int minutes, SoundTypeChoice s ) |
228 | { | 537 | { |
229 | hAlarm = b; | 538 | hAlarm = b; |
230 | aMinutes = minutes; | 539 | aMinutes = minutes; |
231 | aSound = s; | 540 | aSound = s; |
232 | } | 541 | } |
233 | 542 | ||
543 | /*! | ||
544 | \internal | ||
545 | */ | ||
234 | void Event::setRepeat( bool b, const RepeatPattern &p ) | 546 | void Event::setRepeat( bool b, const RepeatPattern &p ) |
235 | { | 547 | { |
236 | hRepeat = b; | 548 | hRepeat = b; |
237 | pattern = p; | 549 | pattern = p; |
238 | } | 550 | } |
239 | 551 | ||
552 | /*! | ||
553 | Sets the notes for the event to \a n. | ||
554 | */ | ||
240 | void Event::setNotes( const QString &n ) | 555 | void Event::setNotes( const QString &n ) |
241 | { | 556 | { |
242 | note = n; | 557 | note = n; |
243 | } | 558 | } |
244 | 559 | ||
560 | /*! | ||
561 | Returns the description of the event. | ||
562 | */ | ||
245 | const QString &Event::description() const | 563 | const QString &Event::description() const |
246 | { | 564 | { |
247 | return descript; | 565 | return descript; |
248 | } | 566 | } |
249 | 567 | ||
568 | /*! | ||
569 | Returns the location of the event. | ||
570 | */ | ||
250 | const QString &Event::location() const | 571 | const QString &Event::location() const |
251 | { | 572 | { |
252 | return locat; | 573 | return locat; |
253 | } | 574 | } |
254 | 575 | ||
255 | // QString Event::category() const | 576 | // QString Event::category() const |
256 | // { | 577 | // { |
257 | // return categ; | 578 | // return categ; |
258 | // } | 579 | // } |
259 | 580 | ||
581 | /*! | ||
582 | \internal | ||
583 | */ | ||
260 | Event::Type Event::type() const | 584 | Event::Type Event::type() const |
261 | { | 585 | { |
262 | return typ; | 586 | return typ; |
263 | } | 587 | } |
264 | 588 | ||
589 | /*! | ||
590 | \internal | ||
591 | */ | ||
265 | QDateTime Event::start( bool actual ) const | 592 | QDateTime Event::start( bool actual ) const |
266 | { | 593 | { |
267 | QDateTime dt = (startUTC > 0) ? TimeConversion::fromUTC( startUTC ) : QDateTime::currentDateTime(); | 594 | QDateTime dt = (startUTC > 0) ? TimeConversion::fromUTC( startUTC ) : QDateTime::currentDateTime(); |
268 | 595 | ||
269 | if ( actual && typ == AllDay ) { | 596 | if ( actual && typ == AllDay ) { |
270 | QTime t = dt.time(); | 597 | QTime t = dt.time(); |
271 | t.setHMS( 0, 0, 0 ); | 598 | t.setHMS( 0, 0, 0 ); |
272 | dt.setTime( t ); | 599 | dt.setTime( t ); |
273 | } | 600 | } |
274 | return dt; | 601 | return dt; |
275 | } | 602 | } |
276 | 603 | ||
604 | /*! | ||
605 | \internal | ||
606 | */ | ||
277 | QDateTime Event::end( bool actual ) const | 607 | QDateTime Event::end( bool actual ) const |
278 | { | 608 | { |
279 | QDateTime dt = (endUTC > 0) ? TimeConversion::fromUTC( endUTC ) : QDateTime::currentDateTime(); | 609 | QDateTime dt = (endUTC > 0) ? TimeConversion::fromUTC( endUTC ) : QDateTime::currentDateTime(); |
280 | 610 | ||
281 | if ( actual && typ == AllDay ) { | 611 | if ( actual && typ == AllDay ) { |
282 | QTime t = dt.time(); | 612 | QTime t = dt.time(); |
283 | t.setHMS( 23, 59, 59 ); | 613 | t.setHMS( 23, 59, 59 ); |
284 | dt.setTime( t ); | 614 | dt.setTime( t ); |
285 | } | 615 | } |
286 | return dt; | 616 | return dt; |
287 | } | 617 | } |
288 | 618 | ||
619 | /*! | ||
620 | \internal | ||
621 | */ | ||
289 | const QString &Event::timeZone() const | 622 | const QString &Event::timeZone() const |
290 | { | 623 | { |
291 | return tz; | 624 | return tz; |
292 | } | 625 | } |
293 | 626 | ||
627 | /*! | ||
628 | \internal | ||
629 | */ | ||
294 | bool Event::hasAlarm() const | 630 | bool Event::hasAlarm() const |
295 | { | 631 | { |
296 | return hAlarm; | 632 | return hAlarm; |
297 | } | 633 | } |
298 | 634 | ||
635 | /*! | ||
636 | \internal | ||
637 | */ | ||
299 | int Event::alarmTime() const | 638 | int Event::alarmTime() const |
300 | { | 639 | { |
301 | return aMinutes; | 640 | return aMinutes; |
302 | } | 641 | } |
303 | 642 | ||
643 | /*! | ||
644 | Returns the sound type for the alarm of this event. | ||
645 | */ | ||
304 | Event::SoundTypeChoice Event::alarmSound() const | 646 | Event::SoundTypeChoice Event::alarmSound() const |
305 | { | 647 | { |
306 | return aSound; | 648 | return aSound; |
307 | } | 649 | } |
308 | 650 | ||
651 | /*! | ||
652 | \internal | ||
653 | */ | ||
309 | bool Event::hasRepeat() const | 654 | bool Event::hasRepeat() const |
310 | { | 655 | { |
311 | return doRepeat(); | 656 | return doRepeat(); |
312 | } | 657 | } |
313 | 658 | ||
659 | /*! | ||
660 | \internal | ||
661 | */ | ||
314 | const Event::RepeatPattern &Event::repeatPattern() const | 662 | const Event::RepeatPattern &Event::repeatPattern() const |
315 | { | 663 | { |
316 | return pattern; | 664 | return pattern; |
317 | } | 665 | } |
318 | 666 | ||
667 | /*! | ||
668 | \internal | ||
669 | */ | ||
319 | Event::RepeatPattern &Event::repeatPattern() | 670 | Event::RepeatPattern &Event::repeatPattern() |
320 | { | 671 | { |
321 | return pattern; | 672 | return pattern; |
322 | } | 673 | } |
323 | 674 | ||
675 | /*! | ||
676 | Returns the notes for the event. | ||
677 | */ | ||
324 | const QString &Event::notes() const | 678 | const QString &Event::notes() const |
325 | { | 679 | { |
326 | return note; | 680 | return note; |
327 | } | 681 | } |
328 | 682 | ||
683 | /*! | ||
684 | \internal | ||
685 | */ | ||
329 | bool Event::operator==( const Event &e ) const | 686 | bool Event::operator==( const Event &e ) const |
330 | { | 687 | { |
688 | if ( uid() && e.uid() == uid() ) | ||
689 | return TRUE; | ||
331 | return ( e.descript == descript && | 690 | return ( e.descript == descript && |
332 | e.locat == locat && | 691 | e.locat == locat && |
333 | e.categ == categ && | 692 | e.categ == categ && |
334 | e.typ == typ && | 693 | e.typ == typ && |
335 | e.startUTC == startUTC && | 694 | e.startUTC == startUTC && |
336 | e.endUTC == endUTC && | 695 | e.endUTC == endUTC && |
337 | e.tz == tz && | 696 | e.tz == tz && |
338 | e.hAlarm == hAlarm && | 697 | e.hAlarm == hAlarm && |
339 | e.aMinutes == aMinutes && | 698 | e.aMinutes == aMinutes && |
340 | e.aSound == aSound && | 699 | e.aSound == aSound && |
341 | e.hRepeat == hRepeat && | 700 | e.hRepeat == hRepeat && |
342 | e.pattern == pattern && | 701 | e.pattern == pattern && |
343 | e.note == note ); | 702 | e.note == note ); |
344 | } | 703 | } |
345 | 704 | ||
705 | /*! | ||
706 | \internal | ||
707 | Appends the contact information to \a buf. | ||
708 | */ | ||
346 | void Event::save( QString& buf ) | 709 | void Event::save( QString& buf ) |
347 | { | 710 | { |
348 | buf += " description=\"" + Qtopia::escapeString(descript) + "\""; | 711 | buf += " description=\"" + Qtopia::escapeString(descript) + "\""; |
349 | if ( !locat.isEmpty() ) | 712 | if ( !locat.isEmpty() ) |
350 | buf += " location=\"" + Qtopia::escapeString(locat) + "\""; | 713 | buf += " location=\"" + Qtopia::escapeString(locat) + "\""; |
351 | // save the categoies differently.... | 714 | // save the categoies differently.... |
352 | QString strCats = idsToString( categories() ); | 715 | QString strCats = idsToString( categories() ); |
353 | buf += " categories=\"" + Qtopia::escapeString(strCats) + "\""; | 716 | buf += " categories=\"" + Qtopia::escapeString(strCats) + "\""; |
354 | buf += " uid=\"" + QString::number( uid() ) + "\""; | 717 | buf += " uid=\"" + QString::number( uid() ) + "\""; |
355 | if ( (Type)typ != Normal ) | 718 | if ( (Type)typ != Normal ) |
356 | buf += " type=\"AllDay\""; | 719 | buf += " type=\"AllDay\""; |
357 | if ( hAlarm ) { | 720 | if ( hAlarm ) { |
358 | buf += " alarm=\"" + QString::number( aMinutes ) + "\" sound=\""; | 721 | buf += " alarm=\"" + QString::number( aMinutes ) + "\" sound=\""; |
359 | if ( aSound == Event::Loud ) | 722 | if ( aSound == Event::Loud ) |
360 | buf += "loud"; | 723 | buf += "loud"; |
361 | else | 724 | else |
362 | buf += "silent"; | 725 | buf += "silent"; |
363 | buf += "\""; | 726 | buf += "\""; |
364 | } | 727 | } |
365 | if ( hRepeat ) | 728 | if ( hRepeat ) |
366 | write( buf, pattern ); | 729 | write( buf, pattern ); |
367 | 730 | ||
368 | buf += " start=\"" | 731 | buf += " start=\"" |
369 | + QString::number( startUTC ) | 732 | + QString::number( startUTC ) |
370 | + "\""; | 733 | + "\""; |
371 | 734 | ||
372 | buf += " end=\"" | 735 | buf += " end=\"" |
373 | + QString::number( endUTC ) | 736 | + QString::number( endUTC ) |
374 | + "\""; | 737 | + "\""; |
375 | 738 | ||
376 | if ( !note.isEmpty() ) | 739 | if ( !note.isEmpty() ) |
377 | buf += " note=\"" + Qtopia::escapeString( note ) + "\""; | 740 | buf += " note=\"" + Qtopia::escapeString( note ) + "\""; |
378 | buf += customToXml(); | 741 | buf += customToXml(); |
379 | } | 742 | } |
380 | 743 | ||
744 | /*! | ||
745 | \internal | ||
746 | */ | ||
381 | bool Event::RepeatPattern::operator==( const Event::RepeatPattern &right ) const | 747 | bool Event::RepeatPattern::operator==( const Event::RepeatPattern &right ) const |
382 | { | 748 | { |
383 | // *sigh* | 749 | // *sigh* |
384 | return ( type == right.type | 750 | return ( type == right.type |
385 | && frequency == right.frequency | 751 | && frequency == right.frequency |
386 | && position == right.position | 752 | && position == right.position |
387 | && days == right.days | 753 | && days == right.days |
388 | && hasEndDate == right.hasEndDate | 754 | && hasEndDate == right.hasEndDate |
389 | && endDateUTC == right.endDateUTC | 755 | && endDateUTC == right.endDateUTC |
390 | && createTime == right.createTime ); | 756 | && createTime == right.createTime ); |
391 | } | 757 | } |
392 | 758 | ||
759 | /*! | ||
760 | \class EffectiveEvent | ||
761 | \brief The EffectiveEvent class the data for a single occurance of an event. | ||
762 | |||
763 | This class describes the event for a single occurance of it. For example if | ||
764 | an Event occurs every week, the effective event might represent the third | ||
765 | occurance of this Event. | ||
766 | |||
767 | \ingroup qtopiaemb | ||
768 | \ingroup qtopiadesktop | ||
769 | \warning This class will be phased out in Qtopia 3.x | ||
770 | */ | ||
771 | |||
772 | /*! | ||
773 | \enum EffectiveEvent::Position | ||
774 | \internal | ||
775 | */ | ||
776 | |||
777 | /*! | ||
778 | \fn EffectiveEvent &EffectiveEvent::operator=(const EffectiveEvent &) | ||
779 | \internal | ||
780 | */ | ||
393 | 781 | ||
394 | class EffectiveEventPrivate | 782 | class EffectiveEventPrivate |
395 | { | 783 | { |
396 | public: | 784 | public: |
397 | //currently the existence of the d pointer means multi-day repeating, | 785 | //currently the existence of the d pointer means multi-day repeating, |
398 | //msut be changed if we use the d pointer for anything else. | 786 | //msut be changed if we use the d pointer for anything else. |
399 | QDate startDate; | 787 | QDate startDate; |
400 | QDate endDate; | 788 | QDate endDate; |
401 | }; | 789 | }; |
402 | 790 | ||
403 | 791 | /*! | |
792 | \internal | ||
793 | */ | ||
404 | EffectiveEvent::EffectiveEvent() | 794 | EffectiveEvent::EffectiveEvent() |
405 | { | 795 | { |
406 | mDate = QDate::currentDate(); | 796 | mDate = QDate::currentDate(); |
407 | mStart = mEnd = QTime::currentTime(); | 797 | mStart = mEnd = QTime::currentTime(); |
408 | d = 0; | 798 | d = 0; |
409 | } | 799 | } |
410 | 800 | ||
801 | /*! | ||
802 | \internal | ||
803 | */ | ||
411 | EffectiveEvent::EffectiveEvent( const Event &e, const QDate &date, Position pos ) | 804 | EffectiveEvent::EffectiveEvent( const Event &e, const QDate &date, Position pos ) |
412 | { | 805 | { |
413 | mEvent = e; | 806 | mEvent = e; |
414 | mDate = date; | 807 | mDate = date; |
415 | if ( pos & Start ) | 808 | if ( pos & Start ) |
416 | mStart = e.start( TRUE ).time(); | 809 | mStart = e.start( TRUE ).time(); |
417 | else | 810 | else |
418 | mStart = QTime( 0, 0, 0 ); | 811 | mStart = QTime( 0, 0, 0 ); |
419 | 812 | ||
420 | if ( pos & End ) | 813 | if ( pos & End ) |
421 | mEnd = e.end( TRUE ).time(); | 814 | mEnd = e.end( TRUE ).time(); |
422 | else | 815 | else |
423 | mEnd = QTime( 23, 59, 59 ); | 816 | mEnd = QTime( 23, 59, 59 ); |
424 | d = 0; | 817 | d = 0; |
425 | } | 818 | } |
426 | 819 | ||
820 | /*! | ||
821 | \internal | ||
822 | */ | ||
427 | EffectiveEvent::~EffectiveEvent() | 823 | EffectiveEvent::~EffectiveEvent() |
428 | { | 824 | { |
429 | delete d; | 825 | delete d; |
430 | } | 826 | } |
431 | 827 | ||
828 | /*! | ||
829 | \internal | ||
830 | */ | ||
432 | EffectiveEvent::EffectiveEvent( const EffectiveEvent &e ) | 831 | EffectiveEvent::EffectiveEvent( const EffectiveEvent &e ) |
433 | { | 832 | { |
434 | d = 0; | 833 | d = 0; |
435 | *this = e; | 834 | *this = e; |
436 | } | 835 | } |
437 | 836 | ||
438 | EffectiveEvent& EffectiveEvent::operator=( const EffectiveEvent & e ) | 837 | EffectiveEvent& EffectiveEvent::operator=( const EffectiveEvent & e ) |
439 | { | 838 | { |
440 | if ( &e == this ) | 839 | if ( &e == this ) |
441 | return *this; | 840 | return *this; |
442 | delete d; | 841 | delete d; |
443 | if ( e.d ) { | 842 | if ( e.d ) { |
444 | d = new EffectiveEventPrivate; | 843 | d = new EffectiveEventPrivate; |
445 | d->startDate = e.d->startDate; | 844 | d->startDate = e.d->startDate; |
446 | d->endDate = e.d->endDate; | 845 | d->endDate = e.d->endDate; |
447 | } else { | 846 | } else { |
448 | d = 0; | 847 | d = 0; |
449 | } | 848 | } |
450 | mEvent = e.mEvent; | 849 | mEvent = e.mEvent; |
451 | mDate = e.mDate; | 850 | mDate = e.mDate; |
452 | mStart = e.mStart; | 851 | mStart = e.mStart; |
453 | mEnd = e.mEnd; | 852 | mEnd = e.mEnd; |
454 | 853 | ||
455 | return *this; | 854 | return *this; |
456 | 855 | ||
457 | } | 856 | } |
458 | 857 | ||
459 | // QString EffectiveEvent::category() const | 858 | // QString EffectiveEvent::category() const |
460 | // { | 859 | // { |
461 | // return mEvent.category(); | 860 | // return mEvent.category(); |
462 | // } | 861 | // } |
463 | 862 | ||
863 | /*! | ||
864 | Returns the description of the event for this effective event. | ||
865 | */ | ||
464 | const QString &EffectiveEvent::description( ) const | 866 | const QString &EffectiveEvent::description( ) const |
465 | { | 867 | { |
466 | return mEvent.description(); | 868 | return mEvent.description(); |
467 | } | 869 | } |
468 | 870 | ||
871 | /*! | ||
872 | \internal | ||
873 | */ | ||
469 | const QString &EffectiveEvent::location( ) const | 874 | const QString &EffectiveEvent::location( ) const |
470 | { | 875 | { |
471 | return mEvent.location(); | 876 | return mEvent.location(); |
472 | } | 877 | } |
473 | 878 | ||
879 | /*! | ||
880 | \internal | ||
881 | */ | ||
474 | const QString &EffectiveEvent::notes() const | 882 | const QString &EffectiveEvent::notes() const |
475 | { | 883 | { |
476 | return mEvent.notes(); | 884 | return mEvent.notes(); |
477 | } | 885 | } |
478 | 886 | ||
887 | /*! | ||
888 | Returns the event associated with this effective event. | ||
889 | */ | ||
479 | const Event &EffectiveEvent::event() const | 890 | const Event &EffectiveEvent::event() const |
480 | { | 891 | { |
481 | return mEvent; | 892 | return mEvent; |
482 | } | 893 | } |
483 | 894 | ||
895 | /*! | ||
896 | \internal | ||
897 | */ | ||
484 | const QTime &EffectiveEvent::end() const | 898 | const QTime &EffectiveEvent::end() const |
485 | { | 899 | { |
486 | return mEnd; | 900 | return mEnd; |
487 | } | 901 | } |
488 | 902 | ||
903 | /*! | ||
904 | \internal | ||
905 | */ | ||
489 | const QTime &EffectiveEvent::start() const | 906 | const QTime &EffectiveEvent::start() const |
490 | { | 907 | { |
491 | return mStart; | 908 | return mStart; |
492 | } | 909 | } |
493 | 910 | ||
911 | /*! | ||
912 | Returns the date the effective event occurs on. | ||
913 | */ | ||
494 | const QDate &EffectiveEvent::date() const | 914 | const QDate &EffectiveEvent::date() const |
495 | { | 915 | { |
496 | return mDate; | 916 | return mDate; |
497 | } | 917 | } |
498 | 918 | ||
919 | /*! | ||
920 | \internal | ||
921 | */ | ||
499 | int EffectiveEvent::length() const | 922 | int EffectiveEvent::length() const |
500 | { | 923 | { |
501 | return (mEnd.hour() * 60 - mStart.hour() * 60) | 924 | return (mEnd.hour() * 60 - mStart.hour() * 60) |
502 | + QABS(mStart.minute() - mEnd.minute() ); | 925 | + QABS(mStart.minute() - mEnd.minute() ); |
503 | } | 926 | } |
504 | 927 | ||
928 | /*! | ||
929 | \internal | ||
930 | */ | ||
505 | void EffectiveEvent::setDate( const QDate &dt ) | 931 | void EffectiveEvent::setDate( const QDate &dt ) |
506 | { | 932 | { |
507 | mDate = dt; | 933 | mDate = dt; |
508 | } | 934 | } |
509 | 935 | ||
936 | /*! | ||
937 | \internal | ||
938 | */ | ||
510 | void EffectiveEvent::setStart( const QTime &start ) | 939 | void EffectiveEvent::setStart( const QTime &start ) |
511 | { | 940 | { |
512 | mStart = start; | 941 | mStart = start; |
513 | } | 942 | } |
514 | 943 | ||
944 | /*! | ||
945 | \internal | ||
946 | */ | ||
515 | void EffectiveEvent::setEnd( const QTime &end ) | 947 | void EffectiveEvent::setEnd( const QTime &end ) |
516 | { | 948 | { |
517 | mEnd = end; | 949 | mEnd = end; |
518 | } | 950 | } |
519 | 951 | ||
952 | /*! | ||
953 | \internal | ||
954 | */ | ||
520 | void EffectiveEvent::setEvent( Event e ) | 955 | void EffectiveEvent::setEvent( Event e ) |
521 | { | 956 | { |
522 | mEvent = e; | 957 | mEvent = e; |
523 | } | 958 | } |
524 | 959 | ||
960 | /*! | ||
961 | \internal | ||
962 | */ | ||
525 | bool EffectiveEvent::operator<( const EffectiveEvent &e ) const | 963 | bool EffectiveEvent::operator<( const EffectiveEvent &e ) const |
526 | { | 964 | { |
527 | if ( mDate < e.date() ) | 965 | if ( mDate < e.date() ) |
528 | return TRUE; | 966 | return TRUE; |
529 | if ( mDate == e.date() ) | 967 | if ( mDate == e.date() ) |
530 | return ( mStart < e.start() ); | 968 | return ( mStart < e.start() ); |
531 | else | 969 | else |
532 | return FALSE; | 970 | return FALSE; |
533 | } | 971 | } |
534 | 972 | ||
973 | /*! | ||
974 | \internal | ||
975 | */ | ||
535 | bool EffectiveEvent::operator<=( const EffectiveEvent &e ) const | 976 | bool EffectiveEvent::operator<=( const EffectiveEvent &e ) const |
536 | { | 977 | { |
537 | return (mDate <= e.date() ); | 978 | return (mDate <= e.date() ); |
538 | } | 979 | } |
539 | 980 | ||
981 | /*! | ||
982 | \internal | ||
983 | */ | ||
540 | bool EffectiveEvent::operator==( const EffectiveEvent &e ) const | 984 | bool EffectiveEvent::operator==( const EffectiveEvent &e ) const |
541 | { | 985 | { |
542 | return ( mDate == e.date() | 986 | return ( mDate == e.date() |
543 | && mStart == e.start() | 987 | && mStart == e.start() |
544 | && mEnd == e.end() | 988 | && mEnd == e.end() |
545 | && mEvent == e.event() ); | 989 | && mEvent == e.event() ); |
546 | } | 990 | } |
547 | 991 | ||
992 | /*! | ||
993 | \internal | ||
994 | */ | ||
548 | bool EffectiveEvent::operator!=( const EffectiveEvent &e ) const | 995 | bool EffectiveEvent::operator!=( const EffectiveEvent &e ) const |
549 | { | 996 | { |
550 | return !(*this == e); | 997 | return !(*this == e); |
551 | } | 998 | } |
552 | 999 | ||
1000 | /*! | ||
1001 | \internal | ||
1002 | */ | ||
553 | bool EffectiveEvent::operator>( const EffectiveEvent &e ) const | 1003 | bool EffectiveEvent::operator>( const EffectiveEvent &e ) const |
554 | { | 1004 | { |
555 | return !(*this <= e ); | 1005 | return !(*this <= e ); |
556 | } | 1006 | } |
557 | 1007 | ||
1008 | /*! | ||
1009 | \internal | ||
1010 | */ | ||
558 | bool EffectiveEvent::operator>=(const EffectiveEvent &e) const | 1011 | bool EffectiveEvent::operator>=(const EffectiveEvent &e) const |
559 | { | 1012 | { |
560 | return !(*this < e); | 1013 | return !(*this < e); |
561 | } | 1014 | } |
562 | 1015 | ||
1016 | /*! | ||
1017 | \internal | ||
1018 | */ | ||
563 | void EffectiveEvent::setEffectiveDates( const QDate &from, const QDate &to ) | 1019 | void EffectiveEvent::setEffectiveDates( const QDate &from, const QDate &to ) |
564 | { | 1020 | { |
565 | if ( !from.isValid() ) { | 1021 | if ( !from.isValid() ) { |
566 | delete d; | 1022 | delete d; |
567 | d = 0; | 1023 | d = 0; |
568 | return; | 1024 | return; |
569 | } | 1025 | } |
570 | if ( !d ) | 1026 | if ( !d ) |
571 | d = new EffectiveEventPrivate; | 1027 | d = new EffectiveEventPrivate; |
572 | d->startDate = from; | 1028 | d->startDate = from; |
573 | d->endDate = to; | 1029 | d->endDate = to; |
574 | } | 1030 | } |
575 | 1031 | ||
1032 | /*! | ||
1033 | \internal | ||
1034 | */ | ||
576 | QDate EffectiveEvent::startDate() const | 1035 | QDate EffectiveEvent::startDate() const |
577 | { | 1036 | { |
578 | if ( d ) | 1037 | if ( d ) |
579 | return d->startDate; | 1038 | return d->startDate; |
580 | else if ( mEvent.hasRepeat() ) | 1039 | else if ( mEvent.hasRepeat() ) |
581 | return mDate; // single day, since multi-day should have a d pointer | 1040 | return mDate; // single day, since multi-day should have a d pointer |
582 | else | 1041 | else |
583 | return mEvent.start().date(); | 1042 | return mEvent.start().date(); |
584 | } | 1043 | } |
585 | 1044 | ||
1045 | /*! | ||
1046 | \internal | ||
1047 | */ | ||
586 | QDate EffectiveEvent::endDate() const | 1048 | QDate EffectiveEvent::endDate() const |
587 | { | 1049 | { |
588 | if ( d ) | 1050 | if ( d ) |
589 | return d->endDate; | 1051 | return d->endDate; |
590 | else if ( mEvent.hasRepeat() ) | 1052 | else if ( mEvent.hasRepeat() ) |
591 | return mDate; // single day, since multi-day should have a d pointer | 1053 | return mDate; // single day, since multi-day should have a d pointer |
592 | else | 1054 | else |
593 | return mEvent.end().date(); | 1055 | return mEvent.end().date(); |
594 | } | 1056 | } |
595 | 1057 | ||
1058 | /*! | ||
1059 | \internal | ||
1060 | */ | ||
596 | int EffectiveEvent::size() const | 1061 | int EffectiveEvent::size() const |
597 | { | 1062 | { |
598 | return ( mEnd.hour() - mStart.hour() ) * 3600 | 1063 | return ( mEnd.hour() - mStart.hour() ) * 3600 |
599 | + (mEnd.minute() - mStart.minute() * 60 | 1064 | + (mEnd.minute() - mStart.minute() * 60 |
600 | + mEnd.second() - mStart.second() ); | 1065 | + mEnd.second() - mStart.second() ); |
601 | } | 1066 | } |
602 | 1067 | ||
603 | 1068 | ||
604 | // vcal conversion code | 1069 | // vcal conversion code |
605 | static inline VObject *safeAddPropValue( VObject *o, const char *prop, const QString &value ) | 1070 | static inline VObject *safeAddPropValue( VObject *o, const char *prop, const QString &value ) |
606 | { | 1071 | { |
607 | VObject *ret = 0; | 1072 | VObject *ret = 0; |
608 | if ( o && !value.isEmpty() ) | 1073 | if ( o && !value.isEmpty() ) |
609 | ret = addPropValue( o, prop, value.latin1() ); | 1074 | ret = addPropValue( o, prop, value.latin1() ); |
610 | return ret; | 1075 | return ret; |
611 | } | 1076 | } |
612 | 1077 | ||
613 | static inline VObject *safeAddProp( VObject *o, const char *prop) | 1078 | static inline VObject *safeAddProp( VObject *o, const char *prop) |
614 | { | 1079 | { |
615 | VObject *ret = 0; | 1080 | VObject *ret = 0; |
616 | if ( o ) | 1081 | if ( o ) |
617 | ret = addProp( o, prop ); | 1082 | ret = addProp( o, prop ); |
618 | return ret; | 1083 | return ret; |
619 | } | 1084 | } |
620 | 1085 | ||
621 | static VObject *createVObject( const Event &e ) | 1086 | static VObject *createVObject( const Event &e ) |
622 | { | 1087 | { |
623 | VObject *vcal = newVObject( VCCalProp ); | 1088 | VObject *vcal = newVObject( VCCalProp ); |
624 | safeAddPropValue( vcal, VCVersionProp, "1.0" ); | 1089 | safeAddPropValue( vcal, VCVersionProp, "1.0" ); |
625 | VObject *event = safeAddProp( vcal, VCEventProp ); | 1090 | VObject *event = safeAddProp( vcal, VCEventProp ); |
626 | 1091 | ||
627 | safeAddPropValue( event, VCDTstartProp, TimeConversion::toISO8601( e.start() ) ); | 1092 | safeAddPropValue( event, VCDTstartProp, TimeConversion::toISO8601( e.start() ) ); |
628 | safeAddPropValue( event, VCDTendProp, TimeConversion::toISO8601( e.end() ) ); | 1093 | safeAddPropValue( event, VCDTendProp, TimeConversion::toISO8601( e.end() ) ); |
629 | safeAddPropValue( event, "X-Qtopia-NOTES", e.description() ); | 1094 | safeAddPropValue( event, "X-Qtopia-NOTES", e.description() ); |
630 | safeAddPropValue( event, VCDescriptionProp, e.description() ); | 1095 | safeAddPropValue( event, VCDescriptionProp, e.description() ); |
631 | safeAddPropValue( event, VCLocationProp, e.location() ); | 1096 | safeAddPropValue( event, VCLocationProp, e.location() ); |
632 | 1097 | ||
633 | if ( e.hasAlarm() ) { | 1098 | if ( e.hasAlarm() ) { |
634 | VObject *alarm = safeAddProp( event, VCAAlarmProp ); | 1099 | VObject *alarm = safeAddProp( event, VCAAlarmProp ); |
635 | QDateTime dt = e.start(); | 1100 | QDateTime dt = e.start(); |
636 | dt = dt.addSecs( -e.alarmTime()*60 ); | 1101 | dt = dt.addSecs( -e.alarmTime()*60 ); |
637 | safeAddPropValue( alarm, VCRunTimeProp, TimeConversion::toISO8601( dt ) ); | 1102 | safeAddPropValue( alarm, VCRunTimeProp, TimeConversion::toISO8601( dt ) ); |
638 | safeAddPropValue( alarm, VCAudioContentProp, | 1103 | safeAddPropValue( alarm, VCAudioContentProp, |
639 | (e.alarmSound() == Event::Silent ? "silent" : "alarm" ) ); | 1104 | (e.alarmSound() == Event::Silent ? "silent" : "alarm" ) ); |
640 | } | 1105 | } |
641 | 1106 | ||
642 | safeAddPropValue( event, "X-Qtopia-TIMEZONE", e.timeZone() ); | 1107 | safeAddPropValue( event, "X-Qtopia-TIMEZONE", e.timeZone() ); |
643 | 1108 | ||
644 | if ( e.type() == Event::AllDay ) | 1109 | if ( e.type() == Event::AllDay ) |
645 | safeAddPropValue( event, "X-Qtopia-AllDay", e.timeZone() ); | 1110 | safeAddPropValue( event, "X-Qtopia-AllDay", e.timeZone() ); |
646 | 1111 | ||
647 | // ### repeat missing | 1112 | // ### repeat missing |
648 | 1113 | ||
649 | // ### categories missing | 1114 | // ### categories missing |
650 | 1115 | ||
651 | return vcal; | 1116 | return vcal; |
652 | } | 1117 | } |
653 | 1118 | ||
654 | 1119 | ||
655 | static Event parseVObject( VObject *obj ) | 1120 | static Event parseVObject( VObject *obj ) |
656 | { | 1121 | { |
657 | Event e; | 1122 | Event e; |
658 | 1123 | ||
659 | bool haveAlarm = FALSE; | 1124 | bool haveAlarm = FALSE; |
660 | bool haveStart = FALSE; | 1125 | bool haveStart = FALSE; |
661 | bool haveEnd = FALSE; | 1126 | bool haveEnd = FALSE; |
662 | QDateTime alarmTime; | 1127 | QDateTime alarmTime; |
663 | Event::SoundTypeChoice soundType = Event::Silent; | 1128 | Event::SoundTypeChoice soundType = Event::Silent; |
664 | 1129 | ||
665 | VObjectIterator it; | 1130 | VObjectIterator it; |
666 | initPropIterator( &it, obj ); | 1131 | initPropIterator( &it, obj ); |
667 | while( moreIteration( &it ) ) { | 1132 | while( moreIteration( &it ) ) { |
668 | VObject *o = nextVObject( &it ); | 1133 | VObject *o = nextVObject( &it ); |
669 | QCString name = vObjectName( o ); | 1134 | QCString name = vObjectName( o ); |
670 | QCString value = vObjectStringZValue( o ); | 1135 | QCString value = vObjectStringZValue( o ); |
671 | if ( name == VCDTstartProp ) { | 1136 | if ( name == VCDTstartProp ) { |
672 | e.setStart( TimeConversion::fromISO8601( value ) ); | 1137 | e.setStart( TimeConversion::fromISO8601( value ) ); |
673 | haveStart = TRUE; | 1138 | haveStart = TRUE; |
674 | } | 1139 | } |
675 | else if ( name == VCDTendProp ) { | 1140 | else if ( name == VCDTendProp ) { |
676 | e.setEnd( TimeConversion::fromISO8601( value ) ); | 1141 | e.setEnd( TimeConversion::fromISO8601( value ) ); |
677 | haveEnd = TRUE; | 1142 | haveEnd = TRUE; |
678 | } | 1143 | } |
679 | else if ( name == "X-Qtopia-NOTES" ) { | 1144 | else if ( name == "X-Qtopia-NOTES" ) { |
680 | e.setNotes( value ); | 1145 | e.setNotes( value ); |
681 | } | 1146 | } |
682 | else if ( name == VCDescriptionProp ) { | 1147 | else if ( name == VCDescriptionProp ) { |
683 | e.setDescription( value ); | 1148 | e.setDescription( value ); |
684 | } | 1149 | } |
685 | else if ( name == VCLocationProp ) { | 1150 | else if ( name == VCLocationProp ) { |
686 | e.setLocation( value ); | 1151 | e.setLocation( value ); |
687 | } | 1152 | } |
688 | else if ( name == VCAudioContentProp ) { | 1153 | else if ( name == VCAudioContentProp ) { |
689 | haveAlarm = TRUE; | 1154 | haveAlarm = TRUE; |
690 | VObjectIterator nit; | 1155 | VObjectIterator nit; |
691 | initPropIterator( &nit, o ); | 1156 | initPropIterator( &nit, o ); |
692 | while( moreIteration( &nit ) ) { | 1157 | while( moreIteration( &nit ) ) { |
693 | VObject *o = nextVObject( &nit ); | 1158 | VObject *o = nextVObject( &nit ); |
694 | QCString name = vObjectName( o ); | 1159 | QCString name = vObjectName( o ); |
695 | QCString value = vObjectStringZValue( o ); | 1160 | QCString value = vObjectStringZValue( o ); |
696 | if ( name == VCRunTimeProp ) | 1161 | if ( name == VCRunTimeProp ) |
697 | alarmTime = TimeConversion::fromISO8601( value ); | 1162 | alarmTime = TimeConversion::fromISO8601( value ); |
698 | else if ( name == VCAudioContentProp ) { | 1163 | else if ( name == VCAudioContentProp ) { |
699 | if ( value == "silent" ) | 1164 | if ( value == "silent" ) |
700 | soundType = Event::Silent; | 1165 | soundType = Event::Silent; |
701 | else | 1166 | else |
702 | soundType = Event::Loud; | 1167 | soundType = Event::Loud; |
703 | } | 1168 | } |
704 | } | 1169 | } |
705 | } | 1170 | } |
706 | else if ( name == "X-Qtopia-TIMEZONE") { | 1171 | else if ( name == "X-Qtopia-TIMEZONE") { |
707 | e.setTimeZone( value ); | 1172 | e.setTimeZone( value ); |
708 | } | 1173 | } |
709 | else if ( name == "X-Qtopia-AllDay" ) { | 1174 | else if ( name == "X-Qtopia-AllDay" ) { |
710 | e.setType( Event::AllDay ); | 1175 | e.setType( Event::AllDay ); |
711 | } | 1176 | } |
712 | #if 0 | 1177 | #if 0 |
713 | else { | 1178 | else { |
714 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); | 1179 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); |
715 | VObjectIterator nit; | 1180 | VObjectIterator nit; |
716 | initPropIterator( &nit, o ); | 1181 | initPropIterator( &nit, o ); |
717 | while( moreIteration( &nit ) ) { | 1182 | while( moreIteration( &nit ) ) { |
718 | VObject *o = nextVObject( &nit ); | 1183 | VObject *o = nextVObject( &nit ); |
719 | QCString name = vObjectName( o ); | 1184 | QCString name = vObjectName( o ); |
720 | QString value = vObjectStringZValue( o ); | 1185 | QString value = vObjectStringZValue( o ); |
721 | printf(" subprop: %s = %s\n", name.data(), value.latin1() ); | 1186 | printf(" subprop: %s = %s\n", name.data(), value.latin1() ); |
722 | } | 1187 | } |
723 | } | 1188 | } |
724 | #endif | 1189 | #endif |
725 | } | 1190 | } |
726 | 1191 | ||
727 | if ( !haveStart && !haveEnd ) | 1192 | if ( !haveStart && !haveEnd ) |
728 | e.setStart( QDateTime::currentDateTime() ); | 1193 | e.setStart( QDateTime::currentDateTime() ); |
729 | 1194 | ||
730 | if ( !haveEnd ) { | 1195 | if ( !haveEnd ) { |
731 | e.setType( Event::AllDay ); | 1196 | e.setType( Event::AllDay ); |
732 | e.setEnd( e.start() ); | 1197 | e.setEnd( e.start() ); |
733 | } | 1198 | } |
734 | 1199 | ||
735 | if ( haveAlarm ) { | 1200 | if ( haveAlarm ) { |
736 | int minutes = alarmTime.secsTo( e.start() ) / 60; | 1201 | int minutes = alarmTime.secsTo( e.start() ) / 60; |
737 | e.setAlarm( TRUE, minutes, soundType ); | 1202 | e.setAlarm( TRUE, minutes, soundType ); |
738 | } | 1203 | } |
739 | return e; | 1204 | return e; |
740 | } | 1205 | } |
741 | 1206 | ||
742 | 1207 | ||
743 | 1208 | /*! | |
1209 | Writes the list of \a events as a set of VCards to the file \a filename. | ||
1210 | */ | ||
744 | void Event::writeVCalendar( const QString &filename, const QValueList<Event> &events) | 1211 | void Event::writeVCalendar( const QString &filename, const QValueList<Event> &events) |
745 | { | 1212 | { |
746 | QFileDirect f( filename.utf8().data() ); | 1213 | |
747 | if ( !f.open( IO_WriteOnly ) ) { | 1214 | QFileDirect f( filename.utf8().data() ); |
748 | qWarning("Unable to open vcard write"); | 1215 | |
749 | return; | 1216 | if ( !f.open( IO_WriteOnly ) ) { |
750 | } | 1217 | |
1218 | qWarning("Unable to open vcard write"); | ||
1219 | |||
1220 | return; | ||
1221 | |||
1222 | } | ||
1223 | |||
751 | 1224 | ||
752 | QValueList<Event>::ConstIterator it; | 1225 | QValueList<Event>::ConstIterator it; |
753 | for( it = events.begin(); it != events.end(); ++it ) { | 1226 | for( it = events.begin(); it != events.end(); ++it ) { |
754 | VObject *obj = createVObject( *it ); | 1227 | VObject *obj = createVObject( *it ); |
755 | writeVObject( f.directHandle() , obj ); | 1228 | writeVObject( f.directHandle() , obj ); |
756 | cleanVObject( obj ); | 1229 | cleanVObject( obj ); |
757 | } | 1230 | } |
1231 | |||
758 | 1232 | ||
759 | cleanStrTbl(); | 1233 | cleanStrTbl(); |
760 | } | 1234 | } |
761 | 1235 | ||
1236 | /*! | ||
1237 | Writes \a event as a VCard to the file \a filename. | ||
1238 | */ | ||
762 | void Event::writeVCalendar( const QString &filename, const Event &event) | 1239 | void Event::writeVCalendar( const QString &filename, const Event &event) |
763 | { | 1240 | { |
764 | QFileDirect f( filename.utf8().data() ); | 1241 | |
765 | if ( !f.open( IO_WriteOnly ) ) { | 1242 | QFileDirect f( filename.utf8().data() ); |
766 | qWarning("Unable to open vcard write"); | 1243 | |
767 | return; | 1244 | if ( !f.open( IO_WriteOnly ) ) { |
768 | } | 1245 | |
1246 | qWarning("Unable to open vcard write"); | ||
1247 | |||
1248 | return; | ||
1249 | |||
1250 | } | ||
1251 | |||
769 | 1252 | ||
770 | VObject *obj = createVObject( event ); | 1253 | VObject *obj = createVObject( event ); |
771 | writeVObject( f.directHandle() , obj ); | 1254 | writeVObject( f.directHandle() , obj ); |
772 | cleanVObject( obj ); | 1255 | cleanVObject( obj ); |
773 | 1256 | ||
774 | cleanStrTbl(); | 1257 | cleanStrTbl(); |
775 | } | 1258 | } |
776 | 1259 | ||
777 | 1260 | /*! | |
1261 | Returns the set of events read as VCards from the file \a filename. | ||
1262 | */ | ||
778 | QValueList<Event> Event::readVCalendar( const QString &filename ) | 1263 | QValueList<Event> Event::readVCalendar( const QString &filename ) |
779 | { | 1264 | { |
780 | VObject *obj = Parse_MIME_FromFileName( (char *)filename.utf8().data() ); | 1265 | VObject *obj = Parse_MIME_FromFileName( (char *)filename.utf8().data() ); |
781 | 1266 | ||
782 | QValueList<Event> events; | 1267 | QValueList<Event> events; |
783 | 1268 | ||
784 | while ( obj ) { | 1269 | while ( obj ) { |
785 | QCString name = vObjectName( obj ); | 1270 | QCString name = vObjectName( obj ); |
786 | if ( name == VCCalProp ) { | 1271 | if ( name == VCCalProp ) { |
787 | VObjectIterator nit; | 1272 | VObjectIterator nit; |
788 | initPropIterator( &nit, obj ); | 1273 | initPropIterator( &nit, obj ); |
789 | while( moreIteration( &nit ) ) { | 1274 | while( moreIteration( &nit ) ) { |
790 | VObject *o = nextVObject( &nit ); | 1275 | VObject *o = nextVObject( &nit ); |
791 | QCString name = vObjectName( o ); | 1276 | QCString name = vObjectName( o ); |
792 | if ( name == VCEventProp ) | 1277 | if ( name == VCEventProp ) |
793 | events.append( parseVObject( o ) ); | 1278 | events.append( parseVObject( o ) ); |
794 | } | 1279 | } |
795 | } else if ( name == VCEventProp ) { | 1280 | } else if ( name == VCEventProp ) { |
796 | // shouldn't happen, but just to be sure | 1281 | // shouldn't happen, but just to be sure |
797 | events.append( parseVObject( obj ) ); | 1282 | events.append( parseVObject( obj ) ); |
798 | } | 1283 | } |
799 | VObject *t = obj; | 1284 | VObject *t = obj; |
800 | obj = nextVObjectInList(obj); | 1285 | obj = nextVObjectInList(obj); |
801 | cleanVObject( t ); | 1286 | cleanVObject( t ); |
802 | } | 1287 | } |
803 | 1288 | ||
804 | return events; | 1289 | return events; |
805 | } | 1290 | } |
806 | 1291 | ||
807 | bool Event::match( const QRegExp &r ) const | 1292 | bool Event::match( const QRegExp &r ) const |
808 | { | 1293 | { |
809 | bool returnMe; | 1294 | bool returnMe; |
810 | returnMe = false; | 1295 | returnMe = false; |
811 | 1296 | ||
812 | if ( descript.find( r ) > -1 ) | 1297 | if ( descript.find( r ) > -1 ) |
813 | returnMe = true; | 1298 | returnMe = true; |
814 | else if ( locat.find( r ) > -1 ) | 1299 | else if ( locat.find( r ) > -1 ) |
815 | returnMe = true; | 1300 | returnMe = true; |
816 | else if ( TimeConversion::fromUTC( startUTC ).toString().find( r ) > -1 ) | 1301 | else if ( TimeConversion::fromUTC( startUTC ).toString().find( r ) > -1 ) |
817 | returnMe = true; | 1302 | returnMe = true; |
818 | else if ( TimeConversion::fromUTC( endUTC ).toString().find( r ) > -1 ) | 1303 | else if ( TimeConversion::fromUTC( endUTC ).toString().find( r ) > -1 ) |
819 | returnMe = true; | 1304 | returnMe = true; |
820 | else if ( tz.find( r ) > -1 ) | 1305 | else if ( tz.find( r ) > -1 ) |
821 | returnMe = true; | 1306 | returnMe = true; |
822 | else if ( note.find( r ) > -1 ) | 1307 | else if ( note.find( r ) > -1 ) |
823 | returnMe = true; | 1308 | returnMe = true; |
824 | else if ( doRepeat() ) { | 1309 | else if ( doRepeat() ) { |
825 | if ( pattern.hasEndDate ) | 1310 | if ( pattern.hasEndDate ) |
826 | if ( TimeConversion::fromUTC( pattern.endDateUTC ).toString().find(r) > -1 ) | 1311 | if ( TimeConversion::fromUTC( pattern.endDateUTC ).toString().find(r) > -1 ) |
827 | returnMe = true; | 1312 | returnMe = true; |
828 | } | 1313 | } |
829 | return returnMe; | 1314 | return returnMe; |
830 | } | 1315 | } |