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
23 objectName: "WideView"
27 property alias background: coverPage.background
28 property alias backgroundTopMargin: coverPage.backgroundTopMargin
29 property alias hasCustomBackground: coverPage.hasCustomBackground
30 property alias dragHandleLeftMargin: coverPage.dragHandleLeftMargin
31 property alias infographicModel: coverPage.infographicModel
32 property alias launcherOffset: coverPage.launcherOffset
33 property alias currentIndex: loginList.currentIndex
34 property int delayMinutes // TODO
35 property alias alphanumeric: loginList.alphanumeric
36 property alias locked: loginList.locked
37 property alias waiting: loginList.waiting
38 property var userModel // Set from outside
40 readonly property bool animating: coverPage.showAnimation.running || coverPage.hideAnimation.running
41 readonly property bool fullyShown: coverPage.showProgress === 1
42 readonly property bool required: coverPage.required
43 readonly property alias sessionToStart: loginList.currentSession
45 // so that it can be replaced in tests with a mock object
46 property var inputMethod: Qt.inputMethod
48 signal selected(int index)
49 signal responded(string response)
51 signal emergencyCall() // unused
53 function notifyAuthenticationFailed() {
54 loginList.showError();
57 function forceShow() {
58 // Nothing to do, we are always fully shown
61 function tryToUnlock(toTheRight) {
64 loginList.tryToUnlock();
67 var coverChanged = coverPage.shown;
69 coverPage.hideRight();
81 function showFakePassword() {
82 loginList.showFakePassword();
88 opacity: coverPage.showProgress * 0.8
93 objectName: "coverPage"
96 draggable: !root.locked && !root.waiting
100 height: 0.75 * parent.height
101 anchors.leftMargin: loginList.x + loginList.width
104 onTease: root.tease()
106 onShowProgressChanged: {
107 if (showProgress === 0 && !root.locked) {
114 objectName: "loginList"
119 leftMargin: Math.min(parent.width * 0.16, units.gu(20))
121 bottom: parent.bottom
124 boxVerticalOffset: (height - highlightedHeight -
125 (inputMethod && inputMethod.visible ?
126 inputMethod.keyboardRectangle.height : 0)) / 2
127 Behavior on boxVerticalOffset { UbuntuNumberAnimation {} }
129 model: root.userModel
130 onResponded: root.responded(response)
131 onSelected: root.selected(index)
132 onSessionChooserButtonClicked: parent.state = "SessionsList"
133 onCurrentIndexChanged: setCurrentSession()
135 Keys.forwardTo: [sessionChooserLoader.item]
137 Component.onCompleted: setCurrentSession()
139 function setCurrentSession() {
140 currentSession = LightDMService.users.data(currentIndex, LightDMService.userRoles.SessionRole);
145 id: sessionChooserLoader
147 height: loginList.height
148 width: loginList.width
152 leftMargin: Math.min(parent.width * 0.16, units.gu(20))
158 onLoaded: sessionChooserLoader.item.forceActiveFocus();
161 item.updateHighlight(loginList.currentSession);
165 target: sessionChooserLoader.item
166 onSessionSelected: loginList.currentSession = sessionKey
168 coverPage.state = "LoginList"
169 loginList.tryToUnlock();
171 ignoreUnknownSignals: true
178 PropertyChanges { target: loginList; opacity: 0 }
179 PropertyChanges { target: sessionChooserLoader;
182 source: "SessionsList.qml"
188 PropertyChanges { target: loginList; opacity: 1 }
189 PropertyChanges { target: sessionChooserLoader;
201 UbuntuNumberAnimation {