2 * Copyright (C) 2013 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 Ubuntu.Components 1.0
19import Ubuntu.Components.Popups 1.0
20import Ubuntu.Telephony 0.1 as Telephony
25 // Determine if a numeric or alphanumeric pad is used.
26 property bool alphaNumeric: false
28 // Whether to show an emergency call button
29 property bool showEmergencyCallButton: true
31 // Whether to show a cancel button (not all lockscreen types normally do anyway)
32 property bool showCancelButton: true
34 // Informational text. (e.g. some text to tell which domain this is pin is entered for)
35 property string infoText: ""
37 // Retries text (e.g. 3 retries left)
38 // (This is not currently used, but will be necessary for SIM unlock screen)
39 property string retryText: ""
41 // The text to be displayed in case the login failed
42 property string errorText: ""
44 // If > 0, a forced delay is happening
45 property int delayMinutes: 0
47 // Set those to a value greater 0 to restrict the pin length.
48 // If both are unset, the Lockscreen will show a confirm button and allow typing any length of pin before
49 // confirming. If minPinLength is set to a value > 0, the confirm button will only become active when the
50 // entered pin is at least that long. If maxPinLength is set, the lockscreen won't allow entering any
51 // more numbers than that. If both are set to the same value, the lockscreen will enter auto confirming
52 // behavior, hiding the confirmation button and triggering that automatically when the entered pin reached
53 // that length. This is ignored by the alphaNumeric lockscreen as that one is always confirmed by pressing
55 property int minPinLength: -1
56 property int maxPinLength: -1
58 property url background: ""
60 readonly property string passphrase: (pinPadLoader.item && pinPadLoader.item.passphrase) ? pinPadLoader.item.passphrase : ""
62 signal entered(string passphrase)
64 signal emergencyCall()
65 signal infoPopupConfirmed()
67 onActiveFocusChanged: if (activeFocus && pinPadLoader.item) pinPadLoader.item.forceActiveFocus()
70 // This causes the loader below to destry and recreate the source
71 pinPadLoader.resetting = true;
72 pinPadLoader.resetting = false;
75 function clear(showAnimation) {
76 if (pinPadLoader.item) {
77 pinPadLoader.item.clear(showAnimation);
79 pinPadLoader.showWrongText = showAnimation
80 pinPadLoader.waiting = false
83 function showInfoPopup(title, text) {
84 var popup = PopupUtils.open(infoPopupComponent, root, {title: title, text: text})
85 // FIXME: SDK will do this internally soonish
86 popup.z = Number.MAX_VALUE
90 // In case background fails to load
94 visible: root.background.toString() !== ""
99 objectName: "lockscreenBackground"
103 source: root.required ? root.background : ""
104 fillMode: Image.PreserveAspectCrop
110 if (pinPadLoader.item)
111 pinPadLoader.item.forceActiveFocus()
121 objectName: "pinPadLoader"
123 property bool resetting: false
124 property bool waiting: false
125 property bool showWrongText: false
128 if (resetting || !root.required) {
130 } else if (root.delayMinutes > 0) {
131 return "DelayedLockscreen.qml"
132 } else if (root.alphaNumeric) {
133 return "PassphraseLockscreen.qml"
135 return "PinLockscreen.qml"
140 showWrongText = false
141 if (loaderScope.activeFocus && pinPadLoader.item)
142 pinPadLoader.item.forceActiveFocus()
146 target: pinPadLoader.item
149 pinPadLoader.waiting = true
150 root.entered(passphrase);
159 target: pinPadLoader.item
160 property: "minPinLength"
161 value: root.minPinLength
164 target: pinPadLoader.item
165 property: "maxPinLength"
166 value: root.maxPinLength
169 target: pinPadLoader.item
174 target: pinPadLoader.item
175 property: "retryText"
176 value: root.retryText
179 target: pinPadLoader.item
180 property: "errorText"
181 value: pinPadLoader.showWrongText ? root.errorText : ""
184 target: pinPadLoader.item
185 property: "entryEnabled"
186 value: !pinPadLoader.waiting
189 target: pinPadLoader.item
190 property: "alphaNumeric"
191 value: root.alphaNumeric
194 target: pinPadLoader.item
195 property: "delayMinutes"
196 value: root.delayMinutes
200 target: pinPadLoader.item
201 property: "showCancelButton"
202 value: root.showCancelButton
209 visible: showEmergencyCallButton
212 bottom: parent.bottom
213 bottomMargin: units.gu(7) + (Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0)
219 id: emergencyCallLabel
220 objectName: "emergencyCallLabel"
221 anchors.horizontalCenter: parent.horizontalCenter
223 text: callManager.hasCalls ? i18n.tr("Return to Call") : i18n.tr("Emergency Call")
228 id: emergencyCallIcon
229 anchors.left: emergencyCallLabel.right
230 anchors.leftMargin: units.gu(1)
231 width: emergencyCallLabel.height
232 height: emergencyCallLabel.height
238 anchors.top: emergencyCallLabel.top
239 anchors.bottom: emergencyCallLabel.bottom
240 anchors.left: emergencyCallLabel.left
241 anchors.right: emergencyCallIcon.right
242 onClicked: root.emergencyCall()
247 id: infoPopupComponent
250 objectName: "infoPopup"
254 objectName: "infoPopupOkButton"
257 PopupUtils.close(dialog)
258 root.infoPopupConfirmed();
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list