-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
LockScreenTest.qml
69 lines (55 loc) · 1.79 KB
/
LockScreenTest.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// SPDX-FileCopyrightText: 2022 Devin LIn <devin@kde.org>
// SPDX-License-Identifier: LGPL-2.0-or-later
import QtQuick 2.15
import QtQuick.Controls 2.15
import org.kde.plasma.components 3.0 as PC3
import org.kde.plasma.private.mobileshell as MobileShell
import "../shell/contents/lockscreen" as LockScreen
// This is a test app for the lockscreen, simulating kscreenlocker.
//
// The "password" in this example is 123456.
ApplicationWindow {
width: 360
height: 720
visible: true
// simulate kscreenlocker wallpaper
Image {
id: wallpaper // id passed in by kscreenlocker
source: "assets/background.jpg"
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
}
// simulate kscreenlocker authenticator object
QtObject {
id: authenticator // id passed in by kscreenlocker
property string infoMessage: ""
property string errorMessage: ""
property string prompt: ""
property string promptForSecret: ""
signal succeeded()
signal failed()
// these are not kscreenlocker properties, for test purposes only
property string password: ""
property bool shouldPrompt: true
function startAuthenticating() {
if (shouldPrompt) {
shouldPrompt = false;
promptForSecret = "Password:";
promptForSecretChanged();
} else if (password === "123456") {
shouldPrompt = true;
succeeded();
} else {
shouldPrompt = true;
failed();
}
}
function respond(promptPassword) {
password = promptPassword;
}
}
// component to test
LockScreen.LockScreen {
anchors.fill: parent
}
}