Warning, /plasma/kscreenlocker/greeter/fallbacktheme/LockScreen.qml is written in an unsupported language. File is not indexed.

0001 /*
0002 SPDX-FileCopyrightText: 2011 Martin Gräßlin <mgraesslin@kde.org>
0003 
0004 SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.15
0008 
0009 import org.kde.kquickcontrolsaddons 2.0
0010 import org.kde.plasma.core 2.0 as PlasmaCore
0011 import org.kde.plasma.components 2.0 as PlasmaComponents
0012 import org.kde.plasma.private.sessions 2.0
0013 
0014 Item {
0015     id: lockScreen
0016 
0017     property alias capsLockOn: unlockUI.capsLockOn
0018     property bool locked: false
0019 
0020     signal unlockRequested()
0021 
0022     // if there's no image, have a near black background
0023     Rectangle {
0024         width: parent.width
0025         height: parent.height
0026         color: "#111"
0027     }
0028 
0029     SessionsModel {
0030         id: sessionsModel
0031     }
0032 
0033     Image {
0034         id: background
0035 
0036         anchors.fill: parent
0037         source: "file:" + theme.wallpaperPathForSize(parent.width, parent.height)
0038         smooth: true
0039     }
0040 
0041     PlasmaCore.FrameSvgItem {
0042         id: dialog
0043 
0044         visible: lockScreen.locked
0045         anchors.centerIn: parent
0046         imagePath: "widgets/background"
0047         width: mainStack.currentPage.implicitWidth + margins.left + margins.right
0048         height: mainStack.currentPage.implicitHeight + margins.top + margins.bottom
0049 
0050         Behavior on height {
0051             enabled: mainStack.currentPage != null
0052             NumberAnimation {
0053                 duration: 250
0054             }
0055         }
0056         Behavior on width {
0057             enabled: mainStack.currentPage != null
0058             NumberAnimation {
0059                 duration: 250
0060             }
0061         }
0062         PlasmaComponents.PageStack {
0063             id: mainStack
0064 
0065             clip: true
0066             anchors {
0067                 fill: parent
0068                 leftMargin: dialog.margins.left
0069                 topMargin: dialog.margins.top
0070                 rightMargin: dialog.margins.right
0071                 bottomMargin: dialog.margins.bottom
0072             }
0073             initialPage: unlockUI
0074         }
0075     }
0076 
0077     Greeter {
0078         id: unlockUI
0079 
0080         switchUserEnabled: sessionsModel.canSwitchUser
0081 
0082         Connections {
0083             function onAccepted() {
0084                 lockScreen.unlockRequested();
0085             }
0086             function onSwitchUserClicked() {
0087                 mainStack.push(userSessionsUIComponent);
0088                 mainStack.currentPage.forceActiveFocus();
0089             }
0090         }
0091     }
0092 
0093     function returnToLogin() {
0094         mainStack.pop();
0095         unlockUI.resetFocus();
0096     }
0097 
0098     Component {
0099         id: userSessionsUIComponent
0100 
0101         SessionSwitching {
0102             id: userSessionsUI
0103 
0104             visible: false
0105 
0106             Connections {
0107                 function onSwitchingCanceled() {
0108                     returnToLogin();
0109                 }
0110                 function onSessionActivated() {
0111                     returnToLogin();
0112                 }
0113                 function onNewSessionStarted() {
0114                     returnToLogin();
0115                 }
0116             }
0117         }
0118     }
0119 }