on xenial help sign in
Restore full mock and make session list default selection fancier
5198098Josh Arenson
qml/Greeter/SessionsList.qml+14
@@ -28,6 +28,20 @@ Item {
28 signal sessionSelected(string sessionKey)
28 signal sessionSelected(string sessionKey)
29 signal showLoginList()
29 signal showLoginList()
30
30
31+ onInitiallySelectedSessionChanged: {
32+ sessionsList.currentIndex = getSelectedIndex();
33+ sessionsList.positionViewAtIndex(sessionsList.currentIndex, ListView.Contain);
34+ }
35+
36+ function getSelectedIndex() {
37+ for (var i = 0; i < sessionsList.model.count; i++) {
38+ var key = sessionsList.model.get(i).key
39+ if (key === initiallySelectedSession) {
40+ return i;
41+ }
42+ }
43+ }
44+
31 LoginAreaContainer {
45 LoginAreaContainer {
32 readonly property real margins: sessionsList.anchors.margins
46 readonly property real margins: sessionsList.anchors.margins
33 readonly property real prefferedHeight: {
47 readonly property real prefferedHeight: {
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp+5−5
@@ -47,16 +47,16 @@ void SessionsModelPrivate::resetEntries_multipleSessions()
47 sessionItems =
47 sessionItems =
48 {
48 {
49 {"ubuntu", "", "Ubuntu", ""},
49 {"ubuntu", "", "Ubuntu", ""},
50− {"ubuntu-2d", "", "Ubuntu 2D", ""}
50+ {"ubuntu-2d", "", "Ubuntu 2D", ""},
51− /*{"gnome", "", "GNOME", ""},
51+ {"gnome", "", "GNOME", ""},
52− //{"gnome-classic", "", "GNOME Classic", ""},
52+ {"gnome-classic", "", "GNOME Classic", ""},
53− //{"gnome-flashback-compiz", "", "GNOME Flashback (Compiz)", ""},
53+ {"gnome-flashback-compiz", "", "GNOME Flashback (Compiz)", ""},
54 {"gnome-flashback-metacity", "", "GNOME Flashback (Metacity)", ""},
54 {"gnome-flashback-metacity", "", "GNOME Flashback (Metacity)", ""},
55 {"gnome-wayland", "", "GNOME on Wayland", ""},
55 {"gnome-wayland", "", "GNOME on Wayland", ""},
56 {"plasma", "", "Plasma", ""},
56 {"plasma", "", "Plasma", ""},
57 {"kde", "", "KDE" , ""},
57 {"kde", "", "KDE" , ""},
58 {"xterm", "", "Recovery Console", ""},
58 {"xterm", "", "Recovery Console", ""},
59− {"", "", "Unknown?", ""}*/
59+ {"", "", "Unknown?", ""}
60 };
60 };
61}
61}
62
62