2 * Copyright (C) 2015-2016 Canonical Ltd.
3 * Copyright (C) 2021 UBports Foundation
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 3.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 import Lomiri.Components 1.3
24 objectName: "WideView"
28 property alias background: coverPage.background
29 property alias backgroundSourceSize: coverPage.backgroundSourceSize
30 property alias panelHeight: coverPage.panelHeight
31 property alias hasCustomBackground: coverPage.hasCustomBackground
32 property alias dragHandleLeftMargin: coverPage.dragHandleLeftMargin
33 property alias infographicModel: coverPage.infographicModel
34 property alias launcherOffset: coverPage.launcherOffset
35 property alias currentIndex: loginList.currentIndex
36 property int delayMinutes // TODO
37 property alias alphanumeric: loginList.alphanumeric
38 property alias hasKeyboard: loginList.hasKeyboard
39 property alias locked: loginList.locked
40 property alias waiting: loginList.waiting
41 property var userModel // Set from outside
43 readonly property bool animating: coverPage.showAnimation.running || coverPage.hideAnimation.running
44 readonly property bool fullyShown: coverPage.showProgress === 1
45 readonly property bool required: coverPage.required
46 readonly property alias sessionToStart: loginList.currentSession
48 property rect inputMethodRect
50 signal selected(int index)
51 signal responded(string response)
53 signal emergencyCall() // unused
55 function notifyAuthenticationFailed() {
56 loginList.showError();
59 function forceShow() {
60 // Nothing to do, we are always fully shown
63 function tryToUnlock(toTheRight) {
66 loginList.tryToUnlock();
69 var coverChanged = coverPage.shown;
71 coverPage.hideRight();
83 function showFakePassword() {
84 loginList.showFakePassword();
90 opacity: coverPage.showProgress * 0.8
95 objectName: "coverPage"
98 draggable: !root.locked && !root.waiting
100 blurAreaHeight: loginList.highlightedHeight + units.gu(4.5)
101 blurAreaWidth: loginList.width + units.gu(3)
102 blurAreaX: loginList.x - units.gu(1.5)
103 blurAreaY: loginList.boxVerticalOffset + loginList.y - units.gu(3)
105 // Darken background to match CoverPage
107 objectName: "lockscreenShade"
110 opacity: root.hasCustomBackground ? 0.1 : 0
114 anchors.topMargin: parent.height * 0.125
115 anchors.bottomMargin: parent.height * 0.125
116 anchors.leftMargin: loginList.x + loginList.width
119 onTease: root.tease()
121 onShowProgressChanged: {
122 if (showProgress === 0 && !root.locked) {
129 objectName: "loginList"
134 leftMargin: Math.min(parent.width * 0.16, units.gu(20))
136 bottom: parent.bottom
139 boxVerticalOffset: (height - highlightedHeight -
140 inputMethodRect.height) / 2
141 Behavior on boxVerticalOffset { LomiriNumberAnimation {} }
143 model: root.userModel
144 onResponded: root.responded(response)
145 onSelected: root.selected(index)
146 onSessionChooserButtonClicked: parent.state = "SessionsList"
147 onCurrentIndexChanged: setCurrentSession()
149 Keys.forwardTo: [sessionChooserLoader.item]
151 Component.onCompleted: setCurrentSession()
153 function setCurrentSession() {
154 currentSession = LightDMService.users.data(currentIndex, LightDMService.userRoles.SessionRole);
159 id: sessionChooserLoader
161 height: loginList.height
162 width: loginList.width
166 leftMargin: Math.min(parent.width * 0.16, units.gu(20))
172 onLoaded: sessionChooserLoader.item.forceActiveFocus();
175 item.updateHighlight(loginList.currentSession);
179 target: sessionChooserLoader.item
180 onSessionSelected: loginList.currentSession = sessionKey
182 coverPage.state = "LoginList"
183 loginList.tryToUnlock();
185 ignoreUnknownSignals: true
189 // Use an AbstractButton due to icon limitations with Button
192 objectName: "sessionChooserButton"
194 readonly property url icon: LightDMService.sessions.iconUrl(loginList.currentSession)
196 visible: LightDMService.sessions.count > 1 &&
197 !LightDMService.users.data(loginList.currentUserIndex, LightDMService.userRoles.LoggedInRole)
199 height: units.gu(3.5)
202 activeFocusOnTab: true
205 rightMargin: units.gu(2)
207 bottom: parent.bottom
208 bottomMargin: units.gu(1.5)
215 visible: parent.activeFocus
217 border.color: theme.palette.normal.focus
218 border.width: units.dp(1)
225 anchors.margins: units.dp(3)
226 keyColor: "#ffffff" // icon providers give us white icons
227 color: theme.palette.normal.raisedSecondaryText
228 source: sessionChooser.icon
231 Keys.onReturnPressed: {
232 parent.state = "SessionsList";
236 parent.state = "SessionsList";
239 // Refresh the icon path if looking at different places at runtime
240 // this is mainly for testing
242 target: LightDMService.sessions
243 onIconSearchDirectoriesChanged: {
244 badge.source = LightDMService.sessions.iconUrl(root.currentSession)
252 PropertyChanges { target: loginList; opacity: 0 }
253 PropertyChanges { target: sessionChooserLoader;
256 source: "SessionsList.qml"
262 PropertyChanges { target: loginList; opacity: 1 }
263 PropertyChanges { target: sessionChooserLoader;
275 LomiriNumberAnimation {