summaryrefslogtreecommitdiff
path: root/noncore/settings/netsystemtime/settime.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/netsystemtime/settime.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/settime.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/noncore/settings/netsystemtime/settime.cpp b/noncore/settings/netsystemtime/settime.cpp
index dac5bd4..01268c9 100644
--- a/noncore/settings/netsystemtime/settime.cpp
+++ b/noncore/settings/netsystemtime/settime.cpp
@@ -199,58 +199,60 @@ void SetDateTime::accept()
config.writeEntry( "ShortOrder", df.shortOrder());
config.writeEntry( "LongOrder", df.longOrder());
config.writeEntry( "ClockApplet", clockAppletCombo->currentItem() );
Config lconfig("locale");
lconfig.setGroup( "Location" );
lconfig.writeEntry( "Timezone", tz->currentZone() );
}
void SetDateTime::commitTime()
{
- Config cfg("ntp",Config::User);
- cfg.setGroup("lookups");
- int time = TimeConversion::toUTC( QDateTime::currentDateTime() );
- cfg.writeEntry("time", time);
tz->setFocus();
// really turn off the screensaver before doing anything
{
// Needs to be encased in { } so that it deconstructs and sends
QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
disableScreenSaver << 0 << 0 << 0;
}
// Need to process the QCOP event generated above before proceeding
qApp->processEvents();
// before we progress further, set our TZ!
setenv( "TZ", tz->currentZone(), 1 );
// now set the time...
QDateTime dt( dateButton->date(), timeButton->time() );
- if ( dt.isValid() ) {
- struct timeval myTv;
- myTv.tv_sec = TimeConversion::toUTC( dt );
- myTv.tv_usec = 0;
+ if ( dt.isValid() ) setTime(dt);
+}
+
+void SetDateTime::setTime(QDateTime dt)
+{
+ Config cfg("ntp",Config::User);
+ cfg.setGroup("correction");
+ int t = TimeConversion::toUTC(dt);
+ struct timeval myTv;
+ myTv.tv_sec = t;
+ cfg.writeEntry("time", t );
+ myTv.tv_usec = 0;
if ( myTv.tv_sec != -1 )
::settimeofday( &myTv, 0 );
Global::writeHWClock();
// since time has changed quickly load in the datebookdb
// to allow the alarm server to get a better grip on itself
// (example re-trigger alarms for when we travel back in time)
DateBookDB db;
- } else {
- qWarning( "Invalid date/time" );
- }
+
// set the timezone for everyone else...
QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" );
setTimeZone << tz->currentZone();
// AM/PM setting and notify time changed
QCopEnvelope setClock( "QPE/System", "clockChange(bool)" );
setClock << ampmCombo->currentItem();
// Notify everyone what day we prefer to start the week on.
QCopEnvelope setWeek( "QPE/System", "weekChange(bool)" );
setWeek << weekStartCombo->currentItem();