27
27
property alias model: userList.model
28
property bool alphanumeric: true
28
property alias alphanumeric: promptList.alphanumeric
29
29
property int currentIndex
30
30
property bool locked
31
31
property bool waiting
32
32
property alias boxVerticalOffset: highlightItem.y
34
readonly property alias passwordInput: passwordInput
35
34
readonly property int numAboveBelow: 4
36
35
readonly property int cellHeight: units.gu(5)
37
readonly property int highlightedHeight: units.gu(15)
36
readonly property int highlightedHeight: highlightItem.height
38
37
readonly property int moveDuration: UbuntuAnimation.FastDuration
39
property string selectedSession
40
38
property string currentSession
41
39
readonly property string currentUser: userList.currentItem.username
42
property bool wasPrompted: false
44
signal loginListSessionChanged(string session)
45
41
signal responded(string response)
46
42
signal selected(int index)
47
43
signal sessionChooserButtonClicked()
49
45
function tryToUnlock() {
51
passwordInput.forceActiveFocus();
54
root.selected(currentIndex);
61
function showMessage(html) {
62
if (infoLabel.text === "") {
63
infoLabel.text = html;
65
infoLabel.text += "<br>" + html;
69
function showPrompt(text, isSecret, isDefaultPrompt) {
70
passwordInput.text = isDefaultPrompt ? alphanumeric ? i18n.tr("Passphrase")
73
passwordInput.isPrompt = true;
74
passwordInput.isSecret = isSecret;
75
passwordInput.reset();
46
promptList.forceActiveFocus();
79
49
function showError() {
80
50
wrongPasswordAnimation.start();
81
root.resetAuthentication();
85
root.resetAuthentication();
88
53
function showFakePassword() {
89
passwordInput.showFakePassword();
95
function checkIfPromptless() {
96
if (!waiting && !wasPrompted) {
97
passwordInput.isPrompt = false;
98
passwordInput.text = root.locked ? i18n.tr("Retry")
104
onWaitingChanged: d.checkIfPromptless()
105
onLockedChanged: d.checkIfPromptless()
54
promptList.interactive = false;
55
promptList.showFakePassword();
107
58
theme: ThemeSettings {
108
59
name: "Ubuntu.Components.Themes.Ambiance"
111
62
Keys.onUpPressed: {
112
selected(currentIndex - 1);
63
if (currentIndex > 0) {
64
selected(currentIndex - 1);
113
66
event.accepted = true;
115
68
Keys.onDownPressed: {
116
selected(currentIndex + 1);
69
if (currentIndex + 1 < model.count) {
70
selected(currentIndex + 1);
117
72
event.accepted = true;
119
74
Keys.onEscapePressed: {
203
153
// Add an offset to bottomMargin for any items below the highlight
204
154
bottomMargin: -(units.gu(4) + (parent.belowHighlight ? parent.belowOffset : 0))
156
text: userList.currentIndex === index
158
&& LightDMService.greeter.authenticationUser !== ""
159
? LightDMService.greeter.authenticationUser : realName
207
160
color: userList.currentIndex !== index ? theme.palette.normal.raised
208
161
: theme.palette.normal.raisedText
314
objectName: "infoLabel"
316
bottom: passwordInput.top
317
left: highlightItem.left
318
topMargin: units.gu(1)
319
bottomMargin: units.gu(1)
320
leftMargin: units.gu(2)
321
rightMargin: units.gu(1)
324
color: theme.palette.normal.raisedText
325
width: root.width - anchors.leftMargin - anchors.rightMargin
327
textFormat: Text.StyledText
329
opacity: (userList.movingInternally || text == "") ? 0 : 1
330
Behavior on opacity {
331
NumberAnimation { duration: 100 }
337
objectName: "passwordInput"
267
objectName: "promptList"
339
269
bottom: highlightItem.bottom
340
270
horizontalCenter: highlightItem.horizontalCenter
341
271
margins: units.gu(2)
343
273
width: highlightItem.width - anchors.margins * 2
344
opacity: userList.movingInternally ? 0 : 1
346
activeFocusOnTab: true
347
isAlphanumeric: root.alphanumeric
349
onClicked: root.tryToUnlock()
350
onResponded: root.responded(text)
351
onCanceled: root.selected(currentIndex)
353
Behavior on opacity {
354
NumberAnimation { duration: 100 }
357
WrongPasswordAnimation {
358
id: wrongPasswordAnimation
359
objectName: "wrongPasswordAnimation"
360
target: passwordInput
278
root.selected(currentIndex);
285
root.responded(text);
289
root.selected(currentIndex);
293
target: LightDMService.prompts
294
onModelReset: promptList.interactive = true
364
function resetAuthentication() {
365
if (!userList.currentItem) {
369
passwordInput.reset();
370
root.wasPrompted = false;
298
WrongPasswordAnimation {
299
id: wrongPasswordAnimation
300
objectName: "wrongPasswordAnimation"