-rw-r--r-- | core/pim/datebook/datebook.cpp | 25 | ||||
-rw-r--r-- | core/pim/datebook/datebook.h | 7 | ||||
-rw-r--r-- | library/datebookdb.cpp | 14 | ||||
-rw-r--r-- | library/datebookdb.h | 1 |
4 files changed, 29 insertions, 18 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 97c305c..c23129a 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -84,7 +84,7 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | |||
84 | { | 84 | { |
85 | QTime t; | 85 | QTime t; |
86 | t.start(); | 86 | t.start(); |
87 | db = new DateBookDB; | 87 | db = new DateBookDBHack; |
88 | qDebug("loading db t=%d", t.elapsed() ); | 88 | qDebug("loading db t=%d", t.elapsed() ); |
89 | loadSettings(); | 89 | loadSettings(); |
90 | setCaption( tr("Calendar") ); | 90 | setCaption( tr("Calendar") ); |
@@ -233,7 +233,7 @@ void DateBook::receive( const QCString &msg, const QByteArray &data ) | |||
233 | else if (msg == "editEvent(int)") { | 233 | else if (msg == "editEvent(int)") { |
234 | int uid; | 234 | int uid; |
235 | stream >> uid; | 235 | stream >> uid; |
236 | Event e=db->getEvent(uid); | 236 | Event e=db->eventByUID(uid); |
237 | editEvent(e); | 237 | editEvent(e); |
238 | } | 238 | } |
239 | } | 239 | } |
@@ -965,3 +965,24 @@ void DateBook::slotDoFind( const QString& txt, const QDate &dt, | |||
965 | wrapAround = !wrapAround; | 965 | wrapAround = !wrapAround; |
966 | } | 966 | } |
967 | } | 967 | } |
968 | |||
969 | Event DateBookDBHack::eventByUID(int uid) { | ||
970 | |||
971 | // FIXME: Dirty Hacks to get hold of the private event lists | ||
972 | QDate start; | ||
973 | QDate end=start.addDays(-1); | ||
974 | QValueList<Event> myEventList=getNonRepeatingEvents(start,end); | ||
975 | QValueList<Event> myRepeatEvents=getRawRepeats(); | ||
976 | |||
977 | QValueList<Event>::ConstIterator it; | ||
978 | |||
979 | for (it = myEventList.begin(); it != myEventList.end(); it++) { | ||
980 | if ((*it).uid() == uid) return *it; | ||
981 | } | ||
982 | for (it = myRepeatEvents.begin(); it != myRepeatEvents.end(); it++) { | ||
983 | if ((*it).uid() == uid) return *it; | ||
984 | } | ||
985 | |||
986 | qDebug("Event not found: uid=%d\n", uid); | ||
987 | } | ||
988 | |||
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h index 2ffcdbe..d1fe90d 100644 --- a/core/pim/datebook/datebook.h +++ b/core/pim/datebook/datebook.h | |||
@@ -34,6 +34,11 @@ class Event; | |||
34 | class QDate; | 34 | class QDate; |
35 | class Ir; | 35 | class Ir; |
36 | 36 | ||
37 | class DateBookDBHack : public DateBookDB { | ||
38 | public: | ||
39 | Event eventByUID(int id); | ||
40 | }; | ||
41 | |||
37 | class DateBook : public QMainWindow | 42 | class DateBook : public QMainWindow |
38 | { | 43 | { |
39 | Q_OBJECT | 44 | Q_OBJECT |
@@ -99,7 +104,7 @@ private: | |||
99 | void saveSettings(); | 104 | void saveSettings(); |
100 | 105 | ||
101 | private: | 106 | private: |
102 | DateBookDB *db; | 107 | DateBookDBHack *db; |
103 | QWidgetStack *views; | 108 | QWidgetStack *views; |
104 | DateBookDay *dayView; | 109 | DateBookDay *dayView; |
105 | DateBookWeek *weekView; | 110 | DateBookWeek *weekView; |
diff --git a/library/datebookdb.cpp b/library/datebookdb.cpp index da5a797..2ac9a0c 100644 --- a/library/datebookdb.cpp +++ b/library/datebookdb.cpp | |||
@@ -587,20 +587,6 @@ QValueList<EffectiveEvent> DateBookDB::getEffectiveEvents( const QDateTime &dt) | |||
587 | return tmpList; | 587 | return tmpList; |
588 | } | 588 | } |
589 | 589 | ||
590 | Event 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 | |||
603 | |||
604 | void DateBookDB::addEvent( const Event &ev, bool doalarm ) | 590 | void DateBookDB::addEvent( const Event &ev, bool doalarm ) |
605 | { | 591 | { |
606 | // write to the journal... | 592 | // write to the journal... |
diff --git a/library/datebookdb.h b/library/datebookdb.h index e4c251c..0add028 100644 --- a/library/datebookdb.h +++ b/library/datebookdb.h | |||
@@ -44,7 +44,6 @@ public: | |||
44 | QValueList<EffectiveEvent> getEffectiveEvents( const QDate &from, | 44 | QValueList<EffectiveEvent> getEffectiveEvents( const QDate &from, |
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 ); | ||
48 | 47 | ||
49 | QValueList<Event> getRawRepeats() const; | 48 | QValueList<Event> getRawRepeats() const; |
50 | QValueList<Event> getNonRepeatingEvents( const QDate &from, | 49 | QValueList<Event> getNonRepeatingEvents( const QDate &from, |