Commit fa8c62b3 authored by Martin Klapetek's avatar Martin Klapetek
Browse files

Fix time showing applets not showing correct time for some timezones

Apparently passing QDateTime::time() to the Qt.formatTime is messing
things up; might also be a Qt bug, on the other hand the docs for QTime
say that "Unlike QDateTime, QTime knows nothing about time zones or
daylight savings time (DST)".

Passing the full QDateTime object makes the applets show correct time in
all timezones.

Hats off to Andreas Eckstein for finding out this

BUG: 335050
parent 2345ebb0
......@@ -47,7 +47,7 @@ Item {
connectedSources: "Local"
interval: plasmoid.configuration.showSecondHand ? 1000 : 30000
onDataChanged: {
var date = new Date(data["Local"]["Time"]);
var date = new Date(data["Local"]["DateTime"]);
hours = date.getHours();
minutes = date.getMinutes();
seconds = date.getSeconds();
......@@ -164,7 +164,7 @@ Item {
Layout.minimumWidth: units.gridUnit * 20
Layout.minimumHeight: units.gridUnit * 20
today: dataSource.data["Local"]["Date"]
today: dataSource.data["Local"]["DateTime"]
}
}
......@@ -63,7 +63,7 @@ Item {
}
minimumPixelSize: theme.mSize(theme.smallestFont).height
fontSizeMode: Text.Fit
text: Qt.formatTime(dataSource.data["Local"]["Time"], main.timeFormat);
text: Qt.formatTime(dataSource.data["Local"]["DateTime"], main.timeFormat);
wrapMode: plasmoid.formFactor != PlasmaCore.Types.Horizontal ? Text.WordWrap : Text.NoWrap
horizontalAlignment: vertical ? Text.AlignHCenter : Text.AlignLeft // we want left align when horizontal to avoid re-aligning when seconds are visible
verticalAlignment: Text.AlignVCenter
......@@ -130,7 +130,7 @@ Item {
var st = Qt.formatTime(new Date(2000, 0, 1, 20, 0, 0), timeFormatString);
if (main.showTimezone) {
st += Qt.formatTime(dataSource.data["Local"]["Time"], " t");
st += Qt.formatTime(dataSource.data["Local"]["DateTime"], " t");
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment