-rw-r--r-- | noncore/settings/netsystemtime/ntp.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/opie-netsystemtime.control | 3 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/settime.cpp | 25 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/settime.h | 2 |
4 files changed, 29 insertions, 3 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp index 4a7959e..b2f192a 100644 --- a/noncore/settings/netsystemtime/ntp.cpp +++ b/noncore/settings/netsystemtime/ntp.cpp | |||
@@ -37,17 +37,17 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) | |||
37 | SLOT(slotCheckNtp(int)) ); | 37 | SLOT(slotCheckNtp(int)) ); |
38 | 38 | ||
39 | connect ( ntpProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), | 39 | connect ( ntpProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), |
40 | this, SLOT(getNtpOutput(OProcess*,char*,int))); | 40 | this, SLOT(getNtpOutput(OProcess*,char*,int))); |
41 | connect ( ntpProcess, SIGNAL(processExited(OProcess*)), | 41 | connect ( ntpProcess, SIGNAL(processExited(OProcess*)), |
42 | this, SLOT(ntpFinished(OProcess*))); | 42 | this, SLOT(ntpFinished(OProcess*))); |
43 | connect(runNtp, SIGNAL(clicked()), this, SLOT(slotRunNtp())); | 43 | connect(runNtp, SIGNAL(clicked()), this, SLOT(slotRunNtp())); |
44 | connect(PushButtonPredict, SIGNAL(clicked()), this, SLOT(preditctTime())); | 44 | connect(PushButtonPredict, SIGNAL(clicked()), this, SLOT(preditctTime())); |
45 | 45 | slotCheckNtp(-1); | |
46 | // slotRunNtp(); | 46 | // slotRunNtp(); |
47 | readLookups(); | 47 | readLookups(); |
48 | } | 48 | } |
49 | 49 | ||
50 | Ntp::~Ntp() | 50 | Ntp::~Ntp() |
51 | { | 51 | { |
52 | Config cfg("ntp",Config::User); | 52 | Config cfg("ntp",Config::User); |
53 | cfg.setGroup("settings"); | 53 | cfg.setGroup("settings"); |
diff --git a/noncore/settings/netsystemtime/opie-netsystemtime.control b/noncore/settings/netsystemtime/opie-netsystemtime.control index a5809b0..406d7b0 100644 --- a/noncore/settings/netsystemtime/opie-netsystemtime.control +++ b/noncore/settings/netsystemtime/opie-netsystemtime.control | |||
@@ -1,10 +1,11 @@ | |||
1 | Files: bin/netsystemtime apps/Settings/ntpdatetime.desktop | 1 | Files: bin/netsystemtime apps/Settings/ntpdatetime.desktop |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/settings | 3 | Section: opie/settings |
4 | Depends: ntpdate | 4 | Depends: ntpdate |
5 | Conflicts: opie-systemtime | ||
5 | Maintainer: Patrick S. Vogt <tille@handhelds.org> | 6 | Maintainer: Patrick S. Vogt <tille@handhelds.org> |
6 | Architecture: arm | 7 | Architecture: arm |
7 | Version: $QPE_VERSION-$SUB_VERSION | 8 | Version: $QPE_VERSION-$SUB_VERSION |
8 | Depends: opie-base ($QPE_VERSION), ntpdate | 9 | Depends: opie-base ($QPE_VERSION), ntpdate |
9 | Description: ntp ( Network Time Protocol) gui | 10 | Description: ntp ( Network Time Protocol) gui |
10 | This utility syncs system time with a atomic timerserver via internet \ No newline at end of file | 11 | This utility syncs system time with a atomic timerserver via internet |
diff --git a/noncore/settings/netsystemtime/settime.cpp b/noncore/settings/netsystemtime/settime.cpp index 2cef6e8..b456012 100644 --- a/noncore/settings/netsystemtime/settime.cpp +++ b/noncore/settings/netsystemtime/settime.cpp | |||
@@ -187,21 +187,35 @@ SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f ) | |||
187 | 187 | ||
188 | QObject::connect( PushButtonSetManualTime, SIGNAL(clicked()), | 188 | QObject::connect( PushButtonSetManualTime, SIGNAL(clicked()), |
189 | this, SLOT(commitTime())); | 189 | this, SLOT(commitTime())); |
190 | 190 | ||
191 | QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), | 191 | QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), |
192 | timeButton, SLOT( slotTzChange( const QString& ) ) ); | 192 | timeButton, SLOT( slotTzChange( const QString& ) ) ); |
193 | QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), | 193 | QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), |
194 | SLOT( tzChange( const QString& ) ) ); | 194 | SLOT( tzChange( const QString& ) ) ); |
195 | |||
196 | QObject::connect( weekStartCombo, SIGNAL( activated ( int )), | ||
197 | SLOT(updateSystem(int ) )); | ||
198 | QObject::connect( ampmCombo, SIGNAL( activated ( int )), | ||
199 | SLOT(updateSystem(int ) )); | ||
200 | QObject::connect( dateFormatCombo, SIGNAL( activated ( int )), | ||
201 | SLOT(updateSystem(int ) )); | ||
202 | QObject::connect( clockAppletCombo, SIGNAL( activated ( int )), | ||
203 | SLOT(updateSystem(int ) )); | ||
195 | } | 204 | } |
196 | 205 | ||
197 | SetDateTime::~SetDateTime() | 206 | SetDateTime::~SetDateTime() |
198 | { | 207 | { |
208 | writeSettings(); | ||
209 | |||
210 | } | ||
199 | 211 | ||
212 | void SetDateTime::writeSettings() | ||
213 | { | ||
200 | Config config("qpe"); | 214 | Config config("qpe"); |
201 | config.setGroup( "Time" ); | 215 | config.setGroup( "Time" ); |
202 | config.writeEntry( "AMPM", ampmCombo->currentItem() ); | 216 | config.writeEntry( "AMPM", ampmCombo->currentItem() ); |
203 | config.writeEntry( "MONDAY", weekStartCombo->currentItem() ); | 217 | config.writeEntry( "MONDAY", weekStartCombo->currentItem() ); |
204 | config.setGroup( "Date" ); | 218 | config.setGroup( "Date" ); |
205 | DateFormat df = date_formats[dateFormatCombo->currentItem()]; | 219 | DateFormat df = date_formats[dateFormatCombo->currentItem()]; |
206 | config.writeEntry( "Separator", QString(df.separator())); | 220 | config.writeEntry( "Separator", QString(df.separator())); |
207 | config.writeEntry( "ShortOrder", df.shortOrder()); | 221 | config.writeEntry( "ShortOrder", df.shortOrder()); |
@@ -242,20 +256,26 @@ void SetDateTime::setTime(QDateTime dt) | |||
242 | struct timeval myTv; | 256 | struct timeval myTv; |
243 | myTv.tv_sec = t; | 257 | myTv.tv_sec = t; |
244 | cfg.writeEntry("time", t ); | 258 | cfg.writeEntry("time", t ); |
245 | myTv.tv_usec = 0; | 259 | myTv.tv_usec = 0; |
246 | 260 | ||
247 | if ( myTv.tv_sec != -1 ) | 261 | if ( myTv.tv_sec != -1 ) |
248 | ::settimeofday( &myTv, 0 ); | 262 | ::settimeofday( &myTv, 0 ); |
249 | Global::writeHWClock(); | 263 | Global::writeHWClock(); |
264 | } | ||
265 | |||
266 | void SetDateTime::updateSystem(int i) | ||
267 | { | ||
268 | qDebug("SetDateTime::updateSystem(int %i)",i); | ||
269 | writeSettings(); | ||
250 | // since time has changed quickly load in the datebookdb | 270 | // since time has changed quickly load in the datebookdb |
251 | // to allow the alarm server to get a better grip on itself | 271 | // to allow the alarm server to get a better grip on itself |
252 | // (example re-trigger alarms for when we travel back in time) | 272 | // (example re-trigger alarms for when we travel back in time) |
253 | DateBookDB db; | 273 | // DateBookDB db; |
254 | 274 | ||
255 | // set the timezone for everyone else... | 275 | // set the timezone for everyone else... |
256 | QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" ); | 276 | QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" ); |
257 | setTimeZone << tz->currentZone(); | 277 | setTimeZone << tz->currentZone(); |
258 | 278 | ||
259 | // AM/PM setting and notify time changed | 279 | // AM/PM setting and notify time changed |
260 | QCopEnvelope setClock( "QPE/System", "clockChange(bool)" ); | 280 | QCopEnvelope setClock( "QPE/System", "clockChange(bool)" ); |
261 | setClock << ampmCombo->currentItem(); | 281 | setClock << ampmCombo->currentItem(); |
@@ -271,27 +291,29 @@ void SetDateTime::setTime(QDateTime dt) | |||
271 | // Restore screensaver | 291 | // Restore screensaver |
272 | QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 292 | QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
273 | enableScreenSaver << -1 << -1 << -1; | 293 | enableScreenSaver << -1 << -1 << -1; |
274 | 294 | ||
275 | } | 295 | } |
276 | 296 | ||
277 | void SetDateTime::tzChange( const QString &tz ) | 297 | void SetDateTime::tzChange( const QString &tz ) |
278 | { | 298 | { |
299 | qDebug("SetDateTime::tzChange"); | ||
279 | // set the TZ get the time and leave gracefully... | 300 | // set the TZ get the time and leave gracefully... |
280 | QString strSave; | 301 | QString strSave; |
281 | strSave = getenv( "TZ" ); | 302 | strSave = getenv( "TZ" ); |
282 | setenv( "TZ", tz, 1 ); | 303 | setenv( "TZ", tz, 1 ); |
283 | 304 | ||
284 | QDate d = QDate::currentDate(); | 305 | QDate d = QDate::currentDate(); |
285 | // reset the time. | 306 | // reset the time. |
286 | if ( !strSave.isNull() ) { | 307 | if ( !strSave.isNull() ) { |
287 | setenv( "TZ", strSave, 1 ); | 308 | setenv( "TZ", strSave, 1 ); |
288 | } | 309 | } |
289 | dateButton->setDate( d ); | 310 | dateButton->setDate( d ); |
311 | updateSystem(); | ||
290 | } | 312 | } |
291 | 313 | ||
292 | void SetDateTime::formatChanged(int i) | 314 | void SetDateTime::formatChanged(int i) |
293 | { | 315 | { |
294 | dateButton->setDateFormat(date_formats[i]); | 316 | dateButton->setDateFormat(date_formats[i]); |
295 | } | 317 | } |
296 | 318 | ||
297 | static const int ValueAM = 0; | 319 | static const int ValueAM = 0; |
@@ -425,16 +447,17 @@ void SetTime::checkedPM( int c ) | |||
425 | if ( c == ValuePM ) | 447 | if ( c == ValuePM ) |
426 | show_hour += 12; | 448 | show_hour += 12; |
427 | 449 | ||
428 | hour = show_hour; | 450 | hour = show_hour; |
429 | } | 451 | } |
430 | 452 | ||
431 | void SetTime::slotTzChange( const QString &tz ) | 453 | void SetTime::slotTzChange( const QString &tz ) |
432 | { | 454 | { |
455 | qDebug("SetTime::slotTzChange"); | ||
433 | // set the TZ get the time and leave gracefully... | 456 | // set the TZ get the time and leave gracefully... |
434 | QString strSave; | 457 | QString strSave; |
435 | strSave = getenv( "TZ" ); | 458 | strSave = getenv( "TZ" ); |
436 | setenv( "TZ", tz, 1 ); | 459 | setenv( "TZ", tz, 1 ); |
437 | 460 | ||
438 | QTime t = QTime::currentTime(); | 461 | QTime t = QTime::currentTime(); |
439 | // reset the time. | 462 | // reset the time. |
440 | if ( !strSave.isNull() ) { | 463 | if ( !strSave.isNull() ) { |
diff --git a/noncore/settings/netsystemtime/settime.h b/noncore/settings/netsystemtime/settime.h index 60423e7..778cb9c 100644 --- a/noncore/settings/netsystemtime/settime.h +++ b/noncore/settings/netsystemtime/settime.h | |||
@@ -69,19 +69,21 @@ class SetDateTime : public NtpBase | |||
69 | public: | 69 | public: |
70 | SetDateTime( QWidget *parent=0, const char *name=0, WFlags f=0 ); | 70 | SetDateTime( QWidget *parent=0, const char *name=0, WFlags f=0 ); |
71 | ~SetDateTime(); | 71 | ~SetDateTime(); |
72 | 72 | ||
73 | protected slots: | 73 | protected slots: |
74 | void commitTime(); | 74 | void commitTime(); |
75 | void tzChange( const QString &tz ); | 75 | void tzChange( const QString &tz ); |
76 | void formatChanged(int); | 76 | void formatChanged(int); |
77 | void updateSystem(int i=0); | ||
77 | 78 | ||
78 | protected: | 79 | protected: |
79 | void setTime(QDateTime dt); | 80 | void setTime(QDateTime dt); |
81 | void writeSettings(); | ||
80 | 82 | ||
81 | SetTime *timeButton; | 83 | SetTime *timeButton; |
82 | DateButton *dateButton; | 84 | DateButton *dateButton; |
83 | TimeZoneSelector *tz; | 85 | TimeZoneSelector *tz; |
84 | QComboBox *weekStartCombo; | 86 | QComboBox *weekStartCombo; |
85 | QComboBox *ampmCombo; | 87 | QComboBox *ampmCombo; |
86 | QComboBox *dateFormatCombo; | 88 | QComboBox *dateFormatCombo; |
87 | QComboBox *clockAppletCombo; | 89 | QComboBox *clockAppletCombo; |