Warning, /plasma/plasma-mobile/tests/LockScreenTest.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2022 Devin LIn <devin@kde.org> 0002 // SPDX-License-Identifier: LGPL-2.0-or-later 0003 0004 import QtQuick 2.15 0005 import QtQuick.Controls 2.15 0006 0007 import org.kde.plasma.components 3.0 as PC3 0008 import org.kde.plasma.core 2.0 as PlasmaCore 0009 import org.kde.plasma.private.mobileshell 1.0 as MobileShell 0010 import org.kde.notificationmanager 1.1 as Notifications 0011 0012 import org.kde.notificationmanager 1.0 as NotificationManager 0013 0014 import "../look-and-feel/contents/lockscreen" as LockScreen 0015 0016 // This is a test app for the lockscreen, simulating kscreenlocker. 0017 // 0018 // The "password" in this example is 123456. 0019 0020 ApplicationWindow { 0021 width: 360 0022 height: 720 0023 visible: true 0024 0025 // simulate kscreenlocker wallpaper 0026 Image { 0027 id: wallpaper // id passed in by kscreenlocker 0028 source: "assets/background.jpg" 0029 anchors.fill: parent 0030 fillMode: Image.PreserveAspectCrop 0031 } 0032 0033 // simulate kscreenlocker authenticator object 0034 QtObject { 0035 id: authenticator // id passed in by kscreenlocker 0036 0037 signal succeeded() 0038 signal failed() 0039 signal infoMessage(string msg) 0040 signal errorMessage(string msg) 0041 signal prompt(string msg) 0042 signal promptForSecret(string msg) 0043 0044 // these are not kscreenlocker properties, for test purposes only 0045 property string password: "" 0046 property bool prompt: true 0047 0048 function tryUnlock() { 0049 if (prompt) { 0050 prompt = false; 0051 promptForSecret("Password:"); 0052 } else if (password === "123456") { 0053 prompt = true; 0054 succeeded(); 0055 } else { 0056 prompt = true; 0057 failed(); 0058 } 0059 } 0060 0061 function respond(promptPassword) { 0062 password = promptPassword; 0063 } 0064 } 0065 0066 // component to test 0067 LockScreen.LockScreen { 0068 anchors.fill: parent 0069 } 0070 } 0071