on xenial help sign in
Add an indicator to the greeter when a user is logged in (only shown if we have more than one user)
e7d3d61Michael Terry
qml/Greeter/LoginList.qml+15−2
@@ -34,7 +34,7 @@ StyledItem {
34 readonly property int numAboveBelow: 4
34 readonly property int numAboveBelow: 4
35 readonly property int cellHeight: units.gu(5)
35 readonly property int cellHeight: units.gu(5)
36 readonly property int highlightedHeight: units.gu(15)
36 readonly property int highlightedHeight: units.gu(15)
37− readonly property int moveDuration: 200
37+ readonly property int moveDuration: UbuntuAnimation.FastDuration
38 property string selectedSession
38 property string selectedSession
39 property string currentSession
39 property string currentSession
40 readonly property string currentUser: userList.currentItem.username
40 readonly property string currentUser: userList.currentItem.username
@@ -202,9 +202,22 @@ StyledItem {
202 bottomMargin: -(units.gu(4) + (parent.belowHighlight ? parent.belowOffset : 0))
202 bottomMargin: -(units.gu(4) + (parent.belowHighlight ? parent.belowOffset : 0))
203 }
203 }
204 text: realName
204 text: realName
205− color: userList.currentIndex !== index ? theme.palette.normal.raised : theme.palette.normal.raisedText
205+ color: userList.currentIndex !== index ? theme.palette.normal.raised
206+ : theme.palette.normal.raisedText
206
207
207 Behavior on anchors.topMargin { NumberAnimation { duration: root.moveDuration; easing.type: Easing.InOutQuad; } }
208 Behavior on anchors.topMargin { NumberAnimation { duration: root.moveDuration; easing.type: Easing.InOutQuad; } }
209+
210+ Rectangle {
211+ id: activeIndicator
212+ anchors.horizontalCenter: parent.left
213+ anchors.horizontalCenterOffset: -units.gu(1)
214+ anchors.verticalCenter: parent.verticalCenter
215+ color: userList.currentIndex !== index ? theme.palette.normal.raised
216+ : theme.palette.normal.focus
217+ visible: userList.count > 1 && loggedIn
218+ height: units.gu(0.5)
219+ width: height
220+ }
208 }
221 }
209
222
210 MouseArea {
223 MouseArea {
tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp+1
@@ -117,6 +117,7 @@ void UsersModelPrivate::resetEntries_full()
117 { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 },
117 { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 },
118 { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 },
118 { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 },
119 { "empty-name", "", 0, 0, false, false, "ubuntu", 0 },
119 { "empty-name", "", 0, 0, false, false, "ubuntu", 0 },
120+ { "active", "Active Account", 0, 0, true, false, "ubuntu", 0 },
120 };
121 };
121}
122}
122
123
tests/qmltests/Greeter/tst_WideView.qml+16
@@ -430,6 +430,8 @@ StyledItem {
430 var originalDirectories = LightDM.Sessions.iconSearchDirectories
430 var originalDirectories = LightDM.Sessions.iconSearchDirectories
431 LightDM.Sessions.iconSearchDirectories = [testIconDirectory]
431 LightDM.Sessions.iconSearchDirectories = [testIconDirectory]
432
432
433+ selectUser("has-password");
434+
433 // Test the login list icon is valid
435 // Test the login list icon is valid
434 var sessionChooserButton = findChild(view, "sessionChooserButton");
436 var sessionChooserButton = findChild(view, "sessionChooserButton");
435 compare(sessionChooserButton.visible, true);
437 compare(sessionChooserButton.visible, true);
@@ -450,6 +452,8 @@ StyledItem {
450 loader.active = false;
452 loader.active = false;
451 loader.active = true;
453 loader.active = true;
452
454
455+ selectUser("has-password");
456+
453 LightDM.Sessions.testScenario = "multipleSessions";
457 LightDM.Sessions.testScenario = "multipleSessions";
454 var sessionChooserButton = findChild(view, "sessionChooserButton");
458 var sessionChooserButton = findChild(view, "sessionChooserButton");
455 var icon = String(sessionChooserButton.icon);
459 var icon = String(sessionChooserButton.icon);
@@ -486,10 +490,22 @@ StyledItem {
486 tryCompare(sessionChooserButton, "visible", false);
490 tryCompare(sessionChooserButton, "visible", false);
487 }
491 }
488
492
493+ function test_sessionIconNotShownWithActiveUser() {
494+ LightDM.Sessions.testScenario = "multipleSessions";
495+ compare(LightDM.Sessions.count > 1, true);
496+
497+ selectUser("active");
498+
499+ var sessionChooserButton = findChild(view, "sessionChooserButton");
500+ tryCompare(sessionChooserButton, "visible", false);
501+ }
502+
489 function test_sessionIconShownWithMultipleSessions() {
503 function test_sessionIconShownWithMultipleSessions() {
490 LightDM.Sessions.testScenario = "multipleSessions"
504 LightDM.Sessions.testScenario = "multipleSessions"
491 compare(LightDM.Sessions.count > 1, true);
505 compare(LightDM.Sessions.count > 1, true);
492
506
507+ selectUser("has-password");
508+
493 var sessionChooserButton = findChild(view, "sessionChooserButton");
509 var sessionChooserButton = findChild(view, "sessionChooserButton");
494 tryCompare(sessionChooserButton, "visible", true);
510 tryCompare(sessionChooserButton, "visible", true);
495 }
511 }