summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/mainwindow.cpp29
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
@@ -73,8 +73,8 @@ MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags
73 mainWidget->addTab( predictTab = new PredictTabWidget( mainWidget ), "netsystemtime/predicttab", tr( "Predict" ) ); 73 mainWidget->addTab( predictTab = new PredictTabWidget( mainWidget ), "netsystemtime/predicttab", tr( "Predict" ) );
74 Config config( "ntp" ); 74 Config config( "ntp" );
75 config.setGroup( "settings" ); 75 config.setGroup( "settings" );
76 slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", FALSE ) ); 76 slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", false ) );
77 slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", FALSE ) ); 77 slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", false ) );
78 78
79 mainWidget->setCurrentTab( tr( "Time" ) ); 79 mainWidget->setCurrentTab( tr( "Time" ) );
80 layout->addWidget( mainWidget ); 80 layout->addWidget( mainWidget );
@@ -128,10 +128,10 @@ void MainWindow::accept()
128 } 128 }
129 129
130 // Update the systemtime 130 // Update the systemtime
131 timeTab->saveSettings( TRUE ); 131 timeTab->saveSettings( true );
132 132
133 // Save format options 133 // Save format options
134 formatTab->saveSettings( TRUE ); 134 formatTab->saveSettings( true );
135 135
136 // Save settings options 136 // Save settings options
137 settingsTab->saveSettings(); 137 settingsTab->saveSettings();
@@ -151,10 +151,10 @@ void MainWindow::accept()
151void MainWindow::reject() 151void MainWindow::reject()
152{ 152{
153 // Reset time settings 153 // Reset time settings
154 timeTab->saveSettings( FALSE ); 154 timeTab->saveSettings( false );
155 155
156 // Send notifications but do not save settings 156 // Send notifications but do not save settings
157 formatTab->saveSettings( FALSE ); 157 formatTab->saveSettings( false );
158 158
159 // Exit app 159 // Exit app
160 qApp->quit(); 160 qApp->quit();
@@ -185,10 +185,10 @@ void MainWindow::runNTP()
185 QString output = tr( "Running:\nntpdate " ); 185 QString output = tr( "Running:\nntpdate " );
186 output.append( srv ); 186 output.append( srv );
187 ntpTab->addNtpOutput( output ); 187 ntpTab->addNtpOutput( output );
188 ntpTab->setNTPBtnEnabled( false );
188 } 189 }
189 190
190 // Disable set time buttons & change app caption to indicate time update is happening 191 // Disable set time buttons & change app caption to indicate time update is happening
191 ntpTab->setNTPBtnEnabled( false );
192 timeTab->setNTPBtnEnabled( false ); 192 timeTab->setNTPBtnEnabled( false );
193 setCaption( tr( "Retrieving time from network..." ) ); 193 setCaption( tr( "Retrieving time from network..." ) );
194 194
@@ -210,10 +210,12 @@ void MainWindow::runNTP()
210 { 210 {
211 QMessageBox::critical( this, tr( "Error" ), tr( "Error while getting time from network." ) ); 211 QMessageBox::critical( this, tr( "Error" ), tr( "Error while getting time from network." ) );
212 if ( ntpTabEnabled ) 212 if ( ntpTabEnabled )
213 {
213 ntpTab->addNtpOutput( tr( "Error while executing ntpdate" ) ); 214 ntpTab->addNtpOutput( tr( "Error while executing ntpdate" ) );
215 ntpTab->setNTPBtnEnabled( true );
216 }
214 217
215 // Re-enable set time buttons & change app caption to indicate time update is happening 218 // Re-enable set time buttons & change app caption to indicate time update is happening
216 ntpTab->setNTPBtnEnabled( true );
217 timeTab->setNTPBtnEnabled( true ); 219 timeTab->setNTPBtnEnabled( true );
218 setCaption( tr( "SystemTime" ) ); 220 setCaption( tr( "SystemTime" ) );
219 } 221 }
@@ -279,13 +281,13 @@ void MainWindow::slotDisplayPredictTab( bool display )
279 281
280void MainWindow::slotGetNTPTime() 282void MainWindow::slotGetNTPTime()
281{ 283{
282 ntpInteractive = TRUE; 284 ntpInteractive = true;
283 runNTP(); 285 runNTP();
284} 286}
285 287
286void MainWindow::slotTimerGetNTPTime() 288void MainWindow::slotTimerGetNTPTime()
287{ 289{
288 ntpInteractive = FALSE; 290 ntpInteractive = false;
289 runNTP(); 291 runNTP();
290} 292}
291 293
@@ -309,7 +311,8 @@ void MainWindow::slotNtpFinished( OProcess *p )
309 QDateTime dt = QDateTime::currentDateTime(); 311 QDateTime dt = QDateTime::currentDateTime();
310 312
311 // Re-enable set time buttons & change app caption to indicate time update is happening 313 // Re-enable set time buttons & change app caption to indicate time update is happening
312 ntpTab->setNTPBtnEnabled( true ); 314 if ( ntpTabEnabled )
315 ntpTab->setNTPBtnEnabled( true );
313 timeTab->setNTPBtnEnabled( true ); 316 timeTab->setNTPBtnEnabled( true );
314 setCaption( tr( "SystemTime" ) ); 317 setCaption( tr( "SystemTime" ) );
315 318
@@ -334,7 +337,7 @@ void MainWindow::slotNtpFinished( OProcess *p )
334 config.setGroup( "lookups" ); 337 config.setGroup( "lookups" );
335 int lastLookup = config.readNumEntry( "time", 0 ); 338 int lastLookup = config.readNumEntry( "time", 0 );
336 int lookupCount = config.readNumEntry( "count", 0 ); 339 int lookupCount = config.readNumEntry( "count", 0 );
337 bool lastNtp = config.readBoolEntry( "lastNtp", FALSE ); 340 bool lastNtp = config.readBoolEntry( "lastNtp", false );
338 int time = TimeConversion::toUTC( QDateTime::currentDateTime() ); 341 int time = TimeConversion::toUTC( QDateTime::currentDateTime() );
339 config.writeEntry( "time", time ); 342 config.writeEntry( "time", time );
340 343
@@ -371,7 +374,7 @@ void MainWindow::slotNtpFinished( OProcess *p )
371 config.writeEntry( "timeShift", QString::number( timeShift ) ); 374 config.writeEntry( "timeShift", QString::number( timeShift ) );
372 config.setGroup( "lookups" ); 375 config.setGroup( "lookups" );
373 config.writeEntry( "count", lookupCount ); 376 config.writeEntry( "count", lookupCount );
374 config.writeEntry( "lastNtp", TRUE ); 377 config.writeEntry( "lastNtp", true );
375 } 378 }
376} 379}
377 380