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/>.
19import Lomiri.Components 1.3
25 implicitHeight: units.gu(5)
28 property bool isPrompt
29 property bool isPinPrompt
31 property bool isSecret
32 property bool interactive: true
33 property bool loginError: false
34 readonly property string enteredText: loader.item ? loader.item.enteredText : ""
35 property bool hasKeyboard: false
36 property bool waitingToAccept: false
37 property string pinCodeManager: "PinPrompt.qml"
45 schema.id: "com.lomiri.Shell"
48 onEnteredTextChanged: if (waitingToAccept) root.accepted()
50 function showFakePassword() {
51 // Just a silly hack for looking like 4 pin numbers got entered, if
52 // a fingerprint was used and we happen to be using a pin. This was
53 // a request from Design.
55 loader.item.enteredText = "...."; // actual text doesn't matter
61 objectName: "promptLoader"
69 function onClicked() { root.clicked() }
70 function onCanceled() { root.canceled() }
71 function onAccepted(response) {
72 if (response == root.enteredText)
75 root.waitingToAccept = true;
93 property: "interactive"
94 value: root.interactive
99 property: "loginError"
100 value: root.loginError
105 property: "hasKeyboard"
106 value: root.hasKeyboard
109 onLoaded: loader.item.focus = true
116 PropertyChanges { target: loader; source: "ButtonPrompt.qml" }
120 when: root.isPinPrompt
121 PropertyChanges { target: loader; source: root.pinCodeManager }
125 when: !root.isPinPrompt
126 PropertyChanges { target: loader; source: "TextPrompt.qml" }