mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-31 00:34:45 +00:00
components/mobileshell: port from the clock dataengine
This commit is contained in:
parent
6a327acde6
commit
b0b7a92808
12 changed files with 36 additions and 52 deletions
|
|
@ -8,7 +8,7 @@ import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
import org.kde.plasma.clock
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
import org.kde.plasma.private.mobileshell as MobileShell
|
import org.kde.plasma.private.mobileshell as MobileShell
|
||||||
import org.kde.kirigami 2.20 as Kirigami
|
import org.kde.kirigami 2.20 as Kirigami
|
||||||
|
|
@ -34,11 +34,8 @@ Item {
|
||||||
height: Math.min(actionDrawer.height - toolButtons.height, notificationWidget.listView.contentHeight + 10 + topMargin)
|
height: Math.min(actionDrawer.height - toolButtons.height, notificationWidget.listView.contentHeight + 10 + topMargin)
|
||||||
|
|
||||||
// time source for the time and date whenin landscape mode
|
// time source for the time and date whenin landscape mode
|
||||||
P5Support.DataSource {
|
Clock {
|
||||||
id: timeSource
|
id: clockSource
|
||||||
engine: "time"
|
|
||||||
connectedSources: ["Local"]
|
|
||||||
interval: 60 * 1000
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MobileShell.VelocityCalculator {
|
MobileShell.VelocityCalculator {
|
||||||
|
|
@ -167,7 +164,7 @@ Item {
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
id: clock
|
id: clock
|
||||||
text: Qt.formatTime(timeSource.data.Local.DateTime, MobileShell.ShellUtil.isSystem24HourFormat ? "h:mm" : "h:mm ap")
|
text: Qt.formatTime(clockSource.dateTime, MobileShell.ShellUtil.isSystem24HourFormat ? "h:mm" : "h:mm ap")
|
||||||
verticalAlignment: Qt.AlignVCenter
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
|
|
@ -183,7 +180,7 @@ Item {
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
id: date
|
id: date
|
||||||
text: Qt.formatDate(timeSource.data.Local.DateTime, "ddd MMMM d")
|
text: Qt.formatDate(clockSource.dateTime, "ddd MMMM d")
|
||||||
verticalAlignment: Qt.AlignTop
|
verticalAlignment: Qt.AlignTop
|
||||||
color: Kirigami.Theme.disabledTextColor
|
color: Kirigami.Theme.disabledTextColor
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import org.kde.plasma.private.mobileshell.state as MobileShellState
|
||||||
import org.kde.layershell 1.0 as LayerShell
|
import org.kde.layershell 1.0 as LayerShell
|
||||||
|
|
||||||
import org.kde.notificationmanager as NotificationManager
|
import org.kde.notificationmanager as NotificationManager
|
||||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
import org.kde.plasma.clock
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: notificationPopup
|
id: notificationPopup
|
||||||
|
|
@ -323,7 +323,7 @@ Item {
|
||||||
modelIndex: notificationPopup.popupIndex
|
modelIndex: notificationPopup.popupIndex
|
||||||
notificationsModel: notificationPopup.notificationsModel
|
notificationsModel: notificationPopup.notificationsModel
|
||||||
notificationsModelType: notificationPopup.notificationsModelType
|
notificationsModelType: notificationPopup.notificationsModelType
|
||||||
timeSource: notificationPopup.timeDataSource
|
clockSource: notificationPopup.timeDataSource
|
||||||
panelType: notificationPopup.popupDrawerOpened ?
|
panelType: notificationPopup.popupDrawerOpened ?
|
||||||
MobileShell.PanelBackground.PanelType.Drawer :
|
MobileShell.PanelBackground.PanelType.Drawer :
|
||||||
MobileShell.PanelBackground.PanelType.Popup
|
MobileShell.PanelBackground.PanelType.Popup
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import org.kde.plasma.private.mobileshell.state as MobileShellState
|
||||||
import org.kde.layershell 1.0 as LayerShell
|
import org.kde.layershell 1.0 as LayerShell
|
||||||
|
|
||||||
import org.kde.notificationmanager as NotificationManager
|
import org.kde.notificationmanager as NotificationManager
|
||||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
import org.kde.plasma.clock
|
||||||
|
|
||||||
import QtQuick.Controls as Controls
|
import QtQuick.Controls as Controls
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
|
|
@ -46,7 +46,7 @@ Window {
|
||||||
property QtObject notificationSettings
|
property QtObject notificationSettings
|
||||||
property QtObject popupNotificationsModel
|
property QtObject popupNotificationsModel
|
||||||
property QtObject tasksModel
|
property QtObject tasksModel
|
||||||
property QtObject timeSource
|
property Clock clockSource
|
||||||
property bool inhibited
|
property bool inhibited
|
||||||
|
|
||||||
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
|
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
|
||||||
|
|
@ -209,7 +209,7 @@ Window {
|
||||||
popupModel: model
|
popupModel: model
|
||||||
notificationsModel: popupNotificationsModel
|
notificationsModel: popupNotificationsModel
|
||||||
notificationsModelType: notificationModelType
|
notificationsModelType: notificationModelType
|
||||||
timeDataSource: timeSource
|
timeDataSource: clockSource
|
||||||
|
|
||||||
timeout: model.timeout
|
timeout: model.timeout
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import org.kde.plasma.private.mobileshell.state as MobileShellState
|
||||||
import org.kde.plasma.private.mobileshell as MobileShell
|
import org.kde.plasma.private.mobileshell as MobileShell
|
||||||
|
|
||||||
import org.kde.notificationmanager as NotificationManager
|
import org.kde.notificationmanager as NotificationManager
|
||||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
import org.kde.plasma.clock
|
||||||
|
|
||||||
import org.kde.taskmanager 0.1 as TaskManager
|
import org.kde.taskmanager 0.1 as TaskManager
|
||||||
|
|
||||||
|
|
@ -126,13 +126,9 @@ QtObject {
|
||||||
groupInline: false
|
groupInline: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property Clock clockSource: Clock {
|
||||||
property QtObject timeSource: P5Support.DataSource {
|
id: clockSource
|
||||||
engine: "time"
|
onTimeChanged: {
|
||||||
connectedSources: ["Local"]
|
|
||||||
interval: 60000 // 1 min
|
|
||||||
intervalAlignment: P5Support.Types.AlignToMinute
|
|
||||||
onDataChanged: {
|
|
||||||
checkInhibition();
|
checkInhibition();
|
||||||
npm.timeChanged();
|
npm.timeChanged();
|
||||||
}
|
}
|
||||||
|
|
@ -142,7 +138,7 @@ QtObject {
|
||||||
notificationModelType: notificationProvider.notificationModelType
|
notificationModelType: notificationProvider.notificationModelType
|
||||||
notificationSettings: notificationProvider.notificationSettings
|
notificationSettings: notificationProvider.notificationSettings
|
||||||
popupNotificationsModel: notificationProvider.popupNotificationsModel
|
popupNotificationsModel: notificationProvider.popupNotificationsModel
|
||||||
timeSource: notificationProvider.timeSource
|
clockSource: notificationProvider.clockSource
|
||||||
inhibited: notificationProvider.inhibited
|
inhibited: notificationProvider.inhibited
|
||||||
tasksModel: notificationProvider.tasksModel
|
tasksModel: notificationProvider.tasksModel
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts 1.15
|
||||||
|
|
||||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
import org.kde.plasma.clock
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
import org.kde.plasma.private.mobileshell as MobileShell
|
import org.kde.plasma.private.mobileshell as MobileShell
|
||||||
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
||||||
|
|
@ -19,14 +19,14 @@ RowLayout {
|
||||||
id: clockText
|
id: clockText
|
||||||
|
|
||||||
required property int fontPixelSize
|
required property int fontPixelSize
|
||||||
required property P5Support.DataSource source
|
required property Clock clockSource
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
id: clock
|
id: clock
|
||||||
|
|
||||||
property bool is24HourTime: MobileShell.ShellUtil.isSystem24HourFormat
|
property bool is24HourTime: MobileShell.ShellUtil.isSystem24HourFormat
|
||||||
|
|
||||||
text: Qt.formatTime(source.data.Local.DateTime, is24HourTime ? "h:mm" : "h:mm ap")
|
text: Qt.formatTime(clockSource.dateTime, is24HourTime ? "h:mm" : "h:mm ap")
|
||||||
color: Kirigami.Theme.textColor
|
color: Kirigami.Theme.textColor
|
||||||
verticalAlignment: Qt.AlignVCenter
|
verticalAlignment: Qt.AlignVCenter
|
||||||
font.pixelSize: fontPixelSize
|
font.pixelSize: fontPixelSize
|
||||||
|
|
@ -36,7 +36,7 @@ RowLayout {
|
||||||
id: date
|
id: date
|
||||||
visible: ShellSettings.Settings.dateInStatusBar && !root.showSecondRow
|
visible: ShellSettings.Settings.dateInStatusBar && !root.showSecondRow
|
||||||
|
|
||||||
text: Qt.formatDate(source.data.Local.DateTime, "ddd. MMMM d")
|
text: Qt.formatDate(clockSource.dateTime, "ddd. MMMM d")
|
||||||
color: Kirigami.Theme.textColor
|
color: Kirigami.Theme.textColor
|
||||||
verticalAlignment: Qt.AlignVCenter
|
verticalAlignment: Qt.AlignVCenter
|
||||||
font.pixelSize: fontPixelSize
|
font.pixelSize: fontPixelSize
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import QtQml.Models
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
|
|
||||||
import org.kde.plasma.core as PlasmaCore
|
import org.kde.plasma.core as PlasmaCore
|
||||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
import org.kde.plasma.clock
|
||||||
import org.kde.plasma.private.systemtray as SystemTray
|
import org.kde.plasma.private.systemtray as SystemTray
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
import org.kde.kitemmodels as KItemModels
|
import org.kde.kitemmodels as KItemModels
|
||||||
|
|
@ -55,12 +55,8 @@ Item {
|
||||||
readonly property real smallerTextPixelSize: Math.round(9 * ShellSettings.Settings.statusBarScaleFactor)
|
readonly property real smallerTextPixelSize: Math.round(9 * ShellSettings.Settings.statusBarScaleFactor)
|
||||||
readonly property real elementSpacing: Math.round(Kirigami.Units.smallSpacing * 1.5)
|
readonly property real elementSpacing: Math.round(Kirigami.Units.smallSpacing * 1.5)
|
||||||
|
|
||||||
P5Support.DataSource {
|
Clock {
|
||||||
id: timeSource
|
id: clockSource
|
||||||
engine: "time"
|
|
||||||
connectedSources: ["Local"]
|
|
||||||
interval: 1000
|
|
||||||
intervalAlignment: P5Support.Types.AlignToMinute
|
|
||||||
}
|
}
|
||||||
|
|
||||||
property alias statusNotifierSource: statusNotifierSourceLoader.item
|
property alias statusNotifierSource: statusNotifierSourceLoader.item
|
||||||
|
|
@ -120,7 +116,7 @@ Item {
|
||||||
visible: root.showTime
|
visible: root.showTime
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
fontPixelSize: textPixelSize
|
fontPixelSize: textPixelSize
|
||||||
source: timeSource
|
clockSource: clockSource
|
||||||
}
|
}
|
||||||
|
|
||||||
MobileShell.SignalStrengthIndicator {
|
MobileShell.SignalStrengthIndicator {
|
||||||
|
|
@ -190,7 +186,7 @@ Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
text: Qt.formatDate(timeSource.data.Local.DateTime, "ddd. MMMM d")
|
text: Qt.formatDate(clockSource.dateTime, "ddd. MMMM d")
|
||||||
color: Kirigami.Theme.disabledTextColor
|
color: Kirigami.Theme.disabledTextColor
|
||||||
font.pixelSize: root.smallerTextPixelSize
|
font.pixelSize: root.smallerTextPixelSize
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
|
|
||||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
import org.kde.plasma.clock
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents3
|
import org.kde.plasma.components 3.0 as PlasmaComponents3
|
||||||
|
|
||||||
import org.kde.notificationmanager as NotificationManager
|
import org.kde.notificationmanager as NotificationManager
|
||||||
|
|
@ -35,7 +35,7 @@ Item {
|
||||||
property var model
|
property var model
|
||||||
property int modelIndex
|
property int modelIndex
|
||||||
|
|
||||||
property P5Support.DataSource timeSource
|
property Clock clockSource
|
||||||
|
|
||||||
readonly property int notificationType: model.type
|
readonly property int notificationType: model.type
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import QtQuick.Window 2.2
|
||||||
import org.kde.kirigami 2.12 as Kirigami
|
import org.kde.kirigami 2.12 as Kirigami
|
||||||
|
|
||||||
import org.kde.plasma.core as PlasmaCore
|
import org.kde.plasma.core as PlasmaCore
|
||||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
import org.kde.notificationmanager as NotificationManager
|
import org.kde.notificationmanager as NotificationManager
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ BaseNotificationItem {
|
||||||
jobDetails: notificationItem.jobDetails
|
jobDetails: notificationItem.jobDetails
|
||||||
|
|
||||||
time: notificationItem.time
|
time: notificationItem.time
|
||||||
timeSource: notificationItem.timeSource
|
clockSource: notificationItem.clockSource
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ BaseNotificationItem {
|
||||||
jobDetails: notificationItem.jobDetails
|
jobDetails: notificationItem.jobDetails
|
||||||
|
|
||||||
time: notificationItem.time
|
time: notificationItem.time
|
||||||
timeSource: notificationItem.timeSource
|
clockSource: notificationItem.clockSource
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import QtQuick.Layouts 1.1
|
||||||
import QtQuick.Window 2.2
|
import QtQuick.Window 2.2
|
||||||
|
|
||||||
import org.kde.plasma.private.mobileshell as MobileShell
|
import org.kde.plasma.private.mobileshell as MobileShell
|
||||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
import org.kde.plasma.clock
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
|
|
@ -26,15 +26,15 @@ PlasmaComponents.Label {
|
||||||
property QtObject jobDetails
|
property QtObject jobDetails
|
||||||
|
|
||||||
property var time
|
property var time
|
||||||
property P5Support.DataSource timeSource
|
property Clock clockSource
|
||||||
|
|
||||||
// notification created/updated time changed
|
// notification created/updated time changed
|
||||||
onTimeChanged: updateAgoText()
|
onTimeChanged: updateAgoText()
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: timeSource
|
target: clockSource
|
||||||
// clock time changed
|
// clock time changed
|
||||||
function onDataChanged() {
|
function timeChanged() {
|
||||||
ageLabel.updateAgoText()
|
ageLabel.updateAgoText()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import Qt5Compat.GraphicalEffects
|
||||||
|
|
||||||
import org.kde.kirigami 2.12 as Kirigami
|
import org.kde.kirigami 2.12 as Kirigami
|
||||||
|
|
||||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
import org.kde.plasma.clock
|
||||||
import org.kde.plasma.private.mobileshell as MobileShell
|
import org.kde.plasma.private.mobileshell as MobileShell
|
||||||
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
||||||
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
||||||
|
|
@ -176,12 +176,8 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
P5Support.DataSource {
|
Clock {
|
||||||
id: timeDataSource
|
id: clockSource
|
||||||
engine: "time"
|
|
||||||
connectedSources: ["Local"]
|
|
||||||
interval: 60000 // 1 min
|
|
||||||
intervalAlignment: P5Support.Types.AlignToMinute
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
|
|
@ -386,7 +382,7 @@ Item {
|
||||||
modelIndex: delegateLoader.index
|
modelIndex: delegateLoader.index
|
||||||
notificationsModel: root.historyModel
|
notificationsModel: root.historyModel
|
||||||
notificationsModelType: root.historyModelType
|
notificationsModelType: root.historyModelType
|
||||||
timeSource: timeDataSource
|
clockSource: clockSource
|
||||||
|
|
||||||
requestToInvoke: root.actionsRequireUnlock
|
requestToInvoke: root.actionsRequireUnlock
|
||||||
onRunActionRequested: {
|
onRunActionRequested: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue