on xenial help sign in
Merge prereq
commit4ca0494d37ff9153622fb640bf0161461085dd90 authorJosh Arenson <joshua.arenson@canonical.com> dateWed 15 Jun 2016, 08:58 (10 years ago) parent06f925757caacc
16 files changed+149−605
data/unity8-greeter-wrapper+1−1 plugins/LightDM/FullLightDM/FullLightDM.qmltypes−286 plugins/LightDM/IntegratedLightDM/CMakeLists.txt+1−2 plugins/LightDM/IntegratedLightDM/IntegratedLightDM.qmltypes−271 plugins/LightDM/IntegratedLightDM/QLightDM/Greeter+17 plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel+17 plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel+17 plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp+2 plugins/LightDM/SessionsModel.cpp+33−2 qml/Greeter/Greeter.qml+1−3 tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp+2 tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp+12−5 tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h+1−1 tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp+22−22 tests/plugins/LightDM/IntegratedLightDM/sessionsmodel.cpp+19 tests/qmltests/tst_Shell.qml+4−12
data/unity8-greeter-wrapper+1−1
@@ -62,7 +62,7 @@ set_greeter_var PA_DISABLED 1
6262# creates for them and don't want to start all the services that a normal
6363# session would. So it's inconvenient to live within an upstart session.
6464# But... we still want to use Upstart for some services. So launch here.
65−USC_SOCKET=$MIR_SOCKET MIR_SOCKET=$SUB_SOCKET $TOUCH_WRAPPER /sbin/upstart --user --no-startup-event &
65+MIR_SOCKET=$SUB_SOCKET $TOUCH_WRAPPER /sbin/upstart --user --no-startup-event &
6666INIT_PID=$!
6767while [ ! -e "$XDG_RUNTIME_DIR/upstart/sessions/$INIT_PID.session" ]; do sleep 0.1; done
6868export UPSTART_SESSION=$(/sbin/initctl list-sessions | grep "^$INIT_PID " | cut -d' ' -f2)
plugins/LightDM/FullLightDM/FullLightDM.qmltypesdeleted−286
@@ -1,286 +0,0 @@
1−import QtQuick.tooling 1.1
2−
3−// This file describes the plugin-supplied types contained in the library.
4−// It is used for QML tooling purposes only.
5−//
6−// This file was auto-generated by:
7−// 'qmlplugindump -notrelocatable FullLightDM 0.1 plugins'
8−
9−Module {
10− Component {
11− name: "QAbstractProxyModel"
12− prototype: "QAbstractItemModel"
13− Property { name: "sourceModel"; type: "QAbstractItemModel"; isPointer: true }
14− }
15− Component {
16− name: "QLightDM::Greeter"
17− prototype: "QObject"
18− exports: ["FullLightDM/Greeter 0.1"]
19− isCreatable: false
20− isSingleton: true
21− exportMetaObjectRevisions: [0]
22− Enum {
23− name: "PromptType"
24− values: {
25− "PromptTypeQuestion": 0,
26− "PromptTypeSecret": 1
27− }
28− }
29− Enum {
30− name: "MessageType"
31− values: {
32− "MessageTypeInfo": 0,
33− "MessageTypeError": 1
34− }
35− }
36− Property { name: "authenticated"; type: "bool"; isReadonly: true }
37− Property { name: "authenticationUser"; type: "string"; isReadonly: true }
38− Property { name: "defaultSession"; type: "string"; isReadonly: true }
39− Property { name: "selectUser"; type: "string"; isReadonly: true }
40− Property { name: "selectGuest"; type: "bool"; isReadonly: true }
41− Property { name: "hostname"; type: "string"; isReadonly: true }
42− Property { name: "hasGuestAccount"; type: "bool"; isReadonly: true }
43− Property { name: "locked"; type: "bool"; isReadonly: true }
44− Property { name: "hostname"; type: "string"; isReadonly: true }
45− Signal {
46− name: "showMessage"
47− Parameter { name: "text"; type: "string" }
48− Parameter { name: "type"; type: "QLightDM::Greeter::MessageType" }
49− }
50− Signal {
51− name: "showPrompt"
52− Parameter { name: "text"; type: "string" }
53− Parameter { name: "type"; type: "QLightDM::Greeter::PromptType" }
54− }
55− Signal { name: "authenticationComplete" }
56− Signal { name: "autologinTimerExpired" }
57− Signal { name: "idle" }
58− Signal { name: "reset" }
59− Method { name: "connectToDaemonSync"; type: "bool" }
60− Method { name: "connectSync"; type: "bool" }
61− Method {
62− name: "authenticate"
63− Parameter { name: "username"; type: "string" }
64− }
65− Method { name: "authenticate" }
66− Method { name: "authenticateAsGuest" }
67− Method { name: "authenticateAutologin" }
68− Method {
69− name: "authenticateRemote"
70− Parameter { name: "session"; type: "string" }
71− Parameter { name: "username"; type: "string" }
72− }
73− Method {
74− name: "authenticateRemote"
75− Parameter { name: "session"; type: "string" }
76− }
77− Method { name: "authenticateRemote" }
78− Method {
79− name: "respond"
80− Parameter { name: "response"; type: "string" }
81− }
82− Method { name: "cancelAuthentication" }
83− Method { name: "cancelAutologin" }
84− Method {
85− name: "setLanguage"
86− Parameter { name: "language"; type: "string" }
87− }
88− Method {
89− name: "setResettable"
90− Parameter { name: "resettable"; type: "bool" }
91− }
92− Method {
93− name: "startSessionSync"
94− type: "bool"
95− Parameter { name: "session"; type: "string" }
96− }
97− Method { name: "startSessionSync"; type: "bool" }
98− Method {
99− name: "ensureSharedDataDirSync"
100− type: "string"
101− Parameter { name: "username"; type: "string" }
102− }
103− }
104− Component {
105− name: "QLightDM::UsersModel"
106− prototype: "QAbstractListModel"
107− exports: ["FullLightDM/UserRoles 0.1"]
108− isCreatable: false
109− exportMetaObjectRevisions: [0]
110− Enum {
111− name: "UserModelRoles"
112− values: {
113− "NameRole": 256,
114− "RealNameRole": 257,
115− "LoggedInRole": 258,
116− "BackgroundRole": 259,
117− "SessionRole": 260,
118− "HasMessagesRole": 261,
119− "ImagePathRole": 262,
120− "BackgroundPathRole": 263,
121− "UidRole": 264
122− }
123− }
124− }
125− Component {
126− name: "QSortFilterProxyModel"
127− prototype: "QAbstractProxyModel"
128− Property { name: "filterRegExp"; type: "QRegExp" }
129− Property { name: "filterKeyColumn"; type: "int" }
130− Property { name: "dynamicSortFilter"; type: "bool" }
131− Property { name: "filterCaseSensitivity"; type: "Qt::CaseSensitivity" }
132− Property { name: "sortCaseSensitivity"; type: "Qt::CaseSensitivity" }
133− Property { name: "isSortLocaleAware"; type: "bool" }
134− Property { name: "sortRole"; type: "int" }
135− Property { name: "filterRole"; type: "int" }
136− Method {
137− name: "setFilterRegExp"
138− Parameter { name: "pattern"; type: "string" }
139− }
140− Method {
141− name: "setFilterWildcard"
142− Parameter { name: "pattern"; type: "string" }
143− }
144− Method {
145− name: "setFilterFixedString"
146− Parameter { name: "pattern"; type: "string" }
147− }
148− Method { name: "clear" }
149− Method { name: "invalidate" }
150− }
151− Component {
152− name: "UnitySortFilterProxyModelQML"
153− prototype: "QSortFilterProxyModel"
154− Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
155− Property { name: "totalCount"; type: "int"; isReadonly: true }
156− Property { name: "count"; type: "int"; isReadonly: true }
157− Property { name: "invertMatch"; type: "bool" }
158− Signal {
159− name: "invertMatchChanged"
160− Parameter { type: "bool" }
161− }
162− Method {
163− name: "get"
164− type: "QVariantMap"
165− Parameter { name: "row"; type: "int" }
166− }
167− Method {
168− name: "data"
169− type: "QVariant"
170− Parameter { name: "row"; type: "int" }
171− Parameter { name: "role"; type: "int" }
172− }
173− Method { name: "count"; type: "int" }
174− Method {
175− name: "findFirst"
176− type: "int"
177− Parameter { name: "role"; type: "int" }
178− Parameter { name: "value"; type: "QVariant" }
179− }
180− Method {
181− name: "mapRowToSource"
182− type: "int"
183− Parameter { name: "row"; type: "int" }
184− }
185− Method {
186− name: "mapFromSource"
187− type: "int"
188− Parameter { name: "row"; type: "int" }
189− }
190− Method {
191− name: "mapToSource"
192− type: "int"
193− Parameter { name: "row"; type: "int" }
194− }
195− }
196− Component {
197− name: "UserMetricsOutput::ColorTheme"
198− prototype: "QObject"
199− Property { name: "start"; type: "QColor"; isReadonly: true }
200− Property { name: "main"; type: "QColor"; isReadonly: true }
201− Property { name: "end"; type: "QColor"; isReadonly: true }
202− Signal {
203− name: "startChanged"
204− Parameter { name: "color"; type: "QColor" }
205− }
206− Signal {
207− name: "mainChanged"
208− Parameter { name: "color"; type: "QColor" }
209− }
210− Signal {
211− name: "endChanged"
212− Parameter { name: "color"; type: "QColor" }
213− }
214− }
215− Component {
216− name: "UserMetricsOutput::UserMetrics"
217− prototype: "QObject"
218− exports: ["FullLightDM/Infographic 0.1"]
219− isCreatable: false
220− isSingleton: true
221− exportMetaObjectRevisions: [0]
222− Property { name: "label"; type: "string"; isReadonly: true }
223− Property { name: "username"; type: "string" }
224− Property {
225− name: "firstColor"
226− type: "UserMetricsOutput::ColorTheme"
227− isReadonly: true
228− isPointer: true
229− }
230− Property {
231− name: "secondColor"
232− type: "UserMetricsOutput::ColorTheme"
233− isReadonly: true
234− isPointer: true
235− }
236− Property { name: "firstMonth"; type: "QAbstractItemModel"; isReadonly: true; isPointer: true }
237− Property { name: "secondMonth"; type: "QAbstractItemModel"; isReadonly: true; isPointer: true }
238− Property { name: "currentDay"; type: "int"; isReadonly: true }
239− Signal {
240− name: "labelChanged"
241− Parameter { name: "label"; type: "string" }
242− }
243− Signal {
244− name: "usernameChanged"
245− Parameter { name: "username"; type: "string" }
246− }
247− Signal {
248− name: "firstColorChanged"
249− Parameter { name: "color"; type: "ColorTheme"; isPointer: true }
250− }
251− Signal {
252− name: "firstMonthChanged"
253− Parameter { name: "firstMonth"; type: "QAbstractItemModel"; isPointer: true }
254− }
255− Signal {
256− name: "currentDayChanged"
257− Parameter { name: "currentDay"; type: "int" }
258− }
259− Signal {
260− name: "secondColorChanged"
261− Parameter { name: "color"; type: "ColorTheme"; isPointer: true }
262− }
263− Signal {
264− name: "secondMonthChanged"
265− Parameter { name: "secondMonth"; type: "QAbstractItemModel"; isPointer: true }
266− }
267− Signal { name: "nextDataSource" }
268− Signal { name: "readyForDataChange" }
269− Signal { name: "dataAboutToAppear" }
270− Signal { name: "dataAppeared" }
271− Signal { name: "dataAboutToChange" }
272− Signal { name: "dataChanged" }
273− Signal { name: "dataAboutToDisappear" }
274− Signal { name: "dataDisappeared" }
275− Method { name: "nextDataSourceSlot" }
276− Method { name: "readyForDataChangeSlot" }
277− }
278− Component {
279− name: "UsersModel"
280− prototype: "UnitySortFilterProxyModelQML"
281− exports: ["FullLightDM/Users 0.1"]
282− isCreatable: false
283− isSingleton: true
284− exportMetaObjectRevisions: [0]
285− }
286−}
plugins/LightDM/IntegratedLightDM/CMakeLists.txt+1−2
@@ -7,8 +7,7 @@ foreach(include_directory ${QMLPLUGIN_INCLUDES})
77endforeach()
88
99include_directories(
10− ../
11− ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
10+ . #QLightDM
1211 )
1312
1413foreach(source_file ${QMLPLUGIN_SRC})
plugins/LightDM/IntegratedLightDM/IntegratedLightDM.qmltypesdeleted−271
@@ -1,271 +0,0 @@
1−import QtQuick.tooling 1.1
2−
3−// This file describes the plugin-supplied types contained in the library.
4−// It is used for QML tooling purposes only.
5−//
6−// This file was auto-generated by:
7−// 'qmlplugindump -notrelocatable IntegratedLightDM 0.1 plugins'
8−
9−Module {
10− Component {
11− name: "QAbstractProxyModel"
12− prototype: "QAbstractItemModel"
13− Property { name: "sourceModel"; type: "QAbstractItemModel"; isPointer: true }
14− }
15− Component {
16− name: "QLightDM::Greeter"
17− prototype: "QObject"
18− exports: ["IntegratedLightDM/Greeter 0.1"]
19− isCreatable: false
20− isSingleton: true
21− exportMetaObjectRevisions: [0]
22− Enum {
23− name: "PromptType"
24− values: {
25− "PromptTypeQuestion": 0,
26− "PromptTypeSecret": 1
27− }
28− }
29− Enum {
30− name: "MessageType"
31− values: {
32− "MessageTypeInfo": 0,
33− "MessageTypeError": 1
34− }
35− }
36− Property { name: "authenticated"; type: "bool"; isReadonly: true }
37− Property { name: "authenticationUser"; type: "string"; isReadonly: true }
38− Property { name: "defaultSession"; type: "string"; isReadonly: true }
39− Property { name: "selectUser"; type: "string"; isReadonly: true }
40− Property { name: "selectGuest"; type: "bool"; isReadonly: true }
41− Property { name: "hostname"; type: "string"; isReadonly: true }
42− Property { name: "hasGuestAccount"; type: "bool"; isReadonly: true }
43− Property { name: "locked"; type: "bool"; isReadonly: true }
44− Signal {
45− name: "showMessage"
46− Parameter { name: "text"; type: "string" }
47− Parameter { name: "type"; type: "QLightDM::Greeter::MessageType" }
48− }
49− Signal {
50− name: "showPrompt"
51− Parameter { name: "text"; type: "string" }
52− Parameter { name: "type"; type: "QLightDM::Greeter::PromptType" }
53− }
54− Signal { name: "authenticationComplete" }
55− Signal { name: "autologinTimerExpired" }
56− Method { name: "connectSync"; type: "bool" }
57− Method {
58− name: "authenticate"
59− Parameter { name: "username"; type: "string" }
60− }
61− Method { name: "authenticate" }
62− Method { name: "authenticateAsGuest" }
63− Method { name: "authenticateAutologin" }
64− Method {
65− name: "authenticateRemote"
66− Parameter { name: "session"; type: "string" }
67− Parameter { name: "username"; type: "string" }
68− }
69− Method {
70− name: "authenticateRemote"
71− Parameter { name: "session"; type: "string" }
72− }
73− Method { name: "authenticateRemote" }
74− Method {
75− name: "respond"
76− Parameter { name: "response"; type: "string" }
77− }
78− Method { name: "cancelAuthentication" }
79− Method {
80− name: "setLanguage"
81− Parameter { name: "language"; type: "string" }
82− }
83− Method {
84− name: "startSessionSync"
85− type: "bool"
86− Parameter { name: "session"; type: "string" }
87− }
88− Method { name: "startSessionSync"; type: "bool" }
89− }
90− Component {
91− name: "QLightDM::UsersModel"
92− prototype: "QAbstractListModel"
93− exports: ["IntegratedLightDM/UserRoles 0.1"]
94− isCreatable: false
95− exportMetaObjectRevisions: [0]
96− Enum {
97− name: "UserModelRoles"
98− values: {
99− "NameRole": 256,
100− "RealNameRole": 257,
101− "LoggedInRole": 258,
102− "BackgroundRole": 259,
103− "SessionRole": 260,
104− "HasMessagesRole": 261,
105− "ImagePathRole": 262,
106− "BackgroundPathRole": 263
107− }
108− }
109− }
110− Component {
111− name: "QSortFilterProxyModel"
112− prototype: "QAbstractProxyModel"
113− Property { name: "filterRegExp"; type: "QRegExp" }
114− Property { name: "filterKeyColumn"; type: "int" }
115− Property { name: "dynamicSortFilter"; type: "bool" }
116− Property { name: "filterCaseSensitivity"; type: "Qt::CaseSensitivity" }
117− Property { name: "sortCaseSensitivity"; type: "Qt::CaseSensitivity" }
118− Property { name: "isSortLocaleAware"; type: "bool" }
119− Property { name: "sortRole"; type: "int" }
120− Property { name: "filterRole"; type: "int" }
121− Method {
122− name: "setFilterRegExp"
123− Parameter { name: "pattern"; type: "string" }
124− }
125− Method {
126− name: "setFilterWildcard"
127− Parameter { name: "pattern"; type: "string" }
128− }
129− Method {
130− name: "setFilterFixedString"
131− Parameter { name: "pattern"; type: "string" }
132− }
133− Method { name: "clear" }
134− Method { name: "invalidate" }
135− }
136− Component {
137− name: "UnitySortFilterProxyModelQML"
138− prototype: "QSortFilterProxyModel"
139− Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
140− Property { name: "totalCount"; type: "int"; isReadonly: true }
141− Property { name: "count"; type: "int"; isReadonly: true }
142− Property { name: "invertMatch"; type: "bool" }
143− Signal {
144− name: "invertMatchChanged"
145− Parameter { type: "bool" }
146− }
147− Method {
148− name: "get"
149− type: "QVariantMap"
150− Parameter { name: "row"; type: "int" }
151− }
152− Method {
153− name: "data"
154− type: "QVariant"
155− Parameter { name: "row"; type: "int" }
156− Parameter { name: "role"; type: "int" }
157− }
158− Method { name: "count"; type: "int" }
159− Method {
160− name: "findFirst"
161− type: "int"
162− Parameter { name: "role"; type: "int" }
163− Parameter { name: "value"; type: "QVariant" }
164− }
165− Method {
166− name: "mapRowToSource"
167− type: "int"
168− Parameter { name: "row"; type: "int" }
169− }
170− Method {
171− name: "mapFromSource"
172− type: "int"
173− Parameter { name: "row"; type: "int" }
174− }
175− Method {
176− name: "mapToSource"
177− type: "int"
178− Parameter { name: "row"; type: "int" }
179− }
180− }
181− Component {
182− name: "UserMetricsOutput::ColorTheme"
183− prototype: "QObject"
184− Property { name: "start"; type: "QColor"; isReadonly: true }
185− Property { name: "main"; type: "QColor"; isReadonly: true }
186− Property { name: "end"; type: "QColor"; isReadonly: true }
187− Signal {
188− name: "startChanged"
189− Parameter { name: "color"; type: "QColor" }
190− }
191− Signal {
192− name: "mainChanged"
193− Parameter { name: "color"; type: "QColor" }
194− }
195− Signal {
196− name: "endChanged"
197− Parameter { name: "color"; type: "QColor" }
198− }
199− }
200− Component {
201− name: "UserMetricsOutput::UserMetrics"
202− prototype: "QObject"
203− exports: ["IntegratedLightDM/Infographic 0.1"]
204− isCreatable: false
205− isSingleton: true
206− exportMetaObjectRevisions: [0]
207− Property { name: "label"; type: "string"; isReadonly: true }
208− Property { name: "username"; type: "string" }
209− Property {
210− name: "firstColor"
211− type: "UserMetricsOutput::ColorTheme"
212− isReadonly: true
213− isPointer: true
214− }
215− Property {
216− name: "secondColor"
217− type: "UserMetricsOutput::ColorTheme"
218− isReadonly: true
219− isPointer: true
220− }
221− Property { name: "firstMonth"; type: "QAbstractItemModel"; isReadonly: true; isPointer: true }
222− Property { name: "secondMonth"; type: "QAbstractItemModel"; isReadonly: true; isPointer: true }
223− Property { name: "currentDay"; type: "int"; isReadonly: true }
224− Signal {
225− name: "labelChanged"
226− Parameter { name: "label"; type: "string" }
227− }
228− Signal {
229− name: "usernameChanged"
230− Parameter { name: "username"; type: "string" }
231− }
232− Signal {
233− name: "firstColorChanged"
234− Parameter { name: "color"; type: "ColorTheme"; isPointer: true }
235− }
236− Signal {
237− name: "firstMonthChanged"
238− Parameter { name: "firstMonth"; type: "QAbstractItemModel"; isPointer: true }
239− }
240− Signal {
241− name: "currentDayChanged"
242− Parameter { name: "currentDay"; type: "int" }
243− }
244− Signal {
245− name: "secondColorChanged"
246− Parameter { name: "color"; type: "ColorTheme"; isPointer: true }
247− }
248− Signal {
249− name: "secondMonthChanged"
250− Parameter { name: "secondMonth"; type: "QAbstractItemModel"; isPointer: true }
251− }
252− Signal { name: "nextDataSource" }
253− Signal { name: "readyForDataChange" }
254− Signal { name: "dataAboutToAppear" }
255− Signal { name: "dataAppeared" }
256− Signal { name: "dataAboutToChange" }
257− Signal { name: "dataChanged" }
258− Signal { name: "dataAboutToDisappear" }
259− Signal { name: "dataDisappeared" }
260− Method { name: "nextDataSourceSlot" }
261− Method { name: "readyForDataChangeSlot" }
262− }
263− Component {
264− name: "UsersModel"
265− prototype: "UnitySortFilterProxyModelQML"
266− exports: ["IntegratedLightDM/Users 0.1"]
267− isCreatable: false
268− isSingleton: true
269− exportMetaObjectRevisions: [0]
270− }
271−}
plugins/LightDM/IntegratedLightDM/QLightDM/Greeternew file+17
@@ -0,0 +1,17 @@
1+/*
2+ * Copyright (C) 2016 Canonical, Ltd.
3+ *
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
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#include "../liblightdm/Greeter.h"
plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModelnew file+17
@@ -0,0 +1,17 @@
1+/*
2+ * Copyright (C) 2016 Canonical, Ltd.
3+ *
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
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#include "../liblightdm/SessionsModel.h"
plugins/LightDM/IntegratedLightDM/QLightDM/UsersModelnew file+17
@@ -0,0 +1,17 @@
1+/*
2+ * Copyright (C) 2016 Canonical, Ltd.
3+ *
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
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#include "../liblightdm/UsersModel.h"
plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp+2
@@ -60,6 +60,8 @@ QVariant SessionsModel::data(const QModelIndex& index, int role) const
6060 int row = index.row();
6161
6262 switch (role) {
63+ case QLightDM::SessionsModel::KeyRole:
64+ return d->sessionItems[row].key;
6365 case Qt::DisplayRole:
6466 return d->sessionItems[row].name;
6567 default:
plugins/LightDM/SessionsModel.cpp+33−2
@@ -52,11 +52,42 @@ QUrl SessionsModel::iconUrl(const QString sessionName) const
5252 Q_FOREACH(const QUrl& searchDirectory, m_iconSearchDirectories)
5353 {
5454 // This is an established icon naming convention
55+ QString customIconUrl = searchDirectory.toString(QUrl::StripTrailingSlash) +
56+ "/custom_" + sessionName + "_badge.png";
5557 QString iconUrl = searchDirectory.toString(QUrl::StripTrailingSlash) +
56− "/" + sessionName.toLower() + "_badge.png";
58+ "/" + sessionName + "_badge.png";
59+
60+ QFile customIconFile(customIconUrl);
5761 QFile iconFile(iconUrl);
58− if (iconFile.exists()) {
62+ if (customIconFile.exists()) {
63+ return QUrl(customIconUrl);
64+ } else if (iconFile.exists()) {
5965 return QUrl(iconUrl);
66+ } else{
67+ // Search the legacy way
68+ QString path = searchDirectory.toString(QUrl::StripTrailingSlash) + "/";
69+ if (sessionName == "ubuntu" || sessionName == "ubuntu-2d") {
70+ path += "ubuntu_badge.png";
71+ } else if(
72+ sessionName == "gnome-classic" ||
73+ sessionName == "gnome-flashback-compiz" ||
74+ sessionName == "gnome-flashback-metacity" ||
75+ sessionName == "gnome-shell" ||
76+ sessionName == "gnome-wayland" ||
77+ sessionName == "gnome"
78+ ){
79+ path += "gnome_badge.png";
80+ } else if (sessionName == "plasma") {
81+ path += "kde_badge.png";
82+ } else if (sessionName == "xterm") {
83+ path += "recovery_console_badge.png";
84+ } else if (sessionName == "remote-login") {
85+ path += "remote_login_help.png";
86+ }
87+
88+ if (QFile(path).exists()) {
89+ return path;
90+ }
6091 }
6192 }
6293
qml/Greeter/Greeter.qml+1−3
@@ -317,9 +317,7 @@ Showable {
317317 if (root.locked) {
318318 LightDMService.greeter.respond(response);
319319 } else {
320− if (LightDMService.greeter.active && !LightDMService.greeter.authenticated) { // could happen if forcedUnlock
321− d.login();
322− }
320+ d.login();
323321 loader.item.hide();
324322 }
325323 }
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp+2
@@ -55,6 +55,8 @@ QVariant SessionsModel::data(const QModelIndex& index, int role) const
5555 int row = index.row();
5656
5757 switch (role) {
58+ case QLightDM::SessionsModel::KeyRole:
59+ return d->sessionItems[row].key;
5860 case Qt::DisplayRole:
5961 return d->sessionItems[row].name;
6062 default:
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp+12−5
@@ -46,10 +46,17 @@ void SessionsModelPrivate::resetEntries_multipleSessions()
4646{
4747 sessionItems =
4848 {
49− {"", "", "Ubuntu", ""},
50− {"", "", "GNOME", ""},
51− {"", "", "Plasma", ""},
52− {"", "", "Unknown", ""}
49+ {"ubuntu", "", "Ubuntu", ""},
50+ {"ubuntu-2d", "", "Ubuntu 2D", ""},
51+ {"gnome", "", "GNOME", ""},
52+ {"gnome-classic", "", "GNOME Classic", ""},
53+ {"gnome-flashback-compiz", "", "GNOME Flashback (Compiz)", ""},
54+ {"gnome-flashback-metacity", "", "GNOME Flashback (Metacity)", ""},
55+ {"gnome-wayland", "", "GNOME on Wayland", ""},
56+ {"plasma", "", "Plasma", ""},
57+ {"kde", "", "KDE" , ""},
58+ {"xterm", "", "Recovery Console", ""},
59+ {"", "", "Unknown?", ""}
5360 };
5461}
5562
@@ -60,7 +67,7 @@ void SessionsModelPrivate::resetEntries_noSessions()
6067
6168void SessionsModelPrivate::resetEntries_singleSession()
6269{
63− sessionItems = {{"", "", "Ubuntu", ""}};
70+ sessionItems = {{"ubuntu", "", "Ubuntu", ""}};
6471}
6572
6673} // namespace QLightDM
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h+1−1
@@ -28,7 +28,7 @@ class SessionsModel;
2828class SessionItem
2929{
3030public:
31− QString key; // unused
31+ QString key;
3232 QString type; // unused
3333 QString name;
3434 QString comment; // unused
tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp+22−22
@@ -54,7 +54,7 @@ void UsersModelPrivate::resetEntries_single()
5454{
5555 entries =
5656 {
57− { "single", "Single User", 0, 0, false, false, "Ubuntu", 0 },
57+ { "single", "Single User", 0, 0, false, false, "ubuntu", 0 },
5858 };
5959}
6060
@@ -62,7 +62,7 @@ void UsersModelPrivate::resetEntries_singlePassphrase()
6262{
6363 entries =
6464 {
65− { "single", "Single User", 0, 0, false, false, "Ubuntu", 0 },
65+ { "single", "Single User", 0, 0, false, false, "ubuntu", 0 },
6666 };
6767}
6868
@@ -70,7 +70,7 @@ void UsersModelPrivate::resetEntries_singlePin()
7070{
7171 entries =
7272 {
73− { "has-pin", "Has PIN", 0, 0, false, false, 0, 0 },
73+ { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
7474 };
7575}
7676
@@ -78,26 +78,26 @@ void UsersModelPrivate::resetEntries_full()
7878{
7979 entries =
8080 {
81− { "has-password", "Has Password", 0, 0, false, false, "Ubuntu", 0 },
82− { "has-pin", "Has PIN", 0, 0, false, false, "Ubuntu", 0 },
83− { "different-prompt", "Different Prompt", 0, 0, false, false, "Ubuntu", 0 },
84− { "no-password", "No Password", 0, 0, false, false, "Ubuntu", 0 },
85− { "auth-error", "Auth Error", 0, 0, false, false, "Ubuntu", 0 },
86− { "two-factor", "Two Factor", 0, 0, false, false, "Ubuntu", 0 },
87− { "info-prompt", "Info Prompt", 0, 0, false, false, "Ubuntu", 0 },
88− { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, "Ubuntu", 0 },
89− { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, "Ubuntu", 0 },
90− { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, "Ubuntu", 0 },
91− { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, "Ububntu", 0 },
92− { "long-name", "Long name (far far too long to fit)", 0, 0, false, false, "Ubuntu", 0 },
93− { "color-background", "Color Background", "#dd4814", 0, false, false, "Ubuntu", 0 },
81+ { "has-password", "Has Password", 0, 0, false, false, "ubuntu", 0 },
82+ { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
83+ { "different-prompt", "Different Prompt", 0, 0, false, false, "ubuntu", 0 },
84+ { "no-password", "No Password", 0, 0, false, false, "ubuntu", 0 },
85+ { "auth-error", "Auth Error", 0, 0, false, false, "ubuntu", 0 },
86+ { "two-factor", "Two Factor", 0, 0, false, false, "ubuntu", 0 },
87+ { "info-prompt", "Info Prompt", 0, 0, false, false, "ubuntu", 0 },
88+ { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, "ubuntu", 0 },
89+ { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, "ubuntu", 0 },
90+ { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, "ubuntu", 0 },
91+ { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, "ubuntu", 0 },
92+ { "long-name", "Long name (far far too long to fit)", 0, 0, false, false, "ubuntu", 0 },
93+ { "color-background", "Color Background", "#dd4814", 0, false, false, "ubuntu", 0 },
9494 // white and black are a bit redundant, but useful for manually testing if UI is still readable
95− { "white-background", "White Background", "#ffffff", 0, false, false, "Ubuntu", 0 },
96− { "black-background", "Black Background", "#000000", 0, false, false, "Ubuntu", 0 },
97− { "no-background", "No Background", "", 0, false, false, "Ubuntu", 0 },
98− { "unicode", "가나다라마", 0, 0, false, false, "Ubuntu", 0 },
99− { "no-response", "No Response", 0, 0, false, false, "Ubuntu", 0 },
100− { "empty-name", "", 0, 0, false, false, "Ubuntu", 0 },
95+ { "white-background", "White Background", "#ffffff", 0, false, false, "ubuntu", 0 },
96+ { "black-background", "Black Background", "#000000", 0, false, false, "ubuntu", 0 },
97+ { "no-background", "No Background", "", 0, false, false, "ubuntu", 0 },
98+ { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 },
99+ { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 },
100+ { "empty-name", "", 0, 0, false, false, "ubuntu", 0 },
101101 };
102102}
103103
tests/plugins/LightDM/IntegratedLightDM/sessionsmodel.cpp+19
@@ -41,6 +41,16 @@ private Q_SLOTS:
4141 delete sourceModel;
4242 }
4343
44+ static QModelIndex findByKey(QAbstractItemModel *model, const QString& key)
45+ {
46+ for (int i = 0; i < model->rowCount(QModelIndex()); i++) {
47+ if (model->data(model->index(i, 0), QLightDM::SessionsModel::KeyRole).toString() == key)
48+ return model->index(i, 0);
49+ }
50+
51+ return QModelIndex();
52+ }
53+
4454 void testIconDirectoriesAreValid()
4555 {
4656 Q_FOREACH(const QUrl& searchDirectory, model->iconSearchDirectories())
@@ -67,6 +77,15 @@ private Q_SLOTS:
6777 QVERIFY(sourceModel->rowCount(QModelIndex()) == 1);
6878 }
6979
80+ void testSessionNameIsCorrect()
81+ {
82+ // This is testing the lookup, not the correctness of the strings,
83+ // so one test should be sufficient
84+ sourceModel->setTestScenario("multipleSessions");
85+ QVERIFY(model->data(findByKey(sourceModel, "ubuntu"),
86+ Qt::DisplayRole).toString() == "Ubuntu");
87+ }
88+
7089private:
7190 SessionsModel *model;
7291 QLightDM::SessionsModel *sourceModel;
tests/qmltests/tst_Shell.qml+4−12
@@ -1142,16 +1142,13 @@ Rectangle {
11421142
11431143 function test_greeterLoginsAutomaticallyWhenNoPasswordSet() {
11441144 loadShell("phone");
1145− swipeAwayGreeter();
1146−
1147− sessionSpy.clear();
1148− verify(sessionSpy.valid);
1149−
1150− showGreeter();
11511145
11521146 var greeter = findChild(shell, "greeter");
11531147 verify(!greeter.locked);
1154− verify(sessionSpy.count > 0);
1148+ compare(sessionSpy.count, 0);
1149+
1150+ swipeAwayGreeter();
1151+ compare(sessionSpy.count, 1);
11551152 }
11561153
11571154 function test_fullscreen() {
@@ -2189,11 +2186,6 @@ Rectangle {
21892186 shell.usageScenario = "desktop";
21902187 GSettingsController.setAutohideLauncher(!data.launcherLocked);
21912188 waitForRendering(shell);
2192− // Not sure why 2 but it's the number of times
2193− // it triggers at this time and we need to wait
2194− // for them otherwise a sessionStarted signal will
2195− // hide the launcher and make the test fail
2196− tryCompare(sessionSpy, "count", 2);
21972189
21982190 var launcher = findChild(shell, "launcher");
21992191 var launcherPanel = findChild(launcher, "launcherPanel");