shift-shell/containments/panel/package/contents/ui/main.qml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

123 lines
4.1 KiB
QML
Raw Normal View History

// SPDX-FileCopyrightText: 2021-2023 Devin Lin <devin@kde.org>
// SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import QtQml.Models
import org.kde.kirigami as Kirigami
import org.kde.plasma.plasmoid
import org.kde.plasma.core as PlasmaCore
2019-10-08 15:15:17 +00:00
import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
2020-07-22 15:17:10 +00:00
import org.kde.taskmanager as TaskManager
import org.kde.notificationmanager as NotificationManager
ContainmentItem {
id: root
Plasmoid.backgroundHints: PlasmaCore.Types.NoBackground
2023-03-03 06:11:51 +00:00
2023-10-22 17:53:55 +00:00
// filled in by the shell (Panel.qml) with the plasma-workspace PanelView
property var panel: null
// only opaque if there are no maximized windows on this screen
readonly property bool showingApp: WindowPlugin.WindowMaximizedTracker.showingWindow
readonly property color backgroundColor: topPanel.colorScopeColor
2022-06-27 22:08:42 +00:00
// enforce thickness
Binding {
2023-10-22 17:53:55 +00:00
target: panel // assumed to be plasma-workspace "PanelView" component
2022-06-27 22:08:42 +00:00
property: "thickness"
2023-10-22 17:53:55 +00:00
value: MobileShell.Constants.topPanelHeight
2022-06-27 22:08:42 +00:00
}
//BEGIN API implementation
Connections {
target: MobileShellState.ShellDBusClient
function onOpenActionDrawerRequested() {
drawer.actionDrawer.open();
}
function onCloseActionDrawerRequested() {
drawer.actionDrawer.close();
}
function onDoNotDisturbChanged() {
if (drawer.actionDrawer.notificationsWidget.doNotDisturbModeEnabled !== MobileShellState.ShellDBusClient.doNotDisturb) {
drawer.actionDrawer.notificationsWidget.toggleDoNotDisturbMode();
}
}
}
Binding {
target: MobileShellState.ShellDBusClient
property: "isActionDrawerOpen"
value: drawer.visible
}
//END API implementation
Component.onCompleted: {
// register dbus
MobileShellState.ShellDBusObject.registerObject();
// HACK: we need to initialize the DBus server somewhere, it might as well be here...
// initialize the volume osd, and volume keys
MobileShell.VolumeOSDProviderLoader.load();
}
// top panel component
MobileShell.StatusBar {
id: topPanel
anchors.fill: parent
Kirigami.Theme.colorSet: root.showingApp ? Kirigami.Theme.Header : Kirigami.Theme.Complementary
Kirigami.Theme.inherit: false
showDropShadow: !root.showingApp
backgroundColor: !root.showingApp ? "transparent" : root.backgroundColor
2015-05-12 16:59:55 +00:00
}
// swiping area for swipe-down drawer
MobileShell.ActionDrawerOpenSurface {
id: swipeArea
actionDrawer: drawer.actionDrawer
anchors.fill: parent
2015-05-12 16:59:55 +00:00
}
// swipe-down drawer component
MobileShell.ActionDrawerWindow {
id: drawer
actionDrawer.notificationSettings: NotificationManager.Settings {}
actionDrawer.notificationModel: NotificationManager.Notifications {
showExpired: true
showDismissed: true
showJobs: drawer.actionDrawer.notificationSettings.jobsInNotifications
sortMode: NotificationManager.Notifications.SortByTypeAndUrgency
groupMode: NotificationManager.Notifications.GroupApplicationsFlat
groupLimit: 2
expandUnread: true
blacklistedDesktopEntries: drawer.actionDrawer.notificationSettings.historyBlacklistedApplications
blacklistedNotifyRcNames: drawer.actionDrawer.notificationSettings.historyBlacklistedServices
urgencies: {
var urgencies = NotificationManager.Notifications.CriticalUrgency
| NotificationManager.Notifications.NormalUrgency;
if (drawer.actionDrawer.notificationSettings.lowPriorityHistory) {
urgencies |= NotificationManager.Notifications.LowUrgency;
}
return urgencies;
}
}
2023-03-03 06:11:51 +00:00
}
}