summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/oevent.cpp
Unidiff
Diffstat (limited to 'libopie2/opiepim/oevent.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/oevent.cpp870
1 files changed, 573 insertions, 297 deletions
diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp
index de5e30b..d9cee2b 100644
--- a/libopie2/opiepim/oevent.cpp
+++ b/libopie2/opiepim/oevent.cpp
@@ -1,7 +1,7 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) 3 Copyright (C) Stefan Eilers <Eilers.Stefan@epost.de>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
6 .>+-= 6 .>+-=
7 _;:, .> :=|. This program is free software; you can 7 _;:, .> :=|. This program is free software; you can
@@ -25,24 +25,28 @@
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29#include <qshared.h>
30#include <qarray.h>
31 29
32#include <qpe/palmtopuidgen.h> 30#include "oevent.h"
33#include <qpe/categories.h>
34#include <qpe/stringutil.h>
35 31
32/* OPIE */
36#include <opie2/orecur.h> 33#include <opie2/orecur.h>
37#include <opie2/opimresolver.h> 34#include <opie2/opimresolver.h>
38#include <opie2/opimnotifymanager.h> 35#include <opie2/opimnotifymanager.h>
36#include <qpe/categories.h>
37#include <qpe/palmtopuidgen.h>
38#include <qpe/stringutil.h>
39 39
40#include <opie2/oevent.h> 40/* QT */
41#include <qshared.h>
42#include <qarray.h>
41 43
42namespace Opie { 44namespace Opie
45{
43 46
44int OCalendarHelper::week( const QDate& date) { 47int OCalendarHelper::week( const QDate& date )
48{
45 // Calculates the week this date is in within that 49 // Calculates the week this date is in within that
46 // month. Equals the "row" is is in in the month view 50 // month. Equals the "row" is is in in the month view
47 int week = 1; 51 int week = 1;
48 QDate tmp( date.year(), date.month(), 1 ); 52 QDate tmp( date.year(), date.month(), 1 );
@@ -52,36 +56,50 @@ int OCalendarHelper::week( const QDate& date) {
52 week += ( date.day() - 1 ) / 7; 56 week += ( date.day() - 1 ) / 7;
53 57
54 return week; 58 return week;
55} 59}
56int OCalendarHelper::ocurrence( const QDate& date) { 60
61
62int OCalendarHelper::ocurrence( const QDate& date )
63{
57 // calculates the number of occurrances of this day of the 64 // calculates the number of occurrances of this day of the
58 // week till the given date (e.g 3rd Wednesday of the month) 65 // week till the given date (e.g 3rd Wednesday of the month)
59 return ( date.day() - 1 ) / 7 + 1; 66 return ( date.day() - 1 ) / 7 + 1;
60} 67}
61int OCalendarHelper::dayOfWeek( char day ) { 68
69
70int OCalendarHelper::dayOfWeek( char day )
71{
62 int dayOfWeek = 1; 72 int dayOfWeek = 1;
63 char i = ORecur::MON; 73 char i = ORecur::MON;
64 while ( !( i & day ) && i <= ORecur::SUN ) { 74 while ( !( i & day ) && i <= ORecur::SUN )
75 {
65 i <<= 1; 76 i <<= 1;
66 ++dayOfWeek; 77 ++dayOfWeek;
67 } 78 }
68 return dayOfWeek; 79 return dayOfWeek;
69} 80}
70int OCalendarHelper::monthDiff( const QDate& first, const QDate& second ) { 81
82
83int OCalendarHelper::monthDiff( const QDate& first, const QDate& second )
84{
71 return ( second.year() - first.year() ) * 12 + 85 return ( second.year() - first.year() ) * 12 +
72 second.month() - first.month(); 86 second.month() - first.month();
73} 87}
74 88
75struct OEvent::Data : public QShared { 89
76 Data() : QShared() { 90struct OEvent::Data : public QShared
91{
92 Data() : QShared()
93 {
77 child = 0; 94 child = 0;
78 recur = 0; 95 recur = 0;
79 manager = 0; 96 manager = 0;
80 isAllDay = false; 97 isAllDay = false;
81 parent = 0; 98 parent = 0;
82 } 99 }
83 ~Data() { 100 ~Data()
101 {
84 delete manager; 102 delete manager;
85 delete recur; 103 delete recur;
86 } 104 }
87 QString description; 105 QString description;
@@ -91,40 +109,51 @@ struct OEvent::Data : public QShared {
91 QString note; 109 QString note;
92 QDateTime created; 110 QDateTime created;
93 QDateTime start; 111 QDateTime start;
94 QDateTime end; 112 QDateTime end;
95 bool isAllDay : 1; 113bool isAllDay : 1;
96 QString timezone; 114 QString timezone;
97 QArray<int>* child; 115 QArray<int>* child;
98 int parent; 116 int parent;
99}; 117};
100 118
119
101OEvent::OEvent( int uid ) 120OEvent::OEvent( int uid )
102 : OPimRecord( uid ) { 121 : OPimRecord( uid )
122{
103 data = new Data; 123 data = new Data;
104} 124}
105OEvent::OEvent( const OEvent& ev) 125
106 : OPimRecord( ev ), data( ev.data ) 126
127OEvent::OEvent( const OEvent& ev )
128 : OPimRecord( ev ), data( ev.data )
107{ 129{
108 data->ref(); 130 data->ref();
109} 131}
110 132
133
111OEvent::OEvent( const QMap<int, QString> map ) 134OEvent::OEvent( const QMap<int, QString> map )
112 : OPimRecord( 0 ) 135 : OPimRecord( 0 )
113{ 136{
114 data = new Data; 137 data = new Data;
115 138
116 fromMap( map ); 139 fromMap( map );
117} 140}
118 141
119OEvent::~OEvent() { 142
120 if ( data->deref() ) { 143OEvent::~OEvent()
144{
145 if ( data->deref() )
146 {
121 delete data; 147 delete data;
122 data = 0; 148 data = 0;
123 } 149 }
124} 150}
125OEvent& OEvent::operator=( const OEvent& ev) { 151
126 if ( this == &ev ) return *this; 152
153OEvent& OEvent::operator=( const OEvent& ev )
154{
155 if ( this == &ev ) return * this;
127 156
128 OPimRecord::operator=( ev ); 157 OPimRecord::operator=( ev );
129 ev.data->ref(); 158 ev.data->ref();
130 deref(); 159 deref();
@@ -132,207 +161,302 @@ OEvent& OEvent::operator=( const OEvent& ev) {
132 161
133 162
134 return *this; 163 return *this;
135} 164}
136QString OEvent::description()const { 165
166
167QString OEvent::description() const
168{
137 return data->description; 169 return data->description;
138} 170}
139void OEvent::setDescription( const QString& description ) { 171
172
173void OEvent::setDescription( const QString& description )
174{
140 changeOrModify(); 175 changeOrModify();
141 data->description = description; 176 data->description = description;
142} 177}
143void OEvent::setLocation( const QString& loc ) { 178
179
180void OEvent::setLocation( const QString& loc )
181{
144 changeOrModify(); 182 changeOrModify();
145 data->location = loc; 183 data->location = loc;
146} 184}
147QString OEvent::location()const { 185
186
187QString OEvent::location() const
188{
148 return data->location; 189 return data->location;
149} 190}
150OPimNotifyManager &OEvent::notifiers()const { 191
192
193OPimNotifyManager &OEvent::notifiers() const
194{
151 // I hope we can skip the changeOrModify here 195 // I hope we can skip the changeOrModify here
152 // the notifier should take care of it 196 // the notifier should take care of it
153 // and OPimNotify is shared too 197 // and OPimNotify is shared too
154 if (!data->manager ) 198 if ( !data->manager )
155 data->manager = new OPimNotifyManager; 199 data->manager = new OPimNotifyManager;
156 200
157 return *data->manager; 201 return *data->manager;
158} 202}
159bool OEvent::hasNotifiers()const { 203
160 if (!data->manager ) 204
205bool OEvent::hasNotifiers() const
206{
207 if ( !data->manager )
161 return false; 208 return false;
162 if (data->manager->reminders().isEmpty() && 209 if ( data->manager->reminders().isEmpty() &&
163 data->manager->alarms().isEmpty() ) 210 data->manager->alarms().isEmpty() )
164 return false; 211 return false;
165 212
166 return true; 213 return true;
167} 214}
168ORecur OEvent::recurrence()const { 215
169 if (!data->recur) 216
217ORecur OEvent::recurrence() const
218{
219 if ( !data->recur )
170 data->recur = new ORecur; 220 data->recur = new ORecur;
171 221
172 return *data->recur; 222 return *data->recur;
173} 223}
174void OEvent::setRecurrence( const ORecur& rec) { 224
225
226void OEvent::setRecurrence( const ORecur& rec )
227{
175 changeOrModify(); 228 changeOrModify();
176 if (data->recur ) 229 if ( data->recur )
177 (*data->recur) = rec; 230 ( *data->recur ) = rec;
178 else 231 else
179 data->recur = new ORecur( rec ); 232 data->recur = new ORecur( rec );
180} 233}
181bool OEvent::hasRecurrence()const { 234
182 if (!data->recur ) return false; 235
236bool OEvent::hasRecurrence() const
237{
238 if ( !data->recur ) return false;
183 return data->recur->doesRecur(); 239 return data->recur->doesRecur();
184} 240}
185QString OEvent::note()const { 241
242
243QString OEvent::note() const
244{
186 return data->note; 245 return data->note;
187} 246}
188void OEvent::setNote( const QString& note ) { 247
248
249void OEvent::setNote( const QString& note )
250{
189 changeOrModify(); 251 changeOrModify();
190 data->note = note; 252 data->note = note;
191} 253}
192QDateTime OEvent::createdDateTime()const { 254
255
256QDateTime OEvent::createdDateTime() const
257{
193 return data->created; 258 return data->created;
194} 259}
195void OEvent::setCreatedDateTime( const QDateTime& time ) { 260
261
262void OEvent::setCreatedDateTime( const QDateTime& time )
263{
196 changeOrModify(); 264 changeOrModify();
197 data->created = time; 265 data->created = time;
198} 266}
199QDateTime OEvent::startDateTime()const { 267
268
269QDateTime OEvent::startDateTime() const
270{
200 if ( data->isAllDay ) 271 if ( data->isAllDay )
201 return QDateTime( data->start.date(), QTime(0, 0, 0 ) ); 272 return QDateTime( data->start.date(), QTime( 0, 0, 0 ) );
202 return data->start; 273 return data->start;
203} 274}
204QDateTime OEvent::startDateTimeInZone()const { 275
276
277QDateTime OEvent::startDateTimeInZone() const
278{
205 /* if no timezone, or all day event or if the current and this timeZone match... */ 279 /* if no timezone, or all day event or if the current and this timeZone match... */
206 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return startDateTime(); 280 if ( data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return startDateTime();
207 281
208 OTimeZone zone(data->timezone ); 282 OTimeZone zone( data->timezone );
209 return zone.toDateTime( data->start, OTimeZone::current() ); 283 return zone.toDateTime( data->start, OTimeZone::current() );
210} 284}
211void OEvent::setStartDateTime( const QDateTime& dt ) { 285
286
287void OEvent::setStartDateTime( const QDateTime& dt )
288{
212 changeOrModify(); 289 changeOrModify();
213 data->start = dt; 290 data->start = dt;
214} 291}
215QDateTime OEvent::endDateTime()const { 292
293
294QDateTime OEvent::endDateTime() const
295{
216 /* 296 /*
217 * if all Day event the end time needs 297 * if all Day event the end time needs
218 * to be on the same day as the start 298 * to be on the same day as the start
219 */ 299 */
220 if ( data->isAllDay ) 300 if ( data->isAllDay )
221 return QDateTime( data->start.date(), QTime(23, 59, 59 ) ); 301 return QDateTime( data->start.date(), QTime( 23, 59, 59 ) );
222 return data->end; 302 return data->end;
223} 303}
224QDateTime OEvent::endDateTimeInZone()const { 304
305
306QDateTime OEvent::endDateTimeInZone() const
307{
225 /* if no timezone, or all day event or if the current and this timeZone match... */ 308 /* if no timezone, or all day event or if the current and this timeZone match... */
226 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime(); 309 if ( data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime();
227 310
228 OTimeZone zone(data->timezone ); 311 OTimeZone zone( data->timezone );
229 return zone.toDateTime( data->end, OTimeZone::current() ); 312 return zone.toDateTime( data->end, OTimeZone::current() );
230} 313}
231void OEvent::setEndDateTime( const QDateTime& dt ) { 314
315
316void OEvent::setEndDateTime( const QDateTime& dt )
317{
232 changeOrModify(); 318 changeOrModify();
233 data->end = dt; 319 data->end = dt;
234} 320}
235bool OEvent::isMultipleDay()const { 321
322
323bool OEvent::isMultipleDay() const
324{
236 return data->end.date().day() - data->start.date().day(); 325 return data->end.date().day() - data->start.date().day();
237} 326}
238bool OEvent::isAllDay()const { 327
328
329bool OEvent::isAllDay() const
330{
239 return data->isAllDay; 331 return data->isAllDay;
240} 332}
241void OEvent::setAllDay( bool allDay ) { 333
334
335void OEvent::setAllDay( bool allDay )
336{
242 changeOrModify(); 337 changeOrModify();
243 data->isAllDay = allDay; 338 data->isAllDay = allDay;
244 if (allDay ) data->timezone = "UTC"; 339 if ( allDay ) data->timezone = "UTC";
245} 340}
246void OEvent::setTimeZone( const QString& tz ) { 341
342
343void OEvent::setTimeZone( const QString& tz )
344{
247 changeOrModify(); 345 changeOrModify();
248 data->timezone = tz; 346 data->timezone = tz;
249} 347}
250QString OEvent::timeZone()const { 348
251 if (data->isAllDay ) return QString::fromLatin1("UTC"); 349
350QString OEvent::timeZone() const
351{
352 if ( data->isAllDay ) return QString::fromLatin1( "UTC" );
252 return data->timezone; 353 return data->timezone;
253} 354}
254bool OEvent::match( const QRegExp& re )const { 355
255 if ( re.match( data->description ) != -1 ){ 356
357bool OEvent::match( const QRegExp& re ) const
358{
359 if ( re.match( data->description ) != -1 )
360 {
256 setLastHitField( Qtopia::DatebookDescription ); 361 setLastHitField( Qtopia::DatebookDescription );
257 return true; 362 return true;
258 } 363 }
259 if ( re.match( data->note ) != -1 ){ 364 if ( re.match( data->note ) != -1 )
365 {
260 setLastHitField( Qtopia::Note ); 366 setLastHitField( Qtopia::Note );
261 return true; 367 return true;
262 } 368 }
263 if ( re.match( data->location ) != -1 ){ 369 if ( re.match( data->location ) != -1 )
370 {
264 setLastHitField( Qtopia::Location ); 371 setLastHitField( Qtopia::Location );
265 return true; 372 return true;
266 } 373 }
267 if ( re.match( data->start.toString() ) != -1 ){ 374 if ( re.match( data->start.toString() ) != -1 )
375 {
268 setLastHitField( Qtopia::StartDateTime ); 376 setLastHitField( Qtopia::StartDateTime );
269 return true; 377 return true;
270 } 378 }
271 if ( re.match( data->end.toString() ) != -1 ){ 379 if ( re.match( data->end.toString() ) != -1 )
380 {
272 setLastHitField( Qtopia::EndDateTime ); 381 setLastHitField( Qtopia::EndDateTime );
273 return true; 382 return true;
274 } 383 }
275 return false; 384 return false;
276} 385}
277QString OEvent::toRichText()const { 386
387
388QString OEvent::toRichText() const
389{
278 QString text, value; 390 QString text, value;
279 391
280 // description 392 // description
281 text += "<b><h3><img src=\"datebook/DateBook\">"; 393 text += "<b><h3><img src=\"datebook/DateBook\">";
282 if ( !description().isEmpty() ) { 394 if ( !description().isEmpty() )
283 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" ); 395 {
396 text += Qtopia::escapeString( description() ).replace( QRegExp( "[\n]" ), "" );
284 } 397 }
285 text += "</h3></b><br><hr><br>"; 398 text += "</h3></b><br><hr><br>";
286 399
287 // location 400 // location
288 if ( !(value = location()).isEmpty() ) { 401 if ( !( value = location() ).isEmpty() )
402 {
289 text += "<b>" + QObject::tr( "Location:" ) + "</b> "; 403 text += "<b>" + QObject::tr( "Location:" ) + "</b> ";
290 text += Qtopia::escapeString(value) + "<br>"; 404 text += Qtopia::escapeString( value ) + "<br>";
291 } 405 }
292 406
293 // all day event 407 // all day event
294 if ( isAllDay() ) { 408 if ( isAllDay() )
409 {
295 text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>"; 410 text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>";
296 } 411 }
297 // multiple day event 412 // multiple day event
298 else if ( isMultipleDay () ) { 413 else if ( isMultipleDay () )
414 {
299 text += "<b><i>" + QObject::tr( "This is a multiple day event" ) + "</i></b><br>"; 415 text += "<b><i>" + QObject::tr( "This is a multiple day event" ) + "</i></b><br>";
300 } 416 }
301 // start & end times 417 // start & end times
302 else { 418 else
419 {
303 // start time 420 // start time
304 if ( startDateTime().isValid() ) { 421 if ( startDateTime().isValid() )
305 text += "<b>" + QObject::tr( "Start:") + "</b> "; 422 {
306 text += Qtopia::escapeString(startDateTime().toString() ). 423 text += "<b>" + QObject::tr( "Start:" ) + "</b> ";
307 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 424 text += Qtopia::escapeString( startDateTime().toString() ).
425 replace( QRegExp( "[\n]" ), "<br>" ) + "<br>";
308 } 426 }
309 427
310 // end time 428 // end time
311 if ( endDateTime().isValid() ) { 429 if ( endDateTime().isValid() )
312 text += "<b>" + QObject::tr( "End:") + "</b> "; 430 {
313 text += Qtopia::escapeString(endDateTime().toString() ). 431 text += "<b>" + QObject::tr( "End:" ) + "</b> ";
314 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 432 text += Qtopia::escapeString( endDateTime().toString() ).
433 replace( QRegExp( "[\n]" ), "<br>" ) + "<br>";
315 } 434 }
316 } 435 }
317 436
318 // categories 437 // categories
319 if ( categoryNames("Calendar").count() ){ 438 if ( categoryNames( "Calendar" ).count() )
320 text += "<b>" + QObject::tr( "Category:") + "</b> "; 439 {
321 text += categoryNames("Calendar").join(", "); 440 text += "<b>" + QObject::tr( "Category:" ) + "</b> ";
322 text += "<br>"; 441 text += categoryNames( "Calendar" ).join( ", " );
442 text += "<br>";
323 } 443 }
324 444
325 //notes 445 //notes
326 if ( !note().isEmpty() ) { 446 if ( !note().isEmpty() )
327 text += "<b>" + QObject::tr( "Note:") + "</b><br>"; 447 {
448 text += "<b>" + QObject::tr( "Note:" ) + "</b><br>";
328 text += note(); 449 text += note();
329// text += Qtopia::escapeString(note() ). 450 // text += Qtopia::escapeString(note() ).
330// replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 451 // replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
331 } 452 }
332 return text; 453 return text;
333} 454}
334QString OEvent::toShortText()const { 455
456
457QString OEvent::toShortText() const
458{
335 QString text; 459 QString text;
336 text += QString::number( startDateTime().date().day() ); 460 text += QString::number( startDateTime().date().day() );
337 text += "."; 461 text += ".";
338 text += QString::number( startDateTime().date().month() ); 462 text += QString::number( startDateTime().date().month() );
@@ -345,31 +469,50 @@ QString OEvent::toShortText()const {
345 text += " - "; 469 text += " - ";
346 text += description(); 470 text += description();
347 return text; 471 return text;
348} 472}
349QString OEvent::type()const { 473
350 return QString::fromLatin1("OEvent"); 474
475QString OEvent::type() const
476{
477 return QString::fromLatin1( "OEvent" );
351} 478}
352QString OEvent::recordField( int /*id */ )const { 479
480
481QString OEvent::recordField( int /*id */ ) const
482{
353 return QString::null; 483 return QString::null;
354} 484}
355int OEvent::rtti() { 485
486
487int OEvent::rtti()
488{
356 return OPimResolver::DateBook; 489 return OPimResolver::DateBook;
357} 490}
358bool OEvent::loadFromStream( QDataStream& ) { 491
492
493bool OEvent::loadFromStream( QDataStream& )
494{
359 return true; 495 return true;
360} 496}
361bool OEvent::saveToStream( QDataStream& )const { 497
498
499bool OEvent::saveToStream( QDataStream& ) const
500{
362 return true; 501 return true;
363} 502}
364void OEvent::changeOrModify() { 503
365 if ( data->count != 1 ) { 504
505void OEvent::changeOrModify()
506{
507 if ( data->count != 1 )
508 {
366 data->deref(); 509 data->deref();
367 Data* d2 = new Data; 510 Data* d2 = new Data;
368 d2->description = data->description; 511 d2->description = data->description;
369 d2->location = data->location; 512 d2->location = data->location;
370 513
371 if (data->manager ) 514 if ( data->manager )
372 d2->manager = new OPimNotifyManager( *data->manager ); 515 d2->manager = new OPimNotifyManager( *data->manager );
373 516
374 if ( data->recur ) 517 if ( data->recur )
375 d2->recur = new ORecur( *data->recur ); 518 d2->recur = new ORecur( *data->recur );
@@ -381,18 +524,23 @@ void OEvent::changeOrModify() {
381 d2->isAllDay = data->isAllDay; 524 d2->isAllDay = data->isAllDay;
382 d2->timezone = data->timezone; 525 d2->timezone = data->timezone;
383 d2->parent = data->parent; 526 d2->parent = data->parent;
384 527
385 if ( data->child ) { 528 if ( data->child )
529 {
386 d2->child = new QArray<int>( *data->child ); 530 d2->child = new QArray<int>( *data->child );
387 d2->child->detach(); 531 d2->child->detach();
388 } 532 }
389 533
390 data = d2; 534 data = d2;
391 } 535 }
392} 536}
393void OEvent::deref() { 537
394 if ( data->deref() ) { 538
539void OEvent::deref()
540{
541 if ( data->deref() )
542 {
395 delete data; 543 delete data;
396 data = 0; 544 data = 0;
397 } 545 }
398} 546}
@@ -400,199 +548,243 @@ void OEvent::deref() {
400// encoding as ODateBookAccessBackend_xml does.. 548// encoding as ODateBookAccessBackend_xml does..
401// Thus, we could remove the stuff there and use this 549// Thus, we could remove the stuff there and use this
402// for it and for all other places.. 550// for it and for all other places..
403// Encoding should happen at one place, only ! (eilers) 551// Encoding should happen at one place, only ! (eilers)
404QMap<int, QString> OEvent::toMap()const { 552QMap<int, QString> OEvent::toMap() const
553{
405 QMap<int, QString> retMap; 554 QMap<int, QString> retMap;
406 555
407 retMap.insert( OEvent::FUid, QString::number( uid() ) ); 556 retMap.insert( OEvent::FUid, QString::number( uid() ) );
408 retMap.insert( OEvent::FCategories, Qtopia::escapeString( Qtopia::Record::idsToString( categories() ) )); 557 retMap.insert( OEvent::FCategories, Qtopia::escapeString( Qtopia::Record::idsToString( categories() ) ) );
409 retMap.insert( OEvent::FDescription, Qtopia::escapeString( description() ) ); 558 retMap.insert( OEvent::FDescription, Qtopia::escapeString( description() ) );
410 retMap.insert( OEvent::FLocation, Qtopia::escapeString( location() ) ); 559 retMap.insert( OEvent::FLocation, Qtopia::escapeString( location() ) );
411 retMap.insert( OEvent::FType, isAllDay() ? "AllDay" : "" ); 560 retMap.insert( OEvent::FType, isAllDay() ? "AllDay" : "" );
412 OPimAlarm alarm = notifiers().alarms()[0]; 561 OPimAlarm alarm = notifiers().alarms() [ 0 ];
413 retMap.insert( OEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) ); 562 retMap.insert( OEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) );
414 retMap.insert( OEvent::FSound, (alarm.sound() == OPimAlarm::Loud) ? "loud" : "silent" ); 563 retMap.insert( OEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" );
415 564
416 OTimeZone zone( timeZone().isEmpty() ? OTimeZone::current() : timeZone() ); 565 OTimeZone zone( timeZone().isEmpty() ? OTimeZone::current() : timeZone() );
417 retMap.insert( OEvent::FStart, QString::number( zone.fromUTCDateTime( zone.toDateTime( startDateTime(), OTimeZone::utc() ) ) ) ); 566 retMap.insert( OEvent::FStart, QString::number( zone.fromUTCDateTime( zone.toDateTime( startDateTime(), OTimeZone::utc() ) ) ) );
418 retMap.insert( OEvent::FEnd, QString::number( zone.fromUTCDateTime( zone.toDateTime( endDateTime(), OTimeZone::utc() ) ) ) ); 567 retMap.insert( OEvent::FEnd, QString::number( zone.fromUTCDateTime( zone.toDateTime( endDateTime(), OTimeZone::utc() ) ) ) );
419 retMap.insert( OEvent::FNote, Qtopia::escapeString( note() ) ); 568 retMap.insert( OEvent::FNote, Qtopia::escapeString( note() ) );
420 retMap.insert( OEvent::FTimeZone, timeZone().isEmpty() ? QString( "None" ) : timeZone() ); 569 retMap.insert( OEvent::FTimeZone, timeZone().isEmpty() ? QString( "None" ) : timeZone() );
421 if( parent() ) 570 if ( parent() )
422 retMap.insert( OEvent::FRecParent, QString::number( parent() ) ); 571 retMap.insert( OEvent::FRecParent, QString::number( parent() ) );
423 if( children().count() ){ 572 if ( children().count() )
424 QArray<int> childr = children(); 573 {
425 QString buf; 574 QArray<int> childr = children();
426 for ( uint i = 0; i < childr.count(); i++ ) { 575 QString buf;
427 if ( i != 0 ) buf += " "; 576 for ( uint i = 0; i < childr.count(); i++ )
428 buf += QString::number( childr[i] ); 577 {
429 } 578 if ( i != 0 ) buf += " ";
430 retMap.insert( OEvent::FRecChildren, buf ); 579 buf += QString::number( childr[ i ] );
431 } 580 }
432 581 retMap.insert( OEvent::FRecChildren, buf );
582 }
583
433 // Add recurrence stuff 584 // Add recurrence stuff
434 if( hasRecurrence() ){ 585 if ( hasRecurrence() )
435 ORecur recur = recurrence(); 586 {
436 QMap<int, QString> recFields = recur.toMap(); 587 ORecur recur = recurrence();
437 retMap.insert( OEvent::FRType, recFields[ORecur::RType] ); 588 QMap<int, QString> recFields = recur.toMap();
438 retMap.insert( OEvent::FRWeekdays, recFields[ORecur::RWeekdays] ); 589 retMap.insert( OEvent::FRType, recFields[ ORecur::RType ] );
439 retMap.insert( OEvent::FRPosition, recFields[ORecur::RPosition] ); 590 retMap.insert( OEvent::FRWeekdays, recFields[ ORecur::RWeekdays ] );
440 retMap.insert( OEvent::FRFreq, recFields[ORecur::RFreq] ); 591 retMap.insert( OEvent::FRPosition, recFields[ ORecur::RPosition ] );
441 retMap.insert( OEvent::FRHasEndDate, recFields[ORecur::RHasEndDate] ); 592 retMap.insert( OEvent::FRFreq, recFields[ ORecur::RFreq ] );
442 retMap.insert( OEvent::FREndDate, recFields[ORecur::EndDate] ); 593 retMap.insert( OEvent::FRHasEndDate, recFields[ ORecur::RHasEndDate ] );
443 retMap.insert( OEvent::FRCreated, recFields[ORecur::Created] ); 594 retMap.insert( OEvent::FREndDate, recFields[ ORecur::EndDate ] );
444 retMap.insert( OEvent::FRExceptions, recFields[ORecur::Exceptions] ); 595 retMap.insert( OEvent::FRCreated, recFields[ ORecur::Created ] );
445 } else { 596 retMap.insert( OEvent::FRExceptions, recFields[ ORecur::Exceptions ] );
446 ORecur recur = recurrence(); 597 }
447 QMap<int, QString> recFields = recur.toMap(); 598 else
448 retMap.insert( OEvent::FRType, recFields[ORecur::RType] ); 599 {
449 } 600 ORecur recur = recurrence();
450 601 QMap<int, QString> recFields = recur.toMap();
602 retMap.insert( OEvent::FRType, recFields[ ORecur::RType ] );
603 }
604
451 return retMap; 605 return retMap;
452} 606}
453 607
608
454void OEvent::fromMap( const QMap<int, QString>& map ) 609void OEvent::fromMap( const QMap<int, QString>& map )
455{ 610{
456 611
457 // We just want to set the UID if it is really stored. 612 // We just want to set the UID if it is really stored.
458 if ( !map[OEvent::FUid].isEmpty() ) 613 if ( !map[ OEvent::FUid ].isEmpty() )
459 setUid( map[OEvent::FUid].toInt() ); 614 setUid( map[ OEvent::FUid ].toInt() );
460 615
461 setCategories( idsFromString( map[OEvent::FCategories] ) ); 616 setCategories( idsFromString( map[ OEvent::FCategories ] ) );
462 setDescription( map[OEvent::FDescription] ); 617 setDescription( map[ OEvent::FDescription ] );
463 setLocation( map[OEvent::FLocation] ); 618 setLocation( map[ OEvent::FLocation ] );
464 619
465 if ( map[OEvent::FType] == "AllDay" ) 620 if ( map[ OEvent::FType ] == "AllDay" )
466 setAllDay( true ); 621 setAllDay( true );
467 else 622 else
468 setAllDay( false ); 623 setAllDay( false );
469 624
470 int alarmTime = -1; 625 int alarmTime = -1;
471 if( !map[OEvent::FAlarm].isEmpty() ) 626 if ( !map[ OEvent::FAlarm ].isEmpty() )
472 alarmTime = map[OEvent::FAlarm].toInt(); 627 alarmTime = map[ OEvent::FAlarm ].toInt();
473 628
474 int sound = ( ( map[OEvent::FSound] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent ); 629 int sound = ( ( map[ OEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent );
475 if ( ( alarmTime != -1 ) ){ 630 if ( ( alarmTime != -1 ) )
476 QDateTime dt = startDateTime().addSecs( -1*alarmTime*60 ); 631 {
477 OPimAlarm al( sound , dt ); 632 QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 );
478 notifiers().add( al ); 633 OPimAlarm al( sound , dt );
479 } 634 notifiers().add( al );
480 if ( !map[OEvent::FTimeZone].isEmpty() && ( map[OEvent::FTimeZone] != "None" ) ){ 635 }
481 setTimeZone( map[OEvent::FTimeZone] ); 636 if ( !map[ OEvent::FTimeZone ].isEmpty() && ( map[ OEvent::FTimeZone ] != "None" ) )
482 } 637 {
483 638 setTimeZone( map[ OEvent::FTimeZone ] );
484 time_t start = (time_t) map[OEvent::FStart].toLong(); 639 }
485 time_t end = (time_t) map[OEvent::FEnd].toLong(); 640
486 641 time_t start = ( time_t ) map[ OEvent::FStart ].toLong();
487 /* AllDay is always in UTC */ 642 time_t end = ( time_t ) map[ OEvent::FEnd ].toLong();
488 if ( isAllDay() ) { 643
489 OTimeZone utc = OTimeZone::utc(); 644 /* AllDay is always in UTC */
490 setStartDateTime( utc.fromUTCDateTime( start ) ); 645 if ( isAllDay() )
491 setEndDateTime ( utc.fromUTCDateTime( end ) ); 646 {
492 setTimeZone( "UTC"); // make sure it is really utc 647 OTimeZone utc = OTimeZone::utc();
493 }else { 648 setStartDateTime( utc.fromUTCDateTime( start ) );
494 /* to current date time */ 649 setEndDateTime ( utc.fromUTCDateTime( end ) );
495 // qWarning(" Start is %d", start ); 650 setTimeZone( "UTC" ); // make sure it is really utc
496 OTimeZone zone( timeZone().isEmpty() ? OTimeZone::current() : timeZone() ); 651 }
497 QDateTime date = zone.toDateTime( start ); 652 else
498 qWarning(" Start is %s", date.toString().latin1() ); 653 {
499 setStartDateTime( zone.toDateTime( date, OTimeZone::current() ) ); 654 /* to current date time */
500 655 // qWarning(" Start is %d", start );
501 date = zone.toDateTime( end ); 656 OTimeZone zone( timeZone().isEmpty() ? OTimeZone::current() : timeZone() );
502 setEndDateTime ( zone.toDateTime( date, OTimeZone::current() ) ); 657 QDateTime date = zone.toDateTime( start );
503 } 658 qWarning( " Start is %s", date.toString().latin1() );
504 659 setStartDateTime( zone.toDateTime( date, OTimeZone::current() ) );
505 if ( !map[OEvent::FRecParent].isEmpty() ) 660
506 setParent( map[OEvent::FRecParent].toInt() ); 661 date = zone.toDateTime( end );
507 662 setEndDateTime ( zone.toDateTime( date, OTimeZone::current() ) );
508 if ( !map[OEvent::FRecChildren].isEmpty() ){ 663 }
509 QStringList list = QStringList::split(' ', map[OEvent::FRecChildren] ); 664
510 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 665 if ( !map[ OEvent::FRecParent ].isEmpty() )
511 addChild( (*it).toInt() ); 666 setParent( map[ OEvent::FRecParent ].toInt() );
512 } 667
513 } 668 if ( !map[ OEvent::FRecChildren ].isEmpty() )
514 669 {
515 // Fill recurrence stuff and put it directly into the ORecur-Object using fromMap.. 670 QStringList list = QStringList::split( ' ', map[ OEvent::FRecChildren ] );
516 if( !map[OEvent::FRType].isEmpty() ){ 671 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
517 QMap<int, QString> recFields; 672 {
518 recFields.insert( ORecur::RType, map[OEvent::FRType] ); 673 addChild( ( *it ).toInt() );
519 recFields.insert( ORecur::RWeekdays, map[OEvent::FRWeekdays] ); 674 }
520 recFields.insert( ORecur::RPosition, map[OEvent::FRPosition] ); 675 }
521 recFields.insert( ORecur::RFreq, map[OEvent::FRFreq] ); 676
522 recFields.insert( ORecur::RHasEndDate, map[OEvent::FRHasEndDate] ); 677 // Fill recurrence stuff and put it directly into the ORecur-Object using fromMap..
523 recFields.insert( ORecur::EndDate, map[OEvent::FREndDate] ); 678 if ( !map[ OEvent::FRType ].isEmpty() )
524 recFields.insert( ORecur::Created, map[OEvent::FRCreated] ); 679 {
525 recFields.insert( ORecur::Exceptions, map[OEvent::FRExceptions] ); 680 QMap<int, QString> recFields;
526 ORecur recur( recFields ); 681 recFields.insert( ORecur::RType, map[ OEvent::FRType ] );
527 setRecurrence( recur ); 682 recFields.insert( ORecur::RWeekdays, map[ OEvent::FRWeekdays ] );
528 } 683 recFields.insert( ORecur::RPosition, map[ OEvent::FRPosition ] );
529 684 recFields.insert( ORecur::RFreq, map[ OEvent::FRFreq ] );
530} 685 recFields.insert( ORecur::RHasEndDate, map[ OEvent::FRHasEndDate ] );
531 686 recFields.insert( ORecur::EndDate, map[ OEvent::FREndDate ] );
532 687 recFields.insert( ORecur::Created, map[ OEvent::FRCreated ] );
533int OEvent::parent()const { 688 recFields.insert( ORecur::Exceptions, map[ OEvent::FRExceptions ] );
689 ORecur recur( recFields );
690 setRecurrence( recur );
691 }
692
693}
694
695
696int OEvent::parent() const
697{
534 return data->parent; 698 return data->parent;
535} 699}
536void OEvent::setParent( int uid ) { 700
701
702void OEvent::setParent( int uid )
703{
537 changeOrModify(); 704 changeOrModify();
538 data->parent = uid; 705 data->parent = uid;
539} 706}
540QArray<int> OEvent::children() const{ 707
541 if (!data->child) return QArray<int>(); 708
709QArray<int> OEvent::children() const
710{
711 if ( !data->child ) return QArray<int>();
542 else 712 else
543 return data->child->copy(); 713 return data->child->copy();
544} 714}
545void OEvent::setChildren( const QArray<int>& arr ) { 715
716
717void OEvent::setChildren( const QArray<int>& arr )
718{
546 changeOrModify(); 719 changeOrModify();
547 if (data->child) delete data->child; 720 if ( data->child ) delete data->child;
548 721
549 data->child = new QArray<int>( arr ); 722 data->child = new QArray<int>( arr );
550 data->child->detach(); 723 data->child->detach();
551} 724}
552void OEvent::addChild( int uid ) { 725
726
727void OEvent::addChild( int uid )
728{
553 changeOrModify(); 729 changeOrModify();
554 if (!data->child ) { 730 if ( !data->child )
555 data->child = new QArray<int>(1); 731 {
556 (*data->child)[0] = uid; 732 data->child = new QArray<int>( 1 );
557 }else{ 733 ( *data->child ) [ 0 ] = uid;
734 }
735 else
736 {
558 int count = data->child->count(); 737 int count = data->child->count();
559 data->child->resize( count + 1 ); 738 data->child->resize( count + 1 );
560 (*data->child)[count] = uid; 739 ( *data->child ) [ count ] = uid;
561 } 740 }
562} 741}
563void OEvent::removeChild( int uid ) { 742
564 if (!data->child || !data->child->contains( uid ) ) return; 743
744void OEvent::removeChild( int uid )
745{
746 if ( !data->child || !data->child->contains( uid ) ) return ;
565 changeOrModify(); 747 changeOrModify();
566 QArray<int> newAr( data->child->count() - 1 ); 748 QArray<int> newAr( data->child->count() - 1 );
567 int j = 0; 749 int j = 0;
568 uint count = data->child->count(); 750 uint count = data->child->count();
569 for ( uint i = 0; i < count; i++ ) { 751 for ( uint i = 0; i < count; i++ )
570 if ( (*data->child)[i] != uid ) { 752 {
571 newAr[j] = (*data->child)[i]; 753 if ( ( *data->child ) [ i ] != uid )
754 {
755 newAr[ j ] = ( *data->child ) [ i ];
572 j++; 756 j++;
573 } 757 }
574 } 758 }
575 (*data->child) = newAr; 759 ( *data->child ) = newAr;
576} 760}
577struct OEffectiveEvent::Data : public QShared { 761
578 Data() : QShared() { 762
579 } 763struct OEffectiveEvent::Data : public QShared
764{
765 Data() : QShared()
766 {}
580 OEvent event; 767 OEvent event;
581 QDate date; 768 QDate date;
582 QTime start, end; 769 QTime start, end;
583 QDate startDate, endDate; 770 QDate startDate, endDate;
584 bool dates : 1; 771bool dates : 1;
585}; 772};
586 773
587OEffectiveEvent::OEffectiveEvent() { 774
775OEffectiveEvent::OEffectiveEvent()
776{
588 data = new Data; 777 data = new Data;
589 data->date = QDate::currentDate(); 778 data->date = QDate::currentDate();
590 data->start = data->end = QTime::currentTime(); 779 data->start = data->end = QTime::currentTime();
591 data->dates = false; 780 data->dates = false;
592} 781}
782
783
593OEffectiveEvent::OEffectiveEvent( const OEvent& ev, const QDate& startDate, 784OEffectiveEvent::OEffectiveEvent( const OEvent& ev, const QDate& startDate,
594 Position pos ) { 785 Position pos )
786{
595 data = new Data; 787 data = new Data;
596 data->event = ev; 788 data->event = ev;
597 data->date = startDate; 789 data->date = startDate;
598 if ( pos & Start ) 790 if ( pos & Start )
@@ -606,108 +798,174 @@ OEffectiveEvent::OEffectiveEvent( const OEvent& ev, const QDate& startDate,
606 data->end = QTime( 23, 59, 59 ); 798 data->end = QTime( 23, 59, 59 );
607 799
608 data->dates = false; 800 data->dates = false;
609} 801}
610OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev) { 802
803
804OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev )
805{
611 data = ev.data; 806 data = ev.data;
612 data->ref(); 807 data->ref();
613} 808}
614OEffectiveEvent::~OEffectiveEvent() { 809
615 if ( data->deref() ) { 810
811OEffectiveEvent::~OEffectiveEvent()
812{
813 if ( data->deref() )
814 {
616 delete data; 815 delete data;
617 data = 0; 816 data = 0;
618 } 817 }
619} 818}
620OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev ) { 819
621 if ( *this == ev ) return *this; 820
821OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev )
822{
823 if ( *this == ev ) return * this;
622 824
623 ev.data->ref(); 825 ev.data->ref();
624 deref(); 826 deref();
625 data = ev.data; 827 data = ev.data;
626 828
627 return *this; 829 return *this;
628} 830}
629 831
630void OEffectiveEvent::setStartTime( const QTime& ti) { 832
833void OEffectiveEvent::setStartTime( const QTime& ti )
834{
631 changeOrModify(); 835 changeOrModify();
632 data->start = ti; 836 data->start = ti;
633} 837}
634void OEffectiveEvent::setEndTime( const QTime& en) { 838
839
840void OEffectiveEvent::setEndTime( const QTime& en )
841{
635 changeOrModify(); 842 changeOrModify();
636 data->end = en; 843 data->end = en;
637} 844}
638void OEffectiveEvent::setEvent( const OEvent& ev) { 845
846
847void OEffectiveEvent::setEvent( const OEvent& ev )
848{
639 changeOrModify(); 849 changeOrModify();
640 data->event = ev; 850 data->event = ev;
641} 851}
642void OEffectiveEvent::setDate( const QDate& da) { 852
853
854void OEffectiveEvent::setDate( const QDate& da )
855{
643 changeOrModify(); 856 changeOrModify();
644 data->date = da; 857 data->date = da;
645} 858}
859
860
646void OEffectiveEvent::setEffectiveDates( const QDate& from, 861void OEffectiveEvent::setEffectiveDates( const QDate& from,
647 const QDate& to ) { 862 const QDate& to )
648 if (!from.isValid() ) { 863{
864 if ( !from.isValid() )
865 {
649 data->dates = false; 866 data->dates = false;
650 return; 867 return ;
651 } 868 }
652 869
653 data->startDate = from; 870 data->startDate = from;
654 data->endDate = to; 871 data->endDate = to;
655} 872}
656QString OEffectiveEvent::description()const { 873
874
875QString OEffectiveEvent::description() const
876{
657 return data->event.description(); 877 return data->event.description();
658} 878}
659QString OEffectiveEvent::location()const { 879
880
881QString OEffectiveEvent::location() const
882{
660 return data->event.location(); 883 return data->event.location();
661} 884}
662QString OEffectiveEvent::note()const { 885
886
887QString OEffectiveEvent::note() const
888{
663 return data->event.note(); 889 return data->event.note();
664} 890}
665OEvent OEffectiveEvent::event()const { 891
892
893OEvent OEffectiveEvent::event() const
894{
666 return data->event; 895 return data->event;
667} 896}
668QTime OEffectiveEvent::startTime()const { 897
898
899QTime OEffectiveEvent::startTime() const
900{
669 return data->start; 901 return data->start;
670} 902}
671QTime OEffectiveEvent::endTime()const { 903
904
905QTime OEffectiveEvent::endTime() const
906{
672 return data->end; 907 return data->end;
673} 908}
674QDate OEffectiveEvent::date()const { 909
910
911QDate OEffectiveEvent::date() const
912{
675 return data->date; 913 return data->date;
676} 914}
677int OEffectiveEvent::length()const { 915
678 return (data->end.hour() * 60 - data->start.hour() * 60) 916
679 + QABS(data->start.minute() - data->end.minute() ); 917int OEffectiveEvent::length() const
918{
919 return ( data->end.hour() * 60 - data->start.hour() * 60 )
920 + QABS( data->start.minute() - data->end.minute() );
680} 921}
681int OEffectiveEvent::size()const { 922
923
924int OEffectiveEvent::size() const
925{
682 return ( data->end.hour() - data->start.hour() ) * 3600 926 return ( data->end.hour() - data->start.hour() ) * 3600
683 + (data->end.minute() - data->start.minute() * 60 927 + ( data->end.minute() - data->start.minute() * 60
684 + data->end.second() - data->start.second() ); 928 + data->end.second() - data->start.second() );
685} 929}
686QDate OEffectiveEvent::startDate()const { 930
931
932QDate OEffectiveEvent::startDate() const
933{
687 if ( data->dates ) 934 if ( data->dates )
688 return data->startDate; 935 return data->startDate;
689 else if ( data->event.hasRecurrence() ) // single day, since multi-day should have a d pointer 936 else if ( data->event.hasRecurrence() ) // single day, since multi-day should have a d pointer
690 return data->date; 937 return data->date;
691 else 938 else
692 return data->event.startDateTime().date(); 939 return data->event.startDateTime().date();
693} 940}
694QDate OEffectiveEvent::endDate()const { 941
942
943QDate OEffectiveEvent::endDate() const
944{
695 if ( data->dates ) 945 if ( data->dates )
696 return data->endDate; 946 return data->endDate;
697 else if ( data->event.hasRecurrence() ) 947 else if ( data->event.hasRecurrence() )
698 return data->date; 948 return data->date;
699 else 949 else
700 return data->event.endDateTime().date(); 950 return data->event.endDateTime().date();
701} 951}
702void OEffectiveEvent::deref() { 952
703 if ( data->deref() ) { 953
954void OEffectiveEvent::deref()
955{
956 if ( data->deref() )
957 {
704 delete data; 958 delete data;
705 data = 0; 959 data = 0;
706 } 960 }
707} 961}
708void OEffectiveEvent::changeOrModify() { 962
709 if ( data->count != 1 ) { 963
964void OEffectiveEvent::changeOrModify()
965{
966 if ( data->count != 1 )
967 {
710 data->deref(); 968 data->deref();
711 Data* d2 = new Data; 969 Data* d2 = new Data;
712 d2->event = data->event; 970 d2->event = data->event;
713 d2->date = data->date; 971 d2->date = data->date;
@@ -718,32 +976,50 @@ void OEffectiveEvent::changeOrModify() {
718 d2->dates = data->dates; 976 d2->dates = data->dates;
719 data = d2; 977 data = d2;
720 } 978 }
721} 979}
722bool OEffectiveEvent::operator<( const OEffectiveEvent &e ) const{ 980
981
982bool OEffectiveEvent::operator<( const OEffectiveEvent &e ) const
983{
723 if ( data->date < e.date() ) 984 if ( data->date < e.date() )
724 return TRUE; 985 return TRUE;
725 if ( data->date == e.date() ) 986 if ( data->date == e.date() )
726 return ( startTime() < e.startTime() ); 987 return ( startTime() < e.startTime() );
727 else 988 else
728 return FALSE; 989 return FALSE;
729} 990}
730bool OEffectiveEvent::operator<=( const OEffectiveEvent &e ) const{ 991
731 return (data->date <= e.date() ); 992
993bool OEffectiveEvent::operator<=( const OEffectiveEvent &e ) const
994{
995 return ( data->date <= e.date() );
732} 996}
733bool OEffectiveEvent::operator==( const OEffectiveEvent &e ) const { 997
998
999bool OEffectiveEvent::operator==( const OEffectiveEvent &e ) const
1000{
734 return ( date() == e.date() 1001 return ( date() == e.date()
735 && startTime() == e.startTime() 1002 && startTime() == e.startTime()
736 && endTime()== e.endTime() 1003 && endTime() == e.endTime()
737 && event() == e.event() ); 1004 && event() == e.event() );
738} 1005}
739bool OEffectiveEvent::operator!=( const OEffectiveEvent &e ) const { 1006
740 return !(*this == e ); 1007
1008bool OEffectiveEvent::operator!=( const OEffectiveEvent &e ) const
1009{
1010 return !( *this == e );
741} 1011}
742bool OEffectiveEvent::operator>( const OEffectiveEvent &e ) const { 1012
743 return !(*this <= e ); 1013
1014bool OEffectiveEvent::operator>( const OEffectiveEvent &e ) const
1015{
1016 return !( *this <= e );
744} 1017}
745bool OEffectiveEvent::operator>= ( const OEffectiveEvent &e ) const { 1018
746 return !(*this < e); 1019
1020bool OEffectiveEvent::operator>= ( const OEffectiveEvent &e ) const
1021{
1022 return !( *this < e );
747} 1023}
748 1024
749} 1025}