summaryrefslogtreecommitdiffabout
path: root/kalarmd/simplealarmdaemonimpl.cpp
Side-by-side diff
Diffstat (limited to 'kalarmd/simplealarmdaemonimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp
index e8ec033..b3da428 100644
--- a/kalarmd/simplealarmdaemonimpl.cpp
+++ b/kalarmd/simplealarmdaemonimpl.cpp
@@ -340,68 +340,68 @@ void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& )
startAlarm( mAlarmMessage, filename );
}
int SimpleAlarmDaemonImpl::getFileNameLen( QString mess )
{
return 0;
}
void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename )
{
//mAlarmDialog->show();
//mAlarmDialog->raise();
mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend );
}
void SimpleAlarmDaemonImpl::fillTimerPopUp()
{
// qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime );
if ( mTimerPopupConf == mTimerTime ) {
if ( mTimerTime ) {
int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer );
QTime t ( secs/3600, (secs/60)%60, secs%60 );
- mTimerPopUp->changeItem ( 1 , t.toString() + " (remaining time)");
+ mTimerPopUp->changeItem ( 1 , t.toString() + " (countdown)");
}
else {
QString text = mCustomText.stripWhiteSpace ();
int in = text.find( " " );
text = text.left ( in );
mTimerPopUp->changeItem ( 3, text );
}
return;
}
mTimerPopupConf = mTimerTime;
mTimerPopUp->clear();
if ( mTimerTime ) {
int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer );
QTime t ( secs/3600, (secs/60)%60, secs%60 );
mTimerPopUp->insertItem( "Stop timer "+ mRunningTimerText , 0 );
- mTimerPopUp->insertItem( t.toString() + " (remaining time)",1);
- mTimerPopUp->insertItem( mRunningTimer.time().toString() + " (alarm time)",2);
+ mTimerPopUp->insertItem( t.toString() + " (countdown)",1);
+ mTimerPopUp->insertItem( mRunningTimer.time().toString() + " (alarm)",2);
} else {
QString fileName = QDir::homeDirPath() +"/.kopialarmtimerrc";
QFile file( fileName );
if( !QFile::exists( fileName) ) {
// write defaults
if (!file.open( IO_WriteOnly ) ) {
return;
}
QString configString ;
configString += "#config file for kopi alarm timer\n";
configString += "#format: <Text for popup menu>;<timer countdown in minutes>\n";
configString += "#NOTE: minimum value for timer are 3 minutes!\n";
configString += "24 h; 1440\n";
configString += " 8 h; 480\n";
configString += " 5 h; 300\n";
configString += " 1 h; 60\n";
configString += "30 min; 30\n";
configString += "15 min; 15\n";
configString += "SEPARATOR\n";
configString += "Pizza; 22\n";
configString += "Nap; 45\n";
configString += "Tea; 5\n";
QTextStream ts( &file );
@@ -539,96 +539,99 @@ void SimpleAlarmDaemonImpl::confTimer( int time )
QLineEdit lEdit( mCustomText, &dia );
lay.addWidget( &lEdit);
QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia );
lay.addWidget( &lab2);
QHBox hbox1 ( &dia );
lay.addWidget( &hbox1);
QLabel lab3 (("Hours"), &hbox1 );
QLabel lab4 (("Minutes"), &hbox1 );
QHBox hbox ( &dia );
QSpinBox spinh( 0, 24, 1,& hbox );
QFont fo = dia.font();
fo.setPointSize( 36 );
QSpinBox spinm( 0, 59, 1,&hbox );
spinm.setFont( fo );
spinh.setFont( fo );
spinh.setButtonSymbols( QSpinBox::PlusMinus );
spinm.setButtonSymbols( QSpinBox::PlusMinus );
spinh.upButton ()->setFixedSize( QSize( 48, 30 ));
spinh.downButton ()->setFixedSize( QSize( 48, 30 ));
//spinh.editor ()->setFixedSize( QSize( 50, 100 ));
spinh.setFixedSize( 100,62 );
spinm.upButton ()->setFixedSize( QSize( 48, 30 ));
spinm.downButton ()->setFixedSize( QSize( 48, 30 ));
spinm.downButton ()->setGeometry( 50,50,50,50);
- spinm.setSuffix( " m" );
- spinh.setSuffix( " h" );
+ // spinm.setSuffix( " m" );
+ //spinh.setSuffix( " h" );
spinm.setWrapping ( true );
//spinm.editor ()->setFixedSize( QSize( 50, 100 ));
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;
minutes = mCustomMinutes;
mRunningTimerText = mCustomText.stripWhiteSpace ();
int in = mRunningTimerText.find( " " );
mRunningTimerText = mRunningTimerText.left ( in );
}
else {
mess+= QString::number ( minutes ) + ( " minutes are past!");
int min = minutes;
if ( min % 60 == 0 )
mRunningTimerText = QString::number ( min/60 ) + ( " hours");
else
mRunningTimerText = QString::number ( minutes ) + ( " minutes");
}
}
//minutes = 1;
+
mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 );
timerMesssage = mess;
AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.latin1());
mTimerTime = 1;
}
void SimpleAlarmDaemonImpl::writeFile()
{
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");
}