summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp15
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
@@ -617,50 +617,63 @@ void SimpleAlarmDaemonImpl::confTimer( int time )
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
653void SimpleAlarmDaemonImpl::confFontSize( int size ) 666void 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}