Diffstat (limited to 'kalarmd/simplealarmdaemonimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kalarmd/simplealarmdaemonimpl.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp index 37e7d0d..d6e06c8 100644 --- a/kalarmd/simplealarmdaemonimpl.cpp +++ b/kalarmd/simplealarmdaemonimpl.cpp | |||
@@ -177,193 +177,193 @@ void SimpleAlarmDaemonImpl::saveSlot( int load ) | |||
177 | if ( ok ) { | 177 | if ( ok ) { |
178 | confPause( val ); | 178 | confPause( val ); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | if ( line.left(4 ) == "SUCO" ) { | 181 | if ( line.left(4 ) == "SUCO" ) { |
182 | val = line.mid( 4,len-5).toInt( &ok ); | 182 | val = line.mid( 4,len-5).toInt( &ok ); |
183 | if ( ok ) | 183 | if ( ok ) |
184 | confSuspend ( val ); | 184 | confSuspend ( val ); |
185 | } | 185 | } |
186 | if ( line.left(4 ) == "WAAL" ) { | 186 | if ( line.left(4 ) == "WAAL" ) { |
187 | val = line.mid( 4,len-5).toInt( &ok ); | 187 | val = line.mid( 4,len-5).toInt( &ok ); |
188 | if ( ok ) | 188 | if ( ok ) |
189 | confSound( val ); | 189 | confSound( val ); |
190 | 190 | ||
191 | } | 191 | } |
192 | if ( line.left(4 ) == "PLBE" ) { | 192 | if ( line.left(4 ) == "PLBE" ) { |
193 | val = line.mid( 4,len-5).toInt( &ok ); | 193 | val = line.mid( 4,len-5).toInt( &ok ); |
194 | if ( ok ) | 194 | if ( ok ) |
195 | slotPlayBeep( val ); | 195 | slotPlayBeep( val ); |
196 | 196 | ||
197 | } | 197 | } |
198 | if ( line.left(4 ) == "CUTE" ) { | 198 | if ( line.left(4 ) == "CUTE" ) { |
199 | mCustomText = line.mid( 5,len-6); | 199 | mCustomText = line.mid( 5,len-6); |
200 | // qDebug("text ***%s*** ",mCustomText.latin1() ); | 200 | // qDebug("text ***%s*** ",mCustomText.latin1() ); |
201 | 201 | ||
202 | } | 202 | } |
203 | if ( line.left(4 ) == "CUMI" ) { | 203 | if ( line.left(4 ) == "CUMI" ) { |
204 | val = line.mid( 4,len-5).toInt( &ok ); | 204 | val = line.mid( 4,len-5).toInt( &ok ); |
205 | if ( ok ) | 205 | if ( ok ) |
206 | mCustomMinutes = val; | 206 | mCustomMinutes = val; |
207 | 207 | ||
208 | } | 208 | } |
209 | if ( line.left(4 ) == "SUTI" ) { | 209 | if ( line.left(4 ) == "SUTI" ) { |
210 | val = line.mid( 4,len-5).toInt( &ok ); | 210 | val = line.mid( 4,len-5).toInt( &ok ); |
211 | if ( ok ) | 211 | if ( ok ) |
212 | mAlarmDialog->setSuspendTime( val );; | 212 | mAlarmDialog->setSuspendTime( val );; |
213 | 213 | ||
214 | } | 214 | } |
215 | } | 215 | } |
216 | file.close(); | 216 | file.close(); |
217 | } else { | 217 | } else { |
218 | if (!file.open( IO_WriteOnly ) ) { | 218 | if (!file.open( IO_WriteOnly ) ) { |
219 | return; | 219 | return; |
220 | } | 220 | } |
221 | QString configString ; | 221 | QString configString ; |
222 | configString += "PPAU " + QString::number( mPausePlay ) + "\n"; | 222 | configString += "PPAU " + QString::number( mPausePlay ) + "\n"; |
223 | configString += "SUCO " + QString::number( mSuspend ) + "\n"; | 223 | configString += "SUCO " + QString::number( mSuspend ) + "\n"; |
224 | configString += "WAAL " + QString::number( wavAlarm ) + "\n"; | 224 | configString += "WAAL " + QString::number( wavAlarm ) + "\n"; |
225 | configString += "PLBE " + QString::number( mPlayBeeps ) + "\n"; | 225 | configString += "PLBE " + QString::number( mPlayBeeps ) + "\n"; |
226 | configString += "CUTE " + mCustomText + "\n"; | 226 | configString += "CUTE " + mCustomText + "\n"; |
227 | configString += "CUMI " + QString::number( mCustomMinutes ) + "\n"; | 227 | configString += "CUMI " + QString::number( mCustomMinutes ) + "\n"; |
228 | configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n"; | 228 | configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n"; |
229 | QTextStream ts( &file ); | 229 | QTextStream ts( &file ); |
230 | ts << configString ; | 230 | ts << configString ; |
231 | file.close(); | 231 | file.close(); |
232 | } | 232 | } |
233 | 233 | ||
234 | } | 234 | } |
235 | void SimpleAlarmDaemonImpl::confSuspend( int num ) | 235 | void SimpleAlarmDaemonImpl::confSuspend( int num ) |
236 | { | 236 | { |
237 | mSuspendPopUp->setItemChecked ( mSuspend,false ); | 237 | mSuspendPopUp->setItemChecked ( mSuspend,false ); |
238 | mSuspend = num; | 238 | mSuspend = num; |
239 | mSuspendPopUp->setItemChecked ( mSuspend,true ); | 239 | mSuspendPopUp->setItemChecked ( mSuspend,true ); |
240 | } | 240 | } |
241 | void SimpleAlarmDaemonImpl::confPause( int num ) | 241 | void SimpleAlarmDaemonImpl::confPause( int num ) |
242 | { | 242 | { |
243 | mPausePopUp->setItemChecked ( mPausePlay,false ); | 243 | mPausePopUp->setItemChecked ( mPausePlay,false ); |
244 | mPausePlay = num; | 244 | mPausePlay = num; |
245 | mPausePopUp->setItemChecked ( mPausePlay,true ); | 245 | mPausePopUp->setItemChecked ( mPausePlay,true ); |
246 | } | 246 | } |
247 | void SimpleAlarmDaemonImpl::confSound( int num ) | 247 | void SimpleAlarmDaemonImpl::confSound( int num ) |
248 | { | 248 | { |
249 | if ( num == 0 ) { | 249 | if ( num == 0 ) { |
250 | wavAlarm = false; | 250 | wavAlarm = false; |
251 | mSoundPopUp->setItemChecked ( 0, true ); | 251 | mSoundPopUp->setItemChecked ( 0, true ); |
252 | mSoundPopUp->setItemChecked ( 1, false ); | 252 | mSoundPopUp->setItemChecked ( 1, false ); |
253 | } else { | 253 | } else { |
254 | wavAlarm = true; | 254 | wavAlarm = true; |
255 | mSoundPopUp->setItemChecked ( 0, false ); | 255 | mSoundPopUp->setItemChecked ( 0, false ); |
256 | mSoundPopUp->setItemChecked ( 1, true ); | 256 | mSoundPopUp->setItemChecked ( 1, true ); |
257 | } | 257 | } |
258 | } | 258 | } |
259 | void SimpleAlarmDaemonImpl::slotPlayBeep( int num ) | 259 | void SimpleAlarmDaemonImpl::slotPlayBeep( int num ) |
260 | { | 260 | { |
261 | if ( num == 1000 ) { | 261 | if ( num == 1000 ) { |
262 | simulate(); | 262 | simulate(); |
263 | return; | 263 | return; |
264 | } | 264 | } |
265 | mBeepPopUp->setItemChecked ( mPlayBeeps,false ); | 265 | mBeepPopUp->setItemChecked ( mPlayBeeps,false ); |
266 | mPlayBeeps = num; | 266 | mPlayBeeps = num; |
267 | mBeepPopUp->setItemChecked ( mPlayBeeps, true ); | 267 | mBeepPopUp->setItemChecked ( mPlayBeeps, true ); |
268 | } | 268 | } |
269 | 269 | ||
270 | void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& ) | 270 | void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& ) |
271 | { | 271 | { |
272 | //qDebug("SimpleAlarmDaemonImpl::ALARM RECEIVED! %s", msg.data()); | 272 | //qDebug("SimpleAlarmDaemonImpl::ALARM RECEIVED! %s", msg.data()); |
273 | QString mess = msg; | 273 | QString mess = QString::fromUtf8(msg.data()); |
274 | mAlarmMessage = mess.mid( 9 ); | 274 | mAlarmMessage = mess.mid( 9 ); |
275 | QString filename = getenv("QPEDIR") ; | 275 | QString filename = getenv("QPEDIR") ; |
276 | filename += "/pics/kdepim/korganizer/koalarm.wav"; | 276 | filename += "/pics/kdepim/korganizer/koalarm.wav"; |
277 | QString tempfilename; | 277 | QString tempfilename; |
278 | if ( mess.left( 13 ) == "suspend_alarm") { | 278 | if ( mess.left( 13 ) == "suspend_alarm") { |
279 | bool error = false; | 279 | bool error = false; |
280 | int len = mess.mid( 13 ).find("+++"); | 280 | int len = mess.mid( 13 ).find("+++"); |
281 | if ( len < 2 ) | 281 | if ( len < 2 ) |
282 | error = true; | 282 | error = true; |
283 | else { | 283 | else { |
284 | tempfilename = mess.mid( 13, len ); | 284 | tempfilename = mess.mid( 13, len ); |
285 | if ( !QFile::exists( tempfilename ) ) | 285 | if ( !QFile::exists( tempfilename ) ) |
286 | error = true; | 286 | error = true; |
287 | } | 287 | } |
288 | if ( ! error ) { | 288 | if ( ! error ) { |
289 | filename = tempfilename; | 289 | filename = tempfilename; |
290 | } | 290 | } |
291 | mAlarmMessage = mess.mid( 13+len+3 ); | 291 | mAlarmMessage = mess.mid( 13+len+3 ); |
292 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 292 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
293 | startAlarm( mAlarmMessage, filename); | 293 | startAlarm( mAlarmMessage, filename); |
294 | return; | 294 | return; |
295 | } | 295 | } |
296 | if ( mess.left( 11 ) == "timer_alarm") { | 296 | if ( mess.left( 11 ) == "timer_alarm") { |
297 | mTimerTime = 0; | 297 | mTimerTime = 0; |
298 | startAlarm( mess.mid( 11 ), filename ); | 298 | startAlarm( mess.mid( 11 ), filename ); |
299 | return; | 299 | return; |
300 | } | 300 | } |
301 | if ( mess.left( 10 ) == "proc_alarm") { | 301 | if ( mess.left( 10 ) == "proc_alarm") { |
302 | bool error = false; | 302 | bool error = false; |
303 | int len = mess.mid( 10 ).find("+++"); | 303 | int len = mess.mid( 10 ).find("+++"); |
304 | if ( len < 2 ) | 304 | if ( len < 2 ) |
305 | error = true; | 305 | error = true; |
306 | else { | 306 | else { |
307 | tempfilename = mess.mid( 10, len ); | 307 | tempfilename = mess.mid( 10, len ); |
308 | if ( !QFile::exists( tempfilename ) ) | 308 | if ( !QFile::exists( tempfilename ) ) |
309 | error = true; | 309 | error = true; |
310 | } | 310 | } |
311 | if ( error ) { | 311 | if ( error ) { |
312 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 312 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
313 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 313 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
314 | } else { | 314 | } else { |
315 | { | 315 | { |
316 | QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 316 | QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
317 | } | 317 | } |
318 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 318 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
319 | if ( vfork () == 0 ) { | 319 | if ( vfork () == 0 ) { |
320 | execl ( tempfilename.latin1(), 0 ); | 320 | execl ( tempfilename.latin1(), 0 ); |
321 | return; | 321 | return; |
322 | } | 322 | } |
323 | return; | 323 | return; |
324 | } | 324 | } |
325 | 325 | ||
326 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 326 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
327 | } | 327 | } |
328 | if ( mess.left( 11 ) == "audio_alarm") { | 328 | if ( mess.left( 11 ) == "audio_alarm") { |
329 | bool error = false; | 329 | bool error = false; |
330 | int len = mess.mid( 11 ).find("+++"); | 330 | int len = mess.mid( 11 ).find("+++"); |
331 | if ( len < 2 ) | 331 | if ( len < 2 ) |
332 | error = true; | 332 | error = true; |
333 | else { | 333 | else { |
334 | tempfilename = mess.mid( 11, len ); | 334 | tempfilename = mess.mid( 11, len ); |
335 | if ( !QFile::exists( tempfilename ) ) | 335 | if ( !QFile::exists( tempfilename ) ) |
336 | error = true; | 336 | error = true; |
337 | } | 337 | } |
338 | if ( ! error ) { | 338 | if ( ! error ) { |
339 | filename = tempfilename; | 339 | filename = tempfilename; |
340 | } | 340 | } |
341 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 341 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
342 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 342 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
343 | } | 343 | } |
344 | if ( mess.left( 9 ) == "cal_alarm") { | 344 | if ( mess.left( 9 ) == "cal_alarm") { |
345 | mAlarmMessage = mess.mid( 9 ) ; | 345 | mAlarmMessage = mess.mid( 9 ) ; |
346 | } | 346 | } |
347 | 347 | ||
348 | writeFile(); | 348 | writeFile(); |
349 | startAlarm( mAlarmMessage, filename ); | 349 | startAlarm( mAlarmMessage, filename ); |
350 | 350 | ||
351 | } | 351 | } |
352 | 352 | ||
353 | int SimpleAlarmDaemonImpl::getFileNameLen( QString mess ) | 353 | int SimpleAlarmDaemonImpl::getFileNameLen( QString mess ) |
354 | { | 354 | { |
355 | return 0; | 355 | return 0; |
356 | } | 356 | } |
357 | void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename ) | 357 | void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename ) |
358 | { | 358 | { |
359 | //mAlarmDialog->show(); | 359 | //mAlarmDialog->show(); |
360 | //mAlarmDialog->raise(); | 360 | //mAlarmDialog->raise(); |
361 | mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend ); | 361 | mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend ); |
362 | } | 362 | } |
363 | 363 | ||
364 | 364 | ||
365 | void SimpleAlarmDaemonImpl::fillTimerPopUp() | 365 | void SimpleAlarmDaemonImpl::fillTimerPopUp() |
366 | { | 366 | { |
367 | 367 | ||
368 | // qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime ); | 368 | // qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime ); |
369 | if ( mTimerPopupConf == mTimerTime ) { | 369 | if ( mTimerPopupConf == mTimerTime ) { |
@@ -529,168 +529,168 @@ void SimpleAlarmDaemonImpl::confTimer( int time ) | |||
529 | mRunningTimerText = "Tea"; | 529 | mRunningTimerText = "Tea"; |
530 | } | 530 | } |
531 | else if ( minutes == 3 ) { | 531 | else if ( minutes == 3 ) { |
532 | mess += mCustomText; | 532 | mess += mCustomText; |
533 | minutes = mCustomMinutes ; | 533 | minutes = mCustomMinutes ; |
534 | mRunningTimerText = mCustomText.stripWhiteSpace (); | 534 | mRunningTimerText = mCustomText.stripWhiteSpace (); |
535 | int in = mRunningTimerText.find( " " ); | 535 | int in = mRunningTimerText.find( " " ); |
536 | mRunningTimerText = mRunningTimerText.left ( in ); | 536 | mRunningTimerText = mRunningTimerText.left ( in ); |
537 | } | 537 | } |
538 | else { | 538 | else { |
539 | if ( minutes == 2 ) { | 539 | if ( minutes == 2 ) { |
540 | // ask time | 540 | // ask time |
541 | QDialog dia ( 0, ("Customize Timer" ), true ); | 541 | QDialog dia ( 0, ("Customize Timer" ), true ); |
542 | QLabel lab (("Message Text:"), &dia ); | 542 | QLabel lab (("Message Text:"), &dia ); |
543 | dia.setCaption(("KO/Pi Timer" )); | 543 | dia.setCaption(("KO/Pi Timer" )); |
544 | QVBoxLayout lay( &dia ); | 544 | QVBoxLayout lay( &dia ); |
545 | lay.setMargin(5); | 545 | lay.setMargin(5); |
546 | lay.setSpacing(5); | 546 | lay.setSpacing(5); |
547 | lay.addWidget( &lab); | 547 | lay.addWidget( &lab); |
548 | QLineEdit lEdit( mCustomText, &dia ); | 548 | QLineEdit lEdit( mCustomText, &dia ); |
549 | lay.addWidget( &lEdit); | 549 | lay.addWidget( &lEdit); |
550 | QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia ); | 550 | QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia ); |
551 | lay.addWidget( &lab2); | 551 | lay.addWidget( &lab2); |
552 | QHBox hbox1 ( &dia ); | 552 | QHBox hbox1 ( &dia ); |
553 | lay.addWidget( &hbox1); | 553 | lay.addWidget( &hbox1); |
554 | QLabel lab3 (("Hours"), &hbox1 ); | 554 | QLabel lab3 (("Hours"), &hbox1 ); |
555 | QLabel lab4 (("Minutes"), &hbox1 ); | 555 | QLabel lab4 (("Minutes"), &hbox1 ); |
556 | QHBox hbox ( &dia ); | 556 | QHBox hbox ( &dia ); |
557 | QSpinBox spinh( 0, 24, 1,& hbox ); | 557 | QSpinBox spinh( 0, 24, 1,& hbox ); |
558 | QFont fo = dia.font(); | 558 | QFont fo = dia.font(); |
559 | fo.setPointSize( 36 ); | 559 | fo.setPointSize( 36 ); |
560 | QSpinBox spinm( 0, 59, 1,&hbox ); | 560 | QSpinBox spinm( 0, 59, 1,&hbox ); |
561 | spinm.setFont( fo ); | 561 | spinm.setFont( fo ); |
562 | spinh.setFont( fo ); | 562 | spinh.setFont( fo ); |
563 | spinh.setButtonSymbols( QSpinBox::PlusMinus ); | 563 | spinh.setButtonSymbols( QSpinBox::PlusMinus ); |
564 | spinm.setButtonSymbols( QSpinBox::PlusMinus ); | 564 | spinm.setButtonSymbols( QSpinBox::PlusMinus ); |
565 | spinh.upButton ()->setFixedSize( QSize( 48, 30 )); | 565 | spinh.upButton ()->setFixedSize( QSize( 48, 30 )); |
566 | spinh.downButton ()->setFixedSize( QSize( 48, 30 )); | 566 | spinh.downButton ()->setFixedSize( QSize( 48, 30 )); |
567 | //spinh.editor ()->setFixedSize( QSize( 50, 100 )); | 567 | //spinh.editor ()->setFixedSize( QSize( 50, 100 )); |
568 | spinh.setFixedSize( 100,62 ); | 568 | spinh.setFixedSize( 100,62 ); |
569 | spinm.upButton ()->setFixedSize( QSize( 48, 30 )); | 569 | spinm.upButton ()->setFixedSize( QSize( 48, 30 )); |
570 | spinm.downButton ()->setFixedSize( QSize( 48, 30 )); | 570 | spinm.downButton ()->setFixedSize( QSize( 48, 30 )); |
571 | spinm.downButton ()->setGeometry( 50,50,50,50); | 571 | spinm.downButton ()->setGeometry( 50,50,50,50); |
572 | // spinm.setSuffix( " m" ); | 572 | // spinm.setSuffix( " m" ); |
573 | //spinh.setSuffix( " h" ); | 573 | //spinh.setSuffix( " h" ); |
574 | spinm.setWrapping ( true ); | 574 | spinm.setWrapping ( true ); |
575 | //spinm.editor ()->setFixedSize( QSize( 50, 100 )); | 575 | //spinm.editor ()->setFixedSize( QSize( 50, 100 )); |
576 | spinm.setLineStep( 1 ); | 576 | spinm.setLineStep( 1 ); |
577 | spinm.setFixedSize( 110,62 ); | 577 | spinm.setFixedSize( 110,62 ); |
578 | lay.addWidget( &hbox); | 578 | lay.addWidget( &hbox); |
579 | QLabel lab5 ("Timer fires at:", &dia ); | 579 | QLabel lab5 ("Timer fires at:", &dia ); |
580 | lab5.setAlignment( AlignCenter ); | 580 | lab5.setAlignment( AlignCenter ); |
581 | lay.addWidget( &lab5); | 581 | lay.addWidget( &lab5); |
582 | KODateLabel dl ( &dia ); | 582 | KODateLabel dl ( &dia ); |
583 | dl.setAlignment( AlignCenter ); | 583 | dl.setAlignment( AlignCenter ); |
584 | dl.setFont( fo ); | 584 | dl.setFont( fo ); |
585 | connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) ); | 585 | connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) ); |
586 | connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) ); | 586 | connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) ); |
587 | lay.addWidget( &dl); | 587 | lay.addWidget( &dl); |
588 | spinh.setValue( mCustomMinutes/60 ); | 588 | spinh.setValue( mCustomMinutes/60 ); |
589 | spinm.setValue( mCustomMinutes%60 ); | 589 | spinm.setValue( mCustomMinutes%60 ); |
590 | QPushButton ok ( "Start timer", &dia); | 590 | QPushButton ok ( "Start timer", &dia); |
591 | ok.setDefault( true ); | 591 | ok.setDefault( true ); |
592 | ok.setFont( fo ); | 592 | ok.setFont( fo ); |
593 | spinh.setFocus(); | 593 | spinh.setFocus(); |
594 | lay.addWidget( &ok); | 594 | lay.addWidget( &ok); |
595 | connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); | 595 | connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); |
596 | dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); | 596 | dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); |
597 | 597 | ||
598 | if ( !dia.exec() ) | 598 | if ( !dia.exec() ) |
599 | return; | 599 | return; |
600 | mCustomText = lEdit.text(); | 600 | mCustomText = lEdit.text(); |
601 | mCustomMinutes = spinh.value()*60+spinm.value(); | 601 | mCustomMinutes = spinh.value()*60+spinm.value(); |
602 | if ( mCustomMinutes == 0 ) | 602 | if ( mCustomMinutes == 0 ) |
603 | mCustomMinutes = 1; | 603 | mCustomMinutes = 1; |
604 | if ( mCustomMinutes > 1440 ) | 604 | if ( mCustomMinutes > 1440 ) |
605 | mCustomMinutes = 1440; | 605 | mCustomMinutes = 1440; |
606 | mess += mCustomText; | 606 | mess += mCustomText; |
607 | minutes = mCustomMinutes; | 607 | minutes = mCustomMinutes; |
608 | mRunningTimerText = mCustomText.stripWhiteSpace (); | 608 | mRunningTimerText = mCustomText.stripWhiteSpace (); |
609 | int in = mRunningTimerText.find( " " ); | 609 | int in = mRunningTimerText.find( " " ); |
610 | mRunningTimerText = mRunningTimerText.left ( in ); | 610 | mRunningTimerText = mRunningTimerText.left ( in ); |
611 | } | 611 | } |
612 | else { | 612 | else { |
613 | mess+= QString::number ( minutes ) + ( " minutes are past!"); | 613 | mess+= QString::number ( minutes ) + ( " minutes are past!"); |
614 | int min = minutes; | 614 | int min = minutes; |
615 | if ( min % 60 == 0 ) | 615 | if ( min % 60 == 0 ) |
616 | mRunningTimerText = QString::number ( min/60 ) + ( " hours"); | 616 | mRunningTimerText = QString::number ( min/60 ) + ( " hours"); |
617 | else | 617 | else |
618 | mRunningTimerText = QString::number ( minutes ) + ( " minutes"); | 618 | mRunningTimerText = QString::number ( minutes ) + ( " minutes"); |
619 | } | 619 | } |
620 | } | 620 | } |
621 | //minutes = 1; | 621 | //minutes = 1; |
622 | 622 | ||
623 | mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); | 623 | mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); |
624 | timerMesssage = mess; | 624 | timerMesssage = mess; |
625 | AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.latin1()); | 625 | AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8()); |
626 | mTimerTime = 1; | 626 | mTimerTime = 1; |
627 | } | 627 | } |
628 | 628 | ||
629 | void SimpleAlarmDaemonImpl::writeFile() | 629 | void SimpleAlarmDaemonImpl::writeFile() |
630 | { | 630 | { |
631 | QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 631 | QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
632 | //QCopEnvelope e("QPE/Application/kopi", "-writeFile"); | 632 | //QCopEnvelope e("QPE/Application/kopi", "-writeFile"); |
633 | } | 633 | } |
634 | void SimpleAlarmDaemonImpl::showWN() | 634 | void SimpleAlarmDaemonImpl::showWN() |
635 | { | 635 | { |
636 | QCopEnvelope e("QPE/Application/kopi", "-showWN"); | 636 | QCopEnvelope e("QPE/Application/kopi", "-showWN"); |
637 | } | 637 | } |
638 | void SimpleAlarmDaemonImpl::newTodo() | 638 | void SimpleAlarmDaemonImpl::newTodo() |
639 | { | 639 | { |
640 | QCopEnvelope e("QPE/Application/kopi", "-newTodo"); | 640 | QCopEnvelope e("QPE/Application/kopi", "-newTodo"); |
641 | } | 641 | } |
642 | 642 | ||
643 | void SimpleAlarmDaemonImpl::newEvent() | 643 | void SimpleAlarmDaemonImpl::newEvent() |
644 | { | 644 | { |
645 | QCopEnvelope e("QPE/Application/kopi", "-newEvent"); | 645 | QCopEnvelope e("QPE/Application/kopi", "-newEvent"); |
646 | 646 | ||
647 | } | 647 | } |
648 | void SimpleAlarmDaemonImpl::newMail() | 648 | void SimpleAlarmDaemonImpl::newMail() |
649 | { | 649 | { |
650 | QCopEnvelope e("QPE/Application/ompi", "newMail()"); | 650 | QCopEnvelope e("QPE/Application/ompi", "newMail()"); |
651 | } | 651 | } |
652 | void SimpleAlarmDaemonImpl::showAdd() | 652 | void SimpleAlarmDaemonImpl::showAdd() |
653 | { | 653 | { |
654 | QCopEnvelope e("QPE/Application/kapi", "raise()"); | 654 | QCopEnvelope e("QPE/Application/kapi", "raise()"); |
655 | } | 655 | } |
656 | void SimpleAlarmDaemonImpl::ringSync() | 656 | void SimpleAlarmDaemonImpl::ringSync() |
657 | { | 657 | { |
658 | QCopEnvelope e("QPE/Application/kopi", "-ringSync"); | 658 | QCopEnvelope e("QPE/Application/kopi", "-ringSync"); |
659 | 659 | ||
660 | } | 660 | } |
661 | void SimpleAlarmDaemonImpl::newCountdown() | 661 | void SimpleAlarmDaemonImpl::newCountdown() |
662 | { | 662 | { |
663 | //recieve("cal_alarm", 10 ); | 663 | //recieve("cal_alarm", 10 ); |
664 | } | 664 | } |
665 | void SimpleAlarmDaemonImpl::simulate() | 665 | void SimpleAlarmDaemonImpl::simulate() |
666 | { | 666 | { |
667 | writeFile(); | 667 | writeFile(); |
668 | QString filename = getenv("QPEDIR") ; | 668 | QString filename = getenv("QPEDIR") ; |
669 | filename += "/pics/kdepim/korganizer/koalarm.wav"; | 669 | filename += "/pics/kdepim/korganizer/koalarm.wav"; |
670 | startAlarm("Alarm simulation", filename ); | 670 | startAlarm("Alarm simulation", filename ); |
671 | } | 671 | } |
672 | void SimpleAlarmDaemonImpl::showKO() | 672 | void SimpleAlarmDaemonImpl::showKO() |
673 | { | 673 | { |
674 | QCopEnvelope e("QPE/Application/kopi", "-showKO"); | 674 | QCopEnvelope e("QPE/Application/kopi", "-showKO"); |
675 | // testing only | 675 | // testing only |
676 | //QCopEnvelope e("QPE/Application/kopi", "nextView()"); | 676 | //QCopEnvelope e("QPE/Application/kopi", "nextView()"); |
677 | 677 | ||
678 | } | 678 | } |
679 | void SimpleAlarmDaemonImpl::showTodo() | 679 | void SimpleAlarmDaemonImpl::showTodo() |
680 | { | 680 | { |
681 | QCopEnvelope e("QPE/Application/kopi", "-showTodo"); | 681 | QCopEnvelope e("QPE/Application/kopi", "-showTodo"); |
682 | 682 | ||
683 | } | 683 | } |
684 | void SimpleAlarmDaemonImpl::writeJournal() | 684 | void SimpleAlarmDaemonImpl::writeJournal() |
685 | { | 685 | { |
686 | QCopEnvelope e("QPE/Application/kopi", "-showJournal"); | 686 | QCopEnvelope e("QPE/Application/kopi", "-showJournal"); |
687 | 687 | ||
688 | } | 688 | } |
689 | 689 | ||
690 | void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * ) | 690 | void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * ) |
691 | { | 691 | { |
692 | 692 | ||
693 | mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() ))); | 693 | mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() ))); |
694 | 694 | ||
695 | } | 695 | } |
696 | 696 | ||