summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebook.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp25
1 files changed, 23 insertions, 2 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
@@ -81,13 +81,13 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
startTime( 8 ), // an acceptable default
syncing(FALSE),
inSearch(FALSE)
{
QTime t;
t.start();
- db = new DateBookDB;
+ db = new DateBookDBHack;
qDebug("loading db t=%d", t.elapsed() );
loadSettings();
setCaption( tr("Calendar") );
setIcon( Resource::loadPixmap( "datebook_icon" ) );
setToolBarsMovable( FALSE );
@@ -230,13 +230,13 @@ void DateBook::receive( const QCString &msg, const QByteArray &data )
else if ( monthAction->isOn() )
viewMonth();
}
else if (msg == "editEvent(int)") {
int uid;
stream >> uid;
- Event e=db->getEvent(uid);
+ Event e=db->eventByUID(uid);
editEvent(e);
}
}
DateBook::~DateBook()
{
@@ -962,6 +962,27 @@ void DateBook::slotDoFind( const QString& txt, const QDate &dt,
nonrev.setStart( rev.start() );
} else
emit signalNotFound();
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);
+}
+