-rw-r--r-- | kalarmd/simplealarmdaemonimpl.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp index 141a9ce..15eff28 100644 --- a/kalarmd/simplealarmdaemonimpl.cpp +++ b/kalarmd/simplealarmdaemonimpl.cpp | |||
@@ -593,98 +593,111 @@ void SimpleAlarmDaemonImpl::confTimer( int time ) | |||
593 | spinm.setLineStep( 1 ); | 593 | spinm.setLineStep( 1 ); |
594 | spinm.setFixedSize( 110,62 ); | 594 | spinm.setFixedSize( 110,62 ); |
595 | lay.addWidget( &hbox); | 595 | lay.addWidget( &hbox); |
596 | QLabel lab5 ("Timer fires at:", &dia ); | 596 | QLabel lab5 ("Timer fires at:", &dia ); |
597 | lab5.setAlignment( AlignCenter ); | 597 | lab5.setAlignment( AlignCenter ); |
598 | lay.addWidget( &lab5); | 598 | lay.addWidget( &lab5); |
599 | KODateLabel dl ( &dia ); | 599 | KODateLabel dl ( &dia ); |
600 | dl.setAlignment( AlignCenter ); | 600 | dl.setAlignment( AlignCenter ); |
601 | dl.setFont( fo ); | 601 | dl.setFont( fo ); |
602 | connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) ); | 602 | connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) ); |
603 | connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) ); | 603 | connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) ); |
604 | lay.addWidget( &dl); | 604 | lay.addWidget( &dl); |
605 | spinh.setValue( mCustomMinutes/60 ); | 605 | spinh.setValue( mCustomMinutes/60 ); |
606 | spinm.setValue( mCustomMinutes%60 ); | 606 | spinm.setValue( mCustomMinutes%60 ); |
607 | QPushButton ok ( "Start timer", &dia); | 607 | QPushButton ok ( "Start timer", &dia); |
608 | ok.setDefault( true ); | 608 | ok.setDefault( true ); |
609 | ok.setFont( fo ); | 609 | ok.setFont( fo ); |
610 | spinh.setFocus(); | 610 | spinh.setFocus(); |
611 | lay.addWidget( &ok); | 611 | lay.addWidget( &ok); |
612 | connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); | 612 | connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); |
613 | dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); | 613 | dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); |
614 | 614 | ||
615 | if ( !dia.exec() ) | 615 | if ( !dia.exec() ) |
616 | return; | 616 | return; |
617 | mCustomText = lEdit.text(); | 617 | mCustomText = lEdit.text(); |
618 | mCustomMinutes = spinh.value()*60+spinm.value(); | 618 | mCustomMinutes = spinh.value()*60+spinm.value(); |
619 | if ( mCustomMinutes == 0 ) | 619 | if ( mCustomMinutes == 0 ) |
620 | mCustomMinutes = 1; | 620 | mCustomMinutes = 1; |
621 | if ( mCustomMinutes > 1440 ) | 621 | if ( mCustomMinutes > 1440 ) |
622 | mCustomMinutes = 1440; | 622 | mCustomMinutes = 1440; |
623 | mess += mCustomText; | 623 | mess += mCustomText; |
624 | disp = mCustomText; | 624 | disp = mCustomText; |
625 | minutes = mCustomMinutes; | 625 | minutes = mCustomMinutes; |
626 | mRunningTimerText = mCustomText.stripWhiteSpace (); | 626 | mRunningTimerText = mCustomText.stripWhiteSpace (); |
627 | int in = mRunningTimerText.find( " " ); | 627 | int in = mRunningTimerText.find( " " ); |
628 | mRunningTimerText = mRunningTimerText.left ( in ); | 628 | mRunningTimerText = mRunningTimerText.left ( in ); |
629 | } | 629 | } |
630 | else { | 630 | else { |
631 | mess += mTimerPopUp->text( minutes ); | 631 | mess += mTimerPopUp->text( minutes ); |
632 | disp = mTimerPopUp->text( minutes ); | 632 | disp = mTimerPopUp->text( minutes ); |
633 | mRunningTimerText = mTimerPopUp->text( minutes ); | 633 | mRunningTimerText = mTimerPopUp->text( minutes ); |
634 | minutes -= 10; | 634 | minutes -= 10; |
635 | } | 635 | } |
636 | } | 636 | } |
637 | //minutes = 1; | 637 | //minutes = 1; |
638 | 638 | ||
639 | mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); | 639 | mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); |
640 | timerMesssage = mess; | 640 | timerMesssage = mess; |
641 | QString timerDuration ; | ||
642 | if ( minutes < 60 ) { | ||
643 | timerDuration = QString::number( minutes ) + " min"; | ||
644 | } else { | ||
645 | if ( minutes % 60 ) { | ||
646 | timerDuration = QString::number( minutes/60 ) +":"; | ||
647 | minutes = minutes%60; | ||
648 | if ( minutes < 10 ) timerDuration += "0"; | ||
649 | timerDuration += QString::number( minutes ) + " h"; | ||
650 | } | ||
651 | else | ||
652 | timerDuration = QString::number( minutes / 60 )+ " hours"; | ||
653 | } | ||
641 | AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8()); | 654 | AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8()); |
642 | mTimerStartLabel->setText( disp + "\n\nTimer started!" ); | 655 | mTimerStartLabel->setText( disp + "\n\n" + timerDuration +"\n\nTimer started!" ); |
643 | int w = mTimerStartLabel->sizeHint().width()+20; | 656 | int w = mTimerStartLabel->sizeHint().width()+20; |
644 | int h = mTimerStartLabel->sizeHint().height()+40 ; | 657 | int h = mTimerStartLabel->sizeHint().height()+40 ; |
645 | int dw = QApplication::desktop()->width(); | 658 | int dw = QApplication::desktop()->width(); |
646 | int dh = QApplication::desktop()->height(); | 659 | int dh = QApplication::desktop()->height(); |
647 | mTimerStartLabel->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 660 | mTimerStartLabel->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
648 | mTimerStartLabel->show(); | 661 | mTimerStartLabel->show(); |
649 | QTimer::singleShot( 4000, mTimerStartLabel, SLOT ( hide() ) ); | 662 | QTimer::singleShot( 4000, mTimerStartLabel, SLOT ( hide() ) ); |
650 | mTimerTime = 1; | 663 | mTimerTime = 1; |
651 | } | 664 | } |
652 | 665 | ||
653 | void SimpleAlarmDaemonImpl::confFontSize( int size ) | 666 | void SimpleAlarmDaemonImpl::confFontSize( int size ) |
654 | { | 667 | { |
655 | 668 | ||
656 | mFontsizePopup->setItemChecked( mPopupFontSize, false ); | 669 | mFontsizePopup->setItemChecked( mPopupFontSize, false ); |
657 | mPopupFontSize = size; | 670 | mPopupFontSize = size; |
658 | mFontsizePopup->setItemChecked( mPopupFontSize, true ); | 671 | mFontsizePopup->setItemChecked( mPopupFontSize, true ); |
659 | QFont fon = mTimerPopUp->font(); | 672 | QFont fon = mTimerPopUp->font(); |
660 | fon.setPointSize( mPopupFontSize ); | 673 | fon.setPointSize( mPopupFontSize ); |
661 | mTimerPopUp->setFont( fon ); | 674 | mTimerPopUp->setFont( fon ); |
662 | mPopUp->setFont( fon ); | 675 | mPopUp->setFont( fon ); |
663 | fon.setBold( true ); | 676 | fon.setBold( true ); |
664 | fon.setPointSize( mPopupFontSize * 2 ); | 677 | fon.setPointSize( mPopupFontSize * 2 ); |
665 | mTimerStartLabel->setFont( fon ); | 678 | mTimerStartLabel->setFont( fon ); |
666 | } | 679 | } |
667 | void SimpleAlarmDaemonImpl::writeFile() | 680 | void SimpleAlarmDaemonImpl::writeFile() |
668 | { | 681 | { |
669 | QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 682 | QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
670 | //QCopEnvelope e("QPE/Application/kopi", "-writeFile"); | 683 | //QCopEnvelope e("QPE/Application/kopi", "-writeFile"); |
671 | } | 684 | } |
672 | void SimpleAlarmDaemonImpl::showWN() | 685 | void SimpleAlarmDaemonImpl::showWN() |
673 | { | 686 | { |
674 | QCopEnvelope e("QPE/Application/kopi", "-showWN"); | 687 | QCopEnvelope e("QPE/Application/kopi", "-showWN"); |
675 | } | 688 | } |
676 | void SimpleAlarmDaemonImpl::newTodo() | 689 | void SimpleAlarmDaemonImpl::newTodo() |
677 | { | 690 | { |
678 | QCopEnvelope e("QPE/Application/kopi", "-newTodo"); | 691 | QCopEnvelope e("QPE/Application/kopi", "-newTodo"); |
679 | } | 692 | } |
680 | 693 | ||
681 | void SimpleAlarmDaemonImpl::newEvent() | 694 | void SimpleAlarmDaemonImpl::newEvent() |
682 | { | 695 | { |
683 | QCopEnvelope e("QPE/Application/kopi", "-newEvent"); | 696 | QCopEnvelope e("QPE/Application/kopi", "-newEvent"); |
684 | 697 | ||
685 | } | 698 | } |
686 | void SimpleAlarmDaemonImpl::newMail() | 699 | void SimpleAlarmDaemonImpl::newMail() |
687 | { | 700 | { |
688 | QCopEnvelope e("QPE/Application/ompi", "newMail()"); | 701 | QCopEnvelope e("QPE/Application/ompi", "newMail()"); |
689 | } | 702 | } |
690 | void SimpleAlarmDaemonImpl::showAdd() | 703 | void SimpleAlarmDaemonImpl::showAdd() |