summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/timetabwidget.cpp9
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
@@ -37,32 +37,34 @@
#include <qpe/datebookmonth.h>
#include <qpe/global.h>
#include <qpe/tzselect.h>
#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
#include <qpe/qcopenvelope_qws.h>
#endif
#include <qcombobox.h>
#include <qdatetime.h>
#include <qframe.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qscrollview.h>
#include <qspinbox.h>
+#include <qmessagebox.h>
+#include <qfile.h>
#include <stdlib.h>
#include <sys/time.h>
static const int ValueAM = 0;
static const int ValuePM = 1;
TimeTabWidget::TimeTabWidget( QWidget *parent )
: QWidget( parent, 0x0, 0 )
{
// Synchronize HW clock to systemtime
// This app will update systemtime
// - if Cancel is clicked, will reset systemtime to HW clock's time
// - if Ok is clicked, will leave systemtime as is
system("/sbin/hwclock --systohc --utc");
@@ -264,46 +266,53 @@ void TimeTabWidget::slotUse12HourTime( int i )
sbHour->setValue( show_hour );
}
void TimeTabWidget::slotDateFormatChanged( const DateFormat &df )
{
btnDate->setDateFormat( df );
}
void TimeTabWidget::slotWeekStartChanged( int monday )
{
btnDate->setWeekStartsMonday( monday );
}
void TimeTabWidget::slotTZChanged( const QString &newtz )
{
+ // Check timezone has a valid file in /usr/share/zoneinfo
+ if(!QFile::exists("/usr/share/zoneinfo/" + newtz)) {
+ QMessageBox::warning(this, tr("Time zone file missing"),
+ (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));
+ }
+ else {
// If controls have a valid date & time, update systemtime
int hour = sbHour->value();
if ( use12HourTime && cbAmpm->currentItem() == ValuePM )
hour += 12;
QDateTime dt( btnDate->date(), QTime ( hour, sbMin->value(), QTime::currentTime().second() ) );
setSystemTime( dt );
QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" );
setTimeZone << newtz;
// Set system timezone
QString currtz = getenv( "TZ" );
setenv( "TZ", newtz, 1 );
// Get new date/time
hour = sbHour->value();
if ( use12HourTime && cbAmpm->currentItem() == ValuePM )
hour += 12;
dt = QDateTime::currentDateTime();
// Reset system timezone
if ( !currtz.isNull() )
{
setenv( "TZ", currtz, 1 );
}
// Set controls to new time
setDateTime( dt );
emit tzChanged( newtz );
}
+}