korganizer
testalarmdlg.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <qwidget.h>
00026
00027 #include <kaboutdata.h>
00028 #include <kapplication.h>
00029 #include <kdebug.h>
00030 #include <klocale.h>
00031 #include <kcmdlineargs.h>
00032
00033 #include "alarmdialog.h"
00034
00035 int main(int argc,char **argv)
00036 {
00037 KAboutData aboutData("testkabc",I18N_NOOP("TestKabc"),"0.1");
00038 KCmdLineArgs::init(argc,argv,&aboutData);
00039
00040 KApplication app;
00041
00042 Event *e1 = new Event;
00043 e1->setSummary( "This is a summary." );
00044 QDateTime now = QDateTime::currentDateTime();
00045 e1->setDtStart( now );
00046 e1->setDtEnd( now.addDays( 1 ) );
00047 Alarm *a = e1->newAlarm();
00048
00049 a->setAudioAlarm( "/opt/kde/share/apps/korganizer/sounds/spinout.wav" );
00050
00051 Todo *t1 = new Todo;
00052 t1->setSummary( "To-do A" );
00053 t1->setDtDue( now );
00054 t1->newAlarm();
00055
00056 Event *e2 = new Event;
00057 e2->setSummary( "This is another summary." );
00058 e2->setDtStart( now.addDays( 1 ) );
00059 e2->setDtEnd( now.addDays( 2 ) );
00060 e2->newAlarm();
00061
00062 Event *e3 = new Event;
00063 e3->setSummary( "Meet with Fred" );
00064 e3->setDtStart( now.addDays( 2 ) );
00065 e3->setDtEnd( now.addDays( 3 ) );
00066 e3->newAlarm();
00067
00068 Event *e4 = new Event;
00069 e4->setSummary( "Watch TV" );
00070 e4->setDtStart( now.addSecs( 120 ) );
00071 e4->setDtEnd( now.addSecs( 180 ) );
00072 e4->newAlarm();
00073
00074 AlarmDialog dlg( 0 );
00075 app.setMainWidget( &dlg );
00076 dlg.addIncidence( e2, QDateTime::currentDateTime().addSecs( 60 ) );
00077 dlg.addIncidence( t1, QDateTime::currentDateTime().addSecs( 300 ) );
00078 dlg.addIncidence( e4, QDateTime::currentDateTime().addSecs( 120 ) );
00079 dlg.addIncidence( e3, QDateTime::currentDateTime().addSecs( 240 ) );
00080 dlg.addIncidence( e1, QDateTime::currentDateTime().addSecs( 180 ) );
00081 dlg.show();
00082 dlg.eventNotification();
00083
00084 app.exec();
00085 }
|