Warning, /plasma/plasma-mobile/containments/panel/package/contents/ui/main.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2021-2023 Devin Lin <devin@kde.org>
0002 // SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 import QtQuick
0006 import QtQuick.Layouts
0007 import QtQuick.Window
0008 import QtQml.Models
0009 
0010 import org.kde.kirigami as Kirigami
0011 
0012 import org.kde.plasma.plasmoid
0013 import org.kde.plasma.core as PlasmaCore
0014 import org.kde.plasma.components 3.0 as PlasmaComponents
0015 
0016 import org.kde.plasma.private.mobileshell as MobileShell
0017 import org.kde.plasma.private.mobileshell.state as MobileShellState
0018 import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
0019 
0020 import org.kde.taskmanager as TaskManager
0021 import org.kde.notificationmanager as NotificationManager
0022 
0023 ContainmentItem {
0024     id: root
0025     Plasmoid.backgroundHints: PlasmaCore.Types.NoBackground
0026     Plasmoid.status: PlasmaCore.Types.PassiveStatus // ensure that the panel never takes focus away from the running app
0027 
0028     // filled in by the shell (Panel.qml) with the plasma-workspace PanelView
0029     property var panel: null
0030     onPanelChanged: {
0031         if (panel) {
0032             panel.floating = false;
0033         }
0034     }
0035 
0036     // only opaque if there are no maximized windows on this screen
0037     readonly property bool showingApp: WindowPlugin.WindowMaximizedTracker.showingWindow
0038     readonly property color backgroundColor: topPanel.colorScopeColor
0039 
0040     // enforce thickness
0041     Binding {
0042         target: panel // assumed to be plasma-workspace "PanelView" component
0043         property: "thickness"
0044         value: MobileShell.Constants.topPanelHeight
0045     }
0046 
0047 //BEGIN API implementation
0048 
0049     Connections {
0050         target: MobileShellState.ShellDBusClient
0051 
0052         function onOpenActionDrawerRequested() {
0053             drawer.actionDrawer.open();
0054         }
0055 
0056         function onCloseActionDrawerRequested() {
0057             drawer.actionDrawer.close();
0058         }
0059 
0060         function onDoNotDisturbChanged() {
0061             if (drawer.actionDrawer.notificationsWidget.doNotDisturbModeEnabled !== MobileShellState.ShellDBusClient.doNotDisturb) {
0062                 drawer.actionDrawer.notificationsWidget.toggleDoNotDisturbMode();
0063             }
0064         }
0065     }
0066 
0067     Binding {
0068         target: MobileShellState.ShellDBusClient
0069         property: "isActionDrawerOpen"
0070         value: drawer.visible
0071     }
0072 
0073 //END API implementation
0074 
0075     Component.onCompleted: {
0076         // register dbus
0077         MobileShellState.ShellDBusObject.registerObject();
0078 
0079         // HACK: we need to initialize the DBus server somewhere, it might as well be here...
0080         // initialize the volume osd, and volume keys
0081         MobileShell.VolumeOSDProviderLoader.load();
0082     }
0083 
0084     // top panel component
0085     MobileShell.StatusBar {
0086         id: topPanel
0087         anchors.fill: parent
0088 
0089         Kirigami.Theme.colorSet: root.showingApp ? Kirigami.Theme.Header : Kirigami.Theme.Complementary
0090         Kirigami.Theme.inherit: false
0091 
0092         showDropShadow: !root.showingApp
0093         backgroundColor: !root.showingApp ? "transparent" : root.backgroundColor
0094     }
0095 
0096     // swiping area for swipe-down drawer
0097     MobileShell.ActionDrawerOpenSurface {
0098         id: swipeArea
0099         actionDrawer: drawer.actionDrawer
0100         anchors.fill: parent
0101     }
0102 
0103     // swipe-down drawer component
0104     MobileShell.ActionDrawerWindow {
0105         id: drawer
0106 
0107         actionDrawer.notificationSettings: NotificationManager.Settings {}
0108         actionDrawer.notificationModel: NotificationManager.Notifications {
0109             showExpired: true
0110             showDismissed: true
0111             showJobs: drawer.actionDrawer.notificationSettings.jobsInNotifications
0112             sortMode: NotificationManager.Notifications.SortByTypeAndUrgency
0113             groupMode: NotificationManager.Notifications.GroupApplicationsFlat
0114             groupLimit: 2
0115             expandUnread: true
0116             blacklistedDesktopEntries: drawer.actionDrawer.notificationSettings.historyBlacklistedApplications
0117             blacklistedNotifyRcNames: drawer.actionDrawer.notificationSettings.historyBlacklistedServices
0118             urgencies: {
0119                 var urgencies = NotificationManager.Notifications.CriticalUrgency
0120                             | NotificationManager.Notifications.NormalUrgency;
0121                 if (drawer.actionDrawer.notificationSettings.lowPriorityHistory) {
0122                     urgencies |= NotificationManager.Notifications.LowUrgency;
0123                 }
0124                 return urgencies;
0125             }
0126         }
0127     }
0128 }