mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +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.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.private.mobileshell as MobileShell
|
||||
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)
|
||||
|
||||
// time source for the time and date whenin landscape mode
|
||||
P5Support.DataSource {
|
||||
id: timeSource
|
||||
engine: "time"
|
||||
connectedSources: ["Local"]
|
||||
interval: 60 * 1000
|
||||
Clock {
|
||||
id: clockSource
|
||||
}
|
||||
|
||||
MobileShell.VelocityCalculator {
|
||||
|
|
@ -167,7 +164,7 @@ Item {
|
|||
|
||||
PlasmaComponents.Label {
|
||||
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
|
||||
|
||||
anchors {
|
||||
|
|
@ -183,7 +180,7 @@ Item {
|
|||
|
||||
PlasmaComponents.Label {
|
||||
id: date
|
||||
text: Qt.formatDate(timeSource.data.Local.DateTime, "ddd MMMM d")
|
||||
text: Qt.formatDate(clockSource.dateTime, "ddd MMMM d")
|
||||
verticalAlignment: Qt.AlignTop
|
||||
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.notificationmanager as NotificationManager
|
||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
||||
import org.kde.plasma.clock
|
||||
|
||||
Item {
|
||||
id: notificationPopup
|
||||
|
|
@ -323,7 +323,7 @@ Item {
|
|||
modelIndex: notificationPopup.popupIndex
|
||||
notificationsModel: notificationPopup.notificationsModel
|
||||
notificationsModelType: notificationPopup.notificationsModelType
|
||||
timeSource: notificationPopup.timeDataSource
|
||||
clockSource: notificationPopup.timeDataSource
|
||||
panelType: notificationPopup.popupDrawerOpened ?
|
||||
MobileShell.PanelBackground.PanelType.Drawer :
|
||||
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.notificationmanager as NotificationManager
|
||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
||||
import org.kde.plasma.clock
|
||||
|
||||
import QtQuick.Controls as Controls
|
||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||
|
|
@ -46,7 +46,7 @@ Window {
|
|||
property QtObject notificationSettings
|
||||
property QtObject popupNotificationsModel
|
||||
property QtObject tasksModel
|
||||
property QtObject timeSource
|
||||
property Clock clockSource
|
||||
property bool inhibited
|
||||
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
|
||||
|
|
@ -209,7 +209,7 @@ Window {
|
|||
popupModel: model
|
||||
notificationsModel: popupNotificationsModel
|
||||
notificationsModelType: notificationModelType
|
||||
timeDataSource: timeSource
|
||||
timeDataSource: clockSource
|
||||
|
||||
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.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
|
||||
|
||||
|
|
@ -126,13 +126,9 @@ QtObject {
|
|||
groupInline: false
|
||||
}
|
||||
|
||||
|
||||
property QtObject timeSource: P5Support.DataSource {
|
||||
engine: "time"
|
||||
connectedSources: ["Local"]
|
||||
interval: 60000 // 1 min
|
||||
intervalAlignment: P5Support.Types.AlignToMinute
|
||||
onDataChanged: {
|
||||
property Clock clockSource: Clock {
|
||||
id: clockSource
|
||||
onTimeChanged: {
|
||||
checkInhibition();
|
||||
npm.timeChanged();
|
||||
}
|
||||
|
|
@ -142,7 +138,7 @@ QtObject {
|
|||
notificationModelType: notificationProvider.notificationModelType
|
||||
notificationSettings: notificationProvider.notificationSettings
|
||||
popupNotificationsModel: notificationProvider.popupNotificationsModel
|
||||
timeSource: notificationProvider.timeSource
|
||||
clockSource: notificationProvider.clockSource
|
||||
inhibited: notificationProvider.inhibited
|
||||
tasksModel: notificationProvider.tasksModel
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
import QtQuick 2.12
|
||||
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.private.mobileshell as MobileShell
|
||||
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
||||
|
|
@ -19,14 +19,14 @@ RowLayout {
|
|||
id: clockText
|
||||
|
||||
required property int fontPixelSize
|
||||
required property P5Support.DataSource source
|
||||
required property Clock clockSource
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: clock
|
||||
|
||||
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
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
font.pixelSize: fontPixelSize
|
||||
|
|
@ -36,7 +36,7 @@ RowLayout {
|
|||
id: date
|
||||
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
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
font.pixelSize: fontPixelSize
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import QtQml.Models
|
|||
import org.kde.kirigami as Kirigami
|
||||
|
||||
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.components 3.0 as PlasmaComponents
|
||||
import org.kde.kitemmodels as KItemModels
|
||||
|
|
@ -55,12 +55,8 @@ Item {
|
|||
readonly property real smallerTextPixelSize: Math.round(9 * ShellSettings.Settings.statusBarScaleFactor)
|
||||
readonly property real elementSpacing: Math.round(Kirigami.Units.smallSpacing * 1.5)
|
||||
|
||||
P5Support.DataSource {
|
||||
id: timeSource
|
||||
engine: "time"
|
||||
connectedSources: ["Local"]
|
||||
interval: 1000
|
||||
intervalAlignment: P5Support.Types.AlignToMinute
|
||||
Clock {
|
||||
id: clockSource
|
||||
}
|
||||
|
||||
property alias statusNotifierSource: statusNotifierSourceLoader.item
|
||||
|
|
@ -120,7 +116,7 @@ Item {
|
|||
visible: root.showTime
|
||||
Layout.fillHeight: true
|
||||
fontPixelSize: textPixelSize
|
||||
source: timeSource
|
||||
clockSource: clockSource
|
||||
}
|
||||
|
||||
MobileShell.SignalStrengthIndicator {
|
||||
|
|
@ -190,7 +186,7 @@ Item {
|
|||
Layout.fillWidth: true
|
||||
|
||||
PlasmaComponents.Label {
|
||||
text: Qt.formatDate(timeSource.data.Local.DateTime, "ddd. MMMM d")
|
||||
text: Qt.formatDate(clockSource.dateTime, "ddd. MMMM d")
|
||||
color: Kirigami.Theme.disabledTextColor
|
||||
font.pixelSize: root.smallerTextPixelSize
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import QtQuick
|
|||
import QtQuick.Layouts
|
||||
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.notificationmanager as NotificationManager
|
||||
|
|
@ -35,7 +35,7 @@ Item {
|
|||
property var model
|
||||
property int modelIndex
|
||||
|
||||
property P5Support.DataSource timeSource
|
||||
property Clock clockSource
|
||||
|
||||
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.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.notificationmanager as NotificationManager
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ BaseNotificationItem {
|
|||
jobDetails: notificationItem.jobDetails
|
||||
|
||||
time: notificationItem.time
|
||||
timeSource: notificationItem.timeSource
|
||||
clockSource: notificationItem.clockSource
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ BaseNotificationItem {
|
|||
jobDetails: notificationItem.jobDetails
|
||||
|
||||
time: notificationItem.time
|
||||
timeSource: notificationItem.timeSource
|
||||
clockSource: notificationItem.clockSource
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import QtQuick.Layouts 1.1
|
|||
import QtQuick.Window 2.2
|
||||
|
||||
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.kirigami as Kirigami
|
||||
|
|
@ -26,15 +26,15 @@ PlasmaComponents.Label {
|
|||
property QtObject jobDetails
|
||||
|
||||
property var time
|
||||
property P5Support.DataSource timeSource
|
||||
property Clock clockSource
|
||||
|
||||
// notification created/updated time changed
|
||||
onTimeChanged: updateAgoText()
|
||||
|
||||
Connections {
|
||||
target: timeSource
|
||||
target: clockSource
|
||||
// clock time changed
|
||||
function onDataChanged() {
|
||||
function timeChanged() {
|
||||
ageLabel.updateAgoText()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import Qt5Compat.GraphicalEffects
|
|||
|
||||
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.shellsettingsplugin as ShellSettings
|
||||
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
||||
|
|
@ -176,12 +176,8 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
P5Support.DataSource {
|
||||
id: timeDataSource
|
||||
engine: "time"
|
||||
connectedSources: ["Local"]
|
||||
interval: 60000 // 1 min
|
||||
intervalAlignment: P5Support.Types.AlignToMinute
|
||||
Clock {
|
||||
id: clockSource
|
||||
}
|
||||
|
||||
ListView {
|
||||
|
|
@ -386,7 +382,7 @@ Item {
|
|||
modelIndex: delegateLoader.index
|
||||
notificationsModel: root.historyModel
|
||||
notificationsModelType: root.historyModelType
|
||||
timeSource: timeDataSource
|
||||
clockSource: clockSource
|
||||
|
||||
requestToInvoke: root.actionsRequireUnlock
|
||||
onRunActionRequested: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue