koalarmclient.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <kdebug.h>
00027 #include <klocale.h>
00028
00029 #include <libkcal/calendarlocal.h>
00030 #include <libkcal/icalformat.h>
00031
00032 #include "alarmdockwindow.h"
00033 #include "alarmdialog.h"
00034
00035 #include "koalarmclient.h"
00036 #include "koalarmclient.moc"
00037
00038 KOAlarmClient::KOAlarmClient(QObject *parent, const char *name)
00039 : QObject(parent, name),
00040 DCOPObject("ac"),
00041 mSuspendTimer(this)
00042 {
00043 kdDebug(5900) << "KOAlarmClient::KOAlarmClient()" << endl;
00044
00045 mDocker = new AlarmDockWindow(this);
00046 mDocker->show();
00047
00048 mAlarmDialog = new AlarmDialog;
00049 connect(mAlarmDialog, SIGNAL(suspendSignal(int)), SLOT(suspend(int)));
00050 }
00051
00052 KOAlarmClient::~KOAlarmClient()
00053 {
00054 }
00055
00056 void KOAlarmClient::handleEvent( const QString &iCalendarString )
00057 {
00058
00059
00060
00061
00062 CalendarLocal cal;
00063 ICalFormat format;
00064 format.fromString( &cal, iCalendarString );
00065
00066 QPtrList<Event> events = cal.events();
00067
00068 Event *ev;
00069 for( ev = events.first(); ev; ev = events.next() ) {
00070 mAlarmDialog->appendEvent( new Event( *ev ) );
00071 }
00072
00073 QPtrList<Todo> todos = cal.todos();
00074
00075 Todo *todo;
00076 for( todo = todos.first(); todo; todo = todos.next() ) {
00077 mAlarmDialog->appendTodo( new Todo( *todo ) );
00078 }
00079
00080 showAlarmDialog();
00081 }
00082
00083
00084 void KOAlarmClient::suspend(int minutes)
00085 {
00086
00087 connect(&mSuspendTimer, SIGNAL(timeout()), SLOT(showAlarmDialog()));
00088 mSuspendTimer.start(1000*60*minutes, true);
00089 }
00090
00091
00092 void KOAlarmClient::showAlarmDialog()
00093 {
00094 mAlarmDialog->show();
00095 mAlarmDialog->eventNotification();
00096 }
This file is part of the documentation for kdelibs Version 3.1.4.