@@ -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,10 +15,11 @@
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"
24 property alias model: userList.model
25 property alias model: userList.model
@@ -28,7 +29,7 @@ Item {
29 readonly property int numAboveBelow: 4
30 readonly property int numAboveBelow: 4
30 readonly property int cellHeight: units.gu(5)
31 readonly property int cellHeight: units.gu(5)
31− readonly property int highlightedHeight: units.gu(10)
32+ readonly property int highlightedHeight: units.gu(15)
32 readonly property int moveDuration: 200
33 readonly property int moveDuration: 200
33 readonly property string currentUser: userList.currentItem.username
34 readonly property string currentUser: userList.currentItem.username
34 property bool wasPrompted: false
35 property bool wasPrompted: false
@@ -57,10 +58,9 @@ Item {
59 function showPrompt(text, isSecret, isDefaultPrompt) {
60 function showPrompt(text, isSecret, isDefaultPrompt) {
60− passwordInput.text = "";
61− passwordInput.promptText = text;
61+ d.promptText = text;
62− passwordInput.enabled = true;
62+ passwordInput.reset();
63− passwordInput.echoMode = isSecret ? TextInput.Password : TextInput.Normal;
63+ passwordInput.isSecret = isSecret;
64 if (wasPrompted) // stay in text field if second prompt
64 if (wasPrompted) // stay in text field if second prompt
65 passwordInput.focus = true;
65 passwordInput.focus = true;
66 wasPrompted = true;
66 wasPrompted = true;
@@ -78,6 +78,16 @@ Item {
78 root.resetAuthentication();
78 root.resetAuthentication();
84+ property string promptText
87+ theme: ThemeSettings {
88+ name: "Ubuntu.Components.Themes.Ambiance"
81 Keys.onEscapePressed: {
91 Keys.onEscapePressed: {
82 selected(currentIndex);
92 selected(currentIndex);
@@ -86,19 +96,30 @@ Item {
86 userList.currentIndex = currentIndex;
96 userList.currentIndex = currentIndex;
89− Rectangle {
99+ BorderImage {
102+ topMargin: -units.gu(1)
103+ leftMargin: -units.gu(1.5)
104+ rightMargin: -units.gu(1.5)
105+ bottomMargin: -units.gu(1.5)
107+ source: "../Stages/graphics/dropshadow2gu.sci"
90 id: highlightItem
112 id: highlightItem
91 anchors {
113 anchors {
92 left: parent.left
114 left: parent.left
115+ leftMargin: units.gu(2)
93 right: parent.right
116 right: parent.right
117+ rightMargin: units.gu(2)
94 verticalCenter: parent.verticalCenter
118 verticalCenter: parent.verticalCenter
96 height: root.highlightedHeight
120 height: root.highlightedHeight
97− color: Qt.rgba(0.1, 0.1, 0.1, 0.4)
121+ aspect: UbuntuShape.Flat
98− border.color: Qt.rgba(0.4, 0.4, 0.4, 0.4)
122+ backgroundColor: theme.palette.normal.raised
99− border.width: units.dp(1)
100− radius: units.gu(1.5)
104 ListView {
125 ListView {
@@ -106,6 +127,8 @@ Item {
106 objectName: "userList"
127 objectName: "userList"
108 anchors.fill: parent
129 anchors.fill: parent
130+ anchors.leftMargin: units.gu(2)
131+ anchors.rightMargin: units.gu(2)
110 preferredHighlightBegin: userList.height / 2 - root.highlightedHeight / 2
133 preferredHighlightBegin: userList.height / 2 - root.highlightedHeight / 2
111 preferredHighlightEnd: userList.height / 2 - root.highlightedHeight / 2
134 preferredHighlightEnd: userList.height / 2 - root.highlightedHeight / 2
@@ -151,7 +174,7 @@ Item {
151 return 1 - Math.min(1, (Math.abs(highlightDist) + root.cellHeight) / ((root.numAboveBelow + 1) * root.cellHeight))
174 return 1 - Math.min(1, (Math.abs(highlightDist) + root.cellHeight) / ((root.numAboveBelow + 1) * root.cellHeight))
154− Label {
177+ FadingLabel {
155 objectName: "username" + index
178 objectName: "username" + index
157 anchors {
180 anchors {
@@ -159,13 +182,12 @@ Item {
159 leftMargin: units.gu(2)
182 leftMargin: units.gu(2)
160 right: parent.right
183 right: parent.right
161 rightMargin: units.gu(2)
184 rightMargin: units.gu(2)
162− top: parent.top
185+ bottom: parent.top
163− // Add an offset to topMargin for any items below the highlight
186+ // Add an offset to bottomMargin for any items below the highlight
164− topMargin: units.gu(1) + (parent.belowHighlight ? parent.belowOffset : 0)
187+ bottomMargin: -(units.gu(4) + (parent.belowHighlight ? parent.belowOffset : 0))
166 text: realName
189 text: realName
167− color: "white"
190+ color: userList.currentIndex !== index ? theme.palette.normal.raised : theme.palette.normal.raisedText
168− elide: Text.ElideRight
170 Behavior on anchors.topMargin { NumberAnimation { duration: root.moveDuration; easing.type: Easing.InOutQuad; } }
192 Behavior on anchors.topMargin { NumberAnimation { duration: root.moveDuration; easing.type: Easing.InOutQuad; } }
@@ -196,23 +218,22 @@ Item {
199− Label {
221+ FadingLabel {
200 id: infoLabel
222 id: infoLabel
201 objectName: "infoLabel"
223 objectName: "infoLabel"
202 anchors {
224 anchors {
203 bottom: passwordInput.top
225 bottom: passwordInput.top
204− left: parent.left
226+ left: highlightItem.left
205 topMargin: units.gu(1)
227 topMargin: units.gu(1)
206 bottomMargin: units.gu(1)
228 bottomMargin: units.gu(1)
207 leftMargin: units.gu(2)
229 leftMargin: units.gu(2)
208 rightMargin: units.gu(1)
230 rightMargin: units.gu(1)
211− color: "white"
233+ color: theme.palette.normal.raisedText
212 width: root.width - anchors.leftMargin - anchors.rightMargin
234 width: root.width - anchors.leftMargin - anchors.rightMargin
213 fontSize: "small"
235 fontSize: "small"
214 textFormat: Text.StyledText
236 textFormat: Text.StyledText
217 opacity: (userList.movingInternally || text == "") ? 0 : 1
238 opacity: (userList.movingInternally || text == "") ? 0 : 1
218 Behavior on opacity {
239 Behavior on opacity {
@@ -220,72 +241,36 @@ Item {
223− TextField {
244+ GreeterPrompt {
224 id: passwordInput
245 id: passwordInput
225 objectName: "passwordInput"
246 objectName: "passwordInput"
226 anchors {
247 anchors {
227 bottom: highlightItem.bottom
248 bottom: highlightItem.bottom
228− horizontalCenter: parent.horizontalCenter
249+ horizontalCenter: highlightItem.horizontalCenter
229− margins: units.gu(1)
250+ margins: units.gu(2)
231− height: units.gu(4.5)
232− width: parent.width - anchors.margins * 2
252+ width: highlightItem.width - anchors.margins * 2
233 opacity: userList.movingInternally ? 0 : 1
253 opacity: userList.movingInternally ? 0 : 1
235− inputMethodHints: root.alphanumeric ? Qt.ImhNone : Qt.ImhDigitsOnly
255+ isPrompt: root.wasPrompted
256+ isAlphanumeric: root.alphanumeric
237− property string promptText
238− placeholderText: root.wasPrompted ? promptText
258+ text: root.wasPrompted ? d.promptText
239− : (root.locked ? i18n.tr("Retry")
259+ : (root.locked ? i18n.tr("Retry")
240− : i18n.tr("Tap to unlock"))
260+ : i18n.tr("Log In"))
262+ onClicked: root.tryToUnlock()
263+ onResponded: root.responded(text)
264+ onCanceled: root.selected(currentIndex)
242 Behavior on opacity {
266 Behavior on opacity {
243 NumberAnimation { duration: 100 }
267 NumberAnimation { duration: 100 }
249− root.focus = true; // so that it can handle Escape presses for us
251− root.responded(text);
253− Keys.onEscapePressed: {
254− root.selected(currentIndex);
260− rightMargin: units.gu(2)
261− verticalCenter: parent.verticalCenter
263− visible: !root.wasPrompted
264− source: "graphics/icon_arrow.png"
267 WrongPasswordAnimation {
270 WrongPasswordAnimation {
268 id: wrongPasswordAnimation
271 id: wrongPasswordAnimation
269 target: passwordInput
272 target: passwordInput
273− target: Qt.inputMethod
275− if (!Qt.inputMethod.visible) {
276− passwordInput.focus = false;
284− id: passwordMouseArea
285− objectName: "passwordMouseArea"
286− anchors.fill: passwordInput
287− enabled: !root.wasPrompted
288− onClicked: root.tryToUnlock()
291 function resetAuthentication() {
276 function resetAuthentication() {
@@ -293,10 +278,8 @@ Item {
295 infoLabel.text = "";
280 infoLabel.text = "";
296− passwordInput.promptText = "";
281+ d.promptText = "";
297− passwordInput.text = "";
282+ passwordInput.reset();
298− passwordInput.focus = false;
299− passwordInput.enabled = true;
300 root.wasPrompted = false;
283 root.wasPrompted = false;