2 * Copyright (C) 2016 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18import Lomiri.Components 1.3
24 implicitHeight: units.gu(5)
27 property bool isPrompt
28 property bool isAlphanumeric
30 property bool isSecret
31 property bool interactive: true
32 property bool loginError: false
33 readonly property string enteredText: loader.item.enteredText
34 property bool hasKeyboard: false
35 property bool waitingToAccept: false
43 schema.id: "com.lomiri.Shell"
46 onEnteredTextChanged: if (waitingToAccept) root.accepted()
48 function showFakePassword() {
49 // Just a silly hack for looking like 4 pin numbers got entered, if
50 // a fingerprint was used and we happen to be using a pin. This was
51 // a request from Design.
53 loader.item.enteredText = "...."; // actual text doesn't matter
59 objectName: "promptLoader"
67 onClicked: root.clicked()
68 onCanceled: root.canceled()
70 if (response == enteredText)
73 waitingToAccept = true;
91 property: "interactive"
92 value: root.interactive
97 property: "loginError"
98 value: root.loginError
103 property: "hasKeyboard"
104 value: root.hasKeyboard
107 onLoaded: loader.item.focus = true
114 PropertyChanges { target: loader; source: "ButtonPrompt.qml" }
118 when: root.isPrompt && !root.isAlphanumeric && root.isSecret
119 PropertyChanges { target: loader; source: "PinPrompt.qml" }
124 PropertyChanges { target: loader; source: "TextPrompt.qml" }