korganizer

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 Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
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 //  a->setProcedureAlarm( "/usr/X11R6/bin/xeyes" );
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 }
KDE Home | KDE Accessibility Home | Description of Access Keys