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/>.
18 import Ubuntu.Components 1.3
25 property alias background: coverPage.background
26 property alias backgroundTopMargin: coverPage.backgroundTopMargin
27 property alias hasCustomBackground: coverPage.hasCustomBackground
28 property alias dragHandleLeftMargin: coverPage.dragHandleLeftMargin
29 property alias infographicModel: coverPage.infographicModel
30 property alias launcherOffset: coverPage.launcherOffset
31 property alias currentIndex: loginList.currentIndex
32 property int delayMinutes // TODO
33 property alias alphanumeric: loginList.alphanumeric
34 property alias locked: loginList.locked
35 property alias sessionToStart: loginList.currentSession
36 property alias waiting: loginList.waiting
37 property var userModel // Set from outside
39 readonly property bool animating: coverPage.showAnimation.running || coverPage.hideAnimation.running
40 readonly property bool fullyShown: coverPage.showProgress === 1
41 readonly property bool required: coverPage.required
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() // unused
51 function notifyAuthenticationFailed() {
52 loginList.showError();
55 function reset(forceShow) {
59 function showMessage(html) {
60 loginList.showMessage(html);
63 function showPrompt(text, isSecret, isDefaultPrompt) {
64 loginList.showPrompt(text, isSecret, isDefaultPrompt);
67 function tryToUnlock(toTheRight) {
70 loginList.tryToUnlock();
73 var coverChanged = coverPage.shown;
75 coverPage.hideRight();
87 function notifyAuthenticationSucceeded(showFakePassword) {
88 if (showFakePassword) {
89 loginList.showFakePassword();
93 function showLastChance() {
100 opacity: coverPage.showProgress * 0.8
105 objectName: "coverPage"
106 height: parent.height
108 draggable: !root.locked && !root.waiting
112 height: 0.75 * parent.height
113 anchors.leftMargin: loginList.x + loginList.width
116 onTease: root.tease()
118 onShowProgressChanged: {
119 if (showProgress === 0 && !root.locked) {
126 objectName: "loginList"
131 leftMargin: Math.min(parent.width * 0.16, units.gu(20))
133 bottom: parent.bottom
136 boxVerticalOffset: (height - highlightedHeight -
137 (inputMethod && inputMethod.visible ?
138 inputMethod.keyboardRectangle.height : 0)) / 2
139 Behavior on boxVerticalOffset { UbuntuNumberAnimation {} }
141 model: root.userModel
142 currentSession: LightDMService.greeter.defaultSession
143 onResponded: root.responded(response)
144 onSelected: root.selected(index)
145 onSessionChooserButtonClicked: parent.state = "SessionsList"
147 Keys.forwardTo: [sessionChooserLoader.item]
151 id: sessionChooserLoader
153 height: loginList.height
154 width: loginList.width
157 leftMargin: Math.min(parent.width * 0.16, units.gu(20))
163 onLoaded: sessionChooserLoader.item.forceActiveFocus();
165 target: sessionChooserLoader.item
166 property: "initiallySelectedSession"
167 value: loginList.currentSession
171 target: sessionChooserLoader.item
172 onSessionSelected: loginList.currentSession = sessionKey
174 coverPage.state = "LoginList"
175 loginList.passwordInput.forceActiveFocus();
177 ignoreUnknownSignals: true
184 PropertyChanges { target: loginList; opacity: 0 }
185 PropertyChanges { target: sessionChooserLoader;
188 source: "SessionsList.qml"
194 PropertyChanges { target: loginList; opacity: 1 }
195 PropertyChanges { target: sessionChooserLoader;
207 UbuntuNumberAnimation {