mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
shell/lockscreen: port from the clock dataengine
This commit is contained in:
parent
6ba95df13d
commit
10a12af018
1 changed files with 5 additions and 9 deletions
|
|
@ -9,7 +9,7 @@ import QtQuick.Layouts 1.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
|
|
||||||
import org.kde.kirigami 2.20 as Kirigami
|
import org.kde.kirigami 2.20 as Kirigami
|
||||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
import org.kde.plasma.clock
|
||||||
import org.kde.plasma.components 3.0 as PC3
|
import org.kde.plasma.components 3.0 as PC3
|
||||||
import org.kde.plasma.private.mobileshell as MobileShell
|
import org.kde.plasma.private.mobileshell as MobileShell
|
||||||
|
|
||||||
|
|
@ -20,12 +20,8 @@ Item {
|
||||||
|
|
||||||
property int layoutAlignment
|
property int layoutAlignment
|
||||||
|
|
||||||
P5Support.DataSource {
|
Clock {
|
||||||
id: timeSource
|
id: clockSource
|
||||||
engine: "time"
|
|
||||||
connectedSources: ["Local"]
|
|
||||||
interval: 60000
|
|
||||||
intervalAlignment: P5Support.Types.AlignToMinute
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|
@ -38,7 +34,7 @@ Item {
|
||||||
|
|
||||||
PC3.Label {
|
PC3.Label {
|
||||||
text: {
|
text: {
|
||||||
let timeText = Qt.formatTime(timeSource.data["Local"]["DateTime"], MobileShell.ShellUtil.isSystem24HourFormat ? "h:mm" : "h:mm ap");
|
let timeText = Qt.formatTime(clockSource.dateTime, MobileShell.ShellUtil.isSystem24HourFormat ? "h:mm" : "h:mm ap");
|
||||||
|
|
||||||
// Remove am/pm in 12-hour time to avoid excessive length
|
// Remove am/pm in 12-hour time to avoid excessive length
|
||||||
if (!MobileShell.ShellUtil.isSystem24HourFormat) {
|
if (!MobileShell.ShellUtil.isSystem24HourFormat) {
|
||||||
|
|
@ -62,7 +58,7 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PC3.Label {
|
PC3.Label {
|
||||||
text: Qt.formatDate(timeSource.data["Local"]["DateTime"], "dddd, MMMM d")
|
text: Qt.formatDate(clockSource.dateTime, "dddd, MMMM d")
|
||||||
color: "white"
|
color: "white"
|
||||||
opacity: 0.9
|
opacity: 0.9
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue