aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins/clock
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2015-03-14 01:27:10 -0400
committerKen Moore <ken@pcbsd.org>2015-03-14 01:27:10 -0400
commit60ed98c90ba9ee5c4910a36fb39fb3118f383128 (patch)
tree9f68442f0ac14ef2cead9859ec48279e0896c0f5 /lumina-desktop/panel-plugins/clock
parentMake sure to clean up any broken sym-links in the favorites directory when th... (diff)
downloadlumina-60ed98c90ba9ee5c4910a36fb39fb3118f383128.tar.gz
lumina-60ed98c90ba9ee5c4910a36fb39fb3118f383128.tar.bz2
lumina-60ed98c90ba9ee5c4910a36fb39fb3118f383128.zip
Add the ability to set/use custom timezones on the system - defaulting to the system time (whatever that might be).
Diffstat (limited to 'lumina-desktop/panel-plugins/clock')
-rw-r--r--lumina-desktop/panel-plugins/clock/LClock.cpp4
-rw-r--r--lumina-desktop/panel-plugins/clock/LClock.h4
2 files changed, 7 insertions, 1 deletions
diff --git a/lumina-desktop/panel-plugins/clock/LClock.cpp b/lumina-desktop/panel-plugins/clock/LClock.cpp
index e91a3a71..79cae84b 100644
--- a/lumina-desktop/panel-plugins/clock/LClock.cpp
+++ b/lumina-desktop/panel-plugins/clock/LClock.cpp
@@ -35,6 +35,7 @@ LClock::~LClock(){
void LClock::updateTime(){
QDateTime CT = QDateTime::currentDateTime();
+ if(useTZ){ CT = CT.toTimeZone(TZ); }
//Now update the display
QString label;
if(deftime){ label = CT.time().toString(Qt::SystemLocaleShortDate) ; }
@@ -53,5 +54,8 @@ void LClock::updateFormats(){
datefmt = LSession::handle()->sessionSettings()->value("DateFormat","").toString();
deftime = timefmt.simplified().isEmpty();
defdate = datefmt.simplified().isEmpty();
+ useTZ = LSession::handle()->sessionSettings()->value("CustomTimeZone",false).toBool();
+ if(useTZ){ TZ = QTimeZone( LSession::handle()->sessionSettings()->value("TimeZoneByteCode", QByteArray()).toByteArray() ); }
+
}
diff --git a/lumina-desktop/panel-plugins/clock/LClock.h b/lumina-desktop/panel-plugins/clock/LClock.h
index 1e4c8294..8156e7d8 100644
--- a/lumina-desktop/panel-plugins/clock/LClock.h
+++ b/lumina-desktop/panel-plugins/clock/LClock.h
@@ -13,6 +13,7 @@
#include <QWidget>
#include <QString>
#include <QLocale>
+#include <QTimeZone>
#include "../LPPlugin.h"
@@ -26,7 +27,8 @@ private:
QTimer *timer;
QLabel *labelWidget;
QString timefmt, datefmt;
- bool deftime, defdate;
+ bool deftime, defdate, useTZ;
+ QTimeZone TZ;
private slots:
void updateTime();
bgstack15