Diffstat (limited to 'noncore/settings/netsystemtime/settingstabwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/netsystemtime/settingstabwidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/netsystemtime/settingstabwidget.cpp b/noncore/settings/netsystemtime/settingstabwidget.cpp index ad80e05..1307082 100644 --- a/noncore/settings/netsystemtime/settingstabwidget.cpp +++ b/noncore/settings/netsystemtime/settingstabwidget.cpp | |||
@@ -94,66 +94,66 @@ SettingsTabWidget::SettingsTabWidget( QWidget *parent ) | |||
94 | ntpSrvsFile.append( "etc/ntpservers" ); | 94 | ntpSrvsFile.append( "etc/ntpservers" ); |
95 | Config ntpSrvs( ntpSrvsFile, Config::File ); | 95 | Config ntpSrvs( ntpSrvsFile, Config::File ); |
96 | ntpSrvs.setGroup( "servers" ); | 96 | ntpSrvs.setGroup( "servers" ); |
97 | int srvCount = ntpSrvs.readNumEntry( "count", 0 ); | 97 | int srvCount = ntpSrvs.readNumEntry( "count", 0 ); |
98 | for ( int i = 0; i < srvCount; i++ ) | 98 | for ( int i = 0; i < srvCount; i++ ) |
99 | { | 99 | { |
100 | ntpSrvs.setGroup( QString::number( i ) ); | 100 | ntpSrvs.setGroup( QString::number( i ) ); |
101 | cbTimeServer->insertItem( ntpSrvs.readEntry( "name" ) ); | 101 | cbTimeServer->insertItem( ntpSrvs.readEntry( "name" ) ); |
102 | } | 102 | } |
103 | if ( srvCount==0 ) | 103 | if ( srvCount==0 ) |
104 | cbTimeServer->insertItem( "time.fu-berlin.de" ); | 104 | cbTimeServer->insertItem( "time.fu-berlin.de" ); |
105 | 105 | ||
106 | Config config( "ntp" ); | 106 | Config config( "ntp" ); |
107 | config.setGroup( "settings" ); | 107 | config.setGroup( "settings" ); |
108 | sbPredictDelay->setValue( config.readNumEntry( "minLookupDiff", 720 ) ); | 108 | sbPredictDelay->setValue( config.readNumEntry( "minLookupDiff", 720 ) ); |
109 | sbNtpDelay->setValue( config.readNumEntry( "ntpRefreshFreq", 1440 ) ); | 109 | sbNtpDelay->setValue( config.readNumEntry( "ntpRefreshFreq", 1440 ) ); |
110 | cbTimeServer->setCurrentItem( config.readNumEntry( "ntpServer", 0 ) ); | 110 | cbTimeServer->setCurrentItem( config.readNumEntry( "ntpServer", 0 ) ); |
111 | chNtpTab->setChecked( config.readBoolEntry( "displayNtpTab", FALSE ) ); | 111 | chNtpTab->setChecked( config.readBoolEntry( "displayNtpTab", FALSE ) ); |
112 | chPredictTab->setChecked( config.readBoolEntry( "displayPredictTab", FALSE ) ); | 112 | chPredictTab->setChecked( config.readBoolEntry( "displayPredictTab", FALSE ) ); |
113 | } | 113 | } |
114 | 114 | ||
115 | SettingsTabWidget::~SettingsTabWidget() | 115 | SettingsTabWidget::~SettingsTabWidget() |
116 | { | 116 | { |
117 | } | 117 | } |
118 | 118 | ||
119 | void SettingsTabWidget::saveSettings() | 119 | void SettingsTabWidget::saveSettings() |
120 | { | 120 | { |
121 | int srvCount = cbTimeServer->count(); | 121 | int srvCount = cbTimeServer->count(); |
122 | bool serversChanged = TRUE; | 122 | bool serversChanged = TRUE; |
123 | int curSrv = cbTimeServer->currentItem(); | 123 | int curSrv = cbTimeServer->currentItem(); |
124 | QString edit = cbTimeServer->currentText(); | 124 | QString edit = cbTimeServer->currentText(); |
125 | for ( int i = 0; i < srvCount; i++ ) | 125 | for ( int i = 0; i < srvCount; i++ ) |
126 | { | 126 | { |
127 | if ( edit == cbTimeServer->text( i ) ) | 127 | if ( edit == cbTimeServer->text( i ) ) |
128 | serversChanged = FALSE; | 128 | serversChanged = FALSE; |
129 | } | 129 | } |
130 | if ( serversChanged ) | 130 | if ( serversChanged ) |
131 | { | 131 | { |
132 | QString ntpSrvsFile = QPEApplication::qpeDir(); | 132 | QString ntpSrvsFile = QPEApplication::qpeDir(); |
133 | ntpSrvsFile.append( "etc/ntpservers" ); | 133 | ntpSrvsFile.append( "etc/ntpservers" ); |
134 | Config ntpSrvs( ntpSrvsFile, Config::File ); | 134 | Config ntpSrvs( ntpSrvsFile, Config::File ); |
135 | ntpSrvs.setGroup( "servers" ); | 135 | ntpSrvs.setGroup( "servers" ); |
136 | ntpSrvs.writeEntry( "count", ++srvCount ); | 136 | ntpSrvs.writeEntry( "count", ++srvCount ); |
137 | ntpSrvs.setGroup( "0" ); | 137 | ntpSrvs.setGroup( "0" ); |
138 | ntpSrvs.writeEntry( "name", edit ); | 138 | ntpSrvs.writeEntry( "name", edit ); |
139 | curSrv = 0; | 139 | curSrv = 0; |
140 | for ( int i = 1; i < srvCount; i++ ) | 140 | for ( int i = 1; i < srvCount; i++ ) |
141 | { | 141 | { |
142 | // qDebug( "ntpSrvs[%i/%i]=%s", i, srvCount, cbTimeServer->text( i ).latin1() ); | 142 | // odebug << "ntpSrvs[" << i << "/" << srvCount << "]=" << cbTimeServer->text( i ).latin1() << "" << oendl; |
143 | ntpSrvs.setGroup( QString::number( i ) ); | 143 | ntpSrvs.setGroup( QString::number( i ) ); |
144 | ntpSrvs.writeEntry( "name", cbTimeServer->text( i-1 ) ); | 144 | ntpSrvs.writeEntry( "name", cbTimeServer->text( i-1 ) ); |
145 | } | 145 | } |
146 | } | 146 | } |
147 | Config config( "ntp", Config::User ); | 147 | Config config( "ntp", Config::User ); |
148 | config.setGroup( "settings" ); | 148 | config.setGroup( "settings" ); |
149 | config.writeEntry( "ntpServer", curSrv ); | 149 | config.writeEntry( "ntpServer", curSrv ); |
150 | config.writeEntry( "minLookupDiff", sbPredictDelay->value() ); | 150 | config.writeEntry( "minLookupDiff", sbPredictDelay->value() ); |
151 | config.writeEntry( "ntpRefreshFreq", sbNtpDelay->value() ); | 151 | config.writeEntry( "ntpRefreshFreq", sbNtpDelay->value() ); |
152 | config.writeEntry( "displayNtpTab", chNtpTab->isChecked() ); | 152 | config.writeEntry( "displayNtpTab", chNtpTab->isChecked() ); |
153 | config.writeEntry( "displayPredictTab", chPredictTab->isChecked() ); | 153 | config.writeEntry( "displayPredictTab", chPredictTab->isChecked() ); |
154 | } | 154 | } |
155 | 155 | ||
156 | QString SettingsTabWidget::ntpServer() | 156 | QString SettingsTabWidget::ntpServer() |
157 | { | 157 | { |
158 | return cbTimeServer->currentText(); | 158 | return cbTimeServer->currentText(); |
159 | } | 159 | } |