korganizer

testalarmdlg.cpp
1/*
2 This file is part of KOrganizer.
3
4 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20 As a special exception, permission is given to link this program
21 with any edition of TQt, and distribute the resulting executable,
22 without including the source code for TQt in the source distribution.
23*/
24
25#include <tqwidget.h>
26
27#include <tdeaboutdata.h>
28#include <tdeapplication.h>
29#include <kdebug.h>
30#include <tdelocale.h>
31#include <tdecmdlineargs.h>
32#include <tdeconfig.h>
33#include <tdestandarddirs.h>
34
35#include "alarmdialog.h"
36
37int main(int argc,char **argv)
38{
39 TDEAboutData aboutData("testkabc",I18N_NOOP("TestKabc"),"0.1");
40 TDECmdLineArgs::init(argc,argv,&aboutData);
41
42 TDEApplication app;
43
44 TDEConfig c( locate( "config", "korganizerrc" ) );
45 c.setGroup( "Time & Date" );
46 TQString tz = c.readEntry( "TimeZoneId" );
47 CalendarResources *mCalendar = new CalendarResources( tz );
48
49 Event *e1 = new Event;
50 e1->setSummary( "This is a summary." );
51 TQDateTime now = TQDateTime::currentDateTime();
52 e1->setDtStart( now );
53 e1->setDtEnd( now.addDays( 1 ) );
54 Alarm *a = e1->newAlarm();
55// a->setProcedureAlarm( "/usr/X11R6/bin/xeyes" );
56 a->setAudioAlarm( "/data/kde/share/apps/korganizer/sounds/spinout.wav" );
57 mCalendar->addEvent( e1 );
58
59 Todo *t1 = new Todo;
60 t1->setSummary( "To-do A" );
61 t1->setDtDue( now );
62 t1->newAlarm();
63 mCalendar->addTodo( t1 );
64
65 Event *e2 = new Event;
66 e2->setSummary( "This is another summary." );
67 e2->setDtStart( now.addDays( 1 ) );
68 e2->setDtEnd( now.addDays( 2 ) );
69 e2->newAlarm();
70 mCalendar->addEvent( e2 );
71
72 Event *e3 = new Event;
73 e3->setSummary( "Meet with Fred" );
74 e3->setDtStart( now.addDays( 2 ) );
75 e3->setDtEnd( now.addDays( 3 ) );
76 e3->newAlarm();
77 mCalendar->addEvent( e3 );
78
79 Todo *t2 = new Todo;
80 t2->setSummary( "Something big is due today" );
81 t2->setDtDue( now );
82 t2->newAlarm();
83 mCalendar->addTodo( t2 );
84
85 Todo *t3 = new Todo;
86 t3->setSummary( "Be lazy" );
87 t3->setDtDue( now );
88 t3->newAlarm();
89 mCalendar->addTodo( t3 );
90
91 Event *e4 = new Event;
92 e4->setSummary( "Watch TV" );
93 e4->setDtStart( now.addSecs( 120 ) );
94 e4->setDtEnd( now.addSecs( 180 ) );
95 e4->newAlarm();
96 mCalendar->addEvent( e4 );
97
98 AlarmDialog dlg( mCalendar, 0 );
99 app.setMainWidget( &dlg );
100 dlg.addIncidence( e2, TQDateTime::currentDateTime().addSecs( 60 ),
101 TQString() );
102 dlg.addIncidence( t1, TQDateTime::currentDateTime().addSecs( 300 ),
103 TQString( "THIS IS DISPLAY TEXT" ) );
104 dlg.addIncidence( e4, TQDateTime::currentDateTime().addSecs( 120 ),
105 TQString( "Fred and Barney get cloned" ) );
106 dlg.addIncidence( e3, TQDateTime::currentDateTime().addSecs( 240 ),
107 TQString() );
108 dlg.addIncidence( e1, TQDateTime::currentDateTime().addSecs( 180 ),
109 TQString() );
110 dlg.addIncidence( t2, TQDateTime::currentDateTime().addSecs( 600 ),
111 TQString( "THIS IS DISPLAY TEXT" ) );
112 dlg.addIncidence( t3, TQDateTime::currentDateTime().addSecs( 360 ),
113 TQString() );
114 dlg.show();
115 dlg.eventNotification();
116
117 app.exec();
118}
void setAudioAlarm(const TQString &audioFile=TQString())
bool addTodo(Todo *todo)
bool addEvent(Event *event)
void setDtEnd(const TQDateTime &dtEnd)
void setSummary(const TQString &summary)
Alarm * newAlarm()
virtual void setDtStart(const TQDateTime &dtStart)
void setDtDue(const TQDateTime &dtDue, bool first=false)