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.private.mobileshell as MobileShell
0009
0010 import "../lookandfeel/contents/lockscreen" as LockScreen
0011
0012 // This is a test app for the lockscreen, simulating kscreenlocker.
0013 //
0014 // The "password" in this example is 123456.
0015
0016 ApplicationWindow {
0017 width: 360
0018 height: 720
0019 visible: true
0020
0021 // simulate kscreenlocker wallpaper
0022 Image {
0023 id: wallpaper // id passed in by kscreenlocker
0024 source: "assets/background.jpg"
0025 anchors.fill: parent
0026 fillMode: Image.PreserveAspectCrop
0027 }
0028
0029 // simulate kscreenlocker authenticator object
0030 QtObject {
0031 id: authenticator // id passed in by kscreenlocker
0032
0033 property string infoMessage: ""
0034 property string errorMessage: ""
0035 property string prompt: ""
0036 property string promptForSecret: ""
0037
0038 signal succeeded()
0039 signal failed()
0040
0041 // these are not kscreenlocker properties, for test purposes only
0042 property string password: ""
0043 property bool shouldPrompt: true
0044
0045 function startAuthenticating() {
0046 if (shouldPrompt) {
0047 shouldPrompt = false;
0048 promptForSecret = "Password:";
0049 promptForSecretChanged();
0050 } else if (password === "123456") {
0051 shouldPrompt = true;
0052 succeeded();
0053 } else {
0054 shouldPrompt = true;
0055 failed();
0056 }
0057 }
0058
0059 function respond(promptPassword) {
0060 password = promptPassword;
0061 }
0062 }
0063
0064 // component to test
0065 LockScreen.LockScreen {
0066 anchors.fill: parent
0067 }
0068 }
0069