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( "/data/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 Todo *t2 = new Todo;
00069 t2->setSummary( "Something big is due today" );
00070 t2->setDtDue( now );
00071 t2->newAlarm();
00072
00073 Todo *t3 = new Todo;
00074 t3->setSummary( "Be lazy" );
00075 t3->setDtDue( now );
00076 t3->newAlarm();
00077
00078 Event *e4 = new Event;
00079 e4->setSummary( "Watch TV" );
00080 e4->setDtStart( now.addSecs( 120 ) );
00081 e4->setDtEnd( now.addSecs( 180 ) );
00082 e4->newAlarm();
00083
00084 AlarmDialog dlg( 0 );
00085 app.setMainWidget( &dlg );
00086 dlg.addIncidence( e2, QDateTime::currentDateTime().addSecs( 60 ),
00087 QString() );
00088 dlg.addIncidence( t1, QDateTime::currentDateTime().addSecs( 300 ),
00089 QString( "THIS IS DISPLAY TEXT" ) );
00090 dlg.addIncidence( e4, QDateTime::currentDateTime().addSecs( 120 ),
00091 QString( "Fred and Barney get cloned" ) );
00092 dlg.addIncidence( e3, QDateTime::currentDateTime().addSecs( 240 ),
00093 QString() );
00094 dlg.addIncidence( e1, QDateTime::currentDateTime().addSecs( 180 ),
00095 QString() );
00096 dlg.addIncidence( t2, QDateTime::currentDateTime().addSecs( 600 ),
00097 QString( "THIS IS DISPLAY TEXT" ) );
00098 dlg.addIncidence( t3, QDateTime::currentDateTime().addSecs( 360 ),
00099 QString() );
00100 dlg.show();
00101 dlg.eventNotification();
00102
00103 app.exec();
00104 }
|