summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show 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
@@ -593,98 +593,111 @@ void SimpleAlarmDaemonImpl::confTimer( int time )
spinm.setLineStep( 1 );
spinm.setFixedSize( 110,62 );
lay.addWidget( &hbox);
QLabel lab5 ("Timer fires at:", &dia );
lab5.setAlignment( AlignCenter );
lay.addWidget( &lab5);
KODateLabel dl ( &dia );
dl.setAlignment( AlignCenter );
dl.setFont( fo );
connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) );
connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) );
lay.addWidget( &dl);
spinh.setValue( mCustomMinutes/60 );
spinm.setValue( mCustomMinutes%60 );
QPushButton ok ( "Start timer", &dia);
ok.setDefault( true );
ok.setFont( fo );
spinh.setFocus();
lay.addWidget( &ok);
connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) );
dia.resize( dia.sizeHint().width(), dia.sizeHint().height() );
if ( !dia.exec() )
return;
mCustomText = lEdit.text();
mCustomMinutes = spinh.value()*60+spinm.value();
if ( mCustomMinutes == 0 )
mCustomMinutes = 1;
if ( mCustomMinutes > 1440 )
mCustomMinutes = 1440;
mess += mCustomText;
disp = mCustomText;
minutes = mCustomMinutes;
mRunningTimerText = mCustomText.stripWhiteSpace ();
int in = mRunningTimerText.find( " " );
mRunningTimerText = mRunningTimerText.left ( in );
}
else {
mess += mTimerPopUp->text( minutes );
disp = mTimerPopUp->text( minutes );
mRunningTimerText = mTimerPopUp->text( minutes );
minutes -= 10;
}
}
//minutes = 1;
mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 );
timerMesssage = mess;
+ QString timerDuration ;
+ if ( minutes < 60 ) {
+ timerDuration = QString::number( minutes ) + " min";
+ } else {
+ if ( minutes % 60 ) {
+ timerDuration = QString::number( minutes/60 ) +":";
+ minutes = minutes%60;
+ if ( minutes < 10 ) timerDuration += "0";
+ timerDuration += QString::number( minutes ) + " h";
+ }
+ else
+ timerDuration = QString::number( minutes / 60 )+ " hours";
+ }
AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8());
- mTimerStartLabel->setText( disp + "\n\nTimer started!" );
+ mTimerStartLabel->setText( disp + "\n\n" + timerDuration +"\n\nTimer started!" );
int w = mTimerStartLabel->sizeHint().width()+20;
int h = mTimerStartLabel->sizeHint().height()+40 ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
mTimerStartLabel->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
mTimerStartLabel->show();
QTimer::singleShot( 4000, mTimerStartLabel, SLOT ( hide() ) );
mTimerTime = 1;
}
void SimpleAlarmDaemonImpl::confFontSize( int size )
{
mFontsizePopup->setItemChecked( mPopupFontSize, false );
mPopupFontSize = size;
mFontsizePopup->setItemChecked( mPopupFontSize, true );
QFont fon = mTimerPopUp->font();
fon.setPointSize( mPopupFontSize );
mTimerPopUp->setFont( fon );
mPopUp->setFont( fon );
fon.setBold( true );
fon.setPointSize( mPopupFontSize * 2 );
mTimerStartLabel->setFont( fon );
}
void SimpleAlarmDaemonImpl::writeFile()
{
QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
//QCopEnvelope e("QPE/Application/kopi", "-writeFile");
}
void SimpleAlarmDaemonImpl::showWN()
{
QCopEnvelope e("QPE/Application/kopi", "-showWN");
}
void SimpleAlarmDaemonImpl::newTodo()
{
QCopEnvelope e("QPE/Application/kopi", "-newTodo");
}
void SimpleAlarmDaemonImpl::newEvent()
{
QCopEnvelope e("QPE/Application/kopi", "-newEvent");
}
void SimpleAlarmDaemonImpl::newMail()
{
QCopEnvelope e("QPE/Application/ompi", "newMail()");
}
void SimpleAlarmDaemonImpl::showAdd()