Diffstat (limited to 'noncore/settings/netsystemtime/settime.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/netsystemtime/settime.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/noncore/settings/netsystemtime/settime.cpp b/noncore/settings/netsystemtime/settime.cpp index 36166ae..6a28989 100644 --- a/noncore/settings/netsystemtime/settime.cpp +++ b/noncore/settings/netsystemtime/settime.cpp | |||
@@ -47,25 +47,25 @@ | |||
47 | #include <qcombobox.h> | 47 | #include <qcombobox.h> |
48 | 48 | ||
49 | #include <sys/time.h> | 49 | #include <sys/time.h> |
50 | #include <time.h> | 50 | #include <time.h> |
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | #include <stdio.h> | 52 | #include <stdio.h> |
53 | 53 | ||
54 | 54 | ||
55 | SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f ) | 55 | SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f ) |
56 | : NtpBase( parent, name, true, f ) | 56 | : NtpBase( parent, name, true, f ) |
57 | { | 57 | { |
58 | setCaption( tr("System Time") ); | 58 | setCaption( tr("System Time") ); |
59 | 59 | _oldTimeZone=""; | |
60 | QVBoxLayout *vb = new QVBoxLayout( FrameSystemTime, 5 ); | 60 | QVBoxLayout *vb = new QVBoxLayout( FrameSystemTime, 5 ); |
61 | 61 | ||
62 | // TextLabelMainPredTime = new QLabel( FrameSystemTime ); | 62 | // TextLabelMainPredTime = new QLabel( FrameSystemTime ); |
63 | // vb->addWidget( TextLabelMainPredTime, 1, 0 ); | 63 | // vb->addWidget( TextLabelMainPredTime, 1, 0 ); |
64 | 64 | ||
65 | timeButton = new SetTime( FrameSystemTime ); | 65 | timeButton = new SetTime( FrameSystemTime ); |
66 | vb->addWidget( timeButton ); | 66 | vb->addWidget( timeButton ); |
67 | 67 | ||
68 | QHBoxLayout *db = new QHBoxLayout( vb ); | 68 | QHBoxLayout *db = new QHBoxLayout( vb ); |
69 | QLabel *dateLabel = new QLabel( tr("Date"), FrameSystemTime ); | 69 | QLabel *dateLabel = new QLabel( tr("Date"), FrameSystemTime ); |
70 | db->addWidget( dateLabel, 1 ); | 70 | db->addWidget( dateLabel, 1 ); |
71 | dateButton = new DateButton( TRUE, FrameSystemTime ); | 71 | dateButton = new DateButton( TRUE, FrameSystemTime ); |
@@ -309,32 +309,31 @@ void SetDateTime::updateSystem() | |||
309 | QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 309 | QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
310 | enableScreenSaver << -1 << -1 << -1; | 310 | enableScreenSaver << -1 << -1 << -1; |
311 | // since time has changed quickly load in the datebookdb | 311 | // since time has changed quickly load in the datebookdb |
312 | // to allow the alarm server to get a better grip on itself | 312 | // to allow the alarm server to get a better grip on itself |
313 | // (example re-trigger alarms for when we travel back in time) | 313 | // (example re-trigger alarms for when we travel back in time) |
314 | DateBookDB db; | 314 | DateBookDB db; |
315 | 315 | ||
316 | } | 316 | } |
317 | 317 | ||
318 | void SetDateTime::tzChange( const QString &tz ) | 318 | void SetDateTime::tzChange( const QString &tz ) |
319 | { | 319 | { |
320 | // set the TZ get the time and leave gracefully... | 320 | // set the TZ get the time and leave gracefully... |
321 | QString strSave; | 321 | _oldTimeZone = getenv( "TZ" ); |
322 | strSave = getenv( "TZ" ); | ||
323 | setenv( "TZ", tz, 1 ); | 322 | setenv( "TZ", tz, 1 ); |
324 | 323 | ||
325 | QDate d = QDate::currentDate(); | 324 | QDate d = QDate::currentDate(); |
326 | // reset the time. | 325 | // reset the time. |
327 | if ( !strSave.isNull() ) { | 326 | if ( !_oldTimeZone.isNull() ) { |
328 | setenv( "TZ", strSave, 1 ); | 327 | setenv( "TZ", _oldTimeZone, 1 ); |
329 | } | 328 | } |
330 | dateButton->setDate( d ); | 329 | dateButton->setDate( d ); |
331 | updateSystem(); | 330 | updateSystem(); |
332 | } | 331 | } |
333 | 332 | ||
334 | void SetDateTime::formatChanged(int i) | 333 | void SetDateTime::formatChanged(int i) |
335 | { | 334 | { |
336 | dateButton->setDateFormat(date_formats[i]); | 335 | dateButton->setDateFormat(date_formats[i]); |
337 | } | 336 | } |
338 | 337 | ||
339 | static const int ValueAM = 0; | 338 | static const int ValueAM = 0; |
340 | static const int ValuePM = 1; | 339 | static const int ValuePM = 1; |