testalarmdlg.cpp
00001 /* 00002 This file is part of KOrganizer. 00003 00004 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 00020 As a special exception, permission is given to link this program 00021 with any edition of TQt, and distribute the resulting executable, 00022 without including the source code for TQt in the source distribution. 00023 */ 00024 00025 #include <tqwidget.h> 00026 00027 #include <tdeaboutdata.h> 00028 #include <tdeapplication.h> 00029 #include <kdebug.h> 00030 #include <tdelocale.h> 00031 #include <tdecmdlineargs.h> 00032 #include <tdeconfig.h> 00033 #include <kstandarddirs.h> 00034 00035 #include "alarmdialog.h" 00036 00037 int main(int argc,char **argv) 00038 { 00039 TDEAboutData aboutData("testkabc",I18N_NOOP("TestKabc"),"0.1"); 00040 TDECmdLineArgs::init(argc,argv,&aboutData); 00041 00042 TDEApplication app; 00043 00044 TDEConfig 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 // a->setProcedureAlarm( "/usr/X11R6/bin/xeyes" ); 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 }