summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp
index 04b8b21..c1e064c 100644
--- a/kalarmd/simplealarmdaemonimpl.cpp
+++ b/kalarmd/simplealarmdaemonimpl.cpp
@@ -245,456 +245,456 @@ void SimpleAlarmDaemonImpl::saveSlot( int load )
245void SimpleAlarmDaemonImpl::confSuspend( int num ) 245void SimpleAlarmDaemonImpl::confSuspend( int num )
246{ 246{
247 mSuspendPopUp->setItemChecked ( mSuspend,false ); 247 mSuspendPopUp->setItemChecked ( mSuspend,false );
248 mSuspend = num; 248 mSuspend = num;
249 mSuspendPopUp->setItemChecked ( mSuspend,true ); 249 mSuspendPopUp->setItemChecked ( mSuspend,true );
250} 250}
251void SimpleAlarmDaemonImpl::confPause( int num ) 251void SimpleAlarmDaemonImpl::confPause( int num )
252{ 252{
253 mPausePopUp->setItemChecked ( mPausePlay,false ); 253 mPausePopUp->setItemChecked ( mPausePlay,false );
254 mPausePlay = num; 254 mPausePlay = num;
255 mPausePopUp->setItemChecked ( mPausePlay,true ); 255 mPausePopUp->setItemChecked ( mPausePlay,true );
256} 256}
257void SimpleAlarmDaemonImpl::confSound( int num ) 257void SimpleAlarmDaemonImpl::confSound( int num )
258{ 258{
259 if ( num == 0 ) { 259 if ( num == 0 ) {
260 wavAlarm = false; 260 wavAlarm = false;
261 mSoundPopUp->setItemChecked ( 0, true ); 261 mSoundPopUp->setItemChecked ( 0, true );
262 mSoundPopUp->setItemChecked ( 1, false ); 262 mSoundPopUp->setItemChecked ( 1, false );
263 } else { 263 } else {
264 wavAlarm = true; 264 wavAlarm = true;
265 mSoundPopUp->setItemChecked ( 0, false ); 265 mSoundPopUp->setItemChecked ( 0, false );
266 mSoundPopUp->setItemChecked ( 1, true ); 266 mSoundPopUp->setItemChecked ( 1, true );
267 } 267 }
268} 268}
269void SimpleAlarmDaemonImpl::slotPlayBeep( int num ) 269void SimpleAlarmDaemonImpl::slotPlayBeep( int num )
270{ 270{
271 if ( num == 1000 ) { 271 if ( num == 1000 ) {
272 simulate(); 272 simulate();
273 return; 273 return;
274 } 274 }
275 mBeepPopUp->setItemChecked ( mPlayBeeps,false ); 275 mBeepPopUp->setItemChecked ( mPlayBeeps,false );
276 mPlayBeeps = num; 276 mPlayBeeps = num;
277 mBeepPopUp->setItemChecked ( mPlayBeeps, true ); 277 mBeepPopUp->setItemChecked ( mPlayBeeps, true );
278} 278}
279 279
280void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& ) 280void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& )
281{ 281{
282 //qDebug("SimpleAlarmDaemonImpl::ALARM RECEIVED! %s", msg.data()); 282 //qDebug("SimpleAlarmDaemonImpl::ALARM RECEIVED! %s", msg.data());
283 QString mess = QString::fromUtf8(msg.data()); 283 QString mess = QString::fromUtf8(msg.data());
284 mAlarmMessage = mess.mid( 9 ); 284 mAlarmMessage = mess.mid( 9 );
285 QString filename = getenv("QPEDIR") ; 285 QString filename = getenv("QPEDIR") ;
286 filename += "/pics/kdepim/korganizer/koalarm.wav"; 286 filename += "/pics/kdepim/korganizer/koalarm.wav";
287 QString tempfilename; 287 QString tempfilename;
288 if ( mess.left( 13 ) == "suspend_alarm") { 288 if ( mess.left( 13 ) == "suspend_alarm") {
289 bool error = false; 289 bool error = false;
290 int len = mess.mid( 13 ).find("+++"); 290 int len = mess.mid( 13 ).find("+++");
291 if ( len < 2 ) 291 if ( len < 2 )
292 error = true; 292 error = true;
293 else { 293 else {
294 tempfilename = mess.mid( 13, len ); 294 tempfilename = mess.mid( 13, len );
295 if ( !QFile::exists( tempfilename ) ) 295 if ( !QFile::exists( tempfilename ) )
296 error = true; 296 error = true;
297 } 297 }
298 if ( ! error ) { 298 if ( ! error ) {
299 filename = tempfilename; 299 filename = tempfilename;
300 } 300 }
301 mAlarmMessage = mess.mid( 13+len+3 ); 301 mAlarmMessage = mess.mid( 13+len+3 );
302 //qDebug("suspend file %s ",tempfilename.latin1() ); 302 //qDebug("suspend file %s ",tempfilename.latin1() );
303 startAlarm( mAlarmMessage, filename); 303 startAlarm( mAlarmMessage, filename);
304 return; 304 return;
305 } 305 }
306 if ( mess.left( 11 ) == "timer_alarm") { 306 if ( mess.left( 11 ) == "timer_alarm") {
307 mTimerTime = 0; 307 mTimerTime = 0;
308 startAlarm( mess.mid( 11 ), filename ); 308 startAlarm( mess.mid( 11 ), filename );
309 return; 309 return;
310 } 310 }
311 if ( mess.left( 10 ) == "proc_alarm") { 311 if ( mess.left( 10 ) == "proc_alarm") {
312 bool error = false; 312 bool error = false;
313 int len = mess.mid( 10 ).find("+++"); 313 int len = mess.mid( 10 ).find("+++");
314 if ( len < 2 ) 314 if ( len < 2 )
315 error = true; 315 error = true;
316 else { 316 else {
317 tempfilename = mess.mid( 10, len ); 317 tempfilename = mess.mid( 10, len );
318 if ( !QFile::exists( tempfilename ) ) 318 if ( !QFile::exists( tempfilename ) )
319 error = true; 319 error = true;
320 } 320 }
321 if ( error ) { 321 if ( error ) {
322 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 322 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
323 mAlarmMessage += mess.mid( 10+len+3+9 ); 323 mAlarmMessage += mess.mid( 10+len+3+9 );
324 } else { 324 } else {
325 //qDebug("-----system command %s ",tempfilename.latin1() ); 325 //qDebug("-----system command %s ",tempfilename.latin1() );
326 if ( vfork () == 0 ) { 326 if ( vfork () == 0 ) {
327 execl ( tempfilename.latin1(), 0 ); 327 execl ( tempfilename.latin1(), 0 );
328 return; 328 return;
329 } 329 }
330 QTimer::singleShot( 5000, this, SLOT ( writeFile() ) ); 330 QTimer::singleShot( 5000, this, SLOT ( writeFile() ) );
331 return; 331 return;
332 } 332 }
333 333
334 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 334 //qDebug("+++++++system command %s ",tempfilename.latin1() );
335 } 335 }
336 if ( mess.left( 11 ) == "audio_alarm") { 336 if ( mess.left( 11 ) == "audio_alarm") {
337 bool error = false; 337 bool error = false;
338 int len = mess.mid( 11 ).find("+++"); 338 int len = mess.mid( 11 ).find("+++");
339 if ( len < 2 ) 339 if ( len < 2 )
340 error = true; 340 error = true;
341 else { 341 else {
342 tempfilename = mess.mid( 11, len ); 342 tempfilename = mess.mid( 11, len );
343 if ( !QFile::exists( tempfilename ) ) 343 if ( !QFile::exists( tempfilename ) )
344 error = true; 344 error = true;
345 } 345 }
346 if ( ! error ) { 346 if ( ! error ) {
347 filename = tempfilename; 347 filename = tempfilename;
348 } 348 }
349 mAlarmMessage = mess.mid( 11+len+3+9 ); 349 mAlarmMessage = mess.mid( 11+len+3+9 );
350 //qDebug("audio file command %s ",tempfilename.latin1() ); 350 //qDebug("audio file command %s ",tempfilename.latin1() );
351 } 351 }
352 if ( mess.left( 9 ) == "cal_alarm") { 352 if ( mess.left( 9 ) == "cal_alarm") {
353 mAlarmMessage = mess.mid( 9 ) ; 353 mAlarmMessage = mess.mid( 9 ) ;
354 } 354 }
355 355
356 QTimer::singleShot( 5000, this, SLOT ( writeFile() ) ); 356 QTimer::singleShot( 5000, this, SLOT ( writeFile() ) );
357 startAlarm( mAlarmMessage, filename ); 357 startAlarm( mAlarmMessage, filename );
358 358
359} 359}
360 360
361int SimpleAlarmDaemonImpl::getFileNameLen( QString mess ) 361int SimpleAlarmDaemonImpl::getFileNameLen( QString mess )
362{ 362{
363 return 0; 363 return 0;
364} 364}
365void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename ) 365void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename )
366{ 366{
367 //mAlarmDialog->show(); 367 //mAlarmDialog->show();
368 //mAlarmDialog->raise(); 368 //mAlarmDialog->raise();
369 mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend ); 369 mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend );
370} 370}
371 371
372 372
373void SimpleAlarmDaemonImpl::fillTimerPopUp() 373void SimpleAlarmDaemonImpl::fillTimerPopUp()
374{ 374{
375 375
376 // qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime ); 376 // qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime );
377 if ( mTimerPopupConf == mTimerTime ) { 377 if ( mTimerPopupConf == mTimerTime ) {
378 if ( mTimerTime ) { 378 if ( mTimerTime ) {
379 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer ); 379 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer );
380 QTime t ( secs/3600, (secs/60)%60, secs%60 ); 380 QTime t ( secs/3600, (secs/60)%60, secs%60 );
381 mTimerPopUp->changeItem ( 1 , t.toString() + " (countdown)"); 381 mTimerPopUp->changeItem ( 1 , t.toString() + " (countdown)");
382 } 382 }
383 else { 383 else {
384 QString text = mCustomText.stripWhiteSpace (); 384 QString text = mCustomText.stripWhiteSpace ();
385 int in = text.find( " " ); 385 int in = text.find( " " );
386 text = text.left ( in ); 386 text = text.left ( in );
387 mTimerPopUp->changeItem ( 3, text ); 387 mTimerPopUp->changeItem ( 3, text );
388 } 388 }
389 return; 389 return;
390 } 390 }
391 mTimerPopupConf = mTimerTime; 391 mTimerPopupConf = mTimerTime;
392 mTimerPopUp->clear(); 392 mTimerPopUp->clear();
393 if ( mTimerTime ) { 393 if ( mTimerTime ) {
394 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer ); 394 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer );
395 QTime t ( secs/3600, (secs/60)%60, secs%60 ); 395 QTime t ( secs/3600, (secs/60)%60, secs%60 );
396 396
397 397
398 mTimerPopUp->insertItem( "Stop timer "+ mRunningTimerText , 0 ); 398 mTimerPopUp->insertItem( "Stop timer "+ mRunningTimerText , 0 );
399 mTimerPopUp->insertItem( t.toString() + " (countdown)",1); 399 mTimerPopUp->insertItem( t.toString() + " (countdown)",1);
400 mTimerPopUp->insertItem( mRunningTimer.time().toString() + " (alarm)",2); 400 mTimerPopUp->insertItem( mRunningTimer.time().toString() + " (alarm)",2);
401 } else { 401 } else {
402 402
403 QString fileName = QDir::homeDirPath() +"/.kopialarmtimerrc"; 403 QString fileName = QDir::homeDirPath() +"/.kopialarmtimerrc";
404 QFile file( fileName ); 404 QFile file( fileName );
405 if( !QFile::exists( fileName) ) { 405 if( !QFile::exists( fileName) ) {
406 // write defaults 406 // write defaults
407 if (!file.open( IO_WriteOnly ) ) { 407 if (!file.open( IO_WriteOnly ) ) {
408 return; 408 return;
409 } 409 }
410 QString configString ; 410 QString configString ;
411 configString += "#config file for kopi alarm timer\n"; 411 configString += "#config file for kopi alarm timer\n";
412 configString += "#format: <Text for popup menu>;<timer countdown in minutes>\n"; 412 configString += "#format: <Text for popup menu>;<timer countdown in minutes>\n";
413 configString += "24 hours; 1440\n"; 413 configString += "24 hours; 1440\n";
414 configString += "9 hours; 540\n"; 414 configString += "9 hours; 540\n";
415 configString += "8 hours; 480\n"; 415 configString += "8 hours; 480\n";
416 configString += "1 hour; 60\n"; 416 configString += "1 hour; 60\n";
417 configString += "30 min; 30\n"; 417 configString += "30 min; 30\n";
418 configString += "15 min; 15\n"; 418 configString += "15 min; 15\n";
419 configString += "SEPARATOR\n"; 419 configString += "SEPARATOR\n";
420 configString += "Pizza; 22\n"; 420 configString += "Pizza; 22\n";
421 configString += "Nap; 45\n"; 421 configString += "Nap; 45\n";
422 configString += "Tea; 5\n"; 422 configString += "Tea; 5\n";
423 QTextStream ts( &file ); 423 QTextStream ts( &file );
424 ts << configString ; 424 ts << configString ;
425 file.close(); 425 file.close();
426 } 426 }
427 427
428 if (!file.open( IO_ReadOnly ) ) { 428 if (!file.open( IO_ReadOnly ) ) {
429 return ; 429 return ;
430 } 430 }
431 QString line; 431 QString line;
432 bool ok; 432 bool ok;
433 while ( file.readLine( line, 1024 ) > 0 ) { 433 while ( file.readLine( line, 1024 ) > 0 ) {
434 //qDebug("read %s ", line.latin1()); 434 //qDebug("read %s ", line.latin1());
435 if ( line.left(1 ) != "#" ) { 435 if ( line.left(1 ) != "#" ) {
436 // no comment 436 // no comment
437 if ( line.left(9 ) == "SEPARATOR" ) { 437 if ( line.left(9 ) == "SEPARATOR" ) {
438 mTimerPopUp->insertSeparator(); 438 mTimerPopUp->insertSeparator();
439 } else { 439 } else {
440 QStringList li = QStringList::split(";",line); 440 QStringList li = QStringList::split(";",line);
441 ok = false; 441 ok = false;
442 if ( li.count() == 2 ) { 442 if ( li.count() == 2 ) {
443 int val = li[1].toInt( &ok ); 443 int val = li[1].toInt( &ok );
444 if ( ok && val > 0 ) { 444 if ( ok && val > 0 ) {
445 mTimerPopUp->insertItem( li[0], val+10); 445 mTimerPopUp->insertItem( li[0], val+10);
446 } 446 }
447 } 447 }
448 } 448 }
449 } 449 }
450 } 450 }
451 file.close(); 451 file.close();
452#if 0 452#if 0
453 mTimerPopUp->insertItem( "24 hours", 1440 ); 453 mTimerPopUp->insertItem( "24 hours", 1440 );
454 // mTimerPopUp->insertItem( i18n("12 h"), 720 ); 454 // mTimerPopUp->insertItem( i18n("12 h"), 720 );
455 mTimerPopUp->insertItem( " 8 hours", 480 ); 455 mTimerPopUp->insertItem( " 8 hours", 480 );
456 mTimerPopUp->insertItem( " 5 hours", 300 ); 456 mTimerPopUp->insertItem( " 5 hours", 300 );
457 // mTimerPopUp->insertItem( i18n(" 2 h"), 120 ); 457 // mTimerPopUp->insertItem( i18n(" 2 h"), 120 );
458 mTimerPopUp->insertItem( " 1 hour", 60 ); 458 mTimerPopUp->insertItem( " 1 hour", 60 );
459 mTimerPopUp->insertItem( "30 min", 30 ); 459 mTimerPopUp->insertItem( "30 min", 30 );
460 mTimerPopUp->insertItem( "15 min", 15 ); 460 mTimerPopUp->insertItem( "15 min", 15 );
461 mTimerPopUp->insertItem( "10 min", 10 ); 461 mTimerPopUp->insertItem( "10 min", 10 );
462 //mTimerPopUp->insertItem( " 5 min", 5 ); 462 //mTimerPopUp->insertItem( " 5 min", 5 );
463 mTimerPopUp->insertSeparator(); 463 mTimerPopUp->insertSeparator();
464 mTimerPopUp->insertItem( "Pizza", 22 ); 464 mTimerPopUp->insertItem( "Pizza", 22 );
465 mTimerPopUp->insertItem( "Nap", 45 ); 465 mTimerPopUp->insertItem( "Nap", 45 );
466 mTimerPopUp->insertItem( "Tea", 5 ); 466 mTimerPopUp->insertItem( "Tea", 5 );
467#endif 467#endif
468 QString text = mCustomText.stripWhiteSpace (); 468 QString text = mCustomText.stripWhiteSpace ();
469 int in = text.find( " " ); 469 int in = text.find( " " );
470 text = text.left ( in ); 470 text = text.left ( in );
471 mTimerPopUp->insertItem( text, 3 ); 471 mTimerPopUp->insertItem( text, 3 );
472 mTimerPopUp->insertSeparator(); 472 mTimerPopUp->insertSeparator();
473 mTimerPopUp->insertItem( "Customize", 2 ); 473 mTimerPopUp->insertItem( "Customize", 2 );
474 } 474 }
475 475
476} 476}
477 477
478void SimpleAlarmDaemonImpl::showTimer() 478void SimpleAlarmDaemonImpl::showTimer()
479{ 479{
480 fillTimerPopUp(); 480 fillTimerPopUp();
481} 481}
482 482
483void SimpleAlarmDaemonImpl::confTimer( int time ) 483void SimpleAlarmDaemonImpl::confTimer( int time )
484{ 484{
485 //qDebug("impleAlarmDaemonImpl::confTimer() %d ", time ); 485 //qDebug("impleAlarmDaemonImpl::confTimer() %d ", time );
486 int minutes = time; 486 int minutes = time;
487 if ( minutes == 0 ) { 487 if ( minutes == 0 ) {
488 if ( ! mTimerTime ) 488 if ( ! mTimerTime )
489 return; 489 return;
490 490
491 QDialog dia ( 0, ("Stop Timer" ), true ); 491 QDialog dia ( 0, ("Stop Timer" ), true );
492 QLabel lab (("Really stop the timer?\n\n"+ mRunningTimerText+"\n"), &dia ); 492 QLabel lab (("Really stop the timer?\n\n"+ mRunningTimerText+"\n"), &dia );
493 lab.setAlignment( AlignCenter ); 493 lab.setAlignment( AlignCenter );
494 dia.setCaption(("KO/Pi Timer Stop" )); 494 dia.setCaption(("KO/Pi Timer Stop" ));
495 QVBoxLayout lay( &dia ); 495 QVBoxLayout lay( &dia );
496 lay.addWidget( &lab); 496 lay.addWidget( &lab);
497 QPushButton ok ( "Stop timer!", &dia); 497 QPushButton ok ( "Stop timer!", &dia);
498 QFont fo = dia.font(); 498 QFont fo = dia.font();
499 fo.setPointSize( 36 ); 499 fo.setPointSize( 36 );
500 ok.setFont( fo ); 500 ok.setFont( fo );
501 lay.addWidget( &ok); 501 lay.addWidget( &ok);
502 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); 502 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) );
503 QPushButton con ( "Continue timer!", &dia); 503 QPushButton con ( "Continue timer!", &dia);
504 fo.setPointSize( 36 ); 504 fo.setPointSize( 36 );
505 con.setFont( fo ); 505 con.setFont( fo );
506 lay.addWidget( &con); 506 lay.addWidget( &con);
507 connect ( &con, SIGNAL (clicked()), &dia, SLOT ( reject() ) ); 507 connect ( &con, SIGNAL (clicked()), &dia, SLOT ( reject() ) );
508 lay.setMargin(5); 508 lay.setMargin(5);
509 lay.setSpacing(5); 509 lay.setSpacing(5);
510 dia.resize(dia.sizeHint() ); 510 dia.resize(dia.sizeHint() );
511 511
512 if ( !dia.exec() ) 512 if ( !dia.exec() )
513 return; 513 return;
514 514
515 AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.utf8() ); 515 AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.utf8() );
516 mTimerTime = 0; 516 mTimerTime = 0;
517 return; 517 return;
518 } 518 }
519 if ( mTimerTime ) 519 if ( mTimerTime )
520 return; 520 return;
521 if ( minutes == 1 ) { 521 if ( minutes == 1 ) {
522 return; 522 return;
523 } 523 }
524 QString mess = "timer_alarm"; 524 QString mess = "timer_alarm";
525 QString disp; 525 QString disp;
526 mess += ("Timer Alarm!\n"); 526 mess += ("Timer Alarm!\n");
527 if ( minutes == 3 ) { 527 if ( minutes == 3 ) {
528 mess += mCustomText; 528 mess += mCustomText;
529 minutes = mCustomMinutes ; 529 minutes = mCustomMinutes ;
530 mRunningTimerText = mCustomText.stripWhiteSpace (); 530 mRunningTimerText = mCustomText.stripWhiteSpace ();
531 int in = mRunningTimerText.find( " " ); 531 int in = mRunningTimerText.find( " " );
532 mRunningTimerText = mRunningTimerText.left ( in ); 532 mRunningTimerText = mRunningTimerText.left ( in );
533 disp = mCustomText; 533 disp = mCustomText;
534 } 534 }
535 else { 535 else {
536 if ( minutes == 2 ) { 536 if ( minutes == 2 ) {
537 // ask time 537 // ask time
538 QDialog dia ( 0, ("Customize Timer" ), true ); 538 QDialog dia ( 0, ("Customize Timer" ), true );
539 QLabel lab (("Message Text:"), &dia ); 539 QLabel lab (("Message Text:"), &dia );
540 dia.setCaption(("KO/Pi Timer" )); 540 dia.setCaption(("KO/Pi Timer" ));
541 QVBoxLayout lay( &dia ); 541 QVBoxLayout lay( &dia );
542 lay.setMargin(5); 542 lay.setMargin(5);
543 lay.setSpacing(5); 543 lay.setSpacing(5);
544 lay.addWidget( &lab); 544 lay.addWidget( &lab);
545 QLineEdit lEdit( mCustomText, &dia ); 545 QLineEdit lEdit( mCustomText, &dia );
546 lay.addWidget( &lEdit); 546 lay.addWidget( &lEdit);
547 QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia ); 547 QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia );
548 lay.addWidget( &lab2); 548 lay.addWidget( &lab2);
549 QHBox hbox1 ( &dia ); 549 QHBox hbox1 ( &dia );
550 lay.addWidget( &hbox1); 550 lay.addWidget( &hbox1);
551 QLabel lab3 (("Hours"), &hbox1 ); 551 QLabel lab3 (("Hours"), &hbox1 );
552 QLabel lab4 (("Minutes"), &hbox1 ); 552 QLabel lab4 (("Minutes"), &hbox1 );
553 QHBox hbox ( &dia ); 553 QHBox hbox ( &dia );
554 QSpinBox spinh( 0, 24, 1,& hbox ); 554 QSpinBox spinh( 0, 24, 1,& hbox );
555 QFont fo = dia.font(); 555 QFont fo = dia.font();
556 fo.setPointSize( 36 ); 556 fo.setPointSize( 36 );
557 QSpinBox spinm( 0, 59, 1,&hbox ); 557 QSpinBox spinm( 0, 59, 1,&hbox );
558 spinm.setFont( fo ); 558 spinm.setFont( fo );
559 spinh.setFont( fo ); 559 spinh.setFont( fo );
560 spinh.setButtonSymbols( QSpinBox::PlusMinus ); 560 spinh.setButtonSymbols( QSpinBox::PlusMinus );
561 spinm.setButtonSymbols( QSpinBox::PlusMinus ); 561 spinm.setButtonSymbols( QSpinBox::PlusMinus );
562 spinh.upButton ()->setFixedSize( QSize( 48, 30 )); 562 spinh.upButton ()->setFixedSize( QSize( 48, 30 ));
563 spinh.downButton ()->setFixedSize( QSize( 48, 30 )); 563 spinh.downButton ()->setFixedSize( QSize( 48, 30 ));
564 //spinh.editor ()->setFixedSize( QSize( 50, 100 )); 564 //spinh.editor ()->setFixedSize( QSize( 50, 100 ));
565 spinh.setFixedSize( 100,62 ); 565 spinh.setFixedSize( 100,62 );
566 spinm.upButton ()->setFixedSize( QSize( 48, 30 )); 566 spinm.upButton ()->setFixedSize( QSize( 48, 30 ));
567 spinm.downButton ()->setFixedSize( QSize( 48, 30 )); 567 spinm.downButton ()->setFixedSize( QSize( 48, 30 ));
568 spinm.downButton ()->setGeometry( 50,50,50,50); 568 spinm.downButton ()->setGeometry( 50,50,50,50);
569 // spinm.setSuffix( " m" ); 569 // spinm.setSuffix( " m" );
570 //spinh.setSuffix( " h" ); 570 //spinh.setSuffix( " h" );
571 spinm.setWrapping ( true ); 571 spinm.setWrapping ( true );
572 //spinm.editor ()->setFixedSize( QSize( 50, 100 )); 572 //spinm.editor ()->setFixedSize( QSize( 50, 100 ));
573 spinm.setLineStep( 1 ); 573 spinm.setLineStep( 1 );
574 spinm.setFixedSize( 110,62 ); 574 spinm.setFixedSize( 110,62 );
575 lay.addWidget( &hbox); 575 lay.addWidget( &hbox);
576 QLabel lab5 ("Timer fires at:", &dia ); 576 QLabel lab5 ("Timer fires at:", &dia );
577 lab5.setAlignment( AlignCenter ); 577 lab5.setAlignment( AlignCenter );
578 lay.addWidget( &lab5); 578 lay.addWidget( &lab5);
579 KODateLabel dl ( &dia ); 579 KODateLabel dl ( &dia );
580 dl.setAlignment( AlignCenter ); 580 dl.setAlignment( AlignCenter );
581 dl.setFont( fo ); 581 dl.setFont( fo );
582 connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) ); 582 connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) );
583 connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) ); 583 connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) );
584 lay.addWidget( &dl); 584 lay.addWidget( &dl);
585 spinh.setValue( mCustomMinutes/60 ); 585 spinh.setValue( mCustomMinutes/60 );
586 spinm.setValue( mCustomMinutes%60 ); 586 spinm.setValue( mCustomMinutes%60 );
587 QPushButton ok ( "Start timer", &dia); 587 QPushButton ok ( "Start timer", &dia);
588 ok.setDefault( true ); 588 ok.setDefault( true );
589 ok.setFont( fo ); 589 ok.setFont( fo );
590 spinh.setFocus(); 590 spinh.setFocus();
591 lay.addWidget( &ok); 591 lay.addWidget( &ok);
592 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); 592 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) );
593 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); 593 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() );
594 594
595 if ( !dia.exec() ) 595 if ( !dia.exec() )
596 return; 596 return;
597 mCustomText = lEdit.text(); 597 mCustomText = lEdit.text();
598 mCustomMinutes = spinh.value()*60+spinm.value(); 598 mCustomMinutes = spinh.value()*60+spinm.value();
599 if ( mCustomMinutes == 0 ) 599 if ( mCustomMinutes == 0 )
600 mCustomMinutes = 1; 600 mCustomMinutes = 1;
601 if ( mCustomMinutes > 1440 ) 601 if ( mCustomMinutes > 1440 )
602 mCustomMinutes = 1440; 602 mCustomMinutes = 1440;
603 mess += mCustomText; 603 mess += mCustomText;
604 disp = mCustomText; 604 disp = mCustomText;
605 minutes = mCustomMinutes; 605 minutes = mCustomMinutes;
606 mRunningTimerText = mCustomText.stripWhiteSpace (); 606 mRunningTimerText = mCustomText.stripWhiteSpace ();
607 int in = mRunningTimerText.find( " " ); 607 int in = mRunningTimerText.find( " " );
608 mRunningTimerText = mRunningTimerText.left ( in ); 608 mRunningTimerText = mRunningTimerText.left ( in );
609 } 609 }
610 else { 610 else {
611 mess += mTimerPopUp->text( minutes ); 611 mess += mTimerPopUp->text( minutes );
612 disp = mTimerPopUp->text( minutes ); 612 disp = mTimerPopUp->text( minutes );
613 mRunningTimerText = mTimerPopUp->text( minutes ); 613 mRunningTimerText = mTimerPopUp->text( minutes );
614 minutes -= 10; 614 minutes -= 10;
615 } 615 }
616 } 616 }
617 //minutes = 1; 617 //minutes = 1;
618 618
619 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); 619 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 );
620 timerMesssage = mess; 620 timerMesssage = mess;
621 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8()); 621 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8());
622 mTimerStartLabel->setText( disp ); 622 mTimerStartLabel->setText( disp );
623 int w = 200; 623 int w = 200;
624 int h = mTimerStartLabel->sizeHint().height() ; 624 int h = mTimerStartLabel->sizeHint().height() ;
625 int dw = QApplication::desktop()->width(); 625 int dw = QApplication::desktop()->width();
626 int dh = QApplication::desktop()->height(); 626 int dh = QApplication::desktop()->height();
627 mTimerStartLabel->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 627 mTimerStartLabel->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
628 mTimerStartLabel->show(); 628 mTimerStartLabel->show();
629 QTimer::singleShot( 3000, mTimerStartLabel, SLOT ( hide() ) ); 629 QTimer::singleShot( 2000, mTimerStartLabel, SLOT ( hide() ) );
630 mTimerTime = 1; 630 mTimerTime = 1;
631} 631}
632 632
633void SimpleAlarmDaemonImpl::writeFile() 633void SimpleAlarmDaemonImpl::writeFile()
634{ 634{
635 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 635 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
636 //QCopEnvelope e("QPE/Application/kopi", "-writeFile"); 636 //QCopEnvelope e("QPE/Application/kopi", "-writeFile");
637} 637}
638void SimpleAlarmDaemonImpl::showWN() 638void SimpleAlarmDaemonImpl::showWN()
639{ 639{
640 QCopEnvelope e("QPE/Application/kopi", "-showWN"); 640 QCopEnvelope e("QPE/Application/kopi", "-showWN");
641} 641}
642void SimpleAlarmDaemonImpl::newTodo() 642void SimpleAlarmDaemonImpl::newTodo()
643{ 643{
644 QCopEnvelope e("QPE/Application/kopi", "-newTodo"); 644 QCopEnvelope e("QPE/Application/kopi", "-newTodo");
645} 645}
646 646
647void SimpleAlarmDaemonImpl::newEvent() 647void SimpleAlarmDaemonImpl::newEvent()
648{ 648{
649 QCopEnvelope e("QPE/Application/kopi", "-newEvent"); 649 QCopEnvelope e("QPE/Application/kopi", "-newEvent");
650 650
651} 651}
652void SimpleAlarmDaemonImpl::newMail() 652void SimpleAlarmDaemonImpl::newMail()
653{ 653{
654 QCopEnvelope e("QPE/Application/ompi", "newMail()"); 654 QCopEnvelope e("QPE/Application/ompi", "newMail()");
655} 655}
656void SimpleAlarmDaemonImpl::showAdd() 656void SimpleAlarmDaemonImpl::showAdd()
657{ 657{
658 QCopEnvelope e("QPE/Application/kapi", "raise()"); 658 QCopEnvelope e("QPE/Application/kapi", "raise()");
659} 659}
660void SimpleAlarmDaemonImpl::ringSync() 660void SimpleAlarmDaemonImpl::ringSync()
661{ 661{
662 QCopEnvelope e("QPE/Application/kopi", "-ringSync"); 662 QCopEnvelope e("QPE/Application/kopi", "-ringSync");
663 663
664} 664}
665void SimpleAlarmDaemonImpl::newCountdown() 665void SimpleAlarmDaemonImpl::newCountdown()
666{ 666{
667 //recieve("cal_alarm", 10 ); 667 //recieve("cal_alarm", 10 );
668} 668}
669void SimpleAlarmDaemonImpl::simulate() 669void SimpleAlarmDaemonImpl::simulate()
670{ 670{
671 QTimer::singleShot( 5000, this, SLOT ( writeFile() ) ); 671 QTimer::singleShot( 5000, this, SLOT ( writeFile() ) );
672 QString filename = getenv("QPEDIR") ; 672 QString filename = getenv("QPEDIR") ;
673 filename += "/pics/kdepim/korganizer/koalarm.wav"; 673 filename += "/pics/kdepim/korganizer/koalarm.wav";
674 startAlarm("Alarm simulation", filename ); 674 startAlarm("Alarm simulation", filename );
675} 675}
676void SimpleAlarmDaemonImpl::showKO() 676void SimpleAlarmDaemonImpl::showKO()
677{ 677{
678 QCopEnvelope e("QPE/Application/kopi", "-showKO"); 678 QCopEnvelope e("QPE/Application/kopi", "-showKO");
679 // testing only 679 // testing only
680 //QCopEnvelope e("QPE/Application/kopi", "nextView()"); 680 //QCopEnvelope e("QPE/Application/kopi", "nextView()");
681 681
682} 682}
683void SimpleAlarmDaemonImpl::showTodo() 683void SimpleAlarmDaemonImpl::showTodo()
684{ 684{
685 QCopEnvelope e("QPE/Application/kopi", "-showTodo"); 685 QCopEnvelope e("QPE/Application/kopi", "-showTodo");
686 686
687} 687}
688void SimpleAlarmDaemonImpl::writeJournal() 688void SimpleAlarmDaemonImpl::writeJournal()
689{ 689{
690 QCopEnvelope e("QPE/Application/kopi", "-showJournal"); 690 QCopEnvelope e("QPE/Application/kopi", "-showJournal");
691 691
692} 692}
693 693
694void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * ) 694void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * )
695{ 695{
696 696
697 mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() ))); 697 mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() )));
698 698
699} 699}
700 700