-rw-r--r-- | noncore/settings/netsystemtime/mainwindow.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/noncore/settings/netsystemtime/mainwindow.cpp b/noncore/settings/netsystemtime/mainwindow.cpp index 486257f..01d9a98 100644 --- a/noncore/settings/netsystemtime/mainwindow.cpp +++ b/noncore/settings/netsystemtime/mainwindow.cpp @@ -74,6 +74,6 @@ MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags Config config( "ntp" ); config.setGroup( "settings" ); - slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", FALSE ) ); - slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", FALSE ) ); + slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", false ) ); + slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", false ) ); mainWidget->setCurrentTab( tr( "Time" ) ); @@ -129,8 +129,8 @@ void MainWindow::accept() // Update the systemtime - timeTab->saveSettings( TRUE ); + timeTab->saveSettings( true ); // Save format options - formatTab->saveSettings( TRUE ); + formatTab->saveSettings( true ); // Save settings options @@ -152,8 +152,8 @@ void MainWindow::reject() { // Reset time settings - timeTab->saveSettings( FALSE ); + timeTab->saveSettings( false ); // Send notifications but do not save settings - formatTab->saveSettings( FALSE ); + formatTab->saveSettings( false ); // Exit app @@ -186,8 +186,8 @@ void MainWindow::runNTP() output.append( srv ); ntpTab->addNtpOutput( output ); + ntpTab->setNTPBtnEnabled( false ); } // Disable set time buttons & change app caption to indicate time update is happening - ntpTab->setNTPBtnEnabled( false ); timeTab->setNTPBtnEnabled( false ); setCaption( tr( "Retrieving time from network..." ) ); @@ -211,8 +211,10 @@ void MainWindow::runNTP() QMessageBox::critical( this, tr( "Error" ), tr( "Error while getting time from network." ) ); if ( ntpTabEnabled ) + { ntpTab->addNtpOutput( tr( "Error while executing ntpdate" ) ); + ntpTab->setNTPBtnEnabled( true ); + } // Re-enable set time buttons & change app caption to indicate time update is happening - ntpTab->setNTPBtnEnabled( true ); timeTab->setNTPBtnEnabled( true ); setCaption( tr( "SystemTime" ) ); @@ -280,5 +282,5 @@ void MainWindow::slotDisplayPredictTab( bool display ) void MainWindow::slotGetNTPTime() { - ntpInteractive = TRUE; + ntpInteractive = true; runNTP(); } @@ -286,5 +288,5 @@ void MainWindow::slotGetNTPTime() void MainWindow::slotTimerGetNTPTime() { - ntpInteractive = FALSE; + ntpInteractive = false; runNTP(); } @@ -310,5 +312,6 @@ void MainWindow::slotNtpFinished( OProcess *p ) // Re-enable set time buttons & change app caption to indicate time update is happening - ntpTab->setNTPBtnEnabled( true ); + if ( ntpTabEnabled ) + ntpTab->setNTPBtnEnabled( true ); timeTab->setNTPBtnEnabled( true ); setCaption( tr( "SystemTime" ) ); @@ -335,5 +338,5 @@ void MainWindow::slotNtpFinished( OProcess *p ) int lastLookup = config.readNumEntry( "time", 0 ); int lookupCount = config.readNumEntry( "count", 0 ); - bool lastNtp = config.readBoolEntry( "lastNtp", FALSE ); + bool lastNtp = config.readBoolEntry( "lastNtp", false ); int time = TimeConversion::toUTC( QDateTime::currentDateTime() ); config.writeEntry( "time", time ); @@ -372,5 +375,5 @@ void MainWindow::slotNtpFinished( OProcess *p ) config.setGroup( "lookups" ); config.writeEntry( "count", lookupCount ); - config.writeEntry( "lastNtp", TRUE ); + config.writeEntry( "lastNtp", true ); } } |