summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/datebookdb.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/datebookdb.cpp b/library/datebookdb.cpp
index e4ec2bf..165a637 100644
--- a/library/datebookdb.cpp
+++ b/library/datebookdb.cpp
@@ -361,64 +361,67 @@ static bool nextAlarm( const Event &ev, QDateTime& when, int& warn)
361 361
362static void addEventAlarm( const Event &ev ) 362static void addEventAlarm( const Event &ev )
363{ 363{
364 QDateTime when; 364 QDateTime when;
365 int warn; 365 int warn;
366 if ( nextAlarm(ev,when,warn) ) 366 if ( nextAlarm(ev,when,warn) )
367 AlarmServer::addAlarm( when, 367 AlarmServer::addAlarm( when,
368 "QPE/Application/datebook", 368 "QPE/Application/datebook",
369 "alarm(QDateTime,int)", warn ); 369 "alarm(QDateTime,int)", warn );
370} 370}
371 371
372static void delEventAlarm( const Event &ev ) 372static void delEventAlarm( const Event &ev )
373{ 373{
374 QDateTime when; 374 QDateTime when;
375 int warn; 375 int warn;
376 if ( nextAlarm(ev,when,warn) ) 376 if ( nextAlarm(ev,when,warn) )
377 AlarmServer::deleteAlarm( when, 377 AlarmServer::deleteAlarm( when,
378 "QPE/Application/datebook", 378 "QPE/Application/datebook",
379 "alarm(QDateTime,int)", warn ); 379 "alarm(QDateTime,int)", warn );
380} 380}
381 381
382 382
383DateBookDB::DateBookDB() 383DateBookDB::DateBookDB()
384{ 384{
385 init(); 385 init();
386} 386}
387 387
388DateBookDB::~DateBookDB() 388DateBookDB::~DateBookDB()
389{ 389{
390 save(); 390 save();
391 eventList.clear(); 391 eventList.clear();
392 repeatEvents.clear(); 392 repeatEvents.clear();
393
394 delete d;
395 d=0;
393} 396}
394 397
395 398
396//#### Why is this code duplicated in getEffectiveEvents ????? 399//#### Why is this code duplicated in getEffectiveEvents ?????
397//#### Addendum. Don't use this function, lets faze it out if we can. 400//#### Addendum. Don't use this function, lets faze it out if we can.
398QValueList<Event> DateBookDB::getEvents( const QDate &from, const QDate &to ) 401QValueList<Event> DateBookDB::getEvents( const QDate &from, const QDate &to )
399{ 402{
400 QValueList<Event> tmpList; 403 QValueList<Event> tmpList;
401 tmpList = getNonRepeatingEvents( from, to ); 404 tmpList = getNonRepeatingEvents( from, to );
402 405
403 // check for repeating events... 406 // check for repeating events...
404 for (QValueList<Event>::ConstIterator it = repeatEvents.begin(); 407 for (QValueList<Event>::ConstIterator it = repeatEvents.begin();
405 it != repeatEvents.end(); ++it) { 408 it != repeatEvents.end(); ++it) {
406 QDate itDate = from; 409 QDate itDate = from;
407 QDateTime due; 410 QDateTime due;
408 411
409 /* create a false end date, to short circuit on hard 412 /* create a false end date, to short circuit on hard
410 MonthlyDay recurences */ 413 MonthlyDay recurences */
411 Event dummy_event = *it; 414 Event dummy_event = *it;
412 Event::RepeatPattern r = dummy_event.repeatPattern(); 415 Event::RepeatPattern r = dummy_event.repeatPattern();
413 if ( !r.hasEndDate || r.endDate() > to ) { 416 if ( !r.hasEndDate || r.endDate() > to ) {
414 r.setEndDate( to ); 417 r.setEndDate( to );
415 r.hasEndDate = TRUE; 418 r.hasEndDate = TRUE;
416 } 419 }
417 dummy_event.setRepeat(TRUE, r); 420 dummy_event.setRepeat(TRUE, r);
418 421
419 while (nextOccurance(dummy_event, itDate, due)) { 422 while (nextOccurance(dummy_event, itDate, due)) {
420 if (due.date() > to) 423 if (due.date() > to)
421 break; 424 break;
422 Event newEvent = *it; 425 Event newEvent = *it;
423 newEvent.setStart(due); 426 newEvent.setStart(due);
424 newEvent.setEnd(due.addSecs((*it).start().secsTo((*it).end()))); 427 newEvent.setEnd(due.addSecs((*it).start().secsTo((*it).end())));