-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 | |||
@@ -625,34 +625,47 @@ void SimpleAlarmDaemonImpl::confTimer( int time ) | |||
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 ); |