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
24 // Determine if a numeric or alphanumeric pad is used.
25 property bool alphaNumeric: false
28 property string placeholderText: ""
29 // Placeholder text while shaking (e.g. Incorrect passprase)
30 property string wrongPlaceholderText: ""
31 // Retries text (e.g. 3 retries left)
32 property string retryText: ""
34 // Informational text. (e.g. some text to tell which domain this is pin is entered for.
35 property string infoText: ""
37 // In case the Lockscreen can show a greeter message, this is the username
38 property string username: ""
40 // Set those to a value greater 0 to restrict the pin length.
41 // If both are unset, the Lockscreen will show a confirm button and allow typing any length of pin before
42 // confirming. If minPinLength is set to a value > 0, the confirm button will only become active when the
43 // entered pin is at least that long. If maxPinLength is set, the lockscreen won't allow entering any
44 // more numbers than that. If both are set to the same value, the lockscreen will enter auto confirming
45 // behavior, hiding the confirmation button and triggering that automatically when the entered pin reached
46 // that length. This is ignored by the alphaNumeric lockscreen as that one is always confirmed by pressing
48 property int minPinLength: -1
49 property int maxPinLength: -1
51 property url background: ""
53 signal entered(string passphrase)
55 signal emergencyCall()
56 signal infoPopupConfirmed()
59 if (required && pinPadLoader.item) {
60 pinPadLoader.item.clear(false);
65 // This causes the loader below to destry and recreate the source
66 pinPadLoader.resetting = true;
67 pinPadLoader.resetting = false;
70 function clear(showAnimation) {
71 pinPadLoader.item.clear(showAnimation);
74 function showInfoPopup(title, text) {
75 PopupUtils.open(infoPopupComponent, root, {title: title, text: text})
79 // In case background fails to load or is undefined
87 objectName: "lockscreenBackground"
91 source: root.required ? root.background : ""
92 fillMode: Image.PreserveAspectCrop
104 bottom: pinPadLoader.top
105 bottomMargin: units.gu(2)
108 objectName: "retryCountLabel"
114 horizontalAlignment: Text.AlignHCenter
117 visible: root.retryText.length > 0
121 objectName: "infoTextLabel"
127 horizontalAlignment: Text.AlignHCenter
130 visible: root.infoText.length > 0
138 objectName: "pinPadLoader"
142 verticalCenter: parent.verticalCenter
143 verticalCenterOffset: root.alphaNumeric ? -units.gu(10) : -units.gu(4)
145 property bool resetting: false
147 source: (!resetting && root.required) ? (root.alphaNumeric ? "PassphraseLockscreen.qml" : "PinLockscreen.qml") : ""
150 target: pinPadLoader.item
153 root.entered(passphrase);
162 target: pinPadLoader.item
163 property: "minPinLength"
164 value: root.minPinLength
167 target: pinPadLoader.item
168 property: "maxPinLength"
169 value: root.maxPinLength
172 target: pinPadLoader.item
173 property: "placeholderText"
174 value: root.placeholderText
177 target: pinPadLoader.item
178 property: "wrongPlaceholderText"
179 value: root.wrongPlaceholderText
182 target: pinPadLoader.item
189 id: emergencyCallColumn
191 // FIXME: We *should* show emergency dialer if there is a SIM present,
192 // regardless of whether the side stage is enabled. But right now,
193 // the assumption is that narrow screens are phones which have SIMs
194 // and wider screens are tablets which don't. When we do allow this
195 // on devices with a side stage and a SIM, work should be done to
196 // ensure that the main stage is disabled while the dialer is present
197 // in the side stage.
198 visible: !shell.sideStageEnabled
202 bottom: parent.bottom
203 bottomMargin: units.gu(4)
206 height: childrenRect.height
210 objectName: "emergencyCallIcon"
213 anchors.horizontalCenter: parent.horizontalCenter
214 name: "phone-app-call-symbolic"
220 text: i18n.tr("Emergency Call")
224 anchors.horizontalCenter: parent.horizontalCenter
229 anchors.fill: emergencyCallColumn
230 onClicked: root.emergencyCall()
231 enabled: emergencyCallColumn.visible
235 id: infoPopupComponent
238 objectName: "infoPopup"
242 objectName: "infoPopupOkButton"
245 PopupUtils.close(dialog)
246 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