author | paule <paule> | 2007-01-14 03:02:55 (UTC) |
---|---|---|
committer | paule <paule> | 2007-01-14 03:02:55 (UTC) |
commit | ca67251af3f46d685afac8dc6bfe452799c2546e (patch) (unidiff) | |
tree | 3e7ae7ed8d06e97c5556b52c5cf3826426cedd9b /noncore | |
parent | 81de0baf254bd2d935d0fdf035143e5510354fa7 (diff) | |
download | opie-ca67251af3f46d685afac8dc6bfe452799c2546e.zip opie-ca67251af3f46d685afac8dc6bfe452799c2546e.tar.gz opie-ca67251af3f46d685afac8dc6bfe452799c2546e.tar.bz2 |
When selecting a time zone, warn the user if the time zone file in /usr/share/zoneinfo for the selected time zone is missing
-rw-r--r-- | noncore/settings/netsystemtime/timetabwidget.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/noncore/settings/netsystemtime/timetabwidget.cpp b/noncore/settings/netsystemtime/timetabwidget.cpp index bcfbdf7..895514b 100644 --- a/noncore/settings/netsystemtime/timetabwidget.cpp +++ b/noncore/settings/netsystemtime/timetabwidget.cpp | |||
@@ -47,12 +47,14 @@ | |||
47 | #include <qframe.h> | 47 | #include <qframe.h> |
48 | #include <qlabel.h> | 48 | #include <qlabel.h> |
49 | #include <qlayout.h> | 49 | #include <qlayout.h> |
50 | #include <qpushbutton.h> | 50 | #include <qpushbutton.h> |
51 | #include <qscrollview.h> | 51 | #include <qscrollview.h> |
52 | #include <qspinbox.h> | 52 | #include <qspinbox.h> |
53 | #include <qmessagebox.h> | ||
54 | #include <qfile.h> | ||
53 | 55 | ||
54 | #include <stdlib.h> | 56 | #include <stdlib.h> |
55 | #include <sys/time.h> | 57 | #include <sys/time.h> |
56 | 58 | ||
57 | static const int ValueAM = 0; | 59 | static const int ValueAM = 0; |
58 | static const int ValuePM = 1; | 60 | static const int ValuePM = 1; |
@@ -274,12 +276,18 @@ void TimeTabWidget::slotWeekStartChanged( int monday ) | |||
274 | { | 276 | { |
275 | btnDate->setWeekStartsMonday( monday ); | 277 | btnDate->setWeekStartsMonday( monday ); |
276 | } | 278 | } |
277 | 279 | ||
278 | void TimeTabWidget::slotTZChanged( const QString &newtz ) | 280 | void TimeTabWidget::slotTZChanged( const QString &newtz ) |
279 | { | 281 | { |
282 | // Check timezone has a valid file in /usr/share/zoneinfo | ||
283 | if(!QFile::exists("/usr/share/zoneinfo/" + newtz)) { | ||
284 | QMessageBox::warning(this, tr("Time zone file missing"), | ||
285 | (tr("There is no time zone file for the\nselected time zone (%1).\nYou will need to install it before the\nsystem time zone can be set correctly.")).arg(newtz)); | ||
286 | } | ||
287 | else { | ||
280 | // If controls have a valid date & time, update systemtime | 288 | // If controls have a valid date & time, update systemtime |
281 | int hour = sbHour->value(); | 289 | int hour = sbHour->value(); |
282 | if ( use12HourTime && cbAmpm->currentItem() == ValuePM ) | 290 | if ( use12HourTime && cbAmpm->currentItem() == ValuePM ) |
283 | hour += 12; | 291 | hour += 12; |
284 | QDateTime dt( btnDate->date(), QTime ( hour, sbMin->value(), QTime::currentTime().second() ) ); | 292 | QDateTime dt( btnDate->date(), QTime ( hour, sbMin->value(), QTime::currentTime().second() ) ); |
285 | setSystemTime( dt ); | 293 | setSystemTime( dt ); |
@@ -304,6 +312,7 @@ void TimeTabWidget::slotTZChanged( const QString &newtz ) | |||
304 | 312 | ||
305 | // Set controls to new time | 313 | // Set controls to new time |
306 | setDateTime( dt ); | 314 | setDateTime( dt ); |
307 | 315 | ||
308 | emit tzChanged( newtz ); | 316 | emit tzChanged( newtz ); |
309 | } | 317 | } |
318 | } | ||