2 * Copyright (C) 2015-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 QtQuick.Window 2.2
19import Ubuntu.Components 1.3
20import Ubuntu.Telephony 0.1 as Telephony
26 property alias dragHandleLeftMargin: coverPage.dragHandleLeftMargin
27 property alias launcherOffset: coverPage.launcherOffset
28 property alias currentIndex: loginList.currentIndex
29 property alias delayMinutes: delayedLockscreen.delayMinutes
30 property alias backgroundTopMargin: coverPage.backgroundTopMargin
31 property url background
32 property bool hasCustomBackground
34 property alias alphanumeric: loginList.alphanumeric
35 property alias userModel: loginList.model
36 property alias infographicModel: coverPage.infographicModel
37 property string sessionToStart
39 readonly property bool fullyShown: coverPage.showProgress === 1 || lockscreen.shown
40 readonly property bool required: coverPage.required || lockscreen.required
41 readonly property bool animating: coverPage.showAnimation.running || coverPage.hideAnimation.running
43 // so that it can be replaced in tests with a mock object
44 property var inputMethod: Qt.inputMethod
46 signal selected(int index)
47 signal responded(string response)
49 signal emergencyCall()
51 function showLastChance() {
52 /* TODO: when we finish support for resetting device after too many
53 failed logins, we should re-add this popup.
54 var title = lockscreen.alphaNumeric ?
55 i18n.tr("Sorry, incorrect passphrase.") :
56 i18n.tr("Sorry, incorrect passcode.");
57 var text = i18n.tr("This will be your last attempt.") + " " +
58 (lockscreen.alphaNumeric ?
59 i18n.tr("If passphrase is entered incorrectly, your phone will conduct a factory reset and all personal data will be deleted.") :
60 i18n.tr("If passcode is entered incorrectly, your phone will conduct a factory reset and all personal data will be deleted."));
61 lockscreen.showInfoPopup(title, text);
70 function showFakePassword() {
71 loginList.showFakePassword();
74 function notifyAuthenticationFailed() {
75 loginList.showError();
78 function showErrorMessage(msg) {
79 coverPage.showErrorMessage(msg);
82 function forceShow() {
86 function tryToUnlock(toTheRight) {
87 var coverChanged = coverPage.shown;
88 lockscreen.maybeShow();
90 coverPage.hideRight();
99 lockscreen.maybeShow();
107 objectName: "lockscreen"
112 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
113 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
116 id: lockscreenBackground
117 objectName: "lockscreenBackground"
120 topMargin: root.backgroundTopMargin
122 source: root.background
125 // Darken background to match CoverPage
127 objectName: "lockscreenShade"
130 opacity: root.hasCustomBackground ? 0.4 : 0
135 objectName: "loginList"
138 horizontalCenter: parent.horizontalCenter
140 bottom: parent.bottom
143 boxVerticalOffset: units.gu(14)
144 enabled: !coverPage.shown && visible
145 visible: !delayedLockscreen.visible
149 onSelected: if (enabled) root.selected(index)
150 onResponded: root.responded(response)
154 id: delayedLockscreen
155 objectName: "delayedLockscreen"
157 visible: delayMinutes > 0
158 alphaNumeric: loginList.alphanumeric
161 function maybeShow() {
162 if (root.locked && !shown) {
171 opacity: coverPage.showProgress * 0.8
176 objectName: "coverPage"
177 height: parent.height
179 background: root.background
180 hasCustomBackground: root.hasCustomBackground
181 draggable: !root.waiting
182 onTease: root.tease()
185 onShowProgressChanged: {
186 if (showProgress === 0) {
187 if (lockscreen.shown) {
188 loginList.tryToUnlock();
198 topMargin: units.gu(2)
199 horizontalCenter: parent.horizontalCenter
206 visible: lockscreen.shown
209 anchors.left: parent.left
210 anchors.right: parent.right
211 anchors.top: parent.bottom
212 anchors.topMargin: - height * (1 - coverPage.showProgress)
213 - (inputMethod && inputMethod.visible ?
214 inputMethod.keyboardRectangle.height : 0)
217 color: UbuntuColors.porcelain // matches OSK background
222 text: i18n.tr("Cancel")
223 anchors.left: parent.left
224 anchors.leftMargin: units.gu(2)
225 anchors.top: parent.top
226 anchors.bottom: parent.bottom
227 verticalAlignment: Text.AlignVCenter
228 font.weight: Font.Light
230 color: UbuntuColors.slate
234 anchors.leftMargin: -units.gu(2)
235 anchors.rightMargin: -units.gu(2)
236 onClicked: coverPage.show()
241 objectName: "emergencyCallLabel"
242 text: callManager.hasCalls ? i18n.tr("Return to Call") : i18n.tr("Emergency")
243 anchors.right: parent.right
244 anchors.rightMargin: units.gu(2)
245 anchors.top: parent.top
246 anchors.bottom: parent.bottom
247 verticalAlignment: Text.AlignVCenter
248 font.weight: Font.Light
250 color: UbuntuColors.slate
251 // TODO: uncomment once bug 1616538 is fixed
252 // visible: telepathyHelper.ready && telepathyHelper.emergencyCallsAvailable
257 anchors.leftMargin: -units.gu(2)
258 anchors.rightMargin: -units.gu(2)
259 onClicked: root.emergencyCall()
264 // FIXME: It's difficult to keep something tied closely to the OSK (bug
265 // 1616163). But as a hack to avoid the background peeking out,
266 // we add an extra Rectangle that just serves to hide the background
267 // during OSK animations.
269 visible: bottomBar.visible
270 height: inputMethod && inputMethod.visible ?
271 inputMethod.keyboardRectangle.height : 0
272 anchors.bottom: parent.bottom
273 anchors.left: parent.left
274 anchors.right: parent.right
275 color: UbuntuColors.porcelain
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