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 isPinPrompt
30 property bool isSecret
31 property bool interactive: true
32 property bool loginError: false
33 readonly property string enteredText: loader.item ? loader.item.enteredText : ""
34 property bool hasKeyboard: false
35 property bool waitingToAccept: false
36 property string pinCodeManager: "PinPrompt.qml"
44 schema.id: "com.lomiri.Shell"
47 onEnteredTextChanged: if (waitingToAccept) root.accepted()
49 function showFakePassword() {
50 // Just a silly hack for looking like 4 pin numbers got entered, if
51 // a fingerprint was used and we happen to be using a pin. This was
52 // a request from Design.
54 loader.item.enteredText = "...."; // actual text doesn't matter
60 objectName: "promptLoader"
68 onClicked: root.clicked()
69 onCanceled: root.canceled()
71 if (response == enteredText)
74 waitingToAccept = true;
92 property: "interactive"
93 value: root.interactive
98 property: "loginError"
99 value: root.loginError
104 property: "hasKeyboard"
105 value: root.hasKeyboard
108 onLoaded: loader.item.focus = true
115 PropertyChanges { target: loader; source: "ButtonPrompt.qml" }
119 when: root.isPinPrompt
120 PropertyChanges { target: loader; source: root.pinCodeManager }
124 when: !root.isPinPrompt
125 PropertyChanges { target: loader; source: "TextPrompt.qml" }