actiondrawer: Use passed in notifications model and settings

This commit is contained in:
Devin Lin 2022-02-11 17:50:17 -05:00
parent 27015d1749
commit dca8064ca2
7 changed files with 45 additions and 43 deletions

View file

@ -26,6 +26,16 @@ import "../components" as Components
NanoShell.FullScreenOverlay { NanoShell.FullScreenOverlay {
id: window id: window
/**
* The model for the notification widget.
*/
property var notificationModel
/**
* The notification settings object to be used in the notification widget.
*/
property var notificationSettings
/** /**
* The amount of pixels moved by touch/mouse in the process of opening/closing the panel. * The amount of pixels moved by touch/mouse in the process of opening/closing the panel.
*/ */

View file

@ -94,6 +94,9 @@ PlasmaCore.ColorScope {
MobileShell.NotificationsWidget { MobileShell.NotificationsWidget {
id: notificationWidget id: notificationWidget
historyModel: root.actionDrawer.notificationModel
notificationSettings: root.actionDrawer.notificationSettings
// don't allow notifications widget to get too wide // don't allow notifications widget to get too wide
Layout.maximumWidth: PlasmaCore.Units.gridUnit * 25 Layout.maximumWidth: PlasmaCore.Units.gridUnit * 25
Layout.fillHeight: true Layout.fillHeight: true

View file

@ -78,6 +78,9 @@ PlasmaCore.ColorScope {
MobileShell.NotificationsWidget { MobileShell.NotificationsWidget {
id: notificationWidget id: notificationWidget
historyModel: root.actionDrawer.notificationModel
notificationSettings: root.actionDrawer.notificationSettings
anchors { anchors {
top: quickSettings.top top: quickSettings.top
topMargin: quickSettings.height + translate.y topMargin: quickSettings.height + translate.y

View file

@ -1,39 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
* SPDX-FileCopyrightText: 2018-2019 Kai Uwe Broulik <kde@privat.broulik.de>
*
* SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
import QtQuick 2.2
import org.kde.notificationmanager 1.0 as NotificationManager
pragma Singleton
QtObject {
property var notificationSettings: NotificationManager.Settings {}
property var historyModel: NotificationManager.Notifications {
showExpired: true
showDismissed: true
showJobs: notificationSettings.jobsInNotifications
sortMode: NotificationManager.Notifications.SortByTypeAndUrgency
groupMode: NotificationManager.Notifications.GroupApplicationsFlat
groupLimit: 2
expandUnread: true
blacklistedDesktopEntries: notificationSettings.historyBlacklistedApplications
blacklistedNotifyRcNames: notificationSettings.historyBlacklistedServices
urgencies: {
var urgencies = NotificationManager.Notifications.CriticalUrgency
| NotificationManager.Notifications.NormalUrgency;
if (notificationSettings.lowPriorityHistory) {
urgencies |= NotificationManager.Notifications.LowUrgency;
}
return urgencies;
}
}
}

View file

@ -18,7 +18,6 @@ VelocityCalculator 1.0 components/VelocityCalculator.qml
# /dataproviders # /dataproviders
singleton BatteryProvider 1.0 dataproviders/BatteryProvider.qml singleton BatteryProvider 1.0 dataproviders/BatteryProvider.qml
singleton BluetoothProvider 1.0 dataproviders/BluetoothProvider.qml singleton BluetoothProvider 1.0 dataproviders/BluetoothProvider.qml
singleton NotificationProvider 1.0 dataproviders/NotificationProvider.qml
singleton SignalStrengthProvider 1.0 dataproviders/SignalStrengthProvider.qml singleton SignalStrengthProvider 1.0 dataproviders/SignalStrengthProvider.qml
singleton VolumeProvider 1.0 dataproviders/VolumeProvider.qml singleton VolumeProvider 1.0 dataproviders/VolumeProvider.qml
singleton WifiProvider 1.0 dataproviders/WifiProvider.qml singleton WifiProvider 1.0 dataproviders/WifiProvider.qml

View file

@ -26,8 +26,8 @@ import org.kde.notificationmanager 1.0 as NotificationManager
Item { Item {
id: root id: root
property var historyModel: MobileShell.NotificationProvider.historyModel property var historyModel: []
property var notificationSettings: MobileShell.NotificationProvider.notificationSettings property var notificationSettings: NotificationManager.Settings {}
readonly property bool hasNotifications: list.count > 0 readonly property bool hasNotifications: list.count > 0

View file

@ -18,6 +18,8 @@ import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.private.nanoshell 2.0 as NanoShell import org.kde.plasma.private.nanoshell 2.0 as NanoShell
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell 1.0 as MobileShell
import org.kde.notificationmanager 1.0 as NotificationManager
Item { Item {
id: root id: root
@ -59,7 +61,7 @@ Item {
//END API implementation //END API implementation
Component.onCompleted: { Component.onCompleted: {
// we want to bind global shortcuts here // we want to bind global volume shortcuts here
MobileShell.VolumeProvider.bindShortcuts = true; MobileShell.VolumeProvider.bindShortcuts = true;
} }
@ -67,6 +69,7 @@ Item {
MobileShell.StatusBar { MobileShell.StatusBar {
id: topPanel id: topPanel
anchors.fill: parent anchors.fill: parent
showDropShadow: !root.showingApp showDropShadow: !root.showingApp
colorGroup: root.showingApp ? PlasmaCore.Theme.HeaderColorGroup : PlasmaCore.Theme.ComplementaryColorGroup colorGroup: root.showingApp ? PlasmaCore.Theme.HeaderColorGroup : PlasmaCore.Theme.ComplementaryColorGroup
backgroundColor: !root.showingApp ? "transparent" : root.backgroundColor backgroundColor: !root.showingApp ? "transparent" : root.backgroundColor
@ -78,7 +81,30 @@ Item {
anchors.fill: parent anchors.fill: parent
} }
// swipe-down drawer component
MobileShell.ActionDrawer { MobileShell.ActionDrawer {
id: drawer id: drawer
notificationSettings: NotificationManager.Settings {}
notificationModel: NotificationManager.Notifications {
showExpired: true
showDismissed: true
showJobs: drawer.notificationSettings.jobsInNotifications
sortMode: NotificationManager.Notifications.SortByTypeAndUrgency
groupMode: NotificationManager.Notifications.GroupApplicationsFlat
groupLimit: 2
expandUnread: true
blacklistedDesktopEntries: drawer.notificationSettings.historyBlacklistedApplications
blacklistedNotifyRcNames: drawer.notificationSettings.historyBlacklistedServices
urgencies: {
var urgencies = NotificationManager.Notifications.CriticalUrgency
| NotificationManager.Notifications.NormalUrgency;
if (drawer.notificationSettings.lowPriorityHistory) {
urgencies |= NotificationManager.Notifications.LowUrgency;
}
return urgencies;
}
}
} }
} }