@@ -1,5 +1,5 @@
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2013-2016 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
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
5 * it under the terms of the GNU General Public License as published by
@@ -15,11 +15,12 @@
17import QtQuick 2.4
17import QtQuick 2.4
18+import QtGraphicalEffects 1.0
18import Ubuntu.Components 1.3
19import Ubuntu.Components 1.3
19import "../Components"
20import "../Components"
20import "." 0.1
21import "." 0.1
25 property alias model: userList.model
26 property alias model: userList.model
@@ -29,7 +30,7 @@ Item {
30 readonly property int numAboveBelow: 4
31 readonly property int numAboveBelow: 4
31 readonly property int cellHeight: units.gu(5)
32 readonly property int cellHeight: units.gu(5)
32− readonly property int highlightedHeight: units.gu(10)
33+ readonly property int highlightedHeight: units.gu(15)
33 readonly property int moveDuration: 200
34 readonly property int moveDuration: 200
34 property string selectedSession
35 property string selectedSession
35 property string currentSession: selectedSession ?
36 property string currentSession: selectedSession ?
@@ -66,10 +67,9 @@ Item {
68 function showPrompt(text, isSecret, isDefaultPrompt) {
69 function showPrompt(text, isSecret, isDefaultPrompt) {
69− passwordInput.text = "";
70− passwordInput.promptText = text;
70+ d.promptText = text;
71− passwordInput.enabled = true;
71+ passwordInput.reset();
72− passwordInput.echoMode = isSecret ? TextInput.Password : TextInput.Normal;
72+ passwordInput.isSecret = isSecret;
73 if (wasPrompted) // stay in text field if second prompt
73 if (wasPrompted) // stay in text field if second prompt
74 passwordInput.focus = true;
74 passwordInput.focus = true;
75 wasPrompted = true;
75 wasPrompted = true;
@@ -87,6 +87,16 @@ Item {
87 root.resetAuthentication();
87 root.resetAuthentication();
93+ property string promptText
96+ theme: ThemeSettings {
97+ name: "Ubuntu.Components.Themes.Ambiance"
90 Keys.onEscapePressed: {
100 Keys.onEscapePressed: {
91 selected(currentIndex);
101 selected(currentIndex);
@@ -99,10 +109,14 @@ Item {
99 id: highlightItem
109 id: highlightItem
100 anchors {
110 anchors {
101 left: parent.left
111 left: parent.left
112+ leftMargin: units.gu(2)
102 right: parent.right
113 right: parent.right
114+ rightMargin: units.gu(2)
103 verticalCenter: parent.verticalCenter
115 verticalCenter: parent.verticalCenter
118+ height: root.highlightedHeight
106 z: sessionChooser.visible ? userList.z + 1 : z
120 z: sessionChooser.visible ? userList.z + 1 : z
108 // Use an AbstractButton due to icon limitations with Button
122 // Use an AbstractButton due to icon limitations with Button
@@ -152,6 +166,8 @@ Item {
152 objectName: "userList"
166 objectName: "userList"
154 anchors.fill: parent
168 anchors.fill: parent
169+ anchors.leftMargin: units.gu(2)
170+ anchors.rightMargin: units.gu(2)
156 preferredHighlightBegin: userList.height / 2 - root.highlightedHeight / 2
172 preferredHighlightBegin: userList.height / 2 - root.highlightedHeight / 2
157 preferredHighlightEnd: userList.height / 2 - root.highlightedHeight / 2
173 preferredHighlightEnd: userList.height / 2 - root.highlightedHeight / 2
@@ -198,7 +214,7 @@ Item {
198 return 1 - Math.min(1, (Math.abs(highlightDist) + root.cellHeight) / ((root.numAboveBelow + 1) * root.cellHeight))
214 return 1 - Math.min(1, (Math.abs(highlightDist) + root.cellHeight) / ((root.numAboveBelow + 1) * root.cellHeight))
201− Label {
217+ FadingLabel {
202 objectName: "username" + index
218 objectName: "username" + index
204 anchors {
220 anchors {
@@ -206,13 +222,12 @@ Item {
206 leftMargin: units.gu(2)
222 leftMargin: units.gu(2)
207 right: parent.right
223 right: parent.right
208 rightMargin: units.gu(2)
224 rightMargin: units.gu(2)
209− top: parent.top
225+ bottom: parent.top
210− // Add an offset to topMargin for any items below the highlight
226+ // Add an offset to bottomMargin for any items below the highlight
211− topMargin: units.gu(1) + (parent.belowHighlight ? parent.belowOffset : 0)
227+ bottomMargin: -(units.gu(4) + (parent.belowHighlight ? parent.belowOffset : 0))
213 text: realName
229 text: realName
214− color: "white"
230+ color: userList.currentIndex !== index ? theme.palette.normal.raised : theme.palette.normal.raisedText
215− elide: Text.ElideRight
217 Behavior on anchors.topMargin { NumberAnimation { duration: root.moveDuration; easing.type: Easing.InOutQuad; } }
232 Behavior on anchors.topMargin { NumberAnimation { duration: root.moveDuration; easing.type: Easing.InOutQuad; } }
@@ -243,23 +258,22 @@ Item {
246− Label {
261+ FadingLabel {
247 id: infoLabel
262 id: infoLabel
248 objectName: "infoLabel"
263 objectName: "infoLabel"
249 anchors {
264 anchors {
250 bottom: passwordInput.top
265 bottom: passwordInput.top
251− left: parent.left
266+ left: highlightItem.left
252 topMargin: units.gu(1)
267 topMargin: units.gu(1)
253 bottomMargin: units.gu(1)
268 bottomMargin: units.gu(1)
254 leftMargin: units.gu(2)
269 leftMargin: units.gu(2)
255 rightMargin: units.gu(1)
270 rightMargin: units.gu(1)
258− color: "white"
273+ color: theme.palette.normal.raisedText
259 width: root.width - anchors.leftMargin - anchors.rightMargin
274 width: root.width - anchors.leftMargin - anchors.rightMargin
260 fontSize: "small"
275 fontSize: "small"
261 textFormat: Text.StyledText
276 textFormat: Text.StyledText
264 opacity: (userList.movingInternally || text == "") ? 0 : 1
278 opacity: (userList.movingInternally || text == "") ? 0 : 1
265 Behavior on opacity {
279 Behavior on opacity {
@@ -267,72 +281,36 @@ Item {
270− TextField {
284+ GreeterPrompt {
271 id: passwordInput
285 id: passwordInput
272 objectName: "passwordInput"
286 objectName: "passwordInput"
273 anchors {
287 anchors {
274 bottom: highlightItem.bottom
288 bottom: highlightItem.bottom
275− horizontalCenter: parent.horizontalCenter
289+ horizontalCenter: highlightItem.horizontalCenter
276− margins: units.gu(1)
290+ margins: units.gu(2)
278− height: units.gu(4.5)
279− width: parent.width - anchors.margins * 2
292+ width: highlightItem.width - anchors.margins * 2
280 opacity: userList.movingInternally ? 0 : 1
293 opacity: userList.movingInternally ? 0 : 1
282− inputMethodHints: root.alphanumeric ? Qt.ImhNone : Qt.ImhDigitsOnly
295+ isPrompt: root.wasPrompted
296+ isAlphanumeric: root.alphanumeric
284− property string promptText
285− placeholderText: root.wasPrompted ? promptText
298+ text: root.wasPrompted ? d.promptText
286− : (root.locked ? i18n.tr("Retry")
299+ : (root.locked ? i18n.tr("Retry")
287− : i18n.tr("Tap to unlock"))
300+ : i18n.tr("Log In"))
302+ onClicked: root.tryToUnlock()
303+ onResponded: root.responded(text)
304+ onCanceled: root.selected(currentIndex)
289 Behavior on opacity {
306 Behavior on opacity {
290 NumberAnimation { duration: 100 }
307 NumberAnimation { duration: 100 }
296− root.focus = true; // so that it can handle Escape presses for us
298− root.responded(text);
300− Keys.onEscapePressed: {
301− root.selected(currentIndex);
307− rightMargin: units.gu(2)
308− verticalCenter: parent.verticalCenter
310− visible: !root.wasPrompted
311− source: "graphics/icon_arrow.png"
314 WrongPasswordAnimation {
310 WrongPasswordAnimation {
315 id: wrongPasswordAnimation
311 id: wrongPasswordAnimation
316 target: passwordInput
312 target: passwordInput
320− target: Qt.inputMethod
322− if (!Qt.inputMethod.visible) {
323− passwordInput.focus = false;
331− id: passwordMouseArea
332− objectName: "passwordMouseArea"
333− anchors.fill: passwordInput
334− enabled: !root.wasPrompted
335− onClicked: root.tryToUnlock()
338 function resetAuthentication() {
316 function resetAuthentication() {
@@ -340,10 +318,8 @@ Item {
342 infoLabel.text = "";
320 infoLabel.text = "";
343− passwordInput.promptText = "";
321+ d.promptText = "";
344− passwordInput.text = "";
322+ passwordInput.reset();
345− passwordInput.focus = false;
346− passwordInput.enabled = true;
347 root.wasPrompted = false;
323 root.wasPrompted = false;