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 #include <tqwidget.h>
00026
00027 #include <kaboutdata.h>
00028 #include <kapplication.h>
00029 #include <kdebug.h>
00030 #include <klocale.h>
00031 #include <kcmdlineargs.h>
00032 #include <kconfig.h>
00033 #include <kstandarddirs.h>
00034
00035 #include "alarmdialog.h"
00036
00037 int main(int argc,char **argv)
00038 {
00039 KAboutData aboutData("testkabc",I18N_NOOP("TestKabc"),"0.1");
00040 KCmdLineArgs::init(argc,argv,&aboutData);
00041
00042 KApplication app;
00043
00044 KConfig c( locate( "config", "korganizerrc" ) );
00045 c.setGroup( "Time & Date" );
00046 TQString tz = c.readEntry( "TimeZoneId" );
00047 CalendarResources *mCalendar = new CalendarResources( tz );
00048
00049 Event *e1 = new Event;
00050 e1->setSummary( "This is a summary." );
00051 TQDateTime now = TQDateTime::currentDateTime();
00052 e1->setDtStart( now );
00053 e1->setDtEnd( now.addDays( 1 ) );
00054 Alarm *a = e1->newAlarm();
00055
00056 a->setAudioAlarm( "/data/kde/share/apps/korganizer/sounds/spinout.wav" );
00057 mCalendar->addEvent( e1 );
00058
00059 Todo *t1 = new Todo;
00060 t1->setSummary( "To-do A" );
00061 t1->setDtDue( now );
00062 t1->newAlarm();
00063 mCalendar->addTodo( t1 );
00064
00065 Event *e2 = new Event;
00066 e2->setSummary( "This is another summary." );
00067 e2->setDtStart( now.addDays( 1 ) );
00068 e2->setDtEnd( now.addDays( 2 ) );
00069 e2->newAlarm();
00070 mCalendar->addEvent( e2 );
00071
00072 Event *e3 = new Event;
00073 e3->setSummary( "Meet with Fred" );
00074 e3->setDtStart( now.addDays( 2 ) );
00075 e3->setDtEnd( now.addDays( 3 ) );
00076 e3->newAlarm();
00077 mCalendar->addEvent( e3 );
00078
00079 Todo *t2 = new Todo;
00080 t2->setSummary( "Something big is due today" );
00081 t2->setDtDue( now );
00082 t2->newAlarm();
00083 mCalendar->addTodo( t2 );
00084
00085 Todo *t3 = new Todo;
00086 t3->setSummary( "Be lazy" );
00087 t3->setDtDue( now );
00088 t3->newAlarm();
00089 mCalendar->addTodo( t3 );
00090
00091 Event *e4 = new Event;
00092 e4->setSummary( "Watch TV" );
00093 e4->setDtStart( now.addSecs( 120 ) );
00094 e4->setDtEnd( now.addSecs( 180 ) );
00095 e4->newAlarm();
00096 mCalendar->addEvent( e4 );
00097
00098 AlarmDialog dlg( mCalendar, 0 );
00099 app.setMainWidget( &dlg );
00100 dlg.addIncidence( e2, TQDateTime::currentDateTime().addSecs( 60 ),
00101 TQString() );
00102 dlg.addIncidence( t1, TQDateTime::currentDateTime().addSecs( 300 ),
00103 TQString( "THIS IS DISPLAY TEXT" ) );
00104 dlg.addIncidence( e4, TQDateTime::currentDateTime().addSecs( 120 ),
00105 TQString( "Fred and Barney get cloned" ) );
00106 dlg.addIncidence( e3, TQDateTime::currentDateTime().addSecs( 240 ),
00107 TQString() );
00108 dlg.addIncidence( e1, TQDateTime::currentDateTime().addSecs( 180 ),
00109 TQString() );
00110 dlg.addIncidence( t2, TQDateTime::currentDateTime().addSecs( 600 ),
00111 TQString( "THIS IS DISPLAY TEXT" ) );
00112 dlg.addIncidence( t3, TQDateTime::currentDateTime().addSecs( 360 ),
00113 TQString() );
00114 dlg.show();
00115 dlg.eventNotification();
00116
00117 app.exec();
00118 }