summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-07-03 16:13:47 (UTC)
committer zautrix <zautrix>2004-07-03 16:13:47 (UTC)
commit2dd6ac0b2d24c91d35ce674a6c26351352df2b15 (patch) (unidiff)
treeb8474ca04d5e1bf79ca956ecaefc0c5d62280e8c
parenta95f7085c5dd7234c254750e32e44941599f3390 (diff)
downloadkdepimpi-2dd6ac0b2d24c91d35ce674a6c26351352df2b15.zip
kdepimpi-2dd6ac0b2d24c91d35ce674a6c26351352df2b15.tar.gz
kdepimpi-2dd6ac0b2d24c91d35ce674a6c26351352df2b15.tar.bz2
Popupmenu rearrangeg
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp16
-rw-r--r--kalarmd/simplealarmdaemonimpl.h1
2 files changed, 10 insertions, 7 deletions
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp
index 2bc6643..471836b 100644
--- a/kalarmd/simplealarmdaemonimpl.cpp
+++ b/kalarmd/simplealarmdaemonimpl.cpp
@@ -1,552 +1,554 @@
1/* 1/*
2 This file is part of the KOrganizer alarm daemon. 2 This file is part of the KOrganizer alarm daemon.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include "simplealarmdaemonimpl.h" 24#include "simplealarmdaemonimpl.h"
25 25
26#include "alarmdialog.h" 26#include "alarmdialog.h"
27#include <qpopupmenu.h> 27#include <qpopupmenu.h>
28#include <qapp.h> 28#include <qapp.h>
29#include <qdir.h> 29#include <qdir.h>
30#include <qfile.h> 30#include <qfile.h>
31#include <qhbox.h> 31#include <qhbox.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qlineedit.h> 35#include <qlineedit.h>
36#include <qdialog.h> 36#include <qdialog.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qtextstream.h> 38#include <qtextstream.h>
39#include <qtopia/qcopenvelope_qws.h> 39#include <qtopia/qcopenvelope_qws.h>
40#include <qtopia/alarmserver.h> 40#include <qtopia/alarmserver.h>
41 41
42#include <stdlib.h> 42#include <stdlib.h>
43#include <stdio.h> 43#include <stdio.h>
44#include <unistd.h> 44#include <unistd.h>
45 45
46 46
47SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent ) 47SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent )
48 : QLabel( parent ) 48 : QLabel( parent )
49{ 49{
50 mAlarmDialog = new AlarmDialog( 0 ); 50 mAlarmDialog = new AlarmDialog( 0 );
51 mPopUp = new QPopupMenu( 0 ); 51 mPopUp = new QPopupMenu( 0 );
52 mPopUp->insertItem( "Addresses", this, SLOT ( showAdd() ) );
53 mPopUp->insertSeparator();
54 mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) );
55 mPopUp->insertSeparator();
56 mPopUp->insertItem( "What's Next?", this, SLOT ( showWN() ) ); 52 mPopUp->insertItem( "What's Next?", this, SLOT ( showWN() ) );
53 mPopUp->insertItem( "Next Days!", this, SLOT ( showKO() ) );
57 mPopUp->insertSeparator(); 54 mPopUp->insertSeparator();
58 mPopUp->insertItem( "What's Todo?", this, SLOT ( showTodo() ) ); 55 mPopUp->insertItem( "What's Todo?", this, SLOT ( showTodo() ) );
59 mPopUp->insertSeparator(); 56 mPopUp->insertSeparator();
60 mPopUp->insertItem( "Next Days!", this, SLOT ( showKO() ) ); 57 mPopUp->insertItem( "Addresses", this, SLOT ( showAdd() ) );
61 mPopUp->insertSeparator(); 58 mPopUp->insertSeparator();
62 mPopUp->insertItem( "Edit Journal", this, SLOT ( writeJournal() ) ); 59 mPopUp->insertItem( "Edit Journal", this, SLOT ( writeJournal() ) );
63 mPopUp->insertSeparator();
64 mPopUp->insertItem( "New Event", this, SLOT ( newEvent() ) ); 60 mPopUp->insertItem( "New Event", this, SLOT ( newEvent() ) );
65 mPopUp->insertItem( "New Todo", this, SLOT ( newTodo() ) ); 61 mPopUp->insertItem( "New Todo", this, SLOT ( newTodo() ) );
62 mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) );
63 mPopUp->insertSeparator();
64 mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) );
66 mTimerPopUp = new QPopupMenu( mPopUp ); 65 mTimerPopUp = new QPopupMenu( mPopUp );
67 66
68 mBeepPopUp = new QPopupMenu( mPopUp ); 67 mBeepPopUp = new QPopupMenu( mPopUp );
69 mSoundPopUp = new QPopupMenu( mBeepPopUp ); 68 mSoundPopUp = new QPopupMenu( mBeepPopUp );
70 mPausePopUp = new QPopupMenu( mBeepPopUp ); 69 mPausePopUp = new QPopupMenu( mBeepPopUp );
71 QPopupMenu* savePopUp = new QPopupMenu( mBeepPopUp ); 70 QPopupMenu* savePopUp = new QPopupMenu( mBeepPopUp );
72 savePopUp->insertItem( "Save", 0 ); 71 savePopUp->insertItem( "Save", 0 );
73 savePopUp->insertItem( "Load", 1 ); 72 savePopUp->insertItem( "Load", 1 );
74 mSoundPopUp->insertItem( "Buzzer", 0 ); 73 mSoundPopUp->insertItem( "Buzzer", 0 );
75 mSoundPopUp->insertItem( "Wav file", 1 ); 74 mSoundPopUp->insertItem( "Wav file", 1 );
76 mPausePopUp->insertItem( " 1 sec", 1 ); 75 mPausePopUp->insertItem( " 1 sec", 1 );
77 mPausePopUp->insertItem( " 2 sec", 2 ); 76 mPausePopUp->insertItem( " 2 sec", 2 );
78 mPausePopUp->insertItem( " 3 sec", 3 ); 77 mPausePopUp->insertItem( " 3 sec", 3 );
79 mPausePopUp->insertItem( " 5 sec", 5 ); 78 mPausePopUp->insertItem( " 5 sec", 5 );
80 mPausePopUp->insertItem( "10 sec", 10 ); 79 mPausePopUp->insertItem( "10 sec", 10 );
81 mPausePopUp->insertItem( "30 sec", 30 ); 80 mPausePopUp->insertItem( "30 sec", 30 );
82 mPausePopUp->insertItem( " 1 min", 60 ); 81 mPausePopUp->insertItem( " 1 min", 60 );
83 mPausePopUp->insertItem( " 5 min", 300 ); 82 mPausePopUp->insertItem( " 5 min", 300 );
84 mPausePopUp->insertItem( "10 min", 600 ); 83 mPausePopUp->insertItem( "10 min", 600 );
85 mSuspendPopUp = new QPopupMenu( mBeepPopUp ); 84 mSuspendPopUp = new QPopupMenu( mBeepPopUp );
86 mSuspendPopUp->insertItem( "Off", 0 ); 85 mSuspendPopUp->insertItem( "Off", 0 );
87 mSuspendPopUp->insertItem( " 1x", 1 ); 86 mSuspendPopUp->insertItem( " 1x", 1 );
88 mSuspendPopUp->insertItem( " 2x", 2 ); 87 mSuspendPopUp->insertItem( " 2x", 2 );
89 mSuspendPopUp->insertItem( " 3x", 3 ); 88 mSuspendPopUp->insertItem( " 3x", 3 );
90 mSuspendPopUp->insertItem( " 5x", 5 ); 89 mSuspendPopUp->insertItem( " 5x", 5 );
91 mSuspendPopUp->insertItem( "10x", 10 ); 90 mSuspendPopUp->insertItem( "10x", 10 );
92 mSuspendPopUp->insertItem( "20x", 20 ); 91 mSuspendPopUp->insertItem( "20x", 20 );
93 mSuspendPopUp->insertItem( "30x", 30 ); 92 mSuspendPopUp->insertItem( "30x", 30 );
94 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp ); 93 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp );
95 mBeepPopUp->insertItem( "Beep interval",mPausePopUp ); 94 mBeepPopUp->insertItem( "Beep interval",mPausePopUp );
96 mBeepPopUp->insertItem( "Replay",mSoundPopUp ); 95 mBeepPopUp->insertItem( "Replay",mSoundPopUp );
97 mBeepPopUp->insertItem( "Config",savePopUp ); 96 mBeepPopUp->insertItem( "Config",savePopUp );
98 mBeepPopUp->insertItem( "300", 300 ); 97 mBeepPopUp->insertItem( "300", 300 );
99 mBeepPopUp->insertItem( "180", 180 ); 98 mBeepPopUp->insertItem( "180", 180 );
100 mBeepPopUp->insertItem( "60", 60 ); 99 mBeepPopUp->insertItem( "60", 60 );
101 mBeepPopUp->insertItem( "30", 30 ); 100 mBeepPopUp->insertItem( "30", 30 );
102 mBeepPopUp->insertItem( "10", 10 ); 101 mBeepPopUp->insertItem( "10", 10 );
103 mBeepPopUp->insertItem( "3", 3 ); 102 mBeepPopUp->insertItem( "3", 3 );
104 mBeepPopUp->insertItem( "1", 1 ); 103 mBeepPopUp->insertItem( "1", 1 );
105 mBeepPopUp->insertItem( "Off", 0 ); 104 mBeepPopUp->insertItem( "Off", 0 );
106 mBeepPopUp->setCheckable( true ); 105 mBeepPopUp->setCheckable( true );
107 mPopUp->insertSeparator(); 106 mPopUp->insertSeparator();
108 mPopUp->insertItem( "Play beeps", mBeepPopUp ); 107 mPopUp->insertItem( "Play beeps", mBeepPopUp );
109 mPopUp->insertSeparator(); 108 mPopUp->insertSeparator();
110 mPopUp->insertItem( "Timer", mTimerPopUp ); 109 mPopUp->insertItem( "Timer", mTimerPopUp );
111 mPopUp->insertSeparator(); 110 mPopUp->insertSeparator();
112 mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) ); 111 mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) );
113 112
114 mPopUp->resize( mPopUp->sizeHint() ); 113 mPopUp->resize( mPopUp->sizeHint() );
115 mPlayBeeps = 60; 114 mPlayBeeps = 60;
116 mBeepPopUp->setItemChecked ( mPlayBeeps, true ); 115 mBeepPopUp->setItemChecked ( mPlayBeeps, true );
117 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) ); 116 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) );
118 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) ); 117 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) );
119 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) ); 118 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) );
120 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) ); 119 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) );
121 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) ); 120 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) );
122 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) ); 121 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) );
123 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) ); 122 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) );
124 mTimerTime = 0; 123 mTimerTime = 0;
125 mCustomText = "Custom Text"; 124 mCustomText = "Custom Text";
126 mCustomMinutes = 7; 125 mCustomMinutes = 7;
127 mTimerPopupConf = 1; 126 mTimerPopupConf = 1;
128 fillTimerPopUp(); 127 fillTimerPopUp();
129 mPausePlay = 0; 128 mPausePlay = 0;
130 confPause( 1 ); 129 confPause( 1 );
131 mSuspend = 0; 130 mSuspend = 0;
132 confSuspend( 0 ); 131 confSuspend( 0 );
133 if ( QApplication::desktop()->width() < 480 ) { 132 if ( QApplication::desktop()->width() < 480 ) {
134 wavAlarm = false; 133 wavAlarm = false;
135 mSoundPopUp->setItemChecked ( 0, true ); 134 mSoundPopUp->setItemChecked ( 0, true );
136 } 135 }
137 else { 136 else {
138 wavAlarm = true; 137 wavAlarm = true;
139 mSoundPopUp->setItemChecked ( 1, true ); 138 mSoundPopUp->setItemChecked ( 1, true );
140 } 139 }
141 saveSlot( 1 ); 140 saveSlot( 1 );
142} 141}
143 142
144SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl() 143SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl()
145{ 144{
146 delete mPopUp; 145 delete mPopUp;
147 delete mAlarmDialog; 146 delete mAlarmDialog;
148} 147}
149void SimpleAlarmDaemonImpl::saveSlot( int load ) 148void SimpleAlarmDaemonImpl::saveSlot( int load )
150{ 149{
151 QString fileName = QDir::homeDirPath() +"/.kopialarmrc"; 150 QString fileName = QDir::homeDirPath() +"/.kopialarmrc";
152 //qDebug("save %d ", load ); 151 //qDebug("save %d ", load );
153 QFile file( fileName ); 152 QFile file( fileName );
154 if ( load ) { 153 if ( load ) {
155 if( !QFile::exists( fileName) ) 154 if( !QFile::exists( fileName) )
156 return; 155 return;
157 if (!file.open( IO_ReadOnly ) ) { 156 if (!file.open( IO_ReadOnly ) ) {
158 return ; 157 return ;
159 } 158 }
160 QString line; 159 QString line;
161 bool ok; 160 bool ok;
162 int val; 161 int val;
163 int len; 162 int len;
164 while ( file.readLine( line, 1024 ) > 0 ) { 163 while ( file.readLine( line, 1024 ) > 0 ) {
165 //qDebug("read %s ", line.latin1()); 164 //qDebug("read %s ", line.latin1());
166 len = line.length(); 165 len = line.length();
167 if ( line.left(4 ) == "PPAU" ) { 166 if ( line.left(4 ) == "PPAU" ) {
168 val = line.mid( 4,len-5).toInt( &ok ); 167 val = line.mid( 4,len-5).toInt( &ok );
169 if ( ok ) { 168 if ( ok ) {
170 confPause( val ); 169 confPause( val );
171 } 170 }
172 } 171 }
173 if ( line.left(4 ) == "SUCO" ) { 172 if ( line.left(4 ) == "SUCO" ) {
174 val = line.mid( 4,len-5).toInt( &ok ); 173 val = line.mid( 4,len-5).toInt( &ok );
175 if ( ok ) 174 if ( ok )
176 confSuspend ( val ); 175 confSuspend ( val );
177 } 176 }
178 if ( line.left(4 ) == "WAAL" ) { 177 if ( line.left(4 ) == "WAAL" ) {
179 val = line.mid( 4,len-5).toInt( &ok ); 178 val = line.mid( 4,len-5).toInt( &ok );
180 if ( ok ) 179 if ( ok )
181 confSound( val ); 180 confSound( val );
182 181
183 } 182 }
184 if ( line.left(4 ) == "PLBE" ) { 183 if ( line.left(4 ) == "PLBE" ) {
185 val = line.mid( 4,len-5).toInt( &ok ); 184 val = line.mid( 4,len-5).toInt( &ok );
186 if ( ok ) 185 if ( ok )
187 slotPlayBeep( val ); 186 slotPlayBeep( val );
188 187
189 } 188 }
190 if ( line.left(4 ) == "CUTE" ) { 189 if ( line.left(4 ) == "CUTE" ) {
191 mCustomText = line.mid( 5,len-6); 190 mCustomText = line.mid( 5,len-6);
192 // qDebug("text ***%s*** ",mCustomText.latin1() ); 191 // qDebug("text ***%s*** ",mCustomText.latin1() );
193 192
194 } 193 }
195 if ( line.left(4 ) == "CUMI" ) { 194 if ( line.left(4 ) == "CUMI" ) {
196 val = line.mid( 4,len-5).toInt( &ok ); 195 val = line.mid( 4,len-5).toInt( &ok );
197 if ( ok ) 196 if ( ok )
198 mCustomMinutes = val; 197 mCustomMinutes = val;
199 198
200 } 199 }
201 if ( line.left(4 ) == "SUTI" ) { 200 if ( line.left(4 ) == "SUTI" ) {
202 val = line.mid( 4,len-5).toInt( &ok ); 201 val = line.mid( 4,len-5).toInt( &ok );
203 if ( ok ) 202 if ( ok )
204 mAlarmDialog->setSuspendTime( val );; 203 mAlarmDialog->setSuspendTime( val );;
205 204
206 } 205 }
207 } 206 }
208 file.close(); 207 file.close();
209 } else { 208 } else {
210 if (!file.open( IO_WriteOnly ) ) { 209 if (!file.open( IO_WriteOnly ) ) {
211 return; 210 return;
212 } 211 }
213 QString configString ; 212 QString configString ;
214 configString += "PPAU " + QString::number( mPausePlay ) + "\n"; 213 configString += "PPAU " + QString::number( mPausePlay ) + "\n";
215 configString += "SUCO " + QString::number( mSuspend ) + "\n"; 214 configString += "SUCO " + QString::number( mSuspend ) + "\n";
216 configString += "WAAL " + QString::number( wavAlarm ) + "\n"; 215 configString += "WAAL " + QString::number( wavAlarm ) + "\n";
217 configString += "PLBE " + QString::number( mPlayBeeps ) + "\n"; 216 configString += "PLBE " + QString::number( mPlayBeeps ) + "\n";
218 configString += "CUTE " + mCustomText + "\n"; 217 configString += "CUTE " + mCustomText + "\n";
219 configString += "CUMI " + QString::number( mCustomMinutes ) + "\n"; 218 configString += "CUMI " + QString::number( mCustomMinutes ) + "\n";
220 configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n"; 219 configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n";
221 QTextStream ts( &file ); 220 QTextStream ts( &file );
222 ts << configString ; 221 ts << configString ;
223 file.close(); 222 file.close();
224 } 223 }
225 224
226} 225}
227void SimpleAlarmDaemonImpl::confSuspend( int num ) 226void SimpleAlarmDaemonImpl::confSuspend( int num )
228{ 227{
229 mSuspendPopUp->setItemChecked ( mSuspend,false ); 228 mSuspendPopUp->setItemChecked ( mSuspend,false );
230 mSuspend = num; 229 mSuspend = num;
231 mSuspendPopUp->setItemChecked ( mSuspend,true ); 230 mSuspendPopUp->setItemChecked ( mSuspend,true );
232} 231}
233void SimpleAlarmDaemonImpl::confPause( int num ) 232void SimpleAlarmDaemonImpl::confPause( int num )
234{ 233{
235 mPausePopUp->setItemChecked ( mPausePlay,false ); 234 mPausePopUp->setItemChecked ( mPausePlay,false );
236 mPausePlay = num; 235 mPausePlay = num;
237 mPausePopUp->setItemChecked ( mPausePlay,true ); 236 mPausePopUp->setItemChecked ( mPausePlay,true );
238} 237}
239void SimpleAlarmDaemonImpl::confSound( int num ) 238void SimpleAlarmDaemonImpl::confSound( int num )
240{ 239{
241 if ( num == 0 ) { 240 if ( num == 0 ) {
242 wavAlarm = false; 241 wavAlarm = false;
243 mSoundPopUp->setItemChecked ( 0, true ); 242 mSoundPopUp->setItemChecked ( 0, true );
244 mSoundPopUp->setItemChecked ( 1, false ); 243 mSoundPopUp->setItemChecked ( 1, false );
245 } else { 244 } else {
246 wavAlarm = true; 245 wavAlarm = true;
247 mSoundPopUp->setItemChecked ( 0, false ); 246 mSoundPopUp->setItemChecked ( 0, false );
248 mSoundPopUp->setItemChecked ( 1, true ); 247 mSoundPopUp->setItemChecked ( 1, true );
249 } 248 }
250} 249}
251void SimpleAlarmDaemonImpl::slotPlayBeep( int num ) 250void SimpleAlarmDaemonImpl::slotPlayBeep( int num )
252{ 251{
253 mBeepPopUp->setItemChecked ( mPlayBeeps,false ); 252 mBeepPopUp->setItemChecked ( mPlayBeeps,false );
254 mPlayBeeps = num; 253 mPlayBeeps = num;
255 mBeepPopUp->setItemChecked ( mPlayBeeps, true ); 254 mBeepPopUp->setItemChecked ( mPlayBeeps, true );
256} 255}
257 256
258void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& ) 257void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& )
259{ 258{
260 //qDebug("SimpleAlarmDaemonImpl::ALARM RECEIVED! %s", msg.data()); 259 //qDebug("SimpleAlarmDaemonImpl::ALARM RECEIVED! %s", msg.data());
261 QString mess = msg; 260 QString mess = msg;
262 mAlarmMessage = mess.mid( 9 ); 261 mAlarmMessage = mess.mid( 9 );
263 QString filename = getenv("QPEDIR") ; 262 QString filename = getenv("QPEDIR") ;
264 filename += "/pics/kdepim/korganizer/koalarm.wav"; 263 filename += "/pics/kdepim/korganizer/koalarm.wav";
265 QString tempfilename; 264 QString tempfilename;
266 if ( mess.left( 13 ) == "suspend_alarm") { 265 if ( mess.left( 13 ) == "suspend_alarm") {
267 bool error = false; 266 bool error = false;
268 int len = mess.mid( 13 ).find("+++"); 267 int len = mess.mid( 13 ).find("+++");
269 if ( len < 2 ) 268 if ( len < 2 )
270 error = true; 269 error = true;
271 else { 270 else {
272 tempfilename = mess.mid( 13, len ); 271 tempfilename = mess.mid( 13, len );
273 if ( !QFile::exists( tempfilename ) ) 272 if ( !QFile::exists( tempfilename ) )
274 error = true; 273 error = true;
275 } 274 }
276 if ( ! error ) { 275 if ( ! error ) {
277 filename = tempfilename; 276 filename = tempfilename;
278 } 277 }
279 mAlarmMessage = mess.mid( 13+len+3 ); 278 mAlarmMessage = mess.mid( 13+len+3 );
280 //qDebug("suspend file %s ",tempfilename.latin1() ); 279 //qDebug("suspend file %s ",tempfilename.latin1() );
281 startAlarm( mAlarmMessage, filename); 280 startAlarm( mAlarmMessage, filename);
282 return; 281 return;
283 } 282 }
284 if ( mess.left( 11 ) == "timer_alarm") { 283 if ( mess.left( 11 ) == "timer_alarm") {
285 mTimerTime = 0; 284 mTimerTime = 0;
286 startAlarm( mess.mid( 11 ), filename ); 285 startAlarm( mess.mid( 11 ), filename );
287 return; 286 return;
288 } 287 }
289 if ( mess.left( 10 ) == "proc_alarm") { 288 if ( mess.left( 10 ) == "proc_alarm") {
290 bool error = false; 289 bool error = false;
291 int len = mess.mid( 10 ).find("+++"); 290 int len = mess.mid( 10 ).find("+++");
292 if ( len < 2 ) 291 if ( len < 2 )
293 error = true; 292 error = true;
294 else { 293 else {
295 tempfilename = mess.mid( 10, len ); 294 tempfilename = mess.mid( 10, len );
296 if ( !QFile::exists( tempfilename ) ) 295 if ( !QFile::exists( tempfilename ) )
297 error = true; 296 error = true;
298 } 297 }
299 if ( error ) { 298 if ( error ) {
300 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 299 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
301 mAlarmMessage += mess.mid( 10+len+3+9 ); 300 mAlarmMessage += mess.mid( 10+len+3+9 );
302 } else { 301 } else {
303 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 302 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
304 //qDebug("-----system command %s ",tempfilename.latin1() ); 303 //qDebug("-----system command %s ",tempfilename.latin1() );
305 if ( vfork () == 0 ) { 304 if ( vfork () == 0 ) {
306 execl ( tempfilename.latin1(), 0 ); 305 execl ( tempfilename.latin1(), 0 );
307 return; 306 return;
308 } 307 }
309 return; 308 return;
310 } 309 }
311 310
312 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 311 //qDebug("+++++++system command %s ",tempfilename.latin1() );
313 } 312 }
314 if ( mess.left( 11 ) == "audio_alarm") { 313 if ( mess.left( 11 ) == "audio_alarm") {
315 bool error = false; 314 bool error = false;
316 int len = mess.mid( 11 ).find("+++"); 315 int len = mess.mid( 11 ).find("+++");
317 if ( len < 2 ) 316 if ( len < 2 )
318 error = true; 317 error = true;
319 else { 318 else {
320 tempfilename = mess.mid( 11, len ); 319 tempfilename = mess.mid( 11, len );
321 if ( !QFile::exists( tempfilename ) ) 320 if ( !QFile::exists( tempfilename ) )
322 error = true; 321 error = true;
323 } 322 }
324 if ( ! error ) { 323 if ( ! error ) {
325 filename = tempfilename; 324 filename = tempfilename;
326 } 325 }
327 mAlarmMessage = mess.mid( 11+len+3+9 ); 326 mAlarmMessage = mess.mid( 11+len+3+9 );
328 //qDebug("audio file command %s ",tempfilename.latin1() ); 327 //qDebug("audio file command %s ",tempfilename.latin1() );
329 } 328 }
330 if ( mess.left( 9 ) == "cal_alarm") { 329 if ( mess.left( 9 ) == "cal_alarm") {
331 mAlarmMessage = mess.mid( 9 ) ; 330 mAlarmMessage = mess.mid( 9 ) ;
332 } 331 }
333 332
334 writeFile(); 333 writeFile();
335 startAlarm( mAlarmMessage, filename ); 334 startAlarm( mAlarmMessage, filename );
336 335
337} 336}
338 337
339int SimpleAlarmDaemonImpl::getFileNameLen( QString mess ) 338int SimpleAlarmDaemonImpl::getFileNameLen( QString mess )
340{ 339{
341 return 0; 340 return 0;
342} 341}
343void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename ) 342void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename )
344{ 343{
345 //mAlarmDialog->show(); 344 //mAlarmDialog->show();
346 //mAlarmDialog->raise(); 345 //mAlarmDialog->raise();
347 mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend ); 346 mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend );
348} 347}
349 348
350 349
351void SimpleAlarmDaemonImpl::fillTimerPopUp() 350void SimpleAlarmDaemonImpl::fillTimerPopUp()
352{ 351{
353 352
354 // qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime ); 353 // qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime );
355 if ( mTimerPopupConf == mTimerTime ) { 354 if ( mTimerPopupConf == mTimerTime ) {
356 if ( mTimerTime ) { 355 if ( mTimerTime ) {
357 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer ); 356 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer );
358 QTime t ( secs/3600, (secs/60)%60, secs%60 ); 357 QTime t ( secs/3600, (secs/60)%60, secs%60 );
359 mTimerPopUp->changeItem ( 1 , t.toString()); 358 mTimerPopUp->changeItem ( 1 , t.toString());
360 } 359 }
361 else { 360 else {
362 QString text = mCustomText.stripWhiteSpace (); 361 QString text = mCustomText.stripWhiteSpace ();
363 int in = text.find( " " ); 362 int in = text.find( " " );
364 text = text.left ( in ); 363 text = text.left ( in );
365 mTimerPopUp->changeItem ( 3, text ); 364 mTimerPopUp->changeItem ( 3, text );
366 } 365 }
367 return; 366 return;
368 } 367 }
369 mTimerPopupConf = mTimerTime; 368 mTimerPopupConf = mTimerTime;
370 mTimerPopUp->clear(); 369 mTimerPopUp->clear();
371 if ( mTimerTime ) { 370 if ( mTimerTime ) {
372 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer ); 371 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer );
373 QTime t ( secs/3600, (secs/60)%60, secs%60 ); 372 QTime t ( secs/3600, (secs/60)%60, secs%60 );
374 mTimerPopUp->insertItem( "Stop", 0 ); 373 mTimerPopUp->insertItem( "Stop", 0 );
375 mTimerPopUp->insertItem( t.toString(),1); 374 mTimerPopUp->insertItem( t.toString(),1);
376 } else { 375 } else {
377 mTimerPopUp->insertItem( "24 h", 1440 ); 376 mTimerPopUp->insertItem( "24 h", 1440 );
378 // mTimerPopUp->insertItem( i18n("12 h"), 720 ); 377 // mTimerPopUp->insertItem( i18n("12 h"), 720 );
379 mTimerPopUp->insertItem( " 8 h", 480 ); 378 mTimerPopUp->insertItem( " 8 h", 480 );
380 mTimerPopUp->insertItem( " 5 h", 300 ); 379 mTimerPopUp->insertItem( " 5 h", 300 );
381 // mTimerPopUp->insertItem( i18n(" 2 h"), 120 ); 380 // mTimerPopUp->insertItem( i18n(" 2 h"), 120 );
382 mTimerPopUp->insertItem( " 1 h", 60 ); 381 mTimerPopUp->insertItem( " 1 h", 60 );
383 mTimerPopUp->insertItem( "30 min", 30 ); 382 mTimerPopUp->insertItem( "30 min", 30 );
384 mTimerPopUp->insertItem( "15 min", 15 ); 383 mTimerPopUp->insertItem( "15 min", 15 );
385 mTimerPopUp->insertItem( "10 min", 10 ); 384 mTimerPopUp->insertItem( "10 min", 10 );
386 //mTimerPopUp->insertItem( " 5 min", 5 ); 385 //mTimerPopUp->insertItem( " 5 min", 5 );
387 mTimerPopUp->insertSeparator(); 386 mTimerPopUp->insertSeparator();
388 mTimerPopUp->insertItem( "Pizza", 22 ); 387 mTimerPopUp->insertItem( "Pizza", 22 );
389 mTimerPopUp->insertItem( "Nap", 45 ); 388 mTimerPopUp->insertItem( "Nap", 45 );
390 mTimerPopUp->insertItem( "Tea", 5 ); 389 mTimerPopUp->insertItem( "Tea", 5 );
391 QString text = mCustomText.stripWhiteSpace (); 390 QString text = mCustomText.stripWhiteSpace ();
392 int in = text.find( " " ); 391 int in = text.find( " " );
393 text = text.left ( in ); 392 text = text.left ( in );
394 mTimerPopUp->insertItem( text, 3 ); 393 mTimerPopUp->insertItem( text, 3 );
395 mTimerPopUp->insertSeparator(); 394 mTimerPopUp->insertSeparator();
396 mTimerPopUp->insertItem( "Customize", 2 ); 395 mTimerPopUp->insertItem( "Customize", 2 );
397 } 396 }
398 397
399} 398}
400 399
401void SimpleAlarmDaemonImpl::showTimer() 400void SimpleAlarmDaemonImpl::showTimer()
402{ 401{
403 fillTimerPopUp(); 402 fillTimerPopUp();
404} 403}
405 404
406void SimpleAlarmDaemonImpl::confTimer( int time ) 405void SimpleAlarmDaemonImpl::confTimer( int time )
407{ 406{
408 //qDebug("impleAlarmDaemonImpl::confTimer() %d ", time ); 407 //qDebug("impleAlarmDaemonImpl::confTimer() %d ", time );
409 int minutes = time; 408 int minutes = time;
410 if ( minutes == 0 ) { 409 if ( minutes == 0 ) {
411 if ( ! mTimerTime ) 410 if ( ! mTimerTime )
412 return; 411 return;
413 412
414 QDialog dia ( 0, ("Stop Timer" ), true ); 413 QDialog dia ( 0, ("Stop Timer" ), true );
415 QLabel lab (("Really stop the timer?"), &dia ); 414 QLabel lab (("Really stop the timer?"), &dia );
416 dia.setCaption(("KO/Pi Timer Stop" )); 415 dia.setCaption(("KO/Pi Timer Stop" ));
417 QVBoxLayout lay( &dia ); 416 QVBoxLayout lay( &dia );
418 lay.setMargin(5); 417 lay.setMargin(5);
419 lay.setSpacing(5); 418 lay.setSpacing(5);
420 lay.addWidget( &lab); 419 lay.addWidget( &lab);
421 dia.resize( 200, dia.sizeHint().height() ); 420 dia.resize( 200, dia.sizeHint().height() );
422 421
423 if ( !dia.exec() ) 422 if ( !dia.exec() )
424 return; 423 return;
425 424
426 AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.latin1() ); 425 AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.latin1() );
427 mTimerTime = 0; 426 mTimerTime = 0;
428 return; 427 return;
429 } 428 }
430 if ( mTimerTime ) 429 if ( mTimerTime )
431 return; 430 return;
432 if ( minutes == 1 ) { 431 if ( minutes == 1 ) {
433 return; 432 return;
434 } 433 }
435 QString mess = "timer_alarm"; 434 QString mess = "timer_alarm";
436 mess += ("Timer Alarm!\n"); 435 mess += ("Timer Alarm!\n");
437 if ( minutes == 22 ) 436 if ( minutes == 22 )
438 mess += ( "Pizza is ready"); 437 mess += ( "Pizza is ready");
439 else if ( minutes == 45 ) 438 else if ( minutes == 45 )
440 mess += ( "Please wake up!"); 439 mess += ( "Please wake up!");
441 else if ( minutes == 5 ) 440 else if ( minutes == 5 )
442 mess += ( "Tea is ready"); 441 mess += ( "Tea is ready");
443 else if ( minutes == 3 ) { 442 else if ( minutes == 3 ) {
444 mess += mCustomText; 443 mess += mCustomText;
445 minutes = mCustomMinutes ; 444 minutes = mCustomMinutes ;
446 } 445 }
447 else { 446 else {
448 if ( minutes == 2 ) { 447 if ( minutes == 2 ) {
449 // ask time 448 // ask time
450 QDialog dia ( 0, ("Customize Timer" ), true ); 449 QDialog dia ( 0, ("Customize Timer" ), true );
451 QLabel lab (("Message Text:"), &dia ); 450 QLabel lab (("Message Text:"), &dia );
452 dia.setCaption(("KO/Pi Timer" )); 451 dia.setCaption(("KO/Pi Timer" ));
453 QVBoxLayout lay( &dia ); 452 QVBoxLayout lay( &dia );
454 lay.setMargin(5); 453 lay.setMargin(5);
455 lay.setSpacing(5); 454 lay.setSpacing(5);
456 lay.addWidget( &lab); 455 lay.addWidget( &lab);
457 QLineEdit lEdit( mCustomText, &dia ); 456 QLineEdit lEdit( mCustomText, &dia );
458 lay.addWidget( &lEdit); 457 lay.addWidget( &lEdit);
459 QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia ); 458 QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia );
460 lay.addWidget( &lab2); 459 lay.addWidget( &lab2);
461 QHBox hbox ( &dia ); 460 QHBox hbox ( &dia );
462 QLabel lab3 (("h:"), &hbox ); 461 QLabel lab3 (("h:"), &hbox );
463 QSpinBox spinh( 0, 24, 1,& hbox ); 462 QSpinBox spinh( 0, 24, 1,& hbox );
464 QLabel lab4 ((" min:"), &hbox ); 463 QLabel lab4 ((" min:"), &hbox );
465 QSpinBox spinm( 0, 59, 1,&hbox ); 464 QSpinBox spinm( 0, 59, 1,&hbox );
466 spinh.setValue( mCustomMinutes/60 ); 465 spinh.setValue( mCustomMinutes/60 );
467 spinm.setValue( mCustomMinutes%60 ); 466 spinm.setValue( mCustomMinutes%60 );
468 lay.addWidget( &hbox); 467 lay.addWidget( &hbox);
469 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); 468 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() );
470 if ( !dia.exec() ) 469 if ( !dia.exec() )
471 return; 470 return;
472 mCustomText = lEdit.text(); 471 mCustomText = lEdit.text();
473 mCustomMinutes = spinh.value()*60+spinm.value(); 472 mCustomMinutes = spinh.value()*60+spinm.value();
474 if ( mCustomMinutes == 0 ) 473 if ( mCustomMinutes == 0 )
475 mCustomMinutes = 1; 474 mCustomMinutes = 1;
476 if ( mCustomMinutes > 1440 ) 475 if ( mCustomMinutes > 1440 )
477 mCustomMinutes = 1440; 476 mCustomMinutes = 1440;
478 mess += mCustomText; 477 mess += mCustomText;
479 minutes = mCustomMinutes; 478 minutes = mCustomMinutes;
480 } 479 }
481 else 480 else
482 mess+= QString::number ( minutes ) + ( " minutes are past!"); 481 mess+= QString::number ( minutes ) + ( " minutes are past!");
483 } 482 }
484 //minutes = 1; 483 //minutes = 1;
485 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); 484 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 );
486 timerMesssage = mess; 485 timerMesssage = mess;
487 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.latin1()); 486 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.latin1());
488 mTimerTime = 1; 487 mTimerTime = 1;
489} 488}
490 489
491void SimpleAlarmDaemonImpl::writeFile() 490void SimpleAlarmDaemonImpl::writeFile()
492{ 491{
493 QCopEnvelope e("QPE/Application/kopi", "-writeFile"); 492 QCopEnvelope e("QPE/Application/kopi", "-writeFile");
494} 493}
495void SimpleAlarmDaemonImpl::showWN() 494void SimpleAlarmDaemonImpl::showWN()
496{ 495{
497 QCopEnvelope e("QPE/Application/kopi", "-showWN"); 496 QCopEnvelope e("QPE/Application/kopi", "-showWN");
498} 497}
499void SimpleAlarmDaemonImpl::newTodo() 498void SimpleAlarmDaemonImpl::newTodo()
500{ 499{
501 QCopEnvelope e("QPE/Application/kopi", "-newTodo"); 500 QCopEnvelope e("QPE/Application/kopi", "-newTodo");
502} 501}
503 502
504void SimpleAlarmDaemonImpl::newEvent() 503void SimpleAlarmDaemonImpl::newEvent()
505{ 504{
506 QCopEnvelope e("QPE/Application/kopi", "-newEvent"); 505 QCopEnvelope e("QPE/Application/kopi", "-newEvent");
507 506
508} 507}
509 508void SimpleAlarmDaemonImpl::newMail()
509{
510 QCopEnvelope e("QPE/Application/kmpi", "newMail()");
511}
510void SimpleAlarmDaemonImpl::showAdd() 512void SimpleAlarmDaemonImpl::showAdd()
511{ 513{
512 QCopEnvelope e("QPE/Application/kapi", " "); 514 QCopEnvelope e("QPE/Application/kapi", " ");
513} 515}
514void SimpleAlarmDaemonImpl::ringSync() 516void SimpleAlarmDaemonImpl::ringSync()
515{ 517{
516 QCopEnvelope e("QPE/Application/kopi", "-ringSync"); 518 QCopEnvelope e("QPE/Application/kopi", "-ringSync");
517 519
518} 520}
519void SimpleAlarmDaemonImpl::newCountdown() 521void SimpleAlarmDaemonImpl::newCountdown()
520{ 522{
521 //recieve("cal_alarm", 10 ); 523 //recieve("cal_alarm", 10 );
522} 524}
523void SimpleAlarmDaemonImpl::simulate() 525void SimpleAlarmDaemonImpl::simulate()
524{ 526{
525 writeFile(); 527 writeFile();
526 QString filename = getenv("QPEDIR") ; 528 QString filename = getenv("QPEDIR") ;
527 filename += "/pics/kdepim/korganizer/koalarm.wav"; 529 filename += "/pics/kdepim/korganizer/koalarm.wav";
528 startAlarm("Alarm simulation", filename ); 530 startAlarm("Alarm simulation", filename );
529} 531}
530void SimpleAlarmDaemonImpl::showKO() 532void SimpleAlarmDaemonImpl::showKO()
531{ 533{
532 QCopEnvelope e("QPE/Application/kopi", "-showKO"); 534 QCopEnvelope e("QPE/Application/kopi", "-showKO");
533 535
534} 536}
535void SimpleAlarmDaemonImpl::showTodo() 537void SimpleAlarmDaemonImpl::showTodo()
536{ 538{
537 QCopEnvelope e("QPE/Application/kopi", "-showTodo"); 539 QCopEnvelope e("QPE/Application/kopi", "-showTodo");
538 540
539} 541}
540void SimpleAlarmDaemonImpl::writeJournal() 542void SimpleAlarmDaemonImpl::writeJournal()
541{ 543{
542 QCopEnvelope e("QPE/Application/kopi", "-showJournal"); 544 QCopEnvelope e("QPE/Application/kopi", "-showJournal");
543 545
544} 546}
545 547
546void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * ) 548void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * )
547{ 549{
548 550
549 mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() ))); 551 mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() )));
550 552
551} 553}
552 554
diff --git a/kalarmd/simplealarmdaemonimpl.h b/kalarmd/simplealarmdaemonimpl.h
index 1c16af8..32a3867 100644
--- a/kalarmd/simplealarmdaemonimpl.h
+++ b/kalarmd/simplealarmdaemonimpl.h
@@ -1,85 +1,86 @@
1/* 1/*
2 This file is part of the KOrganizer alarm daemon. 2 This file is part of the KOrganizer alarm daemon.
3 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef SIMPLEALARMDAEMONIMPL_H 23#ifndef SIMPLEALARMDAEMONIMPL_H
24#define SIMPLEALARMDAEMONIMPL_H 24#define SIMPLEALARMDAEMONIMPL_H
25 25
26//#include "simplealarmdaemon.h" 26//#include "simplealarmdaemon.h"
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qlabel.h> 28#include <qlabel.h>
29 29
30class QLabel; 30class QLabel;
31class QTimer; 31class QTimer;
32class QPopupMenu; 32class QPopupMenu;
33class AlarmDialog; 33class AlarmDialog;
34class SimpleAlarmDaemonImpl : public QLabel 34class SimpleAlarmDaemonImpl : public QLabel
35{ 35{
36 Q_OBJECT 36 Q_OBJECT
37 public: 37 public:
38 SimpleAlarmDaemonImpl( QWidget *parent = 0 ); 38 SimpleAlarmDaemonImpl( QWidget *parent = 0 );
39 39
40 ~SimpleAlarmDaemonImpl(); 40 ~SimpleAlarmDaemonImpl();
41 41
42 protected slots: 42 protected slots:
43 void recieve( const QCString& msg, const QByteArray& data ); 43 void recieve( const QCString& msg, const QByteArray& data );
44 void newTodo(); 44 void newTodo();
45 void newEvent(); 45 void newEvent();
46 void newCountdown(); 46 void newCountdown();
47 void simulate(); 47 void simulate();
48 void showKO(); 48 void showKO();
49 void showWN(); 49 void showWN();
50 void showAdd(); 50 void showAdd();
51 void newMail();
51 void ringSync(); 52 void ringSync();
52 void showTodo(); 53 void showTodo();
53 void writeFile(); 54 void writeFile();
54 void writeJournal(); 55 void writeJournal();
55 void slotPlayBeep( int ); 56 void slotPlayBeep( int );
56 void showTimer( ); 57 void showTimer( );
57 void confPause( int ); 58 void confPause( int );
58 void confTimer( int ); 59 void confTimer( int );
59 void saveSlot( int ); 60 void saveSlot( int );
60 void confSuspend( int ); 61 void confSuspend( int );
61 void confSound( int num ); 62 void confSound( int num );
62 void startAlarm(QString mess, QString fn ); 63 void startAlarm(QString mess, QString fn );
63 64
64 protected: 65 protected:
65 void mousePressEvent( QMouseEvent * ); 66 void mousePressEvent( QMouseEvent * );
66 67
67 private: 68 private:
68 AlarmDialog *mAlarmDialog; 69 AlarmDialog *mAlarmDialog;
69 int mPlayBeeps; 70 int mPlayBeeps;
70 int mPausePlay; 71 int mPausePlay;
71 int mSuspend; 72 int mSuspend;
72 QString mAlarmMessage; 73 QString mAlarmMessage;
73 int mTimerTime; 74 int mTimerTime;
74 int getFileNameLen( QString ); 75 int getFileNameLen( QString );
75 QPopupMenu* mPopUp, *mBeepPopUp, *mTimerPopUp, *mSoundPopUp,*mPausePopUp,*mSuspendPopUp; 76 QPopupMenu* mPopUp, *mBeepPopUp, *mTimerPopUp, *mSoundPopUp,*mPausePopUp,*mSuspendPopUp;
76 QDateTime mRunningTimer; 77 QDateTime mRunningTimer;
77 void fillTimerPopUp(); 78 void fillTimerPopUp();
78 QString timerMesssage; 79 QString timerMesssage;
79 QString mCustomText; 80 QString mCustomText;
80 int mCustomMinutes; 81 int mCustomMinutes;
81 int mTimerPopupConf; 82 int mTimerPopupConf;
82 bool wavAlarm; 83 bool wavAlarm;
83}; 84};
84 85
85#endif 86#endif