diff --git a/containments/panel/package/contents/ui/main.qml b/containments/panel/package/contents/ui/main.qml index 6489f378..888c346f 100644 --- a/containments/panel/package/contents/ui/main.qml +++ b/containments/panel/package/contents/ui/main.qml @@ -217,8 +217,10 @@ Item { PlasmaComponents.Label { id: clock + property bool is24HourTime: Qt.locale().timeFormat(Locale.ShortFormat).toLowerCase().indexOf("ap") === -1 + anchors.fill: parent - text: Qt.formatTime(timeSource.data.Local.DateTime, "hh:mm") + text: Qt.formatTime(timeSource.data.Local.DateTime, is24HourTime ? "h:mm" : "h:mm ap") color: PlasmaCore.ColorScope.textColor horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter diff --git a/look-and-feel/contents/lockscreen/Clock.qml b/look-and-feel/contents/lockscreen/Clock.qml index 1a3e9b18..118c7f00 100644 --- a/look-and-feel/contents/lockscreen/Clock.qml +++ b/look-and-feel/contents/lockscreen/Clock.qml @@ -29,7 +29,7 @@ ColumnLayout { spacing: units.gridUnit Label { - text: Qt.formatTime(timeSource.data["Local"]["DateTime"], "h:mm ap") + text: Qt.formatTime(timeSource.data["Local"]["DateTime"], root.is24HourTime ? "h:mm" : "h:mm ap") color: ColorScope.textColor style: softwareRendering ? Text.Outline : Text.Normal styleColor: softwareRendering ? ColorScope.backgroundColor : "transparent" // no outline, doesn't matter diff --git a/look-and-feel/contents/lockscreen/LockScreen.qml b/look-and-feel/contents/lockscreen/LockScreen.qml index 520aefab..dda95653 100644 --- a/look-and-feel/contents/lockscreen/LockScreen.qml +++ b/look-and-feel/contents/lockscreen/LockScreen.qml @@ -33,6 +33,8 @@ PlasmaCore.ColorScope { property bool isWidescreen: root.height < root.width * 0.75 property bool notificationsShown: phoneNotificationsList.count !== 0 + property bool is24HourTime: Qt.locale().timeFormat(Locale.ShortFormat).toLowerCase().indexOf("ap") === -1 + colorGroup: PlasmaCore.Theme.ComplementaryColorGroup anchors.fill: parent diff --git a/look-and-feel/contents/lockscreen/SimpleHeaderBar.qml b/look-and-feel/contents/lockscreen/SimpleHeaderBar.qml index 364c874f..09f504e0 100644 --- a/look-and-feel/contents/lockscreen/SimpleHeaderBar.qml +++ b/look-and-feel/contents/lockscreen/SimpleHeaderBar.qml @@ -76,7 +76,7 @@ PlasmaCore.ColorScope { PlasmaComponents.Label { id: clock anchors.fill: parent - text: Qt.formatTime(timeSource.data.Local.DateTime, "hh:mm") + text: Qt.formatTime(timeSource.data.Local.DateTime, root.is24HourTime ? "h:mm" : "h:mm ap") color: PlasmaCore.ColorScope.textColor horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter