-rw-r--r-- | noncore/settings/netsystemtime/ntp.cpp | 5 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/settime.cpp | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp index 15dae93..6c5aaf5 100644 --- a/noncore/settings/netsystemtime/ntp.cpp +++ b/noncore/settings/netsystemtime/ntp.cpp | |||
@@ -133,49 +133,52 @@ void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) | |||
133 | lineStr = buffer; | 133 | lineStr = buffer; |
134 | lineStr=lineStr.left(buflen); | 134 | lineStr=lineStr.left(buflen); |
135 | if (lineStr!=lineStrOld) | 135 | if (lineStr!=lineStrOld) |
136 | { | 136 | { |
137 | ntpOutPut(lineStr); | 137 | ntpOutPut(lineStr); |
138 | _ntpOutput += lineStr; | 138 | _ntpOutput += lineStr; |
139 | } | 139 | } |
140 | lineStrOld = lineStr; | 140 | lineStrOld = lineStr; |
141 | } | 141 | } |
142 | 142 | ||
143 | void Ntp::ntpFinished(OProcess *p) | 143 | void Ntp::ntpFinished(OProcess *p) |
144 | { | 144 | { |
145 | qDebug("p->exitStatus() %i",p->exitStatus()); | 145 | qDebug("p->exitStatus() %i",p->exitStatus()); |
146 | if (p->exitStatus()!=0 || !p->normalExit()) | 146 | if (p->exitStatus()!=0 || !p->normalExit()) |
147 | { | 147 | { |
148 | slotProbeNtpServer(); | 148 | slotProbeNtpServer(); |
149 | return; | 149 | return; |
150 | } | 150 | } |
151 | 151 | ||
152 | Global::writeHWClock(); | 152 | Global::writeHWClock(); |
153 | // since time has changed quickly load in the datebookdb | 153 | // since time has changed quickly load in the datebookdb |
154 | // to allow the alarm server to get a better grip on itself | 154 | // to allow the alarm server to get a better grip on itself |
155 | // (example re-trigger alarms for when we travel back in time) | 155 | // (example re-trigger alarms for when we travel back in time) |
156 | DateBookDB db; | 156 | DateBookDB db; |
157 | 157 | ||
158 | QCopEnvelope timeApplet( "QPE/TaskBar", "reloadApplets()" ); | ||
159 | timeApplet << ""; | ||
160 | |||
158 | Config cfg("ntp",Config::User); | 161 | Config cfg("ntp",Config::User); |
159 | cfg.setGroup("lookups"); | 162 | cfg.setGroup("lookups"); |
160 | int lastLookup = cfg.readNumEntry("time",0); | 163 | int lastLookup = cfg.readNumEntry("time",0); |
161 | int lookupCount = cfg.readNumEntry("count",0); | 164 | int lookupCount = cfg.readNumEntry("count",0); |
162 | bool lastNtp = cfg.readBoolEntry("lastNtp",false); | 165 | bool lastNtp = cfg.readBoolEntry("lastNtp",false); |
163 | int time = TimeConversion::toUTC( QDateTime::currentDateTime() ); | 166 | int time = TimeConversion::toUTC( QDateTime::currentDateTime() ); |
164 | cfg.writeEntry("time", time); | 167 | cfg.writeEntry("time", time); |
165 | 168 | ||
166 | float timeShift = getTimeShift(); | 169 | float timeShift = getTimeShift(); |
167 | if (timeShift == 0.0) return; | 170 | if (timeShift == 0.0) return; |
168 | int secsSinceLast = time - lastLookup; | 171 | int secsSinceLast = time - lastLookup; |
169 | TextLabelNewTime->setText(QDateTime::currentDateTime().toString()); | 172 | TextLabelNewTime->setText(QDateTime::currentDateTime().toString()); |
170 | TextLabelTimeShift->setText(QString::number(timeShift)+tr(" seconds")); | 173 | TextLabelTimeShift->setText(QString::number(timeShift)+tr(" seconds")); |
171 | if ( lastNtp && lastLookup > 0 && secsSinceLast > 60* SpinBoxMinLookupDelay->value()) | 174 | if ( lastNtp && lastLookup > 0 && secsSinceLast > 60* SpinBoxMinLookupDelay->value()) |
172 | { | 175 | { |
173 | cfg.setGroup("lookup_"+QString::number(lookupCount)); | 176 | cfg.setGroup("lookup_"+QString::number(lookupCount)); |
174 | lookupCount++; | 177 | lookupCount++; |
175 | _shiftPerSec = timeShift / secsSinceLast; | 178 | _shiftPerSec = timeShift / secsSinceLast; |
176 | qDebug("secs since last lookup %i", secsSinceLast);qDebug("timeshift since last lookup %f", timeShift);qDebug("timeshift since per sec %f", _shiftPerSec); | 179 | qDebug("secs since last lookup %i", secsSinceLast);qDebug("timeshift since last lookup %f", timeShift);qDebug("timeshift since per sec %f", _shiftPerSec); |
177 | cfg.writeEntry("secsSinceLast",secsSinceLast); | 180 | cfg.writeEntry("secsSinceLast",secsSinceLast); |
178 | cfg.writeEntry("timeShift",QString::number(timeShift)); | 181 | cfg.writeEntry("timeShift",QString::number(timeShift)); |
179 | cfg.setGroup("lookups"); | 182 | cfg.setGroup("lookups"); |
180 | cfg.writeEntry("count",lookupCount); | 183 | cfg.writeEntry("count",lookupCount); |
181 | cfg.writeEntry("lastNtp",true); | 184 | cfg.writeEntry("lastNtp",true); |
diff --git a/noncore/settings/netsystemtime/settime.cpp b/noncore/settings/netsystemtime/settime.cpp index b0fcb74..e3b2ddd 100644 --- a/noncore/settings/netsystemtime/settime.cpp +++ b/noncore/settings/netsystemtime/settime.cpp | |||
@@ -247,48 +247,50 @@ void SetDateTime::commitTime() | |||
247 | 247 | ||
248 | void SetDateTime::setTime(QDateTime dt) | 248 | void SetDateTime::setTime(QDateTime dt) |
249 | { | 249 | { |
250 | // really turn off the screensaver before doing anything | 250 | // really turn off the screensaver before doing anything |
251 | { | 251 | { |
252 | // Needs to be encased in { } so that it deconstructs and sends | 252 | // Needs to be encased in { } so that it deconstructs and sends |
253 | QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 253 | QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
254 | disableScreenSaver << 0 << 0 << 0; | 254 | disableScreenSaver << 0 << 0 << 0; |
255 | } | 255 | } |
256 | Config cfg("ntp",Config::User); | 256 | Config cfg("ntp",Config::User); |
257 | cfg.setGroup("correction"); | 257 | cfg.setGroup("correction"); |
258 | int t = TimeConversion::toUTC(dt); | 258 | int t = TimeConversion::toUTC(dt); |
259 | struct timeval myTv; | 259 | struct timeval myTv; |
260 | myTv.tv_sec = t; | 260 | myTv.tv_sec = t; |
261 | cfg.writeEntry("time", t ); | 261 | cfg.writeEntry("time", t ); |
262 | myTv.tv_usec = 0; | 262 | myTv.tv_usec = 0; |
263 | 263 | ||
264 | if ( myTv.tv_sec != -1 ) | 264 | if ( myTv.tv_sec != -1 ) |
265 | ::settimeofday( &myTv, 0 ); | 265 | ::settimeofday( &myTv, 0 ); |
266 | Global::writeHWClock(); | 266 | Global::writeHWClock(); |
267 | // since time has changed quickly load in the datebookdb | 267 | // since time has changed quickly load in the datebookdb |
268 | // to allow the alarm server to get a better grip on itself | 268 | // to allow the alarm server to get a better grip on itself |
269 | // (example re-trigger alarms for when we travel back in time) | 269 | // (example re-trigger alarms for when we travel back in time) |
270 | DateBookDB db; | 270 | DateBookDB db; |
271 | QCopEnvelope timeApplet( "QPE/TaskBar", "reloadApplets()" ); | ||
272 | timeApplet << ""; | ||
271 | // Restore screensaver | 273 | // Restore screensaver |
272 | QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 274 | QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
273 | enableScreenSaver << -1 << -1 << -1; | 275 | enableScreenSaver << -1 << -1 << -1; |
274 | } | 276 | } |
275 | 277 | ||
276 | void SetDateTime::updateSystem(int i) | 278 | void SetDateTime::updateSystem(int i) |
277 | { | 279 | { |
278 | // really turn off the screensaver before doing anything | 280 | // really turn off the screensaver before doing anything |
279 | { | 281 | { |
280 | // Needs to be encased in { } so that it deconstructs and sends | 282 | // Needs to be encased in { } so that it deconstructs and sends |
281 | QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 283 | QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
282 | disableScreenSaver << 0 << 0 << 0; | 284 | disableScreenSaver << 0 << 0 << 0; |
283 | } | 285 | } |
284 | qDebug("SetDateTime::updateSystem(int %i)",i); | 286 | qDebug("SetDateTime::updateSystem(int %i)",i); |
285 | writeSettings(); | 287 | writeSettings(); |
286 | 288 | ||
287 | // set the timezone for everyone else... | 289 | // set the timezone for everyone else... |
288 | QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" ); | 290 | QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" ); |
289 | setTimeZone << tz->currentZone(); | 291 | setTimeZone << tz->currentZone(); |
290 | 292 | ||
291 | // AM/PM setting and notify time changed | 293 | // AM/PM setting and notify time changed |
292 | QCopEnvelope setClock( "QPE/System", "clockChange(bool)" ); | 294 | QCopEnvelope setClock( "QPE/System", "clockChange(bool)" ); |
293 | setClock << ampmCombo->currentItem(); | 295 | setClock << ampmCombo->currentItem(); |
294 | 296 | ||