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)

Approved by: Albert Astals Cid

commite7d3d6145ddf9ec991305064ec68e0e01855841e authorMichael Terry <michael.terry@canonical.com> dateTue 13 Sep 2016, 06:53 (10 years ago) parent9716255aef642b
3 files changed+32−2
qml/Greeter/LoginList.qml+15−2 tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp+1 tests/qmltests/Greeter/tst_WideView.qml+16
qml/Greeter/LoginList.qml+15−2
@@ -34,7 +34,7 @@ StyledItem {
3434 readonly property int numAboveBelow: 4
3535 readonly property int cellHeight: units.gu(5)
3636 readonly property int highlightedHeight: units.gu(15)
37− readonly property int moveDuration: 200
37+ readonly property int moveDuration: UbuntuAnimation.FastDuration
3838 property string selectedSession
3939 property string currentSession
4040 readonly property string currentUser: userList.currentItem.username
@@ -202,9 +202,22 @@ StyledItem {
202202 bottomMargin: -(units.gu(4) + (parent.belowHighlight ? parent.belowOffset : 0))
203203 }
204204 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
206207
207208 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+ }
208221 }
209222
210223 MouseArea {
tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp+1
@@ -117,6 +117,7 @@ void UsersModelPrivate::resetEntries_full()
117117 { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 },
118118 { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 },
119119 { "empty-name", "", 0, 0, false, false, "ubuntu", 0 },
120+ { "active", "Active Account", 0, 0, true, false, "ubuntu", 0 },
120121 };
121122}
122123
tests/qmltests/Greeter/tst_WideView.qml+16
@@ -430,6 +430,8 @@ StyledItem {
430430 var originalDirectories = LightDM.Sessions.iconSearchDirectories
431431 LightDM.Sessions.iconSearchDirectories = [testIconDirectory]
432432
433+ selectUser("has-password");
434+
433435 // Test the login list icon is valid
434436 var sessionChooserButton = findChild(view, "sessionChooserButton");
435437 compare(sessionChooserButton.visible, true);
@@ -450,6 +452,8 @@ StyledItem {
450452 loader.active = false;
451453 loader.active = true;
452454
455+ selectUser("has-password");
456+
453457 LightDM.Sessions.testScenario = "multipleSessions";
454458 var sessionChooserButton = findChild(view, "sessionChooserButton");
455459 var icon = String(sessionChooserButton.icon);
@@ -486,10 +490,22 @@ StyledItem {
486490 tryCompare(sessionChooserButton, "visible", false);
487491 }
488492
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+
489503 function test_sessionIconShownWithMultipleSessions() {
490504 LightDM.Sessions.testScenario = "multipleSessions"
491505 compare(LightDM.Sessions.count > 1, true);
492506
507+ selectUser("has-password");
508+
493509 var sessionChooserButton = findChild(view, "sessionChooserButton");
494510 tryCompare(sessionChooserButton, "visible", true);
495511 }