@@ -26,6 +26,7 @@ StyledItem {
27 property alias model: userList.model
27 property alias model: userList.model
28 property alias alphanumeric: promptList.alphanumeric
28 property alias alphanumeric: promptList.alphanumeric
29+ property alias hasKeyboard: promptList.hasKeyboard
29 property int currentIndex
30 property int currentIndex
30 property bool locked
31 property bool locked
31 property bool waiting
32 property bool waiting
@@ -39,6 +40,8 @@ StyledItem {
39 property string currentSession // Initially set by LightDM
40 property string currentSession // Initially set by LightDM
40 readonly property string currentUser: userList.currentItem.username
41 readonly property string currentUser: userList.currentItem.username
43+ readonly property alias currentUserIndex: userList.currentIndex
42 signal responded(string response)
45 signal responded(string response)
43 signal selected(int index)
46 signal selected(int index)
44 signal sessionChooserButtonClicked()
47 signal sessionChooserButtonClicked()
@@ -48,6 +51,7 @@ StyledItem {
50 function showError() {
53 function showError() {
54+ promptList.loginError = true;
51 wrongPasswordAnimation.start();
55 wrongPasswordAnimation.start();
@@ -79,6 +83,7 @@ StyledItem {
80 onCurrentIndexChanged: {
84 onCurrentIndexChanged: {
81 userList.currentIndex = currentIndex;
85 userList.currentIndex = currentIndex;
86+ promptList.loginError = false;
84 LoginAreaContainer {
89 LoginAreaContainer {
@@ -93,18 +98,6 @@ StyledItem {
94 height: Math.max(units.gu(15), promptList.height + units.gu(8))
99 height: Math.max(units.gu(15), promptList.height + units.gu(8))
95 Behavior on height { NumberAnimation { duration: root.moveDuration; easing.type: Easing.InOutQuad; } }
100 Behavior on height { NumberAnimation { duration: root.moveDuration; easing.type: Easing.InOutQuad; } }
98− // HACK: Work around https://github.com/ubports/unity8/issues/185
99− text: _realName ? _realName : LightDMService.greeter.authenticationUser
100− visible: userList.count == 1
104− topMargin: units.gu(2)
105− leftMargin: units.gu(2)
110 ListView {
103 ListView {
@@ -115,14 +108,16 @@ StyledItem {
115 anchors.leftMargin: units.gu(2)
108 anchors.leftMargin: units.gu(2)
116 anchors.rightMargin: units.gu(2)
109 anchors.rightMargin: units.gu(2)
118− preferredHighlightBegin: highlightItem.y
111+ preferredHighlightBegin: highlightItem.y + units.gu(1.5)
119− preferredHighlightEnd: highlightItem.y
112+ preferredHighlightEnd: highlightItem.y + units.gu(1.5)
120 highlightRangeMode: ListView.StrictlyEnforceRange
113 highlightRangeMode: ListView.StrictlyEnforceRange
121 highlightMoveDuration: root.moveDuration
114 highlightMoveDuration: root.moveDuration
122 interactive: count > 1
115 interactive: count > 1
124 readonly property bool movingInternally: moveTimer.running || userList.moving
117 readonly property bool movingInternally: moveTimer.running || userList.moving
119+ onMovingChanged: if (!moving) root.selected(currentIndex)
126 onCurrentIndexChanged: {
121 onCurrentIndexChanged: {
127 moveTimer.start();
122 moveTimer.start();
@@ -132,6 +127,7 @@ StyledItem {
132 height: root.cellHeight
127 height: root.cellHeight
134 readonly property bool belowHighlight: (userList.currentIndex < 0 && index > 0) || (userList.currentIndex >= 0 && index > userList.currentIndex)
129 readonly property bool belowHighlight: (userList.currentIndex < 0 && index > 0) || (userList.currentIndex >= 0 && index > userList.currentIndex)
130+ readonly property bool aboveCurrent: (userList.currentIndex > 0 && index < 0) || (userList.currentIndex >= 0 && index < userList.currentIndex)
135 readonly property int belowOffset: root.highlightedHeight - root.cellHeight
131 readonly property int belowOffset: root.highlightedHeight - root.cellHeight
136 readonly property string userSession: session
132 readonly property string userSession: session
137 readonly property string username: name
133 readonly property string username: name
@@ -154,41 +150,75 @@ StyledItem {
154 return 1 - Math.min(1, (Math.abs(highlightDist) + root.cellHeight) / ((root.numAboveBelow + 1) * root.cellHeight))
150 return 1 - Math.min(1, (Math.abs(highlightDist) + root.cellHeight) / ((root.numAboveBelow + 1) * root.cellHeight))
157− FadingLabel {
153+ Row {
158− objectName: "username" + index
154+ spacing: units.gu(1)
159− visible: userList.count != 1 // HACK Hide username label until someone sorts out the anchoring with the keyboard-dismiss animation, Work around https://github.com/ubports/unity8/issues/185
155+// visible: userList.count != 1 // HACK Hide username label until someone sorts out the anchoring with the keyboard-dismiss animation, Work around https://github.com/ubports/unity8/issues/185
161 anchors {
157 anchors {
163 leftMargin: units.gu(2)
158 leftMargin: units.gu(2)
165 rightMargin: units.gu(2)
159 rightMargin: units.gu(2)
160+ horizontalCenter: parent.horizontalCenter
166 bottom: parent.top
161 bottom: parent.top
167 // Add an offset to bottomMargin for any items below the highlight
162 // Add an offset to bottomMargin for any items below the highlight
168− bottomMargin: -(units.gu(4) + (parent.belowHighlight ? parent.belowOffset : 0))
163+ bottomMargin: -(units.gu(4) + (parent.belowHighlight ? parent.belowOffset : parent.aboveCurrent ? -units.gu(5) : 0))
170− text: userList.currentIndex === index
171− && name === "*other"
172− && LightDMService.greeter.authenticationUser !== ""
173− ? LightDMService.greeter.authenticationUser : realName
174− color: userList.currentIndex !== index ? theme.palette.normal.raised
175− : theme.palette.normal.raisedText
177− Component.onCompleted: _realName = realName
179− Behavior on anchors.topMargin { NumberAnimation { duration: root.moveDuration; easing.type: Easing.InOutQuad; } }
181 Rectangle {
166 Rectangle {
182 id: activeIndicator
167 id: activeIndicator
183− anchors.horizontalCenter: parent.left
184− anchors.horizontalCenterOffset: -units.gu(1)
185 anchors.verticalCenter: parent.verticalCenter
168 anchors.verticalCenter: parent.verticalCenter
186− color: userList.currentIndex !== index ? theme.palette.normal.raised
169+ color: theme.palette.normal.raised
187− : theme.palette.normal.focus
188 visible: userList.count > 1 && loggedIn
170 visible: userList.count > 1 && loggedIn
189− height: units.gu(0.5)
171+ height: visible ? units.gu(0.5) : 0
190 width: height
172 width: height
178+ height: userList.currentIndex === index ? units.gu(4.5) : units.gu(3)
180+ color: theme.palette.normal.raisedSecondaryText
181+ anchors.verticalCenter: parent.verticalCenter
185+ anchors.verticalCenter: parent.verticalCenter
186+ spacing: units.gu(0.25)
189+ objectName: "username" + index
191+ text: userList.currentIndex === index
192+ && name === "*other"
193+ && LightDMService.greeter.authenticationUser !== ""
194+ ? LightDMService.greeter.authenticationUser : realName
195+ color: userList.currentIndex !== index ? theme.palette.normal.raised
196+ : theme.palette.normal.raisedSecondaryText
197+ font.weight: userList.currentIndex === index ? Font.Normal : Font.Light
198+ font.pointSize: units.gu(2)
200+ width: highlightItem.width
201+ && contentWidth > highlightItem.width - userIcon.width - units.gu(4)
202+ ? highlightItem.width - userIcon.width - units.gu(4)
205+ Component.onCompleted: _realName = realName
207+ Behavior on anchors.topMargin { NumberAnimation { duration: root.moveDuration; easing.type: Easing.InOutQuad; } }
211+ spacing: units.gu(1)
214+ text: root.alphanumeric ? "Login with password" : "Login with pin"
215+ color: theme.palette.normal.raisedSecondaryText
216+ visible: userList.currentIndex === index && false
217+ font.weight: Font.Light
218+ font.pointSize: units.gu(1.25)
194 MouseArea {
224 MouseArea {
@@ -197,7 +227,7 @@ StyledItem {
197 right: parent.right
227 right: parent.right
198 top: parent.top
228 top: parent.top
199 // Add an offset to topMargin for any items below the highlight
229 // Add an offset to topMargin for any items below the highlight
200− topMargin: parent.belowHighlight ? parent.belowOffset : 0
230+ topMargin: parent.belowHighlight ? parent.belowOffset : parent.aboveCurrent ? -units.gu(5) : 0
202 height: parent.height
232 height: parent.height
203 enabled: userList.currentIndex !== index && parent.opacity > 0
233 enabled: userList.currentIndex !== index && parent.opacity > 0
@@ -217,67 +247,6 @@ StyledItem {
220− // Use an AbstractButton due to icon limitations with Button
223− objectName: "sessionChooserButton"
225− readonly property alias icon: badge.source
227− visible: LightDMService.sessions.count > 1 &&
228− !LightDMService.users.data(userList.currentIndex, LightDMService.userRoles.LoggedInRole)
230− height: units.gu(3.5)
231− width: units.gu(3.5)
233− activeFocusOnTab: true
235− right: highlightItem.right
236− rightMargin: units.gu(2)
238− top: highlightItem.top
239− topMargin: units.gu(1.5)
245− anchors.fill: parent
246− visible: parent.activeFocus
247− color: "transparent"
248− border.color: theme.palette.normal.focus
249− border.width: units.dp(1)
255− anchors.fill: parent
256− anchors.margins: units.dp(3)
257− keyColor: "#ffffff" // icon providers give us white icons
258− color: theme.palette.normal.raisedSecondaryText
259− source: LightDMService.sessions.iconUrl(root.currentSession)
262− Keys.onReturnPressed: {
263− sessionChooserButtonClicked();
264− event.accepted = true;
268− sessionChooserButtonClicked();
271− // Refresh the icon path if looking at different places at runtime
272− // this is mainly for testing
274− target: LightDMService.sessions
275− onIconSearchDirectoriesChanged: {
276− badge.source = LightDMService.sessions.iconUrl(root.currentSession)
281 PromptList {
250 PromptList {
282 id: promptList
251 id: promptList
283 objectName: "promptList"
252 objectName: "promptList"
@@ -288,6 +257,8 @@ StyledItem {
289 width: highlightItem.width - anchors.margins * 2
258 width: highlightItem.width - anchors.margins * 2
291 onClicked: {
262 onClicked: {
292 interactive = false;
263 interactive = false;
293 if (root.locked) {
264 if (root.locked) {