aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins/clock
diff options
context:
space:
mode:
Diffstat (limited to 'lumina-desktop/panel-plugins/clock')
-rw-r--r--lumina-desktop/panel-plugins/clock/LClock.cpp21
-rw-r--r--lumina-desktop/panel-plugins/clock/LClock.h2
2 files changed, 18 insertions, 5 deletions
diff --git a/lumina-desktop/panel-plugins/clock/LClock.cpp b/lumina-desktop/panel-plugins/clock/LClock.cpp
index 79cae84b..c3eb1451 100644
--- a/lumina-desktop/panel-plugins/clock/LClock.cpp
+++ b/lumina-desktop/panel-plugins/clock/LClock.cpp
@@ -38,10 +38,22 @@ void LClock::updateTime(){
if(useTZ){ CT = CT.toTimeZone(TZ); }
//Now update the display
QString label;
- if(deftime){ label = CT.time().toString(Qt::SystemLocaleShortDate) ; }
- else{ label=CT.toString(timefmt); }
- if(defdate){ labelWidget->setToolTip(CT.date().toString(Qt::SystemLocaleLongDate)); }
- else{ labelWidget->setToolTip(CT.toString(datefmt)); }
+ QString timelabel;
+ QString datelabel;
+ if(deftime){ timelabel = CT.time().toString(Qt::SystemLocaleShortDate) ; }
+ else{ timelabel=CT.toString(timefmt); }
+ if(defdate){ datelabel = CT.date().toString(Qt::SystemLocaleLongDate); }
+ else{ datelabel = CT.toString(datefmt); }
+ if(datetimeorder == "dateonly"){
+ label = datelabel;
+ labelWidget->setToolTip(timelabel);
+ }else if(datetimeorder == "timedate"){
+ label = timelabel + " " + datelabel;
+ }else if(datetimeorder == "datetime"){
+ label = datelabel + " " + timelabel;
+ }else{ label = timelabel;
+ labelWidget->setToolTip(datelabel);
+ }
if( this->layout()->direction() == QBoxLayout::TopToBottom ){
//different routine for vertical text (need newlines instead of spaces)
label.replace(" ","\n");
@@ -54,6 +66,7 @@ void LClock::updateFormats(){
datefmt = LSession::handle()->sessionSettings()->value("DateFormat","").toString();
deftime = timefmt.simplified().isEmpty();
defdate = datefmt.simplified().isEmpty();
+ datetimeorder = LSession::handle()->sessionSettings()->value("DateTimeOrder", "timeonly").toString();
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 8156e7d8..31bf13d6 100644
--- a/lumina-desktop/panel-plugins/clock/LClock.h
+++ b/lumina-desktop/panel-plugins/clock/LClock.h
@@ -26,7 +26,7 @@ public:
private:
QTimer *timer;
QLabel *labelWidget;
- QString timefmt, datefmt;
+ QString timefmt, datefmt, datetimeorder;
bool deftime, defdate, useTZ;
QTimeZone TZ;
bgstack15