author | zautrix <zautrix> | 2005-06-14 19:52:48 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-14 19:52:48 (UTC) |
commit | c50dea673d7bf65614e042a0e3c0c53c73c705a0 (patch) (side-by-side diff) | |
tree | 04331039e86c4fa1976ba20b60acd2988dc8c19f | |
parent | d9df54411b01cabaf51fcae62b91f227f7eff5f5 (diff) | |
download | kdepimpi-c50dea673d7bf65614e042a0e3c0c53c73c705a0.zip kdepimpi-c50dea673d7bf65614e042a0e3c0c53c73c705a0.tar.gz kdepimpi-c50dea673d7bf65614e042a0e3c0c53c73c705a0.tar.bz2 |
fixx
-rw-r--r-- | kalarmd/simplealarmdaemonimpl.cpp | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp index d6e06c8..eff96eb 100644 --- a/kalarmd/simplealarmdaemonimpl.cpp +++ b/kalarmd/simplealarmdaemonimpl.cpp @@ -393,29 +393,28 @@ void SimpleAlarmDaemonImpl::fillTimerPopUp() } 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 += "24 hours; 1440\n"; + configString += "8 hours; 480\n"; + configString += "5 hours; 300\n"; + configString += "1 hour; 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 ); ts << configString ; file.close(); } if (!file.open( IO_ReadOnly ) ) { @@ -425,39 +424,39 @@ void SimpleAlarmDaemonImpl::fillTimerPopUp() bool ok; while ( file.readLine( line, 1024 ) > 0 ) { //qDebug("read %s ", line.latin1()); if ( line.left(1 ) != "#" ) { // no comment if ( line.left(9 ) == "SEPARATOR" ) { mTimerPopUp->insertSeparator(); } else { QStringList li = QStringList::split(";",line); ok = false; if ( li.count() == 2 ) { int val = li[1].toInt( &ok ); - if ( ok && val > 2 ) { - mTimerPopUp->insertItem( li[0], val); + if ( ok && val > 0 ) { + mTimerPopUp->insertItem( li[0], val+10); } } } } } file.close(); #if 0 - mTimerPopUp->insertItem( "24 h", 1440 ); + mTimerPopUp->insertItem( "24 hours", 1440 ); // mTimerPopUp->insertItem( i18n("12 h"), 720 ); - mTimerPopUp->insertItem( " 8 h", 480 ); - mTimerPopUp->insertItem( " 5 h", 300 ); + mTimerPopUp->insertItem( " 8 hours", 480 ); + mTimerPopUp->insertItem( " 5 hours", 300 ); // mTimerPopUp->insertItem( i18n(" 2 h"), 120 ); - mTimerPopUp->insertItem( " 1 h", 60 ); + mTimerPopUp->insertItem( " 1 hour", 60 ); mTimerPopUp->insertItem( "30 min", 30 ); mTimerPopUp->insertItem( "15 min", 15 ); mTimerPopUp->insertItem( "10 min", 10 ); //mTimerPopUp->insertItem( " 5 min", 5 ); mTimerPopUp->insertSeparator(); mTimerPopUp->insertItem( "Pizza", 22 ); mTimerPopUp->insertItem( "Nap", 45 ); mTimerPopUp->insertItem( "Tea", 5 ); #endif QString text = mCustomText.stripWhiteSpace (); int in = text.find( " " ); text = text.left ( in ); @@ -496,48 +495,36 @@ void SimpleAlarmDaemonImpl::confTimer( int time ) QPushButton con ( "Continue timer!", &dia); fo.setPointSize( 36 ); con.setFont( fo ); lay.addWidget( &con); connect ( &con, SIGNAL (clicked()), &dia, SLOT ( reject() ) ); lay.setMargin(5); lay.setSpacing(5); dia.resize(dia.sizeHint() ); if ( !dia.exec() ) return; - AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.latin1() ); + AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.utf8() ); mTimerTime = 0; return; } if ( mTimerTime ) return; if ( minutes == 1 ) { return; } QString mess = "timer_alarm"; mess += ("Timer Alarm!\n"); - if ( minutes == 22 ) { - mess += ( "Pizza is ready"); - mRunningTimerText = "Pizza"; - } - else if ( minutes == 45 ) { - mess += ( "Please wake up!"); - mRunningTimerText = "Nap"; - } - else if ( minutes == 5 ) { - mess += ( "Tea is ready"); - mRunningTimerText = "Tea"; - } - else if ( minutes == 3 ) { + if ( minutes == 3 ) { mess += mCustomText; minutes = mCustomMinutes ; mRunningTimerText = mCustomText.stripWhiteSpace (); int in = mRunningTimerText.find( " " ); mRunningTimerText = mRunningTimerText.left ( in ); } else { if ( minutes == 2 ) { // ask time QDialog dia ( 0, ("Customize Timer" ), true ); QLabel lab (("Message Text:"), &dia ); dia.setCaption(("KO/Pi Timer" )); @@ -601,30 +588,27 @@ void SimpleAlarmDaemonImpl::confTimer( int time ) 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"); + mess += mTimerPopUp->text( minutes ); + mRunningTimerText = mTimerPopUp->text( minutes ); + minutes -= 10; } } //minutes = 1; mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); timerMesssage = mess; AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8()); mTimerTime = 1; } void SimpleAlarmDaemonImpl::writeFile() { |