Warning, /plasma/plasma-mobile/look-and-feel/contents/lockscreen/HeaderComponent.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2021-2022 Devin Lin <espidev@gmail.com>
0003  * SPDX-License-Identifier: GPL-2.0-or-later
0004  */
0005 
0006 import QtQuick 2.12
0007 import QtQuick.Controls 2.15
0008 import QtQuick.Layouts 1.1
0009 
0010 import org.kde.plasma.core 2.0 as PlasmaCore
0011 import org.kde.plasma.private.mobileshell 1.0 as MobileShell
0012 
0013 import org.kde.notificationmanager 1.0 as NotificationManager
0014 
0015 Loader {
0016     id: root
0017     
0018     required property real openFactor
0019     
0020     readonly property real statusBarHeight: PlasmaCore.Units.gridUnit * 1.25
0021     
0022     property var notificationsModel: []
0023     
0024     signal passwordRequested()
0025     
0026     asynchronous: true
0027     
0028     sourceComponent: Item {
0029         // top status bar
0030         MobileShell.StatusBar {
0031             id: statusBar
0032             
0033             anchors.top: parent.top
0034             anchors.left: parent.left
0035             anchors.right: parent.right
0036             
0037             height: root.statusBarHeight
0038             
0039             colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
0040             backgroundColor: "transparent"
0041             
0042             showSecondRow: false
0043             showDropShadow: true
0044             showTime: false
0045             disableSystemTray: true // prevent SIGABRT, since loading the system tray on the lockscreen leads to bad... things
0046         }
0047         
0048         // drag down gesture to open action drawer
0049         MobileShell.ActionDrawerOpenSurface {
0050             id: swipeArea
0051             actionDrawer: drawer
0052             anchors.fill: statusBar
0053         }
0054         
0055         // action drawer component
0056         MobileShell.ActionDrawer {
0057             id: drawer
0058             anchors.fill: parent
0059             
0060             restrictedPermissions: true
0061             
0062             notificationSettings: NotificationManager.Settings {}
0063             notificationModel: root.notificationsModel
0064             notificationModelType: MobileShell.NotificationsModelType.WatchedNotificationsModel
0065             
0066             property bool requestNotificationAction: false
0067             
0068             // notification button clicked, requesting auth
0069             onPermissionsRequested: {
0070                 requestNotificationAction = true;
0071                 drawer.close();
0072                 root.passwordRequested();
0073             }
0074         }
0075         
0076         // listen to authentication events
0077         Connections {
0078             target: authenticator
0079             function onSucceeded() {
0080                 // run pending action if successfully unlocked
0081                 if (drawer.requestNotificationAction) {
0082                     drawer.runPendingAction();
0083                     drawer.requestNotificationAction = false;
0084                 }
0085             }
0086             function onFailed() {
0087                 drawer.requestNotificationAction = false;
0088             }
0089         }
0090     }
0091 }