summaryrefslogtreecommitdiff
authorhakan <hakan>2002-03-31 12:56:14 (UTC)
committer hakan <hakan>2002-03-31 12:56:14 (UTC)
commit7208583b0b7ff339e6019b188332d8bcb8f30973 (patch) (side-by-side diff)
tree4d0b064f1aa0a8553703af4f6e481393cf0ee13c
parenta386e428cbd6b468d4dbff5bf2df4fdba6df9b6e (diff)
downloadopie-7208583b0b7ff339e6019b188332d8bcb8f30973.zip
opie-7208583b0b7ff339e6019b188332d8bcb8f30973.tar.gz
opie-7208583b0b7ff339e6019b188332d8bcb8f30973.tar.bz2
Moved getEvent(uid) into some hack DateBookDBHack::eventByUID(uid) in the datbeook that might work as long as the QDate implementation are not chnaged.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp25
-rw-r--r--core/pim/datebook/datebook.h7
-rw-r--r--library/datebookdb.cpp14
-rw-r--r--library/datebookdb.h1
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 )
{
QTime t;
t.start();
- db = new DateBookDB;
+ db = new DateBookDBHack;
qDebug("loading db t=%d", t.elapsed() );
loadSettings();
setCaption( tr("Calendar") );
@@ -233,7 +233,7 @@ void DateBook::receive( const QCString &msg, const QByteArray &data )
else if (msg == "editEvent(int)") {
int uid;
stream >> uid;
- Event e=db->getEvent(uid);
+ Event e=db->eventByUID(uid);
editEvent(e);
}
}
@@ -965,3 +965,24 @@ void DateBook::slotDoFind( const QString& txt, const QDate &dt,
wrapAround = !wrapAround;
}
}
+
+Event DateBookDBHack::eventByUID(int uid) {
+
+ // FIXME: Dirty Hacks to get hold of the private event lists
+ QDate start;
+ QDate end=start.addDays(-1);
+ QValueList<Event> myEventList=getNonRepeatingEvents(start,end);
+ QValueList<Event> myRepeatEvents=getRawRepeats();
+
+ QValueList<Event>::ConstIterator it;
+
+ for (it = myEventList.begin(); it != myEventList.end(); it++) {
+ if ((*it).uid() == uid) return *it;
+ }
+ for (it = myRepeatEvents.begin(); it != myRepeatEvents.end(); it++) {
+ if ((*it).uid() == uid) return *it;
+ }
+
+ qDebug("Event not found: uid=%d\n", uid);
+}
+
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;
class QDate;
class Ir;
+class DateBookDBHack : public DateBookDB {
+ public:
+ Event eventByUID(int id);
+};
+
class DateBook : public QMainWindow
{
Q_OBJECT
@@ -99,7 +104,7 @@ private:
void saveSettings();
private:
- DateBookDB *db;
+ DateBookDBHack *db;
QWidgetStack *views;
DateBookDay *dayView;
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)
return tmpList;
}
-Event DateBookDB::getEvent( int uid ) {
- QValueList<Event>::ConstIterator it;
-
- for (it = eventList.begin(); it != eventList.end(); it++) {
- if ((*it).uid() == uid) return *it;
- }
- for (it = repeatEvents.begin(); it != repeatEvents.end(); it++) {
- if ((*it).uid() == uid) return *it;
- }
-
- qDebug("Event not found: uid=%d\n", uid);
-}
-
-
void DateBookDB::addEvent( const Event &ev, bool doalarm )
{
// 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:
QValueList<EffectiveEvent> getEffectiveEvents( const QDate &from,
const QDate &to );
QValueList<EffectiveEvent> getEffectiveEvents( const QDateTime &start );
- Event getEvent( int uid );
QValueList<Event> getRawRepeats() const;
QValueList<Event> getNonRepeatingEvents( const QDate &from,