-rw-r--r-- | library/backend/event.cpp | 501 |
1 files changed, 493 insertions, 8 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,6 +1,6 @@ | |||
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 |
@@ -21,7 +21,7 @@ | |||
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> |
@@ -72,4 +72,253 @@ static void write( QString& buf, const Event::RepeatPattern &r ) | |||
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 | { |
@@ -84,4 +333,7 @@ Event::Event() : Record() | |||
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 | { |
@@ -107,8 +359,14 @@ Event::Event( const QMap<int, QString> &map ) | |||
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 | { |
@@ -125,4 +383,7 @@ int Event::week( const QDate& date ) | |||
125 | } | 383 | } |
126 | 384 | ||
385 | /*! | ||
386 | \internal | ||
387 | */ | ||
127 | int Event::occurrence( const QDate& date ) | 388 | int Event::occurrence( const QDate& date ) |
128 | { | 389 | { |
@@ -132,4 +393,7 @@ int Event::occurrence( const QDate& date ) | |||
132 | } | 393 | } |
133 | 394 | ||
395 | /*! | ||
396 | \internal | ||
397 | */ | ||
134 | int Event::dayOfWeek( char day ) | 398 | int Event::dayOfWeek( char day ) |
135 | { | 399 | { |
@@ -143,4 +407,7 @@ int Event::dayOfWeek( char day ) | |||
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 | { |
@@ -149,12 +416,22 @@ int Event::monthDiff( const QDate& first, const QDate& second ) | |||
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; |
424 | |||
425 | if ( !description().isEmpty() ) | ||
154 | m.insert( DatebookDescription, description() ); | 426 | m.insert( DatebookDescription, description() ); |
427 | if ( !location().isEmpty() ) | ||
155 | m.insert ( Location, location() ); | 428 | m.insert ( Location, location() ); |
429 | if ( categories().count() ) | ||
156 | m.insert ( DatebookCategory, idsToString( categories() ) ); | 430 | m.insert ( DatebookCategory, idsToString( categories() ) ); |
431 | if ( !timeZone().isEmpty() ) | ||
157 | m.insert ( TimeZone, timeZone() ); | 432 | m.insert ( TimeZone, timeZone() ); |
433 | if ( !notes().isEmpty() ) | ||
158 | m.insert ( Note, notes() ); | 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() ) ) ); |
@@ -175,4 +452,7 @@ QMap<int, QString> Event::toMap() const | |||
175 | } | 452 | } |
176 | 453 | ||
454 | /*! | ||
455 | \internal | ||
456 | */ | ||
177 | void Event::setRepeat( const RepeatPattern &p ) | 457 | void Event::setRepeat( const RepeatPattern &p ) |
178 | { | 458 | { |
@@ -180,4 +460,7 @@ void Event::setRepeat( const RepeatPattern &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 | { |
@@ -185,4 +468,7 @@ void Event::setDescription( const QString &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 | { |
@@ -195,4 +481,7 @@ void Event::setLocation( const QString &s ) | |||
195 | // } | 481 | // } |
196 | 482 | ||
483 | /*! | ||
484 | \internal | ||
485 | */ | ||
197 | void Event::setType( Type t ) | 486 | void Event::setType( Type t ) |
198 | { | 487 | { |
@@ -200,4 +489,8 @@ void Event::setType( Type 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 | { |
@@ -205,4 +498,7 @@ void Event::setStart( const QDateTime &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 | { |
@@ -210,4 +506,8 @@ void Event::setStart( time_t 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 | { |
@@ -215,4 +515,7 @@ void Event::setEnd( const QDateTime &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 | { |
@@ -220,4 +523,7 @@ void Event::setEnd( time_t 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 | { |
@@ -225,4 +531,7 @@ void Event::setTimeZone( const QString &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 | { |
@@ -232,4 +541,7 @@ void Event::setAlarm( bool b, int minutes, SoundTypeChoice 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 | { |
@@ -238,4 +550,7 @@ void Event::setRepeat( bool b, const RepeatPattern &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 | { |
@@ -243,4 +558,7 @@ void Event::setNotes( const QString &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 | { |
@@ -248,4 +566,7 @@ const QString &Event::description() const | |||
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 | { |
@@ -258,4 +579,7 @@ const QString &Event::location() const | |||
258 | // } | 579 | // } |
259 | 580 | ||
581 | /*! | ||
582 | \internal | ||
583 | */ | ||
260 | Event::Type Event::type() const | 584 | Event::Type Event::type() const |
261 | { | 585 | { |
@@ -263,4 +587,7 @@ Event::Type Event::type() const | |||
263 | } | 587 | } |
264 | 588 | ||
589 | /*! | ||
590 | \internal | ||
591 | */ | ||
265 | QDateTime Event::start( bool actual ) const | 592 | QDateTime Event::start( bool actual ) const |
266 | { | 593 | { |
@@ -275,4 +602,7 @@ QDateTime Event::start( bool actual ) const | |||
275 | } | 602 | } |
276 | 603 | ||
604 | /*! | ||
605 | \internal | ||
606 | */ | ||
277 | QDateTime Event::end( bool actual ) const | 607 | QDateTime Event::end( bool actual ) const |
278 | { | 608 | { |
@@ -287,4 +617,7 @@ QDateTime Event::end( bool actual ) const | |||
287 | } | 617 | } |
288 | 618 | ||
619 | /*! | ||
620 | \internal | ||
621 | */ | ||
289 | const QString &Event::timeZone() const | 622 | const QString &Event::timeZone() const |
290 | { | 623 | { |
@@ -292,4 +625,7 @@ const QString &Event::timeZone() const | |||
292 | } | 625 | } |
293 | 626 | ||
627 | /*! | ||
628 | \internal | ||
629 | */ | ||
294 | bool Event::hasAlarm() const | 630 | bool Event::hasAlarm() const |
295 | { | 631 | { |
@@ -297,4 +633,7 @@ bool Event::hasAlarm() const | |||
297 | } | 633 | } |
298 | 634 | ||
635 | /*! | ||
636 | \internal | ||
637 | */ | ||
299 | int Event::alarmTime() const | 638 | int Event::alarmTime() const |
300 | { | 639 | { |
@@ -302,4 +641,7 @@ int Event::alarmTime() const | |||
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 | { |
@@ -307,4 +649,7 @@ Event::SoundTypeChoice Event::alarmSound() const | |||
307 | } | 649 | } |
308 | 650 | ||
651 | /*! | ||
652 | \internal | ||
653 | */ | ||
309 | bool Event::hasRepeat() const | 654 | bool Event::hasRepeat() const |
310 | { | 655 | { |
@@ -312,4 +657,7 @@ bool Event::hasRepeat() const | |||
312 | } | 657 | } |
313 | 658 | ||
659 | /*! | ||
660 | \internal | ||
661 | */ | ||
314 | const Event::RepeatPattern &Event::repeatPattern() const | 662 | const Event::RepeatPattern &Event::repeatPattern() const |
315 | { | 663 | { |
@@ -317,4 +665,7 @@ const Event::RepeatPattern &Event::repeatPattern() const | |||
317 | } | 665 | } |
318 | 666 | ||
667 | /*! | ||
668 | \internal | ||
669 | */ | ||
319 | Event::RepeatPattern &Event::repeatPattern() | 670 | Event::RepeatPattern &Event::repeatPattern() |
320 | { | 671 | { |
@@ -322,4 +673,7 @@ Event::RepeatPattern &Event::repeatPattern() | |||
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 | { |
@@ -327,6 +681,11 @@ const QString &Event::notes() const | |||
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 && |
@@ -344,4 +703,8 @@ bool Event::operator==( const Event &e ) const | |||
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 | { |
@@ -379,4 +742,7 @@ void Event::save( QString& buf ) | |||
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 | { |
@@ -391,4 +757,26 @@ bool Event::RepeatPattern::operator==( const Event::RepeatPattern &right ) const | |||
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 |
@@ -401,5 +789,7 @@ public: | |||
401 | }; | 789 | }; |
402 | 790 | ||
403 | 791 | /*! | |
792 | \internal | ||
793 | */ | ||
404 | EffectiveEvent::EffectiveEvent() | 794 | EffectiveEvent::EffectiveEvent() |
405 | { | 795 | { |
@@ -409,4 +799,7 @@ EffectiveEvent::EffectiveEvent() | |||
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 | { |
@@ -425,4 +818,7 @@ EffectiveEvent::EffectiveEvent( const Event &e, const QDate &date, Position pos | |||
425 | } | 818 | } |
426 | 819 | ||
820 | /*! | ||
821 | \internal | ||
822 | */ | ||
427 | EffectiveEvent::~EffectiveEvent() | 823 | EffectiveEvent::~EffectiveEvent() |
428 | { | 824 | { |
@@ -430,4 +826,7 @@ EffectiveEvent::~EffectiveEvent() | |||
430 | } | 826 | } |
431 | 827 | ||
828 | /*! | ||
829 | \internal | ||
830 | */ | ||
432 | EffectiveEvent::EffectiveEvent( const EffectiveEvent &e ) | 831 | EffectiveEvent::EffectiveEvent( const EffectiveEvent &e ) |
433 | { | 832 | { |
@@ -462,4 +861,7 @@ EffectiveEvent& EffectiveEvent::operator=( const EffectiveEvent & e ) | |||
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 | { |
@@ -467,4 +869,7 @@ const QString &EffectiveEvent::description( ) const | |||
467 | } | 869 | } |
468 | 870 | ||
871 | /*! | ||
872 | \internal | ||
873 | */ | ||
469 | const QString &EffectiveEvent::location( ) const | 874 | const QString &EffectiveEvent::location( ) const |
470 | { | 875 | { |
@@ -472,4 +877,7 @@ const QString &EffectiveEvent::location( ) const | |||
472 | } | 877 | } |
473 | 878 | ||
879 | /*! | ||
880 | \internal | ||
881 | */ | ||
474 | const QString &EffectiveEvent::notes() const | 882 | const QString &EffectiveEvent::notes() const |
475 | { | 883 | { |
@@ -477,4 +885,7 @@ const QString &EffectiveEvent::notes() const | |||
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 | { |
@@ -482,4 +893,7 @@ const Event &EffectiveEvent::event() const | |||
482 | } | 893 | } |
483 | 894 | ||
895 | /*! | ||
896 | \internal | ||
897 | */ | ||
484 | const QTime &EffectiveEvent::end() const | 898 | const QTime &EffectiveEvent::end() const |
485 | { | 899 | { |
@@ -487,4 +901,7 @@ const QTime &EffectiveEvent::end() const | |||
487 | } | 901 | } |
488 | 902 | ||
903 | /*! | ||
904 | \internal | ||
905 | */ | ||
489 | const QTime &EffectiveEvent::start() const | 906 | const QTime &EffectiveEvent::start() const |
490 | { | 907 | { |
@@ -492,4 +909,7 @@ const QTime &EffectiveEvent::start() const | |||
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 | { |
@@ -497,4 +917,7 @@ const QDate &EffectiveEvent::date() const | |||
497 | } | 917 | } |
498 | 918 | ||
919 | /*! | ||
920 | \internal | ||
921 | */ | ||
499 | int EffectiveEvent::length() const | 922 | int EffectiveEvent::length() const |
500 | { | 923 | { |
@@ -503,4 +926,7 @@ int EffectiveEvent::length() const | |||
503 | } | 926 | } |
504 | 927 | ||
928 | /*! | ||
929 | \internal | ||
930 | */ | ||
505 | void EffectiveEvent::setDate( const QDate &dt ) | 931 | void EffectiveEvent::setDate( const QDate &dt ) |
506 | { | 932 | { |
@@ -508,4 +934,7 @@ void EffectiveEvent::setDate( const QDate &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 | { |
@@ -513,4 +942,7 @@ void EffectiveEvent::setStart( const QTime &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 | { |
@@ -518,4 +950,7 @@ void EffectiveEvent::setEnd( const QTime &end ) | |||
518 | } | 950 | } |
519 | 951 | ||
952 | /*! | ||
953 | \internal | ||
954 | */ | ||
520 | void EffectiveEvent::setEvent( Event e ) | 955 | void EffectiveEvent::setEvent( Event e ) |
521 | { | 956 | { |
@@ -523,4 +958,7 @@ void EffectiveEvent::setEvent( Event 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 | { |
@@ -533,4 +971,7 @@ bool EffectiveEvent::operator<( const EffectiveEvent &e ) const | |||
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 | { |
@@ -538,4 +979,7 @@ bool EffectiveEvent::operator<=( const EffectiveEvent &e ) const | |||
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 | { |
@@ -546,4 +990,7 @@ bool EffectiveEvent::operator==( const EffectiveEvent &e ) const | |||
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 | { |
@@ -551,4 +998,7 @@ bool EffectiveEvent::operator!=( const EffectiveEvent &e ) const | |||
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 | { |
@@ -556,4 +1006,7 @@ bool EffectiveEvent::operator>( const EffectiveEvent &e ) const | |||
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 | { |
@@ -561,4 +1014,7 @@ bool EffectiveEvent::operator>=(const EffectiveEvent &e) const | |||
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 | { |
@@ -574,4 +1030,7 @@ void EffectiveEvent::setEffectiveDates( const QDate &from, const QDate &to ) | |||
574 | } | 1030 | } |
575 | 1031 | ||
1032 | /*! | ||
1033 | \internal | ||
1034 | */ | ||
576 | QDate EffectiveEvent::startDate() const | 1035 | QDate EffectiveEvent::startDate() const |
577 | { | 1036 | { |
@@ -584,4 +1043,7 @@ QDate EffectiveEvent::startDate() const | |||
584 | } | 1043 | } |
585 | 1044 | ||
1045 | /*! | ||
1046 | \internal | ||
1047 | */ | ||
586 | QDate EffectiveEvent::endDate() const | 1048 | QDate EffectiveEvent::endDate() const |
587 | { | 1049 | { |
@@ -594,4 +1056,7 @@ QDate EffectiveEvent::endDate() const | |||
594 | } | 1056 | } |
595 | 1057 | ||
1058 | /*! | ||
1059 | \internal | ||
1060 | */ | ||
596 | int EffectiveEvent::size() const | 1061 | int EffectiveEvent::size() const |
597 | { | 1062 | { |
@@ -741,13 +1206,21 @@ static Event parseVObject( VObject *obj ) | |||
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 | { |
1213 | |||
746 | QFileDirect f( filename.utf8().data() ); | 1214 | QFileDirect f( filename.utf8().data() ); |
1215 | |||
747 | if ( !f.open( IO_WriteOnly ) ) { | 1216 | if ( !f.open( IO_WriteOnly ) ) { |
1217 | |||
748 | qWarning("Unable to open vcard write"); | 1218 | qWarning("Unable to open vcard write"); |
1219 | |||
749 | return; | 1220 | return; |
1221 | |||
750 | } | 1222 | } |
751 | 1223 | ||
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 ) { |
@@ -757,15 +1230,25 @@ void Event::writeVCalendar( const QString &filename, const QValueList<Event> &ev | |||
757 | } | 1230 | } |
758 | 1231 | ||
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 | { |
1241 | |||
764 | QFileDirect f( filename.utf8().data() ); | 1242 | QFileDirect f( filename.utf8().data() ); |
1243 | |||
765 | if ( !f.open( IO_WriteOnly ) ) { | 1244 | if ( !f.open( IO_WriteOnly ) ) { |
1245 | |||
766 | qWarning("Unable to open vcard write"); | 1246 | qWarning("Unable to open vcard write"); |
1247 | |||
767 | return; | 1248 | return; |
1249 | |||
768 | } | 1250 | } |
769 | 1251 | ||
1252 | |||
770 | VObject *obj = createVObject( event ); | 1253 | VObject *obj = createVObject( event ); |
771 | writeVObject( f.directHandle() , obj ); | 1254 | writeVObject( f.directHandle() , obj ); |
@@ -775,5 +1258,7 @@ void Event::writeVCalendar( const QString &filename, const Event &event) | |||
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 | { |