author | paule <paule> | 2007-01-14 03:01:16 (UTC) |
---|---|---|
committer | paule <paule> | 2007-01-14 03:01:16 (UTC) |
commit | 81de0baf254bd2d935d0fdf035143e5510354fa7 (patch) (side-by-side diff) | |
tree | c80e1903bc4b7e5c93ba2bfd70a75c5e5ae44036 | |
parent | 2e26f72390e18260c6fc3fedc5378a6ca9ddfffb (diff) | |
download | opie-81de0baf254bd2d935d0fdf035143e5510354fa7.zip opie-81de0baf254bd2d935d0fdf035143e5510354fa7.tar.gz opie-81de0baf254bd2d935d0fdf035143e5510354fa7.tar.bz2 |
Add setting to show date/time settings on every restart (useful on devices where the date/time slips or is reset when the device is reset)
-rw-r--r-- | noncore/settings/netsystemtime/settingstabwidget.cpp | 18 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/settingstabwidget.h | 1 |
2 files changed, 16 insertions, 3 deletions
diff --git a/noncore/settings/netsystemtime/settingstabwidget.cpp b/noncore/settings/netsystemtime/settingstabwidget.cpp index b26e751..5b52a07 100644 --- a/noncore/settings/netsystemtime/settingstabwidget.cpp +++ b/noncore/settings/netsystemtime/settingstabwidget.cpp @@ -69,60 +69,68 @@ SettingsTabWidget::SettingsTabWidget( QWidget *parent ) layout->addWidget( sbNtpDelay, 2, 0 ); // Prediction delay selector layout->addWidget( new QLabel( tr( "minutes between prediction updates" ), container ), 3, 1 ); sbPredictDelay = new QSpinBox( 42, 9999999, 1, container ); sbPredictDelay->setWrapping( TRUE ); sbPredictDelay->setMaximumWidth( 50 ); layout->addWidget( sbPredictDelay, 3, 0 ); // Space filler layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 4, 0 ); + // Show system time options on every restart + chShowOnRestart = new QCheckBox( tr( "Show time settings on every restart" ), container ); + layout->addMultiCellWidget( chShowOnRestart, 5, 5, 0, 1 ); + // Display time server information selector chNtpTab = new QCheckBox( tr( "Display time server information" ), container ); connect( chNtpTab, SIGNAL( toggled(bool) ), this, SIGNAL( displayNTPTab(bool) ) ); - layout->addMultiCellWidget( chNtpTab, 5, 5, 0, 1 ); + layout->addMultiCellWidget( chNtpTab, 6, 6, 0, 1 ); // Display time prediction information selector chPredictTab = new QCheckBox( tr( "Display time prediction information" ), container ); connect( chPredictTab, SIGNAL( toggled(bool) ), this, SIGNAL( displayPredictTab(bool) ) ); - layout->addMultiCellWidget( chPredictTab, 6, 6, 0, 1 ); + layout->addMultiCellWidget( chPredictTab, 7, 7, 0, 1 ); // Space filler - layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 ); + layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 8, 0 ); // Initialize values QString ntpSrvsFile = QPEApplication::qpeDir(); ntpSrvsFile.append( "etc/ntpservers" ); Config ntpSrvs( ntpSrvsFile, Config::File ); ntpSrvs.setGroup( "servers" ); int srvCount = ntpSrvs.readNumEntry( "count", 0 ); for ( int i = 0; i < srvCount; i++ ) { ntpSrvs.setGroup( QString::number( i ) ); cbTimeServer->insertItem( ntpSrvs.readEntry( "name" ) ); } if ( srvCount==0 ) { cbTimeServer->insertItem( "0.pool.ntp.org" ); cbTimeServer->insertItem( "1.pool.ntp.org" ); cbTimeServer->insertItem( "2.pool.ntp.org" ); } Config config( "ntp" ); config.setGroup( "settings" ); sbPredictDelay->setValue( config.readNumEntry( "minLookupDiff", 720 ) ); sbNtpDelay->setValue( config.readNumEntry( "ntpRefreshFreq", 1440 ) ); cbTimeServer->setCurrentItem( config.readNumEntry( "ntpServer", 0 ) ); chNtpTab->setChecked( config.readBoolEntry( "displayNtpTab", FALSE ) ); chPredictTab->setChecked( config.readBoolEntry( "displayPredictTab", FALSE ) ); + + Config config_qpe( "qpe" ); + config_qpe.setGroup( "Startup" ); + chShowOnRestart->setChecked( config_qpe.readBoolEntry( "ShowTimeSettings", FALSE ) ); } SettingsTabWidget::~SettingsTabWidget() { } void SettingsTabWidget::saveSettings() { int srvCount = cbTimeServer->count(); bool serversChanged = TRUE; int curSrv = cbTimeServer->currentItem(); QString edit = cbTimeServer->currentText(); @@ -146,18 +154,22 @@ void SettingsTabWidget::saveSettings() // odebug << "ntpSrvs[" << i << "/" << srvCount << "]=" << cbTimeServer->text( i ).latin1() << "" << oendl; ntpSrvs.setGroup( QString::number( i ) ); ntpSrvs.writeEntry( "name", cbTimeServer->text( i-1 ) ); } } Config config( "ntp", Config::User ); config.setGroup( "settings" ); config.writeEntry( "ntpServer", curSrv ); config.writeEntry( "minLookupDiff", sbPredictDelay->value() ); config.writeEntry( "ntpRefreshFreq", sbNtpDelay->value() ); config.writeEntry( "displayNtpTab", chNtpTab->isChecked() ); config.writeEntry( "displayPredictTab", chPredictTab->isChecked() ); + + Config config_qpe( "qpe" ); + config_qpe.setGroup( "Startup" ); + config_qpe.writeEntry( "ShowTimeSettings", chShowOnRestart->isChecked() ); } QString SettingsTabWidget::ntpServer() { return cbTimeServer->currentText(); } diff --git a/noncore/settings/netsystemtime/settingstabwidget.h b/noncore/settings/netsystemtime/settingstabwidget.h index 9578245..17e7989 100644 --- a/noncore/settings/netsystemtime/settingstabwidget.h +++ b/noncore/settings/netsystemtime/settingstabwidget.h @@ -43,22 +43,23 @@ class SettingsTabWidget : public QWidget public: SettingsTabWidget( QWidget * = 0x0 ); ~SettingsTabWidget(); void saveSettings(); QString ntpServer(); private: QComboBox *cbTimeServer; QSpinBox *sbNtpDelay; QSpinBox *sbPredictDelay; + QCheckBox *chShowOnRestart; QCheckBox *chNtpTab; QCheckBox *chPredictTab; signals: void ntpDelayChanged( int ); void displayNTPTab( bool ); void displayPredictTab( bool ); }; #endif |