summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/datebookdb.cpp25
-rw-r--r--library/datebookdb.h3
2 files changed, 27 insertions, 1 deletions
diff --git a/library/datebookdb.cpp b/library/datebookdb.cpp
index bf7fd94..da5a797 100644
--- a/library/datebookdb.cpp
+++ b/library/datebookdb.cpp
@@ -462,4 +462,7 @@ QValueList<EffectiveEvent> DateBookDB::getEffectiveEvents( const QDate &from,
462 462
463 for (it = eventList.begin(); it != eventList.end(); ++it ) { 463 for (it = eventList.begin(); it != eventList.end(); ++it ) {
464 if (!(*it).isValidUid())
465 (*it).assignUid(); // FIXME: Hack to restore cleared uids
466
464 dtTmp = (*it).start(TRUE); 467 dtTmp = (*it).start(TRUE);
465 dtEnd = (*it).end(TRUE); 468 dtEnd = (*it).end(TRUE);
@@ -504,4 +507,6 @@ QValueList<EffectiveEvent> DateBookDB::getEffectiveEvents( const QDate &from,
504 QDateTime repeat; 507 QDateTime repeat;
505 for ( it = repeatEvents.begin(); it != repeatEvents.end(); ++it ) { 508 for ( it = repeatEvents.begin(); it != repeatEvents.end(); ++it ) {
509 if (!(*it).isValidUid())
510 (*it).assignUid(); // FIXME: Hack to restore cleared uids
506 511
507 /* create a false end date, to short circuit on hard 512 /* create a false end date, to short circuit on hard
@@ -583,4 +588,17 @@ QValueList<EffectiveEvent> DateBookDB::getEffectiveEvents( const QDateTime &dt)
583} 588}
584 589
590Event DateBookDB::getEvent( int uid ) {
591 QValueList<Event>::ConstIterator it;
592
593 for (it = eventList.begin(); it != eventList.end(); it++) {
594 if ((*it).uid() == uid) return *it;
595 }
596 for (it = repeatEvents.begin(); it != repeatEvents.end(); it++) {
597 if ((*it).uid() == uid) return *it;
598 }
599
600 qDebug("Event not found: uid=%d\n", uid);
601}
602
585 603
586void DateBookDB::addEvent( const Event &ev, bool doalarm ) 604void DateBookDB::addEvent( const Event &ev, bool doalarm )
@@ -616,8 +634,10 @@ void DateBookDB::editEvent( const Event &old, Event &editedEv )
616 saveJournalEntry( editedEv, ACTION_REPLACE, oldIndex, oldHadRepeat ); 634 saveJournalEntry( editedEv, ACTION_REPLACE, oldIndex, oldHadRepeat );
617 635
636 // Delete old event
618 if ( old.hasAlarm() ) 637 if ( old.hasAlarm() )
619 delEventAlarm( old ); 638 delEventAlarm( old );
620 if ( oldHadRepeat ) { 639 if ( oldHadRepeat ) {
621 if ( oldHadRepeat && editedEv.hasRepeat() ) { 640 if ( editedEv.hasRepeat() ) { // This mean that origRepeat was run above and
641 // orig is initialized
622 // assumption, when someone edits a repeating event, they 642 // assumption, when someone edits a repeating event, they
623 // want to change them all, maybe not perfect, but it works 643 // want to change them all, maybe not perfect, but it works
@@ -631,4 +651,6 @@ void DateBookDB::editEvent( const Event &old, Event &editedEv )
631 eventList.remove( it ); 651 eventList.remove( it );
632 } 652 }
653
654 // Add new event
633 if ( editedEv.hasAlarm() ) 655 if ( editedEv.hasAlarm() )
634 addEventAlarm( editedEv ); 656 addEventAlarm( editedEv );
@@ -637,4 +659,5 @@ void DateBookDB::editEvent( const Event &old, Event &editedEv )
637 else 659 else
638 eventList.append( editedEv ); 660 eventList.append( editedEv );
661
639 d->clean = false; 662 d->clean = false;
640} 663}
diff --git a/library/datebookdb.h b/library/datebookdb.h
index aadb397..e4c251c 100644
--- a/library/datebookdb.h
+++ b/library/datebookdb.h
@@ -45,4 +45,5 @@ public:
45 const QDate &to ); 45 const QDate &to );
46 QValueList<EffectiveEvent> getEffectiveEvents( const QDateTime &start ); 46 QValueList<EffectiveEvent> getEffectiveEvents( const QDateTime &start );
47 Event getEvent( int uid );
47 48
48 QValueList<Event> getRawRepeats() const; 49 QValueList<Event> getRawRepeats() const;
@@ -79,4 +80,6 @@ private:
79 DateBookDBPrivate *d; 80 DateBookDBPrivate *d;
80 QFile journalFile; 81 QFile journalFile;
82
83 intrecordIdMax; // ADDITION
81}; 84};
82 85