Merge lp:~mterry/unity8/session-lightdm into lp:unity8
- session-lightdm
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~mterry/unity8/session-lightdm |
Merge into: | lp:unity8 |
Diff against target: |
3515 lines (+329/-1997) 66 files modified
CMakeLists.txt (+1/-0) cmake/modules/QmlTest.cmake (+3/-3) data/unity8.conf (+12/-12) debian/rules (+1/-3) plugins/AccountsService/AccountsService.cpp (+27/-1) plugins/AccountsService/AccountsService.h (+8/-0) plugins/LightDM/CMakeLists.txt (+16/-8) plugins/LightDM/FullLightDM/CMakeLists.txt (+0/-32) plugins/LightDM/IntegratedLightDM/CMakeLists.txt (+0/-33) plugins/LightDM/IntegratedLightDM/QLightDM/Greeter (+0/-17) plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel (+0/-17) plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel (+0/-17) plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt (+0/-55) plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp (+0/-182) plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.h (+0/-108) plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp (+0/-309) plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h (+0/-52) plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp (+0/-87) plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h (+0/-72) plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp (+0/-36) plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h (+0/-54) plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp (+0/-110) plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.h (+0/-66) plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp (+0/-94) plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h (+0/-72) plugins/LightDM/IntegratedLightDM/qmldir (+0/-3) plugins/LightDM/plugin.cpp (+8/-21) plugins/LightDM/plugin.h (+1/-1) plugins/LightDM/qmldir (+2/-3) plugins/Unity/Session/dbusunitysessionservice.cpp (+3/-45) plugins/Unity/Session/dbusunitysessionservice.h (+0/-3) qml/Components/Dialogs.qml (+5/-5) qml/Greeter/FullLightDMImpl.qml (+0/-31) qml/Greeter/Greeter.qml (+30/-29) qml/Greeter/IntegratedLightDMImpl.qml (+0/-30) qml/Greeter/LightDMService.qml (+0/-54) qml/Greeter/LoginList.qml (+9/-9) qml/Greeter/NarrowView.qml (+1/-1) qml/Greeter/PromptList.qml (+7/-7) qml/Greeter/SessionsList.qml (+4/-4) qml/Greeter/WideView.qml (+2/-2) qml/Greeter/qmldir (+0/-1) qml/Shell.qml (+8/-1) tests/mocks/AccountsService/AccountsService.cpp (+14/-0) tests/mocks/AccountsService/AccountsService.h (+8/-0) tests/mocks/AccountsService/CMakeLists.txt (+5/-1) tests/mocks/libusermetrics/UserMetrics.cpp (+3/-5) tests/plugins/AccountsService/AccountsServer.cpp (+11/-0) tests/plugins/AccountsService/AccountsServer.h (+5/-0) tests/plugins/AccountsService/client.cpp (+71/-21) tests/plugins/AccountsService/interfaces.xml (+1/-0) tests/plugins/LightDM/CMakeLists.txt (+33/-107) tests/plugins/LightDM/IntegratedLightDM/integrated.cpp (+0/-88) tests/plugins/LightDM/IntegratedLightDM/pam.cpp (+0/-54) tests/plugins/LightDM/dbus.cpp (+1/-1) tests/plugins/LightDM/greeter.qml (+1/-1) tests/plugins/Unity/Session/sessionbackendtest.cpp (+0/-1) tests/qmltests/Dash/tst_DashShell.qml (+1/-1) tests/qmltests/Greeter/tst_Greeter.qml (+8/-8) tests/qmltests/Greeter/tst_Infographics.qml (+1/-1) tests/qmltests/Greeter/tst_NarrowView.qml (+4/-4) tests/qmltests/Greeter/tst_WideView.qml (+7/-7) tests/qmltests/Tutorial/tst_Tutorial.qml (+1/-1) tests/qmltests/tst_OrientedShell.qml (+1/-1) tests/qmltests/tst_Shell.qml (+4/-4) tests/qmltests/tst_ShellWithPin.qml (+1/-1) |
To merge this branch: | bzr merge lp:~mterry/unity8/session-lightdm |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Josh Arenson | Pending | ||
Unity8 CI Bot | continuous-integration | Pending | |
Albert Astals Cid | Pending | ||
Review via email: mp+315697@code.launchpad.net |
Commit message
Use liblightdm for session lockscreen too.
This lets us switch users directly from the lockscreen, rather than going to the system greeter.
Description of the change
This is mostly simplification.
- I drop the distinction between FullLightDM and IntegratedLightDM. Now we always use the full lightdm experience. This lets us drop our custom PAM and custom user code in IntegratedLightDM. No more support for ~/.unity8-
- I add a "greeterMode" property to our AccountsService plugin. This toggles whether we try to write non-active user properties back to the system AccountsService daemon or not. When running in-session, we don't want to. We don't have permission to anyway, and it doesn't really matter for the properties we change (notably, the FailedLogins count -- we can just keep track of that locally. It's not urgent that we write that to disk in this case.)
As part of landing, we should backport lightdm from yakkety. Silo 1679 has this MP, a backported lightdm, and the related branches listed below.
FIXME: this needs some more work:
- Needs re-testing after some big merges from trunk that I've done.
- It seems to cause (exacerbate?) a crash when switching between sessions, something to do with VT switches failing...?
- Needs some security work to tag unity8 with an apparmor label and have liblightdm only allow in-session connections that have that label.
======
* Are there any related MPs required for this MP to build/function as expected? Please list.
Yes. Two config changes to enable this new mode:
- https:/
- https:/
And a backported yakkety lightdm.
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
I'm on the team.
* If you changed the UI, has there been a design review?
NA
Unmerged revisions
- 2799. By Michael Terry
-
Drop IntegratedLightDM and always use system liblightdm instead
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2017-01-24 07:39:33 +0000 |
3 | +++ CMakeLists.txt 2017-01-26 16:33:43 +0000 |
4 | @@ -74,6 +74,7 @@ |
5 | pkg_check_modules(GEONAMES REQUIRED geonames>=0.2) |
6 | pkg_check_modules(GIO REQUIRED gio-2.0>=2.32) |
7 | pkg_check_modules(GLIB REQUIRED glib-2.0>=2.32) |
8 | +pkg_check_modules(LIBLIGHTDM REQUIRED liblightdm-qt5-3) |
9 | pkg_check_modules(QMENUMODEL REQUIRED qmenumodel) |
10 | pkg_check_modules(GD3 REQUIRED gnome-desktop-3.0) |
11 | pkg_check_modules(UAL REQUIRED ubuntu-app-launch-2) |
12 | |
13 | === modified file 'cmake/modules/QmlTest.cmake' |
14 | --- cmake/modules/QmlTest.cmake 2017-01-24 07:43:35 +0000 |
15 | +++ cmake/modules/QmlTest.cmake 2017-01-26 16:33:43 +0000 |
16 | @@ -114,11 +114,11 @@ |
17 | # This function wraps add_executable_test, see below for available arguments. |
18 | |
19 | function(add_qml_unittest PATH COMPONENT_NAME) |
20 | - import_executables(qmltestrunner) |
21 | + import_executables(dbus-run-session) |
22 | |
23 | - add_executable_test(${COMPONENT_NAME} qmltestrunner |
24 | + add_executable_test(${COMPONENT_NAME} dbus-run-session |
25 | ${ARGN} |
26 | - ARGS -input ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml ${QMLTEST_ARGS} |
27 | + ARGS -- qmltestrunner -input ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml ${QMLTEST_ARGS} |
28 | ) |
29 | |
30 | if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml") |
31 | |
32 | === modified file 'data/unity8.conf' |
33 | --- data/unity8.conf 2017-01-18 00:25:13 +0000 |
34 | +++ data/unity8.conf 2017-01-26 16:33:43 +0000 |
35 | @@ -24,23 +24,23 @@ |
36 | # Tell unity-mir to raise SIGSTOP after we start |
37 | initctl set-env UNITY_MIR_EMITS_SIGSTOP=1 |
38 | |
39 | - if [ -n "$MIR_SOCKET" ]; then |
40 | + if [ -n "$(initctl get-env --global MIR_SERVER_HOST_SOCKET)" ]; then |
41 | # FIXME Create an autopilot test that makes sure start+stop and restart |
42 | # work fine at least 2 times |
43 | - # Save original value of MIR_SOCKET in case we are stopped, |
44 | + # Save original value of MIR_SERVER_HOST_SOCKET in case we are stopped, |
45 | # as we modify the variable for future jobs, including ourself. |
46 | - UNITY_MIR_SOCKET=$(initctl get-env --global MIR_SOCKET) |
47 | + UNITY_MIR_SOCKET=$(initctl get-env --global MIR_SERVER_HOST_SOCKET) |
48 | initctl set-env --global UNITY_MIR_SOCKET=$UNITY_MIR_SOCKET |
49 | |
50 | + # Point all future jobs in this session to our Mir socket instead of |
51 | + # unity-system-compositor's socket. |
52 | + MIR_SERVER_FILE=$XDG_RUNTIME_DIR/mir_socket |
53 | + initctl set-env --global MIR_SERVER_HOST_SOCKET=$MIR_SERVER_FILE |
54 | + gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "@a{ss} {'MIR_SERVER_HOST_SOCKET': '$MIR_SERVER_FILE'}" |
55 | + |
56 | # Point unity8 at unity-system-compositor |
57 | - MIR_SERVER_FILE=$XDG_RUNTIME_DIR/mir_socket |
58 | initctl set-env MIR_SERVER_FILE=$MIR_SERVER_FILE |
59 | initctl set-env MIR_SERVER_HOST_SOCKET=$UNITY_MIR_SOCKET |
60 | - |
61 | - # Point all future jobs in this session to our Mir socket instead of |
62 | - # unity-system-compositor's socket. |
63 | - initctl set-env --global MIR_SOCKET=$MIR_SERVER_FILE |
64 | - gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "@a{ss} {'MIR_SOCKET': '$MIR_SERVER_FILE'}" |
65 | fi |
66 | |
67 | # Remove the normal and trusted sockets if still there |
68 | @@ -74,7 +74,7 @@ |
69 | exec ${BINARY:-unity8} --mode=$MODE $ARGS |
70 | |
71 | post-start script |
72 | - # If no MIR_SOCKET was defined on launch, we try to set one here |
73 | + # If no MIR_SERVER_HOST_SOCKET was defined on launch, we try to set one here |
74 | if [ -z "$(initctl get-env --global UNITY_MIR_SOCKET)" ]; then |
75 | if [ -S "$XDG_RUNTIME_DIR/mir_socket" ]; then |
76 | mir_socket=$XDG_RUNTIME_DIR/mir_socket |
77 | @@ -83,7 +83,7 @@ |
78 | fi |
79 | |
80 | if [ -n "$mir_socket" ]; then |
81 | - initctl set-env --global MIR_SOCKET="$mir_socket" |
82 | + initctl set-env --global MIR_SERVER_HOST_SOCKET="$mir_socket" |
83 | fi |
84 | fi |
85 | |
86 | @@ -91,7 +91,7 @@ |
87 | end script |
88 | |
89 | post-stop script |
90 | - initctl set-env --global MIR_SOCKET=$UNITY_MIR_SOCKET |
91 | + initctl set-env --global MIR_SERVER_HOST_SOCKET=$UNITY_MIR_SOCKET |
92 | initctl unset-env --global UNITY_MIR_SOCKET |
93 | initctl unset-env --global MIR_SERVER_PROMPT_FILE |
94 | initctl emit application-end |
95 | |
96 | === modified file 'debian/rules' |
97 | --- debian/rules 2017-01-18 00:25:13 +0000 |
98 | +++ debian/rules 2017-01-26 16:33:43 +0000 |
99 | @@ -38,6 +38,4 @@ |
100 | dh_makeshlibs -Nunity8-private -Nunity8-tests |
101 | |
102 | override_dh_shlibdeps: |
103 | - # Some mock libraries link against liblightdm-qt5-3.so which we want to |
104 | - # avoid, since we only really link against our mock one, not the system one. |
105 | - dh_shlibdeps -XlibMockAccountsService-qml.so -Lunity8-private |
106 | + dh_shlibdeps -Lunity8-private |
107 | |
108 | === modified file 'plugins/AccountsService/AccountsService.cpp' |
109 | --- plugins/AccountsService/AccountsService.cpp 2016-12-19 19:55:07 +0000 |
110 | +++ plugins/AccountsService/AccountsService.cpp 2017-01-26 16:33:43 +0000 |
111 | @@ -80,6 +80,7 @@ |
112 | AccountsService::AccountsService(QObject* parent, const QString &user) |
113 | : QObject(parent) |
114 | , m_service(new AccountsServiceDBusAdaptor(this)) |
115 | + , m_greeterMode(true) |
116 | { |
117 | m_unityInput = new QDBusInterface(QStringLiteral("com.canonical.Unity.Input"), |
118 | QStringLiteral("/com/canonical/Unity/Input"), |
119 | @@ -155,6 +156,19 @@ |
120 | refresh(!wasEmpty); |
121 | } |
122 | |
123 | +bool AccountsService::greeterMode() const |
124 | +{ |
125 | + return m_greeterMode; |
126 | +} |
127 | + |
128 | +void AccountsService::setGreeterMode(bool greeterMode) |
129 | +{ |
130 | + if (m_greeterMode != greeterMode) { |
131 | + m_greeterMode = greeterMode; |
132 | + Q_EMIT greeterModeChanged(); |
133 | + } |
134 | +} |
135 | + |
136 | bool AccountsService::demoEdges() const |
137 | { |
138 | auto value = getProperty(IFACE_UNITY, PROP_DEMO_EDGES); |
139 | @@ -341,7 +355,19 @@ |
140 | { |
141 | if (m_properties[interface][property].value != value) { |
142 | m_properties[interface][property].value = value; |
143 | - m_service->setUserPropertyAsync(m_user, interface, property, value); |
144 | + if (m_greeterMode || m_user == g_get_user_name()) { |
145 | + // Only write any changes back to AccountsService if we are running |
146 | + // as a proper LightDM greeter (or are writing values for our own |
147 | + // user). |
148 | + // (A) Only the lightdm user has permission to set everyone's |
149 | + // properties. |
150 | + // (B) We don't want to have policykit throw up a password dialog |
151 | + // when we are running in the user session. |
152 | + // (C) We only write things to AS that are safe to ignore for other |
153 | + // users anyway (like failedLogins count, which does not NEED |
154 | + // to be persistent). |
155 | + m_service->setUserPropertyAsync(m_user, interface, property, value); |
156 | + } |
157 | emitChangedForProperty(interface, property); |
158 | } |
159 | } |
160 | |
161 | === modified file 'plugins/AccountsService/AccountsService.h' |
162 | --- plugins/AccountsService/AccountsService.h 2017-01-18 00:25:13 +0000 |
163 | +++ plugins/AccountsService/AccountsService.h 2017-01-26 16:33:43 +0000 |
164 | @@ -33,6 +33,10 @@ |
165 | READ user |
166 | WRITE setUser |
167 | NOTIFY userChanged) |
168 | + Q_PROPERTY (bool greeterMode |
169 | + READ greeterMode |
170 | + WRITE setGreeterMode |
171 | + NOTIFY greeterModeChanged) |
172 | Q_PROPERTY (bool demoEdges |
173 | READ demoEdges |
174 | WRITE setDemoEdges |
175 | @@ -92,6 +96,8 @@ |
176 | |
177 | QString user() const; |
178 | void setUser(const QString &user); |
179 | + bool greeterMode() const; |
180 | + void setGreeterMode(bool greeterMode); |
181 | bool demoEdges() const; |
182 | void setDemoEdges(bool demoEdges); |
183 | QStringList demoEdgesCompleted() const; |
184 | @@ -119,6 +125,7 @@ |
185 | |
186 | Q_SIGNALS: |
187 | void userChanged(); |
188 | + void greeterModeChanged(); |
189 | void demoEdgesChanged(); |
190 | void demoEdgesCompletedChanged(); |
191 | void enableFingerprintIdentificationChanged(); |
192 | @@ -167,6 +174,7 @@ |
193 | AccountsServiceDBusAdaptor *m_service; |
194 | QDBusInterface *m_unityInput; |
195 | QString m_user; |
196 | + bool m_greeterMode; |
197 | }; |
198 | |
199 | #endif |
200 | |
201 | === modified file 'plugins/LightDM/CMakeLists.txt' |
202 | --- plugins/LightDM/CMakeLists.txt 2017-01-19 15:37:24 +0000 |
203 | +++ plugins/LightDM/CMakeLists.txt 2017-01-26 16:33:43 +0000 |
204 | @@ -1,18 +1,20 @@ |
205 | pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1) |
206 | |
207 | -find_package(Qt5Core REQUIRED) |
208 | -find_package(Qt5Quick REQUIRED) |
209 | - |
210 | include_directories( |
211 | ${CMAKE_CURRENT_SOURCE_DIR} |
212 | ${CMAKE_CURRENT_BINARY_DIR} |
213 | ${CMAKE_SOURCE_DIR}/plugins/Utils |
214 | ${libunity8-private_SOURCE_DIR} |
215 | + ) |
216 | + |
217 | +include_directories( |
218 | + SYSTEM |
219 | + ${LIBLIGHTDM_INCLUDE_DIRS} |
220 | ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS} |
221 | -) |
222 | + ) |
223 | |
224 | -set(QMLPLUGIN_SRC |
225 | - ../Utils/unitysortfilterproxymodelqml.cpp |
226 | +add_library(LightDM-qml MODULE |
227 | + ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp |
228 | DBusGreeter.cpp |
229 | DBusGreeterList.cpp |
230 | Greeter.cpp |
231 | @@ -22,5 +24,11 @@ |
232 | UsersModel.cpp |
233 | ) |
234 | |
235 | -add_subdirectory(FullLightDM) |
236 | -add_subdirectory(IntegratedLightDM) |
237 | +target_link_libraries(LightDM-qml |
238 | + unity8-private |
239 | + ${LIBLIGHTDM_LDFLAGS} |
240 | + ${LIBUSERMETRICSOUTPUT_LDFLAGS} |
241 | + ) |
242 | + |
243 | +qt5_use_modules(LightDM-qml DBus Gui Qml) |
244 | +add_unity8_plugin(LightDM 0.1 LightDM TARGETS LightDM-qml) |
245 | |
246 | === removed file 'plugins/LightDM/FullLightDM/CMakeLists.txt' |
247 | --- plugins/LightDM/FullLightDM/CMakeLists.txt 2016-11-28 10:13:37 +0000 |
248 | +++ plugins/LightDM/FullLightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
249 | @@ -1,32 +0,0 @@ |
250 | -pkg_check_modules(LIBLIGHTDM REQUIRED liblightdm-qt5-3) |
251 | - |
252 | -set(PLUGIN_CLASSNAME "FullLightDM") |
253 | - |
254 | -add_definitions(-DFULL_LIGHTDM) |
255 | - |
256 | -include_directories( |
257 | - ../ |
258 | - ${CMAKE_CURRENT_BINARY_DIR} |
259 | - ) |
260 | - |
261 | -include_directories( |
262 | - SYSTEM |
263 | - ${LIBLIGHTDM_INCLUDE_DIRS} |
264 | - ) |
265 | - |
266 | -foreach(source_file ${QMLPLUGIN_SRC}) |
267 | - list(APPEND RELATIVE_QMLPLUGIN_SRC ../${source_file}) |
268 | -endforeach() |
269 | - |
270 | -add_library(FullLightDM-qml MODULE |
271 | - ${RELATIVE_QMLPLUGIN_SRC} |
272 | - ) |
273 | - |
274 | -target_link_libraries(FullLightDM-qml |
275 | - unity8-private |
276 | - ${LIBLIGHTDM_LDFLAGS} |
277 | - ${LIBUSERMETRICSOUTPUT_LDFLAGS} |
278 | - ) |
279 | - |
280 | -qt5_use_modules(FullLightDM-qml DBus Gui Qml) |
281 | -add_unity8_plugin(FullLightDM 0.1 LightDM/FullLightDM TARGETS FullLightDM-qml) |
282 | |
283 | === removed file 'plugins/LightDM/IntegratedLightDM/CMakeLists.txt' |
284 | --- plugins/LightDM/IntegratedLightDM/CMakeLists.txt 2016-07-08 15:44:53 +0000 |
285 | +++ plugins/LightDM/IntegratedLightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
286 | @@ -1,33 +0,0 @@ |
287 | -set(PLUGIN_CLASSNAME "IntegratedLightDM") |
288 | - |
289 | -add_definitions(-DINTEGRATED_LIGHTDM) |
290 | - |
291 | -foreach(include_directory ${QMLPLUGIN_INCLUDES}) |
292 | - list(APPEND RELATIVE_QMLPLUGIN_INCLUDES ../${include_directory}) |
293 | -endforeach() |
294 | - |
295 | -include_directories( |
296 | - . #QLightDM |
297 | - ${QMLPLUGIN_INCLUDES} |
298 | - ${libunity8-private_SOURCE_DIR} |
299 | - ${CMAKE_CURRENT_BINARY_DIR} |
300 | -) |
301 | - |
302 | -foreach(source_file ${QMLPLUGIN_SRC}) |
303 | - list(APPEND RELATIVE_QMLPLUGIN_SRC ../${source_file}) |
304 | -endforeach() |
305 | - |
306 | -add_library(IntegratedLightDM-qml MODULE |
307 | - ${RELATIVE_QMLPLUGIN_SRC} |
308 | - ) |
309 | - |
310 | -target_link_libraries(IntegratedLightDM-qml |
311 | - integratedLightDM |
312 | - unity8-private |
313 | - ${LIBUSERMETRICSOUTPUT_LDFLAGS} |
314 | - ) |
315 | - |
316 | -qt5_use_modules(IntegratedLightDM-qml DBus Gui Qml) |
317 | -add_unity8_plugin(IntegratedLightDM 0.1 LightDM/IntegratedLightDM TARGETS IntegratedLightDM-qml) |
318 | - |
319 | -add_subdirectory(liblightdm) |
320 | |
321 | === removed directory 'plugins/LightDM/IntegratedLightDM/QLightDM' |
322 | === removed file 'plugins/LightDM/IntegratedLightDM/QLightDM/Greeter' |
323 | --- plugins/LightDM/IntegratedLightDM/QLightDM/Greeter 2016-06-13 21:21:57 +0000 |
324 | +++ plugins/LightDM/IntegratedLightDM/QLightDM/Greeter 1970-01-01 00:00:00 +0000 |
325 | @@ -1,17 +0,0 @@ |
326 | -/* |
327 | - * Copyright (C) 2016 Canonical, Ltd. |
328 | - * |
329 | - * This program is free software; you can redistribute it and/or modify |
330 | - * it under the terms of the GNU General Public License as published by |
331 | - * the Free Software Foundation; version 3. |
332 | - * |
333 | - * This program is distributed in the hope that it will be useful, |
334 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
335 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
336 | - * GNU General Public License for more details. |
337 | - * |
338 | - * You should have received a copy of the GNU General Public License |
339 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
340 | - */ |
341 | - |
342 | -#include "../liblightdm/Greeter.h" |
343 | |
344 | === removed file 'plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel' |
345 | --- plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel 2016-06-13 21:21:57 +0000 |
346 | +++ plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel 1970-01-01 00:00:00 +0000 |
347 | @@ -1,17 +0,0 @@ |
348 | -/* |
349 | - * Copyright (C) 2016 Canonical, Ltd. |
350 | - * |
351 | - * This program is free software; you can redistribute it and/or modify |
352 | - * it under the terms of the GNU General Public License as published by |
353 | - * the Free Software Foundation; version 3. |
354 | - * |
355 | - * This program is distributed in the hope that it will be useful, |
356 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
357 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
358 | - * GNU General Public License for more details. |
359 | - * |
360 | - * You should have received a copy of the GNU General Public License |
361 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
362 | - */ |
363 | - |
364 | -#include "../liblightdm/SessionsModel.h" |
365 | |
366 | === removed file 'plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel' |
367 | --- plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel 2016-06-13 21:21:57 +0000 |
368 | +++ plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel 1970-01-01 00:00:00 +0000 |
369 | @@ -1,17 +0,0 @@ |
370 | -/* |
371 | - * Copyright (C) 2016 Canonical, Ltd. |
372 | - * |
373 | - * This program is free software; you can redistribute it and/or modify |
374 | - * it under the terms of the GNU General Public License as published by |
375 | - * the Free Software Foundation; version 3. |
376 | - * |
377 | - * This program is distributed in the hope that it will be useful, |
378 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
379 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
380 | - * GNU General Public License for more details. |
381 | - * |
382 | - * You should have received a copy of the GNU General Public License |
383 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
384 | - */ |
385 | - |
386 | -#include "../liblightdm/UsersModel.h" |
387 | |
388 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt' |
389 | --- plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt 2016-03-17 16:51:38 +0000 |
390 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
391 | @@ -1,55 +0,0 @@ |
392 | -pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1) |
393 | - |
394 | -set(LibLightDM_SOURCES |
395 | - Greeter.cpp |
396 | - SessionsModel.cpp |
397 | - UsersModel.cpp |
398 | - GreeterPrivate.cpp |
399 | - SessionsModelPrivate.cpp |
400 | - UsersModelPrivate.cpp |
401 | - ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsServiceDBusAdaptor.cpp |
402 | - ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp |
403 | - ) |
404 | - |
405 | -add_library(integratedLightDM STATIC ${LibLightDM_SOURCES}) |
406 | -add_library(integratedLightDMSession STATIC ${LibLightDM_SOURCES}) |
407 | -add_library(MockLightDM-demo-shared SHARED ${LibLightDM_SOURCES}) |
408 | - |
409 | -include_directories( |
410 | - ${CMAKE_SOURCE_DIR}/plugins/AccountsService |
411 | - ${CMAKE_CURRENT_BINARY_DIR} |
412 | - ${GLIB_INCLUDE_DIRS} |
413 | - ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS} |
414 | -) |
415 | - |
416 | -target_link_libraries(integratedLightDM |
417 | - ${GLIB_LIBRARIES} |
418 | - ${LIBUSERMETRICSOUTPUT_LDFLAGS} |
419 | - -lpam |
420 | -) |
421 | -target_link_libraries(integratedLightDMSession |
422 | - ${GLIB_LIBRARIES} |
423 | - ${LIBUSERMETRICSOUTPUT_LDFLAGS} |
424 | - -lpam |
425 | -) |
426 | -target_link_libraries(MockLightDM-demo-shared |
427 | - ${GLIB_LIBRARIES} |
428 | - ${LIBUSERMETRICSOUTPUT_LDFLAGS} |
429 | - -lpam |
430 | -) |
431 | - |
432 | -qt5_use_modules(integratedLightDM Concurrent DBus Gui) |
433 | -qt5_use_modules(integratedLightDMSession Concurrent DBus Gui) |
434 | -qt5_use_modules(MockLightDM-demo-shared Concurrent DBus Gui) |
435 | - |
436 | -set_target_properties(integratedLightDM PROPERTIES |
437 | - COMPILE_FLAGS "-DSM_BUSNAME=systemBus -fPIC") |
438 | -set_target_properties(integratedLightDMSession PROPERTIES |
439 | - COMPILE_FLAGS "-DSM_BUSNAME=sessionBus -fPIC") |
440 | -set_target_properties(MockLightDM-demo-shared PROPERTIES |
441 | - COMPILE_FLAGS "-DSM_BUSNAME=systemBus" |
442 | - OUTPUT_NAME lightdm-qt5-3) |
443 | - |
444 | -install(TARGETS MockLightDM-demo-shared |
445 | - DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/demo |
446 | - ) |
447 | |
448 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp' |
449 | --- plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp 2017-01-18 21:18:31 +0000 |
450 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp 1970-01-01 00:00:00 +0000 |
451 | @@ -1,182 +0,0 @@ |
452 | -/* |
453 | - * Copyright (C) 2013 Canonical, Ltd. |
454 | - * |
455 | - * This program is free software; you can redistribute it and/or modify |
456 | - * it under the terms of the GNU General Public License as published by |
457 | - * the Free Software Foundation; version 3. |
458 | - * |
459 | - * This program is distributed in the hope that it will be useful, |
460 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
461 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
462 | - * GNU General Public License for more details. |
463 | - * |
464 | - * You should have received a copy of the GNU General Public License |
465 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
466 | - * |
467 | - * Author: Michael Terry <michael.terry@canonical.com> |
468 | - */ |
469 | - |
470 | - |
471 | -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
472 | - * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB |
473 | - * COUNTERPART IN tests/mocks/Lightdm/liblightdm |
474 | - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ |
475 | - |
476 | - |
477 | -#include "Greeter.h" |
478 | -#include "GreeterPrivate.h" |
479 | -#include <QtCore/QCoreApplication> |
480 | -#include <QTimer> |
481 | - |
482 | -namespace QLightDM |
483 | -{ |
484 | - |
485 | -Greeter::Greeter(QObject *parent) |
486 | - : QObject(parent), |
487 | - d_ptr(new GreeterPrivate(this)) |
488 | -{ |
489 | -} |
490 | - |
491 | -Greeter::~Greeter() |
492 | -{ |
493 | -} |
494 | - |
495 | -QString Greeter::authenticationUser() const |
496 | -{ |
497 | - Q_D(const Greeter); |
498 | - return d->authenticationUser; |
499 | -} |
500 | - |
501 | -bool Greeter::hasGuestAccountHint() const |
502 | -{ |
503 | - return false; |
504 | -} |
505 | - |
506 | -QString Greeter::getHint(const QString &name) const |
507 | -{ |
508 | - Q_UNUSED(name) |
509 | - return QLatin1String(""); |
510 | -} |
511 | - |
512 | -QString Greeter::defaultSessionHint() const |
513 | -{ |
514 | - return QStringLiteral("ubuntu"); |
515 | -} |
516 | - |
517 | -bool Greeter::hideUsersHint() const |
518 | -{ |
519 | - return false; |
520 | -} |
521 | - |
522 | -bool Greeter::showManualLoginHint() const |
523 | -{ |
524 | - return false; |
525 | -} |
526 | - |
527 | -bool Greeter::showRemoteLoginHint() const |
528 | -{ |
529 | - return false; |
530 | -} |
531 | - |
532 | -QString Greeter::selectUserHint() const |
533 | -{ |
534 | - return QLatin1String(""); |
535 | -} |
536 | - |
537 | -bool Greeter::selectGuestHint() const |
538 | -{ |
539 | - return false; |
540 | -} |
541 | - |
542 | -QString Greeter::autologinUserHint() const |
543 | -{ |
544 | - return QLatin1String(""); |
545 | -} |
546 | - |
547 | -bool Greeter::autologinGuestHint() const |
548 | -{ |
549 | - return false; |
550 | -} |
551 | - |
552 | -int Greeter::autologinTimeoutHint() const |
553 | -{ |
554 | - return 0; |
555 | -} |
556 | - |
557 | -bool Greeter::inAuthentication() const |
558 | -{ |
559 | - return false; |
560 | -} |
561 | - |
562 | -QString Greeter::hostname() const |
563 | -{ |
564 | - return QStringLiteral("hostname1"); |
565 | -} |
566 | - |
567 | -bool Greeter::isAuthenticated() const |
568 | -{ |
569 | - Q_D(const Greeter); |
570 | - return d->authenticated; |
571 | -} |
572 | - |
573 | -bool Greeter::connectSync() |
574 | -{ |
575 | - return true; |
576 | -} |
577 | - |
578 | -void Greeter::authenticate(const QString &username) |
579 | -{ |
580 | - Q_D(Greeter); |
581 | - |
582 | - d->authenticated = false; |
583 | - d->authenticationUser = username; |
584 | - d->handleAuthenticate(); |
585 | -} |
586 | - |
587 | -void Greeter::authenticateAsGuest() |
588 | -{} |
589 | - |
590 | -void Greeter::authenticateAutologin() |
591 | -{} |
592 | - |
593 | -void Greeter::authenticateRemote(const QString &session, const QString &username) |
594 | -{ |
595 | - Q_UNUSED(session) |
596 | - Q_UNUSED(username) |
597 | -} |
598 | - |
599 | -void Greeter::cancelAuthentication() |
600 | -{ |
601 | - Q_D(Greeter); |
602 | - d->cancelAuthentication(); |
603 | -} |
604 | - |
605 | -void Greeter::setLanguage (const QString &language) |
606 | -{ |
607 | - Q_UNUSED(language) |
608 | -} |
609 | - |
610 | -bool Greeter::startSessionSync(const QString &session) |
611 | -{ |
612 | - Q_UNUSED(session) |
613 | - return true; |
614 | -} |
615 | - |
616 | -void Greeter::respond(const QString &response) |
617 | -{ |
618 | - Q_D(Greeter); |
619 | - |
620 | - d->handleRespond(response); |
621 | -} |
622 | - |
623 | -void Greeter::sendAuthenticationComplete() |
624 | -{ |
625 | - if (qEnvironmentVariableIsEmpty("UNITY_TESTING")) { |
626 | - // simulate PAM's delay |
627 | - QTimer::singleShot(1000, this, &Greeter::authenticationComplete); |
628 | - } else { |
629 | - Q_EMIT authenticationComplete(); |
630 | - } |
631 | -} |
632 | - |
633 | -} |
634 | |
635 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.h' |
636 | --- plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.h 2016-12-23 11:04:53 +0000 |
637 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.h 1970-01-01 00:00:00 +0000 |
638 | @@ -1,108 +0,0 @@ |
639 | -/* |
640 | - * Copyright (C) 2013 Canonical, Ltd. |
641 | - * Copyright (C) 2010-2011 David Edmundson. |
642 | - * Copyright (C) 2010-2011 Robert Ancell |
643 | - * |
644 | - * This program is free software; you can redistribute it and/or modify |
645 | - * it under the terms of the GNU General Public License as published by |
646 | - * the Free Software Foundation; version 3. |
647 | - * |
648 | - * This program is distributed in the hope that it will be useful, |
649 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
650 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
651 | - * GNU General Public License for more details. |
652 | - * |
653 | - * You should have received a copy of the GNU General Public License |
654 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
655 | - * |
656 | - * Author: David Edmundson <kde@davidedmundson.co.uk> |
657 | - */ |
658 | - |
659 | -#ifndef UNITY_MOCK_GREETER_H |
660 | -#define UNITY_MOCK_GREETER_H |
661 | - |
662 | -#include <QtCore/QObject> |
663 | -#include <QtCore/QVariant> |
664 | - |
665 | -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
666 | - * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB |
667 | - * COUNTERPART IN tests/mocks/Lightdm/liblightdm |
668 | - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ |
669 | - |
670 | -namespace QLightDM |
671 | -{ |
672 | - class GreeterPrivate; |
673 | - |
674 | -class Q_DECL_EXPORT Greeter : public QObject |
675 | -{ |
676 | - Q_OBJECT |
677 | - |
678 | - Q_PROPERTY(bool authenticated READ isAuthenticated ) //NOTFIY authenticationComplete |
679 | - Q_PROPERTY(QString authenticationUser READ authenticationUser ) |
680 | - Q_PROPERTY(QString defaultSession READ defaultSessionHint CONSTANT) |
681 | - Q_PROPERTY(QString selectUser READ selectUserHint CONSTANT) |
682 | - Q_PROPERTY(bool selectGuest READ selectGuestHint CONSTANT) |
683 | - |
684 | - Q_PROPERTY(QString hostname READ hostname CONSTANT) |
685 | - Q_PROPERTY(bool hasGuestAccount READ hasGuestAccountHint CONSTANT) |
686 | - |
687 | -public: |
688 | - enum PromptType { |
689 | - PromptTypeQuestion, |
690 | - PromptTypeSecret |
691 | - }; |
692 | - Q_ENUM(PromptType) |
693 | - |
694 | - enum MessageType { |
695 | - MessageTypeInfo, |
696 | - MessageTypeError |
697 | - }; |
698 | - Q_ENUM(MessageType) |
699 | - |
700 | - explicit Greeter(QObject* parent=0); |
701 | - virtual ~Greeter(); |
702 | - |
703 | - QString getHint(const QString &name) const; |
704 | - QString defaultSessionHint() const; |
705 | - bool hideUsersHint() const; |
706 | - bool showManualLoginHint() const; |
707 | - bool showRemoteLoginHint() const; |
708 | - bool hasGuestAccountHint() const; |
709 | - QString selectUserHint() const; |
710 | - bool selectGuestHint() const; |
711 | - QString autologinUserHint() const; |
712 | - bool autologinGuestHint() const; |
713 | - int autologinTimeoutHint() const; |
714 | - |
715 | - bool inAuthentication() const; |
716 | - bool isAuthenticated() const; |
717 | - QString authenticationUser() const; |
718 | - QString hostname() const; |
719 | - |
720 | -public Q_SLOTS: |
721 | - bool connectSync(); |
722 | - void authenticate(const QString &username=QString()); |
723 | - void authenticateAsGuest(); |
724 | - void authenticateAutologin(); |
725 | - void authenticateRemote(const QString &session=QString(), const QString &username=QString()); |
726 | - void respond(const QString &response); |
727 | - void cancelAuthentication(); |
728 | - void setLanguage (const QString &language); |
729 | - bool startSessionSync(const QString &session=QString()); |
730 | - |
731 | -Q_SIGNALS: |
732 | - void showMessage(QString text, QLightDM::Greeter::MessageType type); |
733 | - void showPrompt(QString text, QLightDM::Greeter::PromptType type); |
734 | - void authenticationComplete(); |
735 | - void autologinTimerExpired(); |
736 | - |
737 | -protected: |
738 | - void sendAuthenticationComplete(); |
739 | - |
740 | -private: |
741 | - GreeterPrivate *d_ptr; |
742 | - Q_DECLARE_PRIVATE(Greeter) |
743 | -}; |
744 | -} |
745 | - |
746 | -#endif // UNITY_MOCK_GREETER_H |
747 | |
748 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp' |
749 | --- plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp 2017-01-18 21:18:31 +0000 |
750 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp 1970-01-01 00:00:00 +0000 |
751 | @@ -1,309 +0,0 @@ |
752 | -/* |
753 | - * Copyright (C) 2013 Canonical, Ltd. |
754 | - * |
755 | - * This program is free software; you can redistribute it and/or modify |
756 | - * it under the terms of the GNU General Public License as published by |
757 | - * the Free Software Foundation; version 3. |
758 | - * |
759 | - * This program is distributed in the hope that it will be useful, |
760 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
761 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
762 | - * GNU General Public License for more details. |
763 | - * |
764 | - * You should have received a copy of the GNU General Public License |
765 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
766 | - * |
767 | - * Author: Michael Terry <michael.terry@canonical.com> |
768 | - */ |
769 | - |
770 | -#include "Greeter.h" |
771 | -#include "GreeterPrivate.h" |
772 | -#include <QFuture> |
773 | -#include <QFutureInterface> |
774 | -#include <QFutureWatcher> |
775 | -#include <QQueue> |
776 | -#include <QtConcurrent> |
777 | -#include <QVector> |
778 | -#include <security/pam_appl.h> |
779 | - |
780 | -namespace QLightDM |
781 | -{ |
782 | - |
783 | -class GreeterImpl : public QObject |
784 | -{ |
785 | - Q_OBJECT |
786 | - |
787 | - struct AppData |
788 | - { |
789 | - GreeterImpl *impl; |
790 | - pam_handle *handle; |
791 | - }; |
792 | - |
793 | - typedef QFutureInterface<QString> ResponseFuture; |
794 | - |
795 | -public: |
796 | - explicit GreeterImpl(Greeter *parent, GreeterPrivate *greeterPrivate) |
797 | - : QObject(parent), |
798 | - greeter(parent), |
799 | - greeterPrivate(greeterPrivate), |
800 | - pamHandle(nullptr) |
801 | - { |
802 | - qRegisterMetaType<QLightDM::GreeterImpl::ResponseFuture>("QLightDM::GreeterImpl::ResponseFuture"); |
803 | - |
804 | - connect(&futureWatcher, &QFutureWatcher<int>::finished, this, &GreeterImpl::finishPam); |
805 | - connect(this, SIGNAL(showMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)), |
806 | - this, SLOT(handleMessage(pam_handle *, QString, QLightDM::Greeter::MessageType))); |
807 | - // This next connect is how we pass ResponseFutures between threads |
808 | - connect(this, SIGNAL(showPrompt(pam_handle *, QString, QLightDM::Greeter::PromptType, QLightDM::GreeterImpl::ResponseFuture)), |
809 | - this, SLOT(handlePrompt(pam_handle *, QString, QLightDM::Greeter::PromptType, QLightDM::GreeterImpl::ResponseFuture)), |
810 | - Qt::BlockingQueuedConnection); |
811 | - } |
812 | - |
813 | - ~GreeterImpl() |
814 | - { |
815 | - cancelPam(); |
816 | - } |
817 | - |
818 | - void start(QString username) |
819 | - { |
820 | - // Clear out any existing PAM interactions first |
821 | - cancelPam(); |
822 | - if (pamHandle != nullptr) { |
823 | - // While we were cancelling pam above, we processed Qt events. |
824 | - // Which may have allowed someone to call start() on us again. |
825 | - // In which case, we'll bail on our current start() call. |
826 | - // This isn't racy because it's all in the same thread. |
827 | - return; |
828 | - } |
829 | - |
830 | - AppData *appData = new AppData(); |
831 | - appData->impl = this; |
832 | - |
833 | - // Now actually start a new conversation with PAM |
834 | - pam_conv conversation; |
835 | - conversation.conv = converseWithPam; |
836 | - conversation.appdata_ptr = static_cast<void*>(appData); |
837 | - |
838 | - if (pam_start("lightdm", username.toUtf8(), &conversation, &pamHandle) == PAM_SUCCESS) { |
839 | - appData->handle = pamHandle; |
840 | - futureWatcher.setFuture(QtConcurrent::mapped(QList<pam_handle*>() << pamHandle, authenticateWithPam)); |
841 | - } else { |
842 | - delete appData; |
843 | - greeterPrivate->authenticated = false; |
844 | - Q_EMIT greeter->showMessage(QStringLiteral("Internal error: could not start PAM authentication"), QLightDM::Greeter::MessageTypeError); |
845 | - Q_EMIT greeter->authenticationComplete(); |
846 | - } |
847 | - } |
848 | - |
849 | - static int authenticateWithPam(pam_handle* const& pamHandle) |
850 | - { |
851 | - int pamStatus = pam_authenticate(pamHandle, 0); |
852 | - if (pamStatus == PAM_SUCCESS) { |
853 | - pamStatus = pam_acct_mgmt(pamHandle, 0); |
854 | - } |
855 | - if (pamStatus == PAM_NEW_AUTHTOK_REQD) { |
856 | - pamStatus = pam_chauthtok(pamHandle, PAM_CHANGE_EXPIRED_AUTHTOK); |
857 | - } |
858 | - if (pamStatus == PAM_SUCCESS) { |
859 | - pam_setcred(pamHandle, PAM_REINITIALIZE_CRED); |
860 | - } |
861 | - return pamStatus; |
862 | - } |
863 | - |
864 | - static int converseWithPam(int num_msg, const pam_message** msg, |
865 | - pam_response** resp, void* appdata_ptr) |
866 | - { |
867 | - if (num_msg <= 0) |
868 | - return PAM_CONV_ERR; |
869 | - |
870 | - auto* tmp_response = static_cast<pam_response*>(calloc(num_msg, sizeof(pam_response))); |
871 | - if (!tmp_response) |
872 | - return PAM_CONV_ERR; |
873 | - |
874 | - AppData *appData = static_cast<AppData*>(appdata_ptr); |
875 | - GreeterImpl *impl = appData->impl; |
876 | - pam_handle *handle = appData->handle; |
877 | - |
878 | - int count; |
879 | - QVector<ResponseFuture> responses; |
880 | - |
881 | - for (count = 0; count < num_msg; ++count) |
882 | - { |
883 | - switch (msg[count]->msg_style) |
884 | - { |
885 | - case PAM_PROMPT_ECHO_ON: |
886 | - { |
887 | - QString message(msg[count]->msg); |
888 | - responses.append(ResponseFuture()); |
889 | - responses.last().reportStarted(); |
890 | - Q_EMIT impl->showPrompt(handle, message, Greeter::PromptTypeQuestion, responses.last()); |
891 | - break; |
892 | - } |
893 | - case PAM_PROMPT_ECHO_OFF: |
894 | - { |
895 | - QString message(msg[count]->msg); |
896 | - responses.append(ResponseFuture()); |
897 | - responses.last().reportStarted(); |
898 | - Q_EMIT impl->showPrompt(handle, message, Greeter::PromptTypeSecret, responses.last()); |
899 | - break; |
900 | - } |
901 | - case PAM_TEXT_INFO: |
902 | - { |
903 | - QString message(msg[count]->msg); |
904 | - Q_EMIT impl->showMessage(handle, message, Greeter::MessageTypeInfo); |
905 | - break; |
906 | - } |
907 | - default: |
908 | - { |
909 | - QString message(msg[count]->msg); |
910 | - Q_EMIT impl->showMessage(handle, message, Greeter::MessageTypeError); |
911 | - break; |
912 | - } |
913 | - } |
914 | - } |
915 | - |
916 | - int i = 0; |
917 | - bool raise_error = false; |
918 | - |
919 | - for (auto &response : responses) |
920 | - { |
921 | - pam_response* resp_item = &tmp_response[i++]; |
922 | - resp_item->resp_retcode = 0; |
923 | - resp_item->resp = strdup(response.future().result().toUtf8()); |
924 | - |
925 | - if (!resp_item->resp) |
926 | - { |
927 | - raise_error = true; |
928 | - break; |
929 | - } |
930 | - } |
931 | - |
932 | - delete appData; |
933 | - |
934 | - if (raise_error) |
935 | - { |
936 | - for (int i = 0; i < count; ++i) |
937 | - free(tmp_response[i].resp); |
938 | - |
939 | - free(tmp_response); |
940 | - return PAM_CONV_ERR; |
941 | - } |
942 | - else |
943 | - { |
944 | - *resp = tmp_response; |
945 | - return PAM_SUCCESS; |
946 | - } |
947 | - } |
948 | - |
949 | -public Q_SLOTS: |
950 | - bool respond(QString response) |
951 | - { |
952 | - if (!futures.isEmpty()) { |
953 | - futures.dequeue().reportFinished(&response); |
954 | - return true; |
955 | - } else { |
956 | - return false; |
957 | - } |
958 | - } |
959 | - |
960 | - void cancelPam() |
961 | - { |
962 | - if (pamHandle != nullptr) { |
963 | - QFuture<int> pamFuture = futureWatcher.future(); |
964 | - pam_handle *handle = pamHandle; |
965 | - pamHandle = nullptr; // to disable normal finishPam() handling |
966 | - pamFuture.cancel(); |
967 | - |
968 | - // Note the empty loop, we just want to clear the futures queue. |
969 | - // Any further prompts from the pam thread will be immediately |
970 | - // responded to/dismissed in handlePrompt(). |
971 | - while (respond(QString())); |
972 | - |
973 | - // Now let signal/slot handling happen so the thread can finish |
974 | - while (!pamFuture.isFinished()) { |
975 | - QCoreApplication::processEvents(); |
976 | - } |
977 | - |
978 | - pam_end(handle, PAM_CONV_ERR); |
979 | - } |
980 | - } |
981 | - |
982 | -Q_SIGNALS: |
983 | - void showMessage(pam_handle *handle, QString text, QLightDM::Greeter::MessageType type); |
984 | - void showPrompt(pam_handle *handle, QString text, QLightDM::Greeter::PromptType type, QLightDM::GreeterImpl::ResponseFuture response); |
985 | - |
986 | -private Q_SLOTS: |
987 | - void finishPam() |
988 | - { |
989 | - if (pamHandle == nullptr) { |
990 | - return; |
991 | - } |
992 | - |
993 | - int pamStatus = futureWatcher.result(); |
994 | - |
995 | - pam_end(pamHandle, pamStatus); |
996 | - pamHandle = nullptr; |
997 | - |
998 | - greeterPrivate->authenticated = (pamStatus == PAM_SUCCESS); |
999 | - Q_EMIT greeter->authenticationComplete(); |
1000 | - } |
1001 | - |
1002 | - void handleMessage(pam_handle *handle, QString text, QLightDM::Greeter::MessageType type) |
1003 | - { |
1004 | - if (handle != pamHandle) |
1005 | - return; |
1006 | - |
1007 | - Q_EMIT greeter->showMessage(text, type); |
1008 | - } |
1009 | - |
1010 | - void handlePrompt(pam_handle *handle, QString text, QLightDM::Greeter::PromptType type, QLightDM::GreeterImpl::ResponseFuture future) |
1011 | - { |
1012 | - if (handle != pamHandle) { |
1013 | - future.reportResult(QString()); |
1014 | - future.reportFinished(); |
1015 | - return; |
1016 | - } |
1017 | - |
1018 | - futures.enqueue(future); |
1019 | - Q_EMIT greeter->showPrompt(text, type); |
1020 | - } |
1021 | - |
1022 | -private: |
1023 | - Greeter *greeter; |
1024 | - GreeterPrivate *greeterPrivate; |
1025 | - pam_handle* pamHandle; |
1026 | - QFutureWatcher<int> futureWatcher; |
1027 | - QQueue<ResponseFuture> futures; |
1028 | -}; |
1029 | - |
1030 | -GreeterPrivate::GreeterPrivate(Greeter* parent) |
1031 | - : authenticated(false), |
1032 | - authenticationUser(), |
1033 | - m_impl(new GreeterImpl(parent, this)), |
1034 | - q_ptr(parent) |
1035 | -{ |
1036 | -} |
1037 | - |
1038 | -GreeterPrivate::~GreeterPrivate() |
1039 | -{ |
1040 | - delete m_impl; |
1041 | -} |
1042 | - |
1043 | -void GreeterPrivate::handleAuthenticate() |
1044 | -{ |
1045 | - m_impl->start(authenticationUser); |
1046 | -} |
1047 | - |
1048 | -void GreeterPrivate::handleRespond(const QString &response) |
1049 | -{ |
1050 | - m_impl->respond(response); |
1051 | -} |
1052 | - |
1053 | -void GreeterPrivate::cancelAuthentication() |
1054 | -{ |
1055 | - m_impl->cancelPam(); |
1056 | -} |
1057 | - |
1058 | -} |
1059 | - |
1060 | -#include "GreeterPrivate.moc" |
1061 | |
1062 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h' |
1063 | --- plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h 2017-01-18 21:18:31 +0000 |
1064 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h 1970-01-01 00:00:00 +0000 |
1065 | @@ -1,52 +0,0 @@ |
1066 | -/* |
1067 | - * Copyright (C) 2013 Canonical, Ltd. |
1068 | - * |
1069 | - * This program is free software; you can redistribute it and/or modify |
1070 | - * it under the terms of the GNU General Public License as published by |
1071 | - * the Free Software Foundation; version 3. |
1072 | - * |
1073 | - * This program is distributed in the hope that it will be useful, |
1074 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1075 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1076 | - * GNU General Public License for more details. |
1077 | - * |
1078 | - * You should have received a copy of the GNU General Public License |
1079 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1080 | - * |
1081 | - * Author: Michael Terry <michael.terry@canonical.com> |
1082 | - */ |
1083 | - |
1084 | -#ifndef UNITY_MOCK_GREETER_PRIVATE_H |
1085 | -#define UNITY_MOCK_GREETER_PRIVATE_H |
1086 | - |
1087 | -#include <QtCore/QObject> |
1088 | - |
1089 | -namespace QLightDM |
1090 | -{ |
1091 | -class Greeter; |
1092 | -class GreeterImpl; |
1093 | - |
1094 | -class GreeterPrivate |
1095 | -{ |
1096 | -public: |
1097 | - explicit GreeterPrivate(Greeter* parent=0); |
1098 | - virtual ~GreeterPrivate(); |
1099 | - |
1100 | - // These variables may not be used by all subclasses, that's no problem |
1101 | - bool authenticated; |
1102 | - QString authenticationUser; |
1103 | - |
1104 | - void handleAuthenticate(); |
1105 | - void handleRespond(const QString &response); |
1106 | - void cancelAuthentication(); |
1107 | - |
1108 | -protected: |
1109 | - GreeterImpl *m_impl; // if the backend needs more private data |
1110 | - Greeter * const q_ptr; |
1111 | - |
1112 | -private: |
1113 | - Q_DECLARE_PUBLIC(Greeter) |
1114 | -}; |
1115 | -} |
1116 | - |
1117 | -#endif // UNITY_MOCK_GREETER_PRIVATE_H |
1118 | |
1119 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp' |
1120 | --- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp 2016-12-23 11:04:53 +0000 |
1121 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp 1970-01-01 00:00:00 +0000 |
1122 | @@ -1,87 +0,0 @@ |
1123 | -/* |
1124 | - * Copyright (C) 2015 Canonical, Ltd. |
1125 | - * |
1126 | - * This program is free software; you can redistribute it and/or modify |
1127 | - * it under the terms of the GNU General Public License as published by |
1128 | - * the Free Software Foundation; version 3. |
1129 | - * |
1130 | - * This program is distributed in the hope that it will be useful, |
1131 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1132 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1133 | - * GNU General Public License for more details. |
1134 | - * |
1135 | - * You should have received a copy of the GNU General Public License |
1136 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1137 | - * |
1138 | - */ |
1139 | - |
1140 | - |
1141 | -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1142 | - * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB |
1143 | - * COUNTERPART IN tests/mocks/LightDM/IntegratedLightDM/liblightdm |
1144 | - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ |
1145 | - |
1146 | -// LightDM currently is Qt4 compatible, and so doesn't define setRoleNames. |
1147 | -// To use the same method of setting role name that it does, we |
1148 | -// set our compatibility to Qt4 here too. |
1149 | -#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0) |
1150 | - |
1151 | -#include "SessionsModel.h" |
1152 | -#include "SessionsModelPrivate.h" |
1153 | -#include <QtCore/QDir> |
1154 | -#include <QtCore/QString> |
1155 | - |
1156 | -namespace QLightDM |
1157 | -{ |
1158 | - |
1159 | -SessionsModel::SessionsModel(QObject* parent) : |
1160 | - QAbstractListModel(parent), |
1161 | - d_ptr(new SessionsModelPrivate(this)) |
1162 | -{ |
1163 | - m_roleNames = QAbstractListModel::roleNames(); |
1164 | - m_roleNames[KeyRole] = "key"; |
1165 | - m_roleNames[TypeRole] = "type"; |
1166 | -} |
1167 | - |
1168 | -SessionsModel::~SessionsModel() |
1169 | -{ |
1170 | - delete d_ptr; |
1171 | -} |
1172 | - |
1173 | -QVariant SessionsModel::data(const QModelIndex& index, int role) const |
1174 | -{ |
1175 | - Q_D(const SessionsModel); |
1176 | - |
1177 | - if(!index.isValid()) { |
1178 | - return QVariant(); |
1179 | - } |
1180 | - |
1181 | - int row = index.row(); |
1182 | - |
1183 | - switch (role) { |
1184 | - case QLightDM::SessionsModel::KeyRole: |
1185 | - return d->sessionItems[row].key; |
1186 | - case Qt::DisplayRole: |
1187 | - return d->sessionItems[row].name; |
1188 | - default: |
1189 | - return QVariant(); |
1190 | - } |
1191 | -} |
1192 | - |
1193 | -QHash<int, QByteArray> SessionsModel::roleNames() const |
1194 | -{ |
1195 | - return m_roleNames; |
1196 | -} |
1197 | - |
1198 | -int SessionsModel::rowCount(const QModelIndex& parent) const |
1199 | -{ |
1200 | - Q_D(const SessionsModel); |
1201 | - |
1202 | - if (parent.isValid()) { |
1203 | - return 0; |
1204 | - } else { // parent is root |
1205 | - return d->sessionItems.size(); |
1206 | - } |
1207 | -} |
1208 | - |
1209 | -} // namespace QLightDM |
1210 | |
1211 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h' |
1212 | --- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h 2016-12-23 11:04:53 +0000 |
1213 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h 1970-01-01 00:00:00 +0000 |
1214 | @@ -1,72 +0,0 @@ |
1215 | -/* |
1216 | - * Copyright (C) 2015 Canonical, Ltd. |
1217 | - * |
1218 | - * This program is free software; you can redistribute it and/or modify |
1219 | - * it under the terms of the GNU General Public License as published by |
1220 | - * the Free Software Foundation; version 3. |
1221 | - * |
1222 | - * This program is distributed in the hope that it will be useful, |
1223 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1224 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1225 | - * GNU General Public License for more details. |
1226 | - * |
1227 | - * You should have received a copy of the GNU General Public License |
1228 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1229 | - * |
1230 | - */ |
1231 | - |
1232 | -#ifndef UNITY_INTEGRATED_SESSIONSMODEL_H |
1233 | -#define UNITY_INTEGRATED_SESSIONSMODEL_H |
1234 | - |
1235 | -#include <QtCore/QAbstractListModel> |
1236 | -#include <QtCore/QString> |
1237 | - |
1238 | -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1239 | - * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB |
1240 | - * COUNTERPART IN tests/mocks/LightDM/IntegratedLightDM/liblightdm |
1241 | - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ |
1242 | - |
1243 | -// This is taken from liblightdm and modified to confirm to our syle conventions |
1244 | -namespace QLightDM |
1245 | -{ |
1246 | -class SessionsModelPrivate; |
1247 | - |
1248 | -class Q_DECL_EXPORT SessionsModel : public QAbstractListModel |
1249 | - { |
1250 | - Q_OBJECT |
1251 | - |
1252 | - public: |
1253 | - |
1254 | - enum SessionModelRoles { |
1255 | - //name is exposed as Qt::DisplayRole |
1256 | - //comment is exposed as Qt::TooltipRole |
1257 | - KeyRole = Qt::UserRole, |
1258 | - IdRole = KeyRole, /** Deprecated */ |
1259 | - TypeRole |
1260 | - }; |
1261 | - Q_ENUM(SessionModelRoles) |
1262 | - |
1263 | - enum SessionType { |
1264 | - LocalSessions, |
1265 | - RemoteSessions |
1266 | - }; |
1267 | - Q_ENUM(SessionType) |
1268 | - |
1269 | - explicit SessionsModel(QObject* parent=0); /** Deprecated. Loads local sessions*/ |
1270 | - explicit SessionsModel(SessionsModel::SessionType, QObject* parent=0); |
1271 | - virtual ~SessionsModel(); |
1272 | - |
1273 | - QHash<int, QByteArray> roleNames() const override; |
1274 | - int rowCount(const QModelIndex& parent) const override; |
1275 | - QVariant data(const QModelIndex& index, int role) const override; |
1276 | - |
1277 | - protected: |
1278 | - SessionsModelPrivate* const d_ptr; |
1279 | - |
1280 | - private: |
1281 | - QHash<int, QByteArray> m_roleNames; |
1282 | - Q_DECLARE_PRIVATE(SessionsModel) |
1283 | - }; |
1284 | -} |
1285 | - |
1286 | -#endif // UNITY_INTEGRATED_SESSIONSMODEL_H |
1287 | |
1288 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp' |
1289 | --- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 2016-06-24 15:47:41 +0000 |
1290 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 1970-01-01 00:00:00 +0000 |
1291 | @@ -1,36 +0,0 @@ |
1292 | -/* |
1293 | - * Copyright (C) 2015 Canonical, Ltd. |
1294 | - * |
1295 | - * This program is free software; you can redistribute it and/or modify |
1296 | - * it under the terms of the GNU General Public License as published by |
1297 | - * the Free Software Foundation; version 3. |
1298 | - * |
1299 | - * This program is distributed in the hope that it will be useful, |
1300 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1301 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1302 | - * GNU General Public License for more details. |
1303 | - * |
1304 | - * You should have received a copy of the GNU General Public License |
1305 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1306 | - * |
1307 | - */ |
1308 | - |
1309 | -#include "SessionsModelPrivate.h" |
1310 | - |
1311 | -#include <QDir> |
1312 | -#include <QSettings> |
1313 | -#include <QStringList> |
1314 | - |
1315 | -namespace QLightDM |
1316 | -{ |
1317 | - |
1318 | -SessionsModelPrivate::SessionsModelPrivate(SessionsModel* parent) |
1319 | - : q_ptr(parent) |
1320 | -{ |
1321 | - // Since this model is never visible, as there is only 1 session, |
1322 | - // just use the session name as the key |
1323 | - QString sessionName = qgetenv("XDG_SESSION_DESKTOP"); |
1324 | - sessionItems.append({sessionName, "", sessionName, ""}); |
1325 | -} |
1326 | - |
1327 | -} // namespace QLightDM |
1328 | |
1329 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h' |
1330 | --- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 2016-06-23 16:00:11 +0000 |
1331 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 1970-01-01 00:00:00 +0000 |
1332 | @@ -1,54 +0,0 @@ |
1333 | -/* |
1334 | - * Copyright (C) 2015 Canonical, Ltd. |
1335 | - * |
1336 | - * This program is free software; you can redistribute it and/or modify |
1337 | - * it under the terms of the GNU General Public License as published by |
1338 | - * the Free Software Foundation; version 3. |
1339 | - * |
1340 | - * This program is distributed in the hope that it will be useful, |
1341 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1342 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1343 | - * GNU General Public License for more details. |
1344 | - * |
1345 | - * You should have received a copy of the GNU General Public License |
1346 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1347 | - * |
1348 | - */ |
1349 | - |
1350 | -#ifndef UNITY_INTEGRATED_SESSIONSMODEL_PRIVATE_H |
1351 | -#define UNITY_INTEGRATED_SESSIONSMODEL_PRIVATE_H |
1352 | - |
1353 | -#include <QtCore/QList> |
1354 | -#include <QtCore/QString> |
1355 | - |
1356 | -namespace QLightDM |
1357 | -{ |
1358 | -class SessionsModel; |
1359 | - |
1360 | -class SessionItem |
1361 | -{ |
1362 | -public: |
1363 | - QString key; |
1364 | - QString type; // unused |
1365 | - QString name; |
1366 | - QString comment; // unused |
1367 | -}; |
1368 | - |
1369 | -class SessionsModelPrivate |
1370 | -{ |
1371 | -public: |
1372 | - explicit SessionsModelPrivate(SessionsModel* parent=0); |
1373 | - virtual ~SessionsModelPrivate() = default; |
1374 | - |
1375 | - QList<SessionItem> sessionItems; |
1376 | - |
1377 | -protected: |
1378 | - SessionsModel* const q_ptr; |
1379 | - |
1380 | -private: |
1381 | - Q_DECLARE_PUBLIC(SessionsModel) |
1382 | -}; |
1383 | - |
1384 | -} // namespace QLightDM |
1385 | - |
1386 | -#endif // UNITY_INTEGRATED_SESSIONSMODEL_PRIVATE_H |
1387 | |
1388 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp' |
1389 | --- plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp 2016-08-08 14:15:49 +0000 |
1390 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp 1970-01-01 00:00:00 +0000 |
1391 | @@ -1,110 +0,0 @@ |
1392 | -/* |
1393 | - * Copyright (C) 2013-2016 Canonical, Ltd. |
1394 | - * |
1395 | - * This program is free software; you can redistribute it and/or modify |
1396 | - * it under the terms of the GNU General Public License as published by |
1397 | - * the Free Software Foundation; version 3. |
1398 | - * |
1399 | - * This program is distributed in the hope that it will be useful, |
1400 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1401 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1402 | - * GNU General Public License for more details. |
1403 | - * |
1404 | - * You should have received a copy of the GNU General Public License |
1405 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1406 | - * |
1407 | - * Author: Michael Terry <michael.terry@canonical.com> |
1408 | - */ |
1409 | - |
1410 | - |
1411 | -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1412 | - * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB |
1413 | - * COUNTERPART IN tests/mocks/Lightdm/liblightdm |
1414 | - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ |
1415 | - |
1416 | -// LightDM currently is Qt4 compatible, and so doesn't define setRoleNames. |
1417 | -// To use the same method of setting role name that it does, we |
1418 | -// set our compatibility to Qt4 here too. |
1419 | -#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0) |
1420 | - |
1421 | -#include "UsersModel.h" |
1422 | -#include "UsersModelPrivate.h" |
1423 | -#include <QtCore/QDir> |
1424 | -#include <QtCore/QString> |
1425 | -#include <QtGui/QIcon> |
1426 | - |
1427 | -namespace QLightDM |
1428 | -{ |
1429 | - |
1430 | -UsersModel::UsersModel(QObject *parent) : |
1431 | - QAbstractListModel(parent), |
1432 | - d_ptr(new UsersModelPrivate(this)) |
1433 | -{ |
1434 | - // Extend roleNames (we want to keep the "display" role) |
1435 | - QHash<int, QByteArray> roles = roleNames(); |
1436 | - roles[NameRole] = "name"; |
1437 | - roles[RealNameRole] = "realName"; |
1438 | - roles[LoggedInRole] = "loggedIn"; |
1439 | - roles[BackgroundRole] = "background"; |
1440 | - roles[BackgroundPathRole] = "backgroundPath"; |
1441 | - roles[SessionRole] = "session"; |
1442 | - roles[HasMessagesRole] = "hasMessages"; |
1443 | - roles[ImagePathRole] = "imagePath"; |
1444 | - roles[UidRole] = "uid"; |
1445 | - setRoleNames(roles); |
1446 | - |
1447 | - connect(d_ptr, &UsersModelPrivate::dataChanged, this, [this](int i) { |
1448 | - QModelIndex index = createIndex(i, 0); |
1449 | - Q_EMIT dataChanged(index, index); |
1450 | - }); |
1451 | -} |
1452 | - |
1453 | -int UsersModel::rowCount(const QModelIndex &parent) const |
1454 | -{ |
1455 | - Q_D(const UsersModel); |
1456 | - |
1457 | - if (parent.isValid()) { |
1458 | - return 0; |
1459 | - } else { // parent is root |
1460 | - return d->entries.size(); |
1461 | - } |
1462 | -} |
1463 | - |
1464 | -QVariant UsersModel::data(const QModelIndex &index, int role) const |
1465 | -{ |
1466 | - Q_D(const UsersModel); |
1467 | - |
1468 | - if (!index.isValid()) { |
1469 | - return QVariant(); |
1470 | - } |
1471 | - |
1472 | - int row = index.row(); |
1473 | - switch (role) { |
1474 | - case Qt::DisplayRole: |
1475 | - return d->entries[row].real_name; |
1476 | - case Qt::DecorationRole: |
1477 | - return QIcon(); |
1478 | - case UsersModel::NameRole: |
1479 | - return d->entries[row].username; |
1480 | - case UsersModel::RealNameRole: |
1481 | - return d->entries[row].real_name; |
1482 | - case UsersModel::SessionRole: |
1483 | - return d->entries[row].session; |
1484 | - case UsersModel::LoggedInRole: |
1485 | - return d->entries[row].is_active; |
1486 | - case UsersModel::BackgroundRole: |
1487 | - return QPixmap(d->entries[row].background); |
1488 | - case UsersModel::BackgroundPathRole: |
1489 | - return d->entries[row].background; |
1490 | - case UsersModel::HasMessagesRole: |
1491 | - return d->entries[row].has_messages; |
1492 | - case UsersModel::ImagePathRole: |
1493 | - return ""; |
1494 | - case UsersModel::UidRole: |
1495 | - return d->entries[row].uid; |
1496 | - default: |
1497 | - return QVariant(); |
1498 | - } |
1499 | -} |
1500 | - |
1501 | -} |
1502 | |
1503 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.h' |
1504 | --- plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.h 2016-12-23 11:04:53 +0000 |
1505 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.h 1970-01-01 00:00:00 +0000 |
1506 | @@ -1,66 +0,0 @@ |
1507 | -/* |
1508 | - * Copyright (C) 2013 Canonical, Ltd. |
1509 | - * Copyright (C) 2010-2011 David Edmundson. |
1510 | - * |
1511 | - * This program is free software; you can redistribute it and/or modify |
1512 | - * it under the terms of the GNU General Public License as published by |
1513 | - * the Free Software Foundation; version 3. |
1514 | - * |
1515 | - * This program is distributed in the hope that it will be useful, |
1516 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1517 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1518 | - * GNU General Public License for more details. |
1519 | - * |
1520 | - * You should have received a copy of the GNU General Public License |
1521 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1522 | - * |
1523 | - * Author: David Edmundson <kde@davidedmundson.co.uk> |
1524 | - */ |
1525 | - |
1526 | -#ifndef UNITY_MOCK_USERSMODEL_H |
1527 | -#define UNITY_MOCK_USERSMODEL_H |
1528 | - |
1529 | -#include <QtCore/QString> |
1530 | -#include <QtCore/QSharedDataPointer> |
1531 | -#include <QAbstractListModel> |
1532 | - |
1533 | -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1534 | - * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB |
1535 | - * COUNTERPART IN tests/mocks/Lightdm/liblightdm |
1536 | - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ |
1537 | - |
1538 | -namespace QLightDM |
1539 | -{ |
1540 | -class UsersModelPrivate; |
1541 | - |
1542 | -class Q_DECL_EXPORT UsersModel : public QAbstractListModel |
1543 | -{ |
1544 | - Q_OBJECT |
1545 | - |
1546 | -public: |
1547 | - explicit UsersModel(QObject *parent = 0); |
1548 | - virtual ~UsersModel() = default; |
1549 | - |
1550 | - enum UserModelRoles {NameRole = Qt::UserRole, |
1551 | - RealNameRole, |
1552 | - LoggedInRole, |
1553 | - BackgroundRole, |
1554 | - SessionRole, |
1555 | - HasMessagesRole, |
1556 | - ImagePathRole, |
1557 | - BackgroundPathRole, |
1558 | - UidRole |
1559 | - }; |
1560 | - Q_ENUM(UserModelRoles) |
1561 | - |
1562 | - int rowCount(const QModelIndex &parent) const override; |
1563 | - QVariant data(const QModelIndex &index, int role) const override; |
1564 | - |
1565 | -private: |
1566 | - UsersModelPrivate * const d_ptr; |
1567 | - Q_DECLARE_PRIVATE(UsersModel) |
1568 | -}; |
1569 | - |
1570 | -} |
1571 | - |
1572 | -#endif // UNITY_MOCK_USERSMODEL_H |
1573 | |
1574 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp' |
1575 | --- plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 2016-07-05 13:52:07 +0000 |
1576 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 1970-01-01 00:00:00 +0000 |
1577 | @@ -1,94 +0,0 @@ |
1578 | -/* |
1579 | - * Copyright (C) 2013-2016 Canonical, Ltd. |
1580 | - * |
1581 | - * This program is free software; you can redistribute it and/or modify |
1582 | - * it under the terms of the GNU General Public License as published by |
1583 | - * the Free Software Foundation; version 3. |
1584 | - * |
1585 | - * This program is distributed in the hope that it will be useful, |
1586 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1587 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1588 | - * GNU General Public License for more details. |
1589 | - * |
1590 | - * You should have received a copy of the GNU General Public License |
1591 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1592 | - * |
1593 | - * Author: Michael Terry <michael.terry@canonical.com> |
1594 | - */ |
1595 | - |
1596 | -#include "UsersModelPrivate.h" |
1597 | - |
1598 | -#include "AccountsServiceDBusAdaptor.h" |
1599 | -#include "UsersModel.h" |
1600 | - |
1601 | -#include <glib.h> |
1602 | -#include <QDebug> |
1603 | -#include <QDir> |
1604 | -#include <QSettings> |
1605 | -#include <QStringList> |
1606 | -#include <unistd.h> |
1607 | - |
1608 | -namespace QLightDM |
1609 | -{ |
1610 | - |
1611 | -UsersModelPrivate::UsersModelPrivate(UsersModel* parent) |
1612 | - : QObject(parent), |
1613 | - q_ptr(parent), |
1614 | - m_service(new AccountsServiceDBusAdaptor(this)) |
1615 | -{ |
1616 | - QFileInfo demoFile(QDir::homePath() + "/.unity8-greeter-demo"); |
1617 | - QString currentUser = g_get_user_name(); |
1618 | - uid_t currentUid = getuid(); |
1619 | - |
1620 | - if (demoFile.exists()) { |
1621 | - QSettings settings(demoFile.filePath(), QSettings::NativeFormat); |
1622 | - QStringList users = settings.value(QStringLiteral("users"), QStringList() << currentUser).toStringList(); |
1623 | - |
1624 | - entries.reserve(users.count()); |
1625 | - Q_FOREACH(const QString &user, users) |
1626 | - { |
1627 | - QString name = settings.value(user + "/name", user).toString(); |
1628 | - entries.append({user, name, 0, 0, false, false, 0, 0, currentUid++}); |
1629 | - } |
1630 | - } else { |
1631 | - entries.append({currentUser, 0, 0, 0, false, false, 0, 0, currentUid}); |
1632 | - |
1633 | - connect(m_service, &AccountsServiceDBusAdaptor::maybeChanged, |
1634 | - this, [this](const QString &user) { |
1635 | - if (user == entries[0].username) { |
1636 | - updateName(true); |
1637 | - } |
1638 | - }); |
1639 | - updateName(false); |
1640 | - } |
1641 | -} |
1642 | - |
1643 | -void UsersModelPrivate::updateName(bool async) |
1644 | -{ |
1645 | - auto pendingReply = m_service->getUserPropertyAsync(entries[0].username, |
1646 | - QStringLiteral("org.freedesktop.Accounts.User"), |
1647 | - QStringLiteral("RealName")); |
1648 | - auto *watcher = new QDBusPendingCallWatcher(pendingReply, this); |
1649 | - |
1650 | - connect(watcher, &QDBusPendingCallWatcher::finished, |
1651 | - this, [this](QDBusPendingCallWatcher* watcher) { |
1652 | - |
1653 | - QDBusPendingReply<QVariant> reply = *watcher; |
1654 | - watcher->deleteLater(); |
1655 | - if (reply.isError()) { |
1656 | - qWarning() << "Failed to get 'RealName' property - " << reply.error().message(); |
1657 | - return; |
1658 | - } |
1659 | - |
1660 | - const QString realName = reply.value().toString(); |
1661 | - if (entries[0].real_name != realName) { |
1662 | - entries[0].real_name = realName; |
1663 | - Q_EMIT dataChanged(0); |
1664 | - } |
1665 | - }); |
1666 | - if (!async) { |
1667 | - watcher->waitForFinished(); |
1668 | - } |
1669 | -} |
1670 | - |
1671 | -} |
1672 | |
1673 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h' |
1674 | --- plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h 2016-06-27 14:51:40 +0000 |
1675 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h 1970-01-01 00:00:00 +0000 |
1676 | @@ -1,72 +0,0 @@ |
1677 | -/* |
1678 | - * Copyright (C) 2013-2016 Canonical, Ltd. |
1679 | - * |
1680 | - * This program is free software; you can redistribute it and/or modify |
1681 | - * it under the terms of the GNU General Public License as published by |
1682 | - * the Free Software Foundation; version 3. |
1683 | - * |
1684 | - * This program is distributed in the hope that it will be useful, |
1685 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1686 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1687 | - * GNU General Public License for more details. |
1688 | - * |
1689 | - * You should have received a copy of the GNU General Public License |
1690 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1691 | - * |
1692 | - * Author: Michael Terry <michael.terry@canonical.com> |
1693 | - */ |
1694 | - |
1695 | -#ifndef UNITY_MOCK_USERSMODEL_PRIVATE_H |
1696 | -#define UNITY_MOCK_USERSMODEL_PRIVATE_H |
1697 | - |
1698 | -#include <QList> |
1699 | -#include <QObject> |
1700 | -#include <QString> |
1701 | - |
1702 | -class AccountsServiceDBusAdaptor; |
1703 | - |
1704 | -namespace QLightDM |
1705 | -{ |
1706 | -class UsersModel; |
1707 | - |
1708 | -class Entry |
1709 | -{ |
1710 | -public: |
1711 | - QString username; |
1712 | - QString real_name; |
1713 | - QString background; |
1714 | - QString layouts; |
1715 | - bool is_active; |
1716 | - bool has_messages; |
1717 | - QString session; |
1718 | - QString infographic; |
1719 | - uid_t uid; |
1720 | -}; |
1721 | - |
1722 | -class UsersModelPrivate : public QObject |
1723 | -{ |
1724 | - Q_OBJECT |
1725 | - |
1726 | -public: |
1727 | - explicit UsersModelPrivate(UsersModel *parent = 0); |
1728 | - virtual ~UsersModelPrivate() = default; |
1729 | - |
1730 | - QList<Entry> entries; |
1731 | - |
1732 | -Q_SIGNALS: |
1733 | - void dataChanged(int); |
1734 | - |
1735 | -protected: |
1736 | - UsersModel * const q_ptr; |
1737 | - |
1738 | -private: |
1739 | - Q_DECLARE_PUBLIC(UsersModel) |
1740 | - |
1741 | - void updateName(bool async); |
1742 | - |
1743 | - AccountsServiceDBusAdaptor *m_service; |
1744 | -}; |
1745 | - |
1746 | -} |
1747 | - |
1748 | -#endif // UNITY_MOCK_USERSMODEL_PRIVATE_H |
1749 | |
1750 | === removed file 'plugins/LightDM/IntegratedLightDM/qmldir' |
1751 | --- plugins/LightDM/IntegratedLightDM/qmldir 2016-02-03 23:45:45 +0000 |
1752 | +++ plugins/LightDM/IntegratedLightDM/qmldir 1970-01-01 00:00:00 +0000 |
1753 | @@ -1,3 +0,0 @@ |
1754 | -module LightDM.IntegratedLightDM |
1755 | -plugin IntegratedLightDM-qml |
1756 | -typeinfo IntegratedLightDM.qmltypes |
1757 | |
1758 | === modified file 'plugins/LightDM/plugin.cpp' |
1759 | --- plugins/LightDM/plugin.cpp 2017-01-19 15:37:24 +0000 |
1760 | +++ plugins/LightDM/plugin.cpp 2017-01-26 16:33:43 +0000 |
1761 | @@ -1,5 +1,5 @@ |
1762 | /* |
1763 | - * Copyright (C) 2012,2013,2015 Canonical, Ltd. |
1764 | + * Copyright (C) 2012-2017 Canonical, Ltd. |
1765 | * |
1766 | * This program is free software; you can redistribute it and/or modify |
1767 | * it under the terms of the GNU General Public License as published by |
1768 | @@ -65,35 +65,22 @@ |
1769 | return new UsersModel(); |
1770 | } |
1771 | |
1772 | -static QObject *infographic_provider(QQmlEngine *engine, QJSEngine *scriptEngine) |
1773 | +static QObject *infographic_provider(QQmlEngine *engine, QJSEngine *) |
1774 | { |
1775 | - Q_UNUSED(engine) |
1776 | - Q_UNUSED(scriptEngine) |
1777 | - return UserMetricsOutput::UserMetrics::getInstance(); |
1778 | + auto instance = UserMetricsOutput::UserMetrics::getInstance(); |
1779 | + engine->setObjectOwnership(instance, QQmlEngine::CppOwnership); |
1780 | + return instance; |
1781 | } |
1782 | |
1783 | -void PLUGIN_CLASSNAME::registerTypes(const char *uri) |
1784 | +void LightDM::registerTypes(const char *uri) |
1785 | { |
1786 | qmlRegisterType<QAbstractItemModel>(); |
1787 | qmlRegisterType<UserMetricsOutput::ColorTheme>(); |
1788 | |
1789 | -#if defined INTEGRATED_LIGHTDM |
1790 | - Q_ASSERT(uri == QLatin1String("LightDM.IntegratedLightDM")); |
1791 | - qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider); |
1792 | -#elif defined FULL_LIGHTDM |
1793 | - Q_ASSERT(uri == QLatin1String("LightDM.FullLightDM")); |
1794 | + Q_ASSERT(uri == QLatin1String("LightDM")); |
1795 | qmlRegisterSingletonType<QLightDM::Greeter>(uri, 0, 1, "Greeter", greeter_provider); |
1796 | -#else |
1797 | - #error No library defined in LightDM plugin |
1798 | -#endif |
1799 | - |
1800 | + qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider); |
1801 | qmlRegisterSingletonType<PromptsModel>(uri, 0, 1, "Prompts", prompts_provider); |
1802 | - |
1803 | qmlRegisterSingletonType<SessionsModel>(uri, 0, 1, "Sessions", sessions_provider); |
1804 | - qmlRegisterUncreatableType<QLightDM::SessionsModel>(uri, 0, 1, "SessionRoles", QStringLiteral("Type is not instantiable")); |
1805 | - |
1806 | qmlRegisterSingletonType<UsersModel>(uri, 0, 1, "Users", users_provider); |
1807 | - qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", QStringLiteral("Type is not instantiable")); |
1808 | - |
1809 | - qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider); |
1810 | } |
1811 | |
1812 | === modified file 'plugins/LightDM/plugin.h' |
1813 | --- plugins/LightDM/plugin.h 2016-12-19 19:55:07 +0000 |
1814 | +++ plugins/LightDM/plugin.h 2017-01-26 16:33:43 +0000 |
1815 | @@ -21,7 +21,7 @@ |
1816 | #include <QtQml/QQmlEngine> |
1817 | #include <QtQml/QQmlExtensionPlugin> |
1818 | |
1819 | -class PLUGIN_CLASSNAME : public QQmlExtensionPlugin |
1820 | +class LightDM : public QQmlExtensionPlugin |
1821 | { |
1822 | Q_OBJECT |
1823 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") |
1824 | |
1825 | === renamed file 'plugins/LightDM/FullLightDM/qmldir' => 'plugins/LightDM/qmldir' |
1826 | --- plugins/LightDM/FullLightDM/qmldir 2016-12-19 19:55:07 +0000 |
1827 | +++ plugins/LightDM/qmldir 2017-01-26 16:33:43 +0000 |
1828 | @@ -1,3 +1,2 @@ |
1829 | -module LightDM.FullLightDM |
1830 | -plugin FullLightDM-qml |
1831 | -typeinfo FullLightDM.qmltypes |
1832 | +module LightDM |
1833 | +plugin LightDM-qml |
1834 | |
1835 | === modified file 'plugins/Unity/Session/dbusunitysessionservice.cpp' |
1836 | --- plugins/Unity/Session/dbusunitysessionservice.cpp 2016-12-19 19:55:07 +0000 |
1837 | +++ plugins/Unity/Session/dbusunitysessionservice.cpp 2017-01-26 16:33:43 +0000 |
1838 | @@ -337,58 +337,16 @@ |
1839 | // user session. |
1840 | Q_EMIT LockRequested(); |
1841 | Q_EMIT lockRequested(); |
1842 | + Q_EMIT Locked(); |
1843 | } |
1844 | |
1845 | void DBusUnitySessionService::Lock() |
1846 | { |
1847 | // Normal lock (with animation, as compared to PromptLock above). Usually |
1848 | // used by indicator-session to lock the session in place. |
1849 | - // |
1850 | - // FIXME: We also -- as a bit of a hack around indicator-session not fully |
1851 | - // supporting a phone profile -- switch to greeter here. The unity7 flow is |
1852 | - // that the user chooses "Lock/Switch" from the indicator, and then can go |
1853 | - // to greeter by selecting "Switch" again from the indicator, which is now |
1854 | - // exposed by the desktop_lockscreen profile. But since in unity8, we try |
1855 | - // to expose most things all the time, we don't use the separate lockscreen |
1856 | - // profile. Instead, we just go directly to the greeter the first time |
1857 | - // a user presses "Lock/Switch". This isn't what this DBus call is |
1858 | - // supposed to do, but we can live with it for now. |
1859 | - // |
1860 | - // Here's a bug about indicator-session growing a converged Touch profile: |
1861 | - // https://launchpad.net/bugs/1557716 |
1862 | - // |
1863 | - // We only do this here in the animated-lock call because that's the only |
1864 | - // time the indicator locks without also asking the display manager to |
1865 | - // switch sessions on us. And since we are switching screens, we also |
1866 | - // don't bother respecting the animate request, simply doing a PromptLock. |
1867 | + // Though here we don't really worry about the difference and just call |
1868 | + // PromptLock. |
1869 | PromptLock(); |
1870 | - switchToGreeter(); |
1871 | -} |
1872 | - |
1873 | -void DBusUnitySessionService::switchToGreeter() |
1874 | -{ |
1875 | - // lock the session using the org.freedesktop.DisplayManager system DBUS service |
1876 | - const QString sessionPath = QString::fromLocal8Bit(qgetenv("XDG_SESSION_PATH")); |
1877 | - QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.DisplayManager"), |
1878 | - sessionPath, |
1879 | - QStringLiteral("org.freedesktop.DisplayManager.Session"), |
1880 | - QStringLiteral("Lock")); |
1881 | - |
1882 | - QDBusPendingCall pendingCall = QDBusConnection::SM_BUSNAME().asyncCall(msg); |
1883 | - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this); |
1884 | - connect(watcher, &QDBusPendingCallWatcher::finished, |
1885 | - this, [this](QDBusPendingCallWatcher* watcher) { |
1886 | - |
1887 | - QDBusPendingReply<void> reply = *watcher; |
1888 | - watcher->deleteLater(); |
1889 | - if (reply.isError()) { |
1890 | - qWarning() << "Lock call failed" << reply.error().message(); |
1891 | - return; |
1892 | - } |
1893 | - |
1894 | - // emit Locked when the call succeeds |
1895 | - Q_EMIT Locked(); |
1896 | - }); |
1897 | } |
1898 | |
1899 | void DBusUnitySessionService::doUnlock() |
1900 | |
1901 | === modified file 'plugins/Unity/Session/dbusunitysessionservice.h' |
1902 | --- plugins/Unity/Session/dbusunitysessionservice.h 2016-12-19 19:55:07 +0000 |
1903 | +++ plugins/Unity/Session/dbusunitysessionservice.h 2017-01-26 16:33:43 +0000 |
1904 | @@ -262,9 +262,6 @@ |
1905 | |
1906 | private Q_SLOTS: |
1907 | void doUnlock(); |
1908 | - |
1909 | -private: |
1910 | - void switchToGreeter(); |
1911 | }; |
1912 | |
1913 | class DBusGnomeSessionManagerWrapper : public UnityDBusObject |
1914 | |
1915 | === modified file 'qml/Components/Dialogs.qml' |
1916 | --- qml/Components/Dialogs.qml 2017-01-24 07:39:33 +0000 |
1917 | +++ qml/Components/Dialogs.qml 2017-01-26 16:33:43 +0000 |
1918 | @@ -19,10 +19,10 @@ |
1919 | import Unity.Application 0.1 |
1920 | import Unity.Session 0.1 |
1921 | import GlobalShortcut 1.0 |
1922 | +import LightDM 0.1 as LightDM |
1923 | import Ubuntu.Components 1.3 |
1924 | import Unity.Platform 1.0 |
1925 | import Utils 0.1 |
1926 | -import "../Greeter" |
1927 | |
1928 | MouseArea { |
1929 | id: root |
1930 | @@ -116,17 +116,17 @@ |
1931 | |
1932 | GlobalShortcut { // lock screen |
1933 | shortcut: Qt.Key_ScreenSaver |
1934 | - onTriggered: LightDMService.greeter.showGreeter() |
1935 | + onTriggered: LightDM.Greeter.showGreeter() |
1936 | } |
1937 | |
1938 | GlobalShortcut { // lock screen |
1939 | shortcut: Qt.ControlModifier|Qt.AltModifier|Qt.Key_L |
1940 | - onTriggered: LightDMService.greeter.showGreeter() |
1941 | + onTriggered: LightDM.Greeter.showGreeter() |
1942 | } |
1943 | |
1944 | GlobalShortcut { // lock screen |
1945 | shortcut: Qt.MetaModifier|Qt.Key_L |
1946 | - onTriggered: LightDMService.greeter.showGreeter() |
1947 | + onTriggered: LightDM.Greeter.showGreeter() |
1948 | } |
1949 | |
1950 | QtObject { |
1951 | @@ -180,7 +180,7 @@ |
1952 | width: parent.width |
1953 | text: i18n.ctr("Button: Lock the system", "Lock") |
1954 | onClicked: { |
1955 | - LightDMService.greeter.showGreeter() |
1956 | + LightDM.Greeter.showGreeter() |
1957 | logoutDialog.hide(); |
1958 | } |
1959 | Component.onCompleted: if (root.hasKeyboard) forceActiveFocus(Qt.TabFocusReason) |
1960 | |
1961 | === removed file 'qml/Greeter/FullLightDMImpl.qml' |
1962 | --- qml/Greeter/FullLightDMImpl.qml 2017-01-12 20:59:23 +0000 |
1963 | +++ qml/Greeter/FullLightDMImpl.qml 1970-01-01 00:00:00 +0000 |
1964 | @@ -1,31 +0,0 @@ |
1965 | -/* |
1966 | - * Copyright (C) 2015 Canonical, Ltd. |
1967 | - * |
1968 | - * This program is free software; you can redistribute it and/or modify |
1969 | - * it under the terms of the GNU General Public License as published by |
1970 | - * the Free Software Foundation; version 3. |
1971 | - * |
1972 | - * This program is distributed in the hope that it will be useful, |
1973 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1974 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1975 | - * GNU General Public License for more details. |
1976 | - * |
1977 | - * You should have received a copy of the GNU General Public License |
1978 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1979 | - */ |
1980 | - |
1981 | -import QtQuick 2.4 |
1982 | -import LightDM.FullLightDM 0.1 as LightDM |
1983 | - |
1984 | -Item{ |
1985 | - id: implementation |
1986 | - |
1987 | - property var greeter: LightDM.Greeter |
1988 | - property var infographic: LightDM.Infographic |
1989 | - property var prompts: LightDM.Prompts |
1990 | - property var sessions: LightDM.Sessions |
1991 | - property var sessionRoles: LightDM.SessionRoles |
1992 | - property var users: LightDM.Users |
1993 | - property var userRoles: LightDM.UserRoles |
1994 | - |
1995 | -} |
1996 | |
1997 | === modified file 'qml/Greeter/Greeter.qml' |
1998 | --- qml/Greeter/Greeter.qml 2017-01-19 15:37:24 +0000 |
1999 | +++ qml/Greeter/Greeter.qml 2017-01-26 16:33:43 +0000 |
2000 | @@ -18,13 +18,13 @@ |
2001 | import AccountsService 0.1 |
2002 | import Biometryd 0.0 |
2003 | import GSettings 1.0 |
2004 | +import LightDM 0.1 as LightDM |
2005 | import Powerd 0.1 |
2006 | import Ubuntu.Components 1.3 |
2007 | import Ubuntu.SystemImage 0.1 |
2008 | import Unity.Launcher 0.1 |
2009 | import Unity.Session 0.1 |
2010 | |
2011 | -import "." 0.1 |
2012 | import "../Components" |
2013 | |
2014 | Showable { |
2015 | @@ -51,7 +51,7 @@ |
2016 | readonly property bool hasLockedApp: lockedApp !== "" |
2017 | |
2018 | property bool forcedUnlock |
2019 | - readonly property bool locked: LightDMService.greeter.active && !LightDMService.greeter.authenticated && !forcedUnlock |
2020 | + readonly property bool locked: LightDM.Greeter.active && !LightDM.Greeter.authenticated && !forcedUnlock |
2021 | |
2022 | property bool tabletMode |
2023 | property url viewSource // only used for testing |
2024 | @@ -137,24 +137,23 @@ |
2025 | } |
2026 | |
2027 | function sessionToStart() { |
2028 | - for (var i = 0; i < LightDMService.sessions.count; i++) { |
2029 | - var session = LightDMService.sessions.data(i, |
2030 | - LightDMService.sessionRoles.KeyRole); |
2031 | + for (var i = 0; i < LightDM.Sessions.count; i++) { |
2032 | + var session = LightDM.Sessions.data(i, LightDM.Sessions.KeyRole); |
2033 | if (loader.item.sessionToStart === session) { |
2034 | return session; |
2035 | } |
2036 | } |
2037 | |
2038 | - return LightDMService.greeter.defaultSession; |
2039 | + return LightDM.Greeter.defaultSession; |
2040 | } |
2041 | |
2042 | QtObject { |
2043 | id: d |
2044 | |
2045 | - readonly property bool multiUser: LightDMService.users.count > 1 |
2046 | - readonly property int selectUserIndex: d.getUserIndex(LightDMService.greeter.selectUser) |
2047 | + readonly property bool multiUser: LightDM.Users.count > 1 |
2048 | + readonly property int selectUserIndex: d.getUserIndex(LightDM.Greeter.selectUser) |
2049 | property int currentIndex: Math.max(selectUserIndex, 0) |
2050 | - readonly property bool waiting: LightDMService.prompts.count == 0 && !root.forcedUnlock |
2051 | + readonly property bool waiting: LightDM.Prompts.count == 0 && !root.forcedUnlock |
2052 | property bool isLockscreen // true when we are locking an active session, rather than first user login |
2053 | readonly property bool secureFingerprint: isLockscreen && |
2054 | AccountsService.failedFingerprintLogins < |
2055 | @@ -180,8 +179,8 @@ |
2056 | return -1; |
2057 | |
2058 | // Find index for requested user, if it exists |
2059 | - for (var i = 0; i < LightDMService.users.count; i++) { |
2060 | - if (username === LightDMService.users.data(i, LightDMService.userRoles.NameRole)) { |
2061 | + for (var i = 0; i < LightDM.Users.count; i++) { |
2062 | + if (username === LightDM.Users.data(i, LightDM.Users.NameRole)) { |
2063 | return i; |
2064 | } |
2065 | } |
2066 | @@ -190,29 +189,31 @@ |
2067 | } |
2068 | |
2069 | function selectUser(index) { |
2070 | - if (index < 0 || index >= LightDMService.users.count) |
2071 | + if (index < 0 || index >= LightDM.Users.count) |
2072 | return; |
2073 | currentIndex = index; |
2074 | - var user = LightDMService.users.data(index, LightDMService.userRoles.NameRole); |
2075 | + var user = LightDM.Users.data(index, LightDM.Users.NameRole); |
2076 | AccountsService.user = user; |
2077 | LauncherModel.setUser(user); |
2078 | - LightDMService.greeter.authenticate(user); // always resets auth state |
2079 | + LightDM.Greeter.authenticate(user); // always resets auth state |
2080 | } |
2081 | |
2082 | function hideView() { |
2083 | if (loader.item) { |
2084 | loader.item.enabled = false; // drop OSK and prevent interaction |
2085 | loader.item.hide(); |
2086 | + sessionStarted(); |
2087 | } |
2088 | } |
2089 | |
2090 | function login() { |
2091 | - if (LightDMService.greeter.startSessionSync(root.sessionToStart())) { |
2092 | - sessionStarted(); |
2093 | - hideView(); |
2094 | - } else if (loader.item) { |
2095 | + if (!LightDM.Greeter.startSessionSync(root.sessionToStart())) { |
2096 | loader.item.notifyAuthenticationFailed(); |
2097 | + selectUser(currentIndex); |
2098 | } |
2099 | + |
2100 | + // If successful as a lockscreen, we don't need to hide ourselves. |
2101 | + // logind will tell us to unlock if our current user logged in. |
2102 | } |
2103 | |
2104 | function startUnlock(toTheRight) { |
2105 | @@ -234,7 +235,7 @@ |
2106 | |
2107 | function showFingerprintMessage(msg) { |
2108 | d.selectUser(d.currentIndex); |
2109 | - LightDMService.prompts.prepend(msg, LightDMService.prompts.Error); |
2110 | + LightDM.Prompts.prepend(msg, LightDM.Prompts.Error); |
2111 | if (loader.item) { |
2112 | loader.item.showErrorMessage(msg); |
2113 | loader.item.notifyAuthenticationFailed(); |
2114 | @@ -356,7 +357,7 @@ |
2115 | root.lockedApp = ""; |
2116 | item.forceActiveFocus(); |
2117 | d.selectUser(d.currentIndex); |
2118 | - LightDMService.infographic.readyForDataChange(); |
2119 | + LightDM.Infographic.readyForDataChange(); |
2120 | } |
2121 | |
2122 | Connections { |
2123 | @@ -366,7 +367,7 @@ |
2124 | } |
2125 | onResponded: { |
2126 | if (root.locked) { |
2127 | - LightDMService.greeter.respond(response); |
2128 | + LightDM.Greeter.respond(response); |
2129 | } else { |
2130 | d.login(); |
2131 | } |
2132 | @@ -443,18 +444,18 @@ |
2133 | Binding { |
2134 | target: loader.item |
2135 | property: "userModel" |
2136 | - value: LightDMService.users |
2137 | + value: LightDM.Users |
2138 | } |
2139 | |
2140 | Binding { |
2141 | target: loader.item |
2142 | property: "infographicModel" |
2143 | - value: LightDMService.infographic |
2144 | + value: LightDM.Infographic |
2145 | } |
2146 | } |
2147 | |
2148 | Connections { |
2149 | - target: LightDMService.greeter |
2150 | + target: LightDM.Greeter |
2151 | |
2152 | onShowGreeter: root.forceShow() |
2153 | onHideGreeter: root.forcedUnlock = true |
2154 | @@ -508,20 +509,20 @@ |
2155 | } |
2156 | |
2157 | Binding { |
2158 | - target: LightDMService.greeter |
2159 | + target: LightDM.Greeter |
2160 | property: "active" |
2161 | value: root.active |
2162 | } |
2163 | |
2164 | Binding { |
2165 | - target: LightDMService.infographic |
2166 | + target: LightDM.Infographic |
2167 | property: "username" |
2168 | - value: AccountsService.statsWelcomeScreen ? LightDMService.users.data(d.currentIndex, LightDMService.userRoles.NameRole) : "" |
2169 | + value: AccountsService.statsWelcomeScreen ? LightDM.Users.data(d.currentIndex, LightDM.Users.NameRole) : "" |
2170 | } |
2171 | |
2172 | Connections { |
2173 | target: i18n |
2174 | - onLanguageChanged: LightDMService.infographic.readyForDataChange() |
2175 | + onLanguageChanged: LightDM.Infographic.readyForDataChange() |
2176 | } |
2177 | |
2178 | Observer { |
2179 | @@ -573,7 +574,7 @@ |
2180 | failOperation("fingerprint reader is locked"); |
2181 | return; |
2182 | } |
2183 | - if (result !== LightDMService.users.data(d.currentIndex, LightDMService.userRoles.UidRole)) { |
2184 | + if (result !== LightDM.Users.data(d.currentIndex, LightDM.Users.UidRole)) { |
2185 | AccountsService.failedFingerprintLogins++; |
2186 | failOperation("not the selected user"); |
2187 | return; |
2188 | |
2189 | === removed file 'qml/Greeter/IntegratedLightDMImpl.qml' |
2190 | --- qml/Greeter/IntegratedLightDMImpl.qml 2017-01-12 20:59:23 +0000 |
2191 | +++ qml/Greeter/IntegratedLightDMImpl.qml 1970-01-01 00:00:00 +0000 |
2192 | @@ -1,30 +0,0 @@ |
2193 | -/* |
2194 | - * Copyright (C) 2015 Canonical, Ltd. |
2195 | - * |
2196 | - * This program is free software; you can redistribute it and/or modify |
2197 | - * it under the terms of the GNU General Public License as published by |
2198 | - * the Free Software Foundation; version 3. |
2199 | - * |
2200 | - * This program is distributed in the hope that it will be useful, |
2201 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2202 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2203 | - * GNU General Public License for more details. |
2204 | - * |
2205 | - * You should have received a copy of the GNU General Public License |
2206 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2207 | - */ |
2208 | - |
2209 | -import QtQuick 2.4 |
2210 | -import LightDM.IntegratedLightDM 0.1 as LightDM |
2211 | - |
2212 | -Item{ |
2213 | - id: implementation |
2214 | - |
2215 | - property var greeter: LightDM.Greeter |
2216 | - property var infographic: LightDM.Infographic |
2217 | - property var prompts: LightDM.Prompts |
2218 | - property var sessions: LightDM.Sessions |
2219 | - property var sessionRoles: LightDM.SessionRoles |
2220 | - property var users: LightDM.Users |
2221 | - property var userRoles: LightDM.UserRoles |
2222 | -} |
2223 | |
2224 | === removed file 'qml/Greeter/LightDMService.qml' |
2225 | --- qml/Greeter/LightDMService.qml 2017-01-12 20:59:23 +0000 |
2226 | +++ qml/Greeter/LightDMService.qml 1970-01-01 00:00:00 +0000 |
2227 | @@ -1,54 +0,0 @@ |
2228 | -/* |
2229 | - * Copyright (C) 2015 Canonical, Ltd. |
2230 | - * |
2231 | - * This program is free software; you can redistribute it and/or modify |
2232 | - * it under the terms of the GNU General Public License as published by |
2233 | - * the Free Software Foundation; version 3. |
2234 | - * |
2235 | - * This program is distributed in the hope that it will be useful, |
2236 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2237 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2238 | - * GNU General Public License for more details. |
2239 | - * |
2240 | - * You should have received a copy of the GNU General Public License |
2241 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2242 | - */ |
2243 | - |
2244 | -/** |
2245 | - * Lightweight wrapper that allows for loading integrated/real LightDM |
2246 | - * plugin |
2247 | - */ |
2248 | - |
2249 | -pragma Singleton |
2250 | -import QtQuick 2.4 |
2251 | - |
2252 | -Loader { |
2253 | - id: loader |
2254 | - |
2255 | - property var greeter: d.valid ? loader.item.greeter : null |
2256 | - property var infographic: d.valid ? loader.item.infographic : null |
2257 | - property var prompts: d.valid ? loader.item.prompts : null |
2258 | - property var sessions: d.valid ? loader.item.sessions : null |
2259 | - property var sessionRoles: d.valid ? loader.item.sessionRoles : null |
2260 | - property var users: d.valid ? loader.item.users : null |
2261 | - property var userRoles: d.valid ? loader.item.userRoles : null |
2262 | - |
2263 | - // This trickery handles cases where applicationArguments aren't provided |
2264 | - // such as during testing |
2265 | - property var fullLightDM: { |
2266 | - if (typeof applicationArguments === "undefined" || |
2267 | - applicationArguments.mode === "greeter") { |
2268 | - return true; |
2269 | - } |
2270 | - return false; |
2271 | - } |
2272 | - |
2273 | - source: fullLightDM ? |
2274 | - "FullLightDMImpl.qml" : "IntegratedLightDMImpl.qml" |
2275 | - |
2276 | - QtObject { |
2277 | - id: d |
2278 | - |
2279 | - property bool valid: loader.item !== null |
2280 | - } |
2281 | -} |
2282 | |
2283 | === modified file 'qml/Greeter/LoginList.qml' |
2284 | --- qml/Greeter/LoginList.qml 2017-01-24 07:40:40 +0000 |
2285 | +++ qml/Greeter/LoginList.qml 2017-01-26 16:33:43 +0000 |
2286 | @@ -17,8 +17,8 @@ |
2287 | import QtQuick 2.4 |
2288 | import QtGraphicalEffects 1.0 |
2289 | import Ubuntu.Components 1.3 |
2290 | +import LightDM 0.1 as LightDM |
2291 | import "../Components" |
2292 | -import "." 0.1 |
2293 | |
2294 | StyledItem { |
2295 | id: root |
2296 | @@ -155,8 +155,8 @@ |
2297 | } |
2298 | text: userList.currentIndex === index |
2299 | && name === "*other" |
2300 | - && LightDMService.greeter.authenticationUser !== "" |
2301 | - ? LightDMService.greeter.authenticationUser : realName |
2302 | + && LightDM.Greeter.authenticationUser !== "" |
2303 | + ? LightDM.Greeter.authenticationUser : realName |
2304 | color: userList.currentIndex !== index ? theme.palette.normal.raised |
2305 | : theme.palette.normal.raisedText |
2306 | |
2307 | @@ -208,8 +208,8 @@ |
2308 | |
2309 | readonly property alias icon: badge.source |
2310 | |
2311 | - visible: LightDMService.sessions.count > 1 && |
2312 | - !LightDMService.users.data(userList.currentIndex, LightDMService.userRoles.LoggedInRole) |
2313 | + visible: LightDM.Sessions.count > 1 && |
2314 | + !LightDM.Users.data(userList.currentIndex, LightDM.Users.LoggedInRole) |
2315 | |
2316 | height: units.gu(3.5) |
2317 | width: units.gu(3.5) |
2318 | @@ -240,7 +240,7 @@ |
2319 | anchors.margins: units.dp(3) |
2320 | keyColor: "#ffffff" // icon providers give us white icons |
2321 | color: theme.palette.normal.raisedSecondaryText |
2322 | - source: LightDMService.sessions.iconUrl(root.currentSession) |
2323 | + source: LightDM.Sessions.iconUrl(root.currentSession) |
2324 | } |
2325 | |
2326 | Keys.onReturnPressed: { |
2327 | @@ -255,9 +255,9 @@ |
2328 | // Refresh the icon path if looking at different places at runtime |
2329 | // this is mainly for testing |
2330 | Connections { |
2331 | - target: LightDMService.sessions |
2332 | + target: LightDM.Sessions |
2333 | onIconSearchDirectoriesChanged: { |
2334 | - badge.source = LightDMService.sessions.iconUrl(root.currentSession) |
2335 | + badge.source = LightDM.Sessions.iconUrl(root.currentSession) |
2336 | } |
2337 | } |
2338 | } |
2339 | @@ -290,7 +290,7 @@ |
2340 | } |
2341 | |
2342 | Connections { |
2343 | - target: LightDMService.prompts |
2344 | + target: LightDM.Prompts |
2345 | onModelReset: promptList.interactive = true |
2346 | } |
2347 | } |
2348 | |
2349 | === modified file 'qml/Greeter/NarrowView.qml' |
2350 | --- qml/Greeter/NarrowView.qml 2017-01-19 15:37:24 +0000 |
2351 | +++ qml/Greeter/NarrowView.qml 2017-01-26 16:33:43 +0000 |
2352 | @@ -34,7 +34,7 @@ |
2353 | property alias alphanumeric: loginList.alphanumeric |
2354 | property alias userModel: loginList.model |
2355 | property alias infographicModel: coverPage.infographicModel |
2356 | - property string sessionToStart |
2357 | + property alias sessionToStart: loginList.currentSession |
2358 | property bool waiting |
2359 | readonly property bool fullyShown: coverPage.showProgress === 1 || lockscreen.shown |
2360 | readonly property bool required: coverPage.required || lockscreen.required |
2361 | |
2362 | === modified file 'qml/Greeter/PromptList.qml' |
2363 | --- qml/Greeter/PromptList.qml 2017-01-13 17:31:51 +0000 |
2364 | +++ qml/Greeter/PromptList.qml 2017-01-26 16:33:43 +0000 |
2365 | @@ -16,8 +16,8 @@ |
2366 | |
2367 | import QtQuick 2.4 |
2368 | import Ubuntu.Components 1.3 |
2369 | +import LightDM 0.1 as LightDM |
2370 | import "../Components" |
2371 | -import "." 0.1 |
2372 | |
2373 | FocusScope { |
2374 | id: root |
2375 | @@ -58,13 +58,13 @@ |
2376 | |
2377 | Repeater { |
2378 | id: repeater |
2379 | - model: LightDMService.prompts |
2380 | + model: LightDM.Prompts |
2381 | |
2382 | delegate: Loader { |
2383 | id: loader |
2384 | |
2385 | - readonly property bool isLabel: model.type == LightDMService.prompts.Message || |
2386 | - model.type == LightDMService.prompts.Error |
2387 | + readonly property bool isLabel: model.type == LightDM.Prompts.Message || |
2388 | + model.type == LightDM.Prompts.Error |
2389 | readonly property var modelData: model |
2390 | |
2391 | sourceComponent: isLabel ? infoLabel : greeterPrompt |
2392 | @@ -99,7 +99,7 @@ |
2393 | property var model |
2394 | readonly property bool isPrompt: false |
2395 | |
2396 | - color: model.type === LightDMService.prompts.Message ? theme.palette.normal.raisedText |
2397 | + color: model.type === LightDM.Prompts.Message ? theme.palette.normal.raisedText |
2398 | : theme.palette.normal.negative |
2399 | fontSize: "small" |
2400 | textFormat: Text.PlainText |
2401 | @@ -121,8 +121,8 @@ |
2402 | |
2403 | interactive: root.interactive |
2404 | isAlphanumeric: model.text !== "" || root.alphanumeric |
2405 | - isPrompt: model.type !== LightDMService.prompts.Button |
2406 | - isSecret: model.type === LightDMService.prompts.Secret |
2407 | + isPrompt: model.type !== LightDM.Prompts.Button |
2408 | + isSecret: model.type === LightDM.Prompts.Secret |
2409 | text: model.text ? model.text : (isAlphanumeric ? i18n.tr("Passphrase") : i18n.tr("Passcode")) |
2410 | |
2411 | onClicked: root.clicked() |
2412 | |
2413 | === modified file 'qml/Greeter/SessionsList.qml' |
2414 | --- qml/Greeter/SessionsList.qml 2016-12-19 19:55:07 +0000 |
2415 | +++ qml/Greeter/SessionsList.qml 2017-01-26 16:33:43 +0000 |
2416 | @@ -17,7 +17,7 @@ |
2417 | import QtQuick 2.4 |
2418 | import Ubuntu.Components 1.3 |
2419 | import Ubuntu.Components.ListItems 1.3 |
2420 | -import "." 0.1 |
2421 | +import LightDM 0.1 as LightDM |
2422 | import "../Components" |
2423 | |
2424 | Item { |
2425 | @@ -43,8 +43,8 @@ |
2426 | } |
2427 | |
2428 | function currentKey() { |
2429 | - var session = LightDMService.sessions.data( |
2430 | - sessionsList.currentIndex, LightDMService.sessionRoles.KeyRole) |
2431 | + var session = LightDM.Sessions.data( |
2432 | + sessionsList.currentIndex, LightDM.Sessions.KeyRole) |
2433 | return session; |
2434 | } |
2435 | |
2436 | @@ -111,7 +111,7 @@ |
2437 | |
2438 | boundsBehavior: Flickable.StopAtBounds |
2439 | |
2440 | - model: LightDMService.sessions |
2441 | + model: LightDM.Sessions |
2442 | header: ListItemLayout { |
2443 | id: header |
2444 | |
2445 | |
2446 | === modified file 'qml/Greeter/WideView.qml' |
2447 | --- qml/Greeter/WideView.qml 2017-01-23 14:28:42 +0000 |
2448 | +++ qml/Greeter/WideView.qml 2017-01-26 16:33:43 +0000 |
2449 | @@ -16,7 +16,7 @@ |
2450 | |
2451 | import QtQuick 2.4 |
2452 | import Ubuntu.Components 1.3 |
2453 | -import "." 0.1 |
2454 | +import LightDM 0.1 as LightDM |
2455 | |
2456 | FocusScope { |
2457 | id: root |
2458 | @@ -139,7 +139,7 @@ |
2459 | Component.onCompleted: setCurrentSession() |
2460 | |
2461 | function setCurrentSession() { |
2462 | - currentSession = LightDMService.users.data(currentIndex, LightDMService.userRoles.SessionRole); |
2463 | + currentSession = LightDM.Users.data(currentIndex, LightDM.Users.SessionRole); |
2464 | } |
2465 | } |
2466 | |
2467 | |
2468 | === removed file 'qml/Greeter/qmldir' |
2469 | --- qml/Greeter/qmldir 2015-10-20 00:59:12 +0000 |
2470 | +++ qml/Greeter/qmldir 1970-01-01 00:00:00 +0000 |
2471 | @@ -1,1 +0,0 @@ |
2472 | -singleton LightDMService 0.1 LightDMService.qml |
2473 | |
2474 | === modified file 'qml/Shell.qml' |
2475 | --- qml/Shell.qml 2017-01-24 07:43:54 +0000 |
2476 | +++ qml/Shell.qml 2017-01-26 16:33:43 +0000 |
2477 | @@ -27,6 +27,7 @@ |
2478 | import GlobalShortcut 1.0 // has to be before Utils, because of WindowInputFilter |
2479 | import GSettings 1.0 |
2480 | import ImageCache 0.1 |
2481 | +import LightDM 0.1 as LightDM |
2482 | import Utils 0.1 |
2483 | import Powerd 0.1 |
2484 | import SessionBroadcast 0.1 |
2485 | @@ -202,6 +203,12 @@ |
2486 | value: ApplicationManager |
2487 | } |
2488 | |
2489 | + Binding { |
2490 | + target: AccountsService |
2491 | + property: "greeterMode" |
2492 | + value: shell.mode === "greeter" |
2493 | + } |
2494 | + |
2495 | Component.onCompleted: { |
2496 | finishStartUpTimer.start(); |
2497 | } |
2498 | @@ -528,7 +535,7 @@ |
2499 | readonly property bool focusedSurfaceIsFullscreen: topLevelSurfaceList.focusedWindow |
2500 | ? topLevelSurfaceList.focusedWindow.state === Mir.FullscreenState |
2501 | : false |
2502 | - fullscreenMode: (focusedSurfaceIsFullscreen && !LightDMService.greeter.active && launcher.progress == 0) |
2503 | + fullscreenMode: (focusedSurfaceIsFullscreen && !LightDM.Greeter.active && launcher.progress === 0) |
2504 | || greeter.hasLockedApp |
2505 | greeterShown: greeter && greeter.shown |
2506 | } |
2507 | |
2508 | === modified file 'tests/mocks/AccountsService/AccountsService.cpp' |
2509 | --- tests/mocks/AccountsService/AccountsService.cpp 2017-01-19 15:23:58 +0000 |
2510 | +++ tests/mocks/AccountsService/AccountsService.cpp 2017-01-26 16:33:43 +0000 |
2511 | @@ -26,6 +26,7 @@ |
2512 | m_enableLauncherWhileLocked(true), |
2513 | m_enableIndicatorsWhileLocked(true), |
2514 | m_backgroundFile(), |
2515 | + m_greeterMode(true), |
2516 | m_statsWelcomeScreen(true), |
2517 | m_failedLogins(0), |
2518 | m_failedFingerprintLogins(0), |
2519 | @@ -50,6 +51,19 @@ |
2520 | Q_EMIT backgroundFileChanged(); |
2521 | } |
2522 | |
2523 | +bool AccountsService::greeterMode() const |
2524 | +{ |
2525 | + return m_greeterMode; |
2526 | +} |
2527 | + |
2528 | +void AccountsService::setGreeterMode(bool greeterMode) |
2529 | +{ |
2530 | + if (m_greeterMode != greeterMode) { |
2531 | + m_greeterMode = greeterMode; |
2532 | + Q_EMIT greeterModeChanged(); |
2533 | + } |
2534 | +} |
2535 | + |
2536 | bool AccountsService::demoEdges() const |
2537 | { |
2538 | return m_demoEdges; |
2539 | |
2540 | === modified file 'tests/mocks/AccountsService/AccountsService.h' |
2541 | --- tests/mocks/AccountsService/AccountsService.h 2017-01-18 00:25:13 +0000 |
2542 | +++ tests/mocks/AccountsService/AccountsService.h 2017-01-26 16:33:43 +0000 |
2543 | @@ -30,6 +30,10 @@ |
2544 | READ user |
2545 | WRITE setUser |
2546 | NOTIFY userChanged) |
2547 | + Q_PROPERTY (bool greeterMode |
2548 | + READ greeterMode |
2549 | + WRITE setGreeterMode |
2550 | + NOTIFY greeterModeChanged) |
2551 | Q_PROPERTY (bool demoEdges |
2552 | READ demoEdges |
2553 | WRITE setDemoEdges |
2554 | @@ -98,6 +102,8 @@ |
2555 | |
2556 | QString user() const; |
2557 | void setUser(const QString &user); |
2558 | + bool greeterMode() const; |
2559 | + void setGreeterMode(bool greeterMode); |
2560 | bool demoEdges() const; |
2561 | void setDemoEdges(bool demoEdges); |
2562 | QStringList demoEdgesCompleted() const; |
2563 | @@ -132,6 +138,7 @@ |
2564 | |
2565 | Q_SIGNALS: |
2566 | void userChanged(); |
2567 | + void greeterModeChanged(); |
2568 | void demoEdgesChanged(); |
2569 | void demoEdgesCompletedChanged(); |
2570 | void enableFingerprintIdentificationChanged(); |
2571 | @@ -154,6 +161,7 @@ |
2572 | bool m_enableIndicatorsWhileLocked; |
2573 | QString m_backgroundFile; |
2574 | QString m_user; |
2575 | + bool m_greeterMode; |
2576 | bool m_statsWelcomeScreen; |
2577 | uint m_failedLogins; |
2578 | uint m_failedFingerprintLogins; |
2579 | |
2580 | === modified file 'tests/mocks/AccountsService/CMakeLists.txt' |
2581 | --- tests/mocks/AccountsService/CMakeLists.txt 2017-01-19 15:37:24 +0000 |
2582 | +++ tests/mocks/AccountsService/CMakeLists.txt 2017-01-26 16:33:43 +0000 |
2583 | @@ -1,10 +1,14 @@ |
2584 | include_directories( |
2585 | ${CMAKE_CURRENT_BINARY_DIR} |
2586 | ${CMAKE_SOURCE_DIR}/plugins/LightDM |
2587 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM |
2588 | ${CMAKE_SOURCE_DIR}/plugins/Utils |
2589 | ) |
2590 | |
2591 | +include_directories( |
2592 | + SYSTEM |
2593 | + ${LIBLIGHTDM_INCLUDE_DIRS} |
2594 | + ) |
2595 | + |
2596 | add_library(MockAccountsService-qml MODULE |
2597 | ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp |
2598 | ${CMAKE_SOURCE_DIR}/plugins/LightDM/PromptsModel.cpp |
2599 | |
2600 | === modified file 'tests/mocks/libusermetrics/UserMetrics.cpp' |
2601 | --- tests/mocks/libusermetrics/UserMetrics.cpp 2017-01-18 00:25:13 +0000 |
2602 | +++ tests/mocks/libusermetrics/UserMetrics.cpp 2017-01-26 16:33:43 +0000 |
2603 | @@ -301,7 +301,7 @@ |
2604 | QSharedPointer<UserMetricsData> data( |
2605 | new UserMetricsData("<b>52km</b> travelled", first, firstMonth, |
2606 | ninth, secondMonth, this)); |
2607 | - m_fakeData.insert("single", data); |
2608 | + m_fakeData.insert("has-password", data); |
2609 | m_fakeData.insert("has-pin", data); |
2610 | } |
2611 | |
2612 | @@ -317,7 +317,7 @@ |
2613 | QSharedPointer<UserMetricsData> data( |
2614 | new UserMetricsData("<b>33</b> messages today", second, |
2615 | firstMonth, eighth, secondMonth, this)); |
2616 | - m_fakeData.insert("single", data); |
2617 | + m_fakeData.insert("has-password", data); |
2618 | m_fakeData.insert("has-pin", data); |
2619 | } |
2620 | |
2621 | @@ -334,10 +334,8 @@ |
2622 | QSharedPointer<UserMetricsData> data( |
2623 | new UserMetricsData("<b>19</b> minutes talk time", eighth, |
2624 | firstMonth, second, secondMonth, this)); |
2625 | - m_fakeData.insert("single", data); |
2626 | + m_fakeData.insert("has-password", data); |
2627 | m_fakeData.insert("has-pin", data); |
2628 | - // Also use same data for some tablet users |
2629 | - m_fakeData.insert("has-password", data); |
2630 | m_fakeData.insert("no-password", data); |
2631 | m_fakeData.insert("empty-name", data); |
2632 | } |
2633 | |
2634 | === modified file 'tests/plugins/AccountsService/AccountsServer.cpp' |
2635 | --- tests/plugins/AccountsService/AccountsServer.cpp 2016-12-19 19:55:07 +0000 |
2636 | +++ tests/plugins/AccountsService/AccountsServer.cpp 2017-01-26 16:33:43 +0000 |
2637 | @@ -40,6 +40,8 @@ |
2638 | if (QDBusConnection::sessionBus().objectRegisteredAt(path) != nullptr) |
2639 | return true; |
2640 | |
2641 | + m_users.insert(path); |
2642 | + |
2643 | auto props = new PropertiesServer(this); |
2644 | new PropertiesAdaptor(props); |
2645 | new AccountsUserAdaptor(props); |
2646 | @@ -52,6 +54,15 @@ |
2647 | if (QDBusConnection::sessionBus().objectRegisteredAt(path) == nullptr) |
2648 | return false; |
2649 | |
2650 | + m_users.remove(path); |
2651 | QDBusConnection::sessionBus().unregisterObject(path); |
2652 | return true; |
2653 | } |
2654 | + |
2655 | +void AccountsServer::RemoveAllUsers() |
2656 | +{ |
2657 | + Q_FOREACH(const QString &path, m_users) { |
2658 | + m_users.remove(path); |
2659 | + QDBusConnection::sessionBus().unregisterObject(path); |
2660 | + } |
2661 | +} |
2662 | |
2663 | === modified file 'tests/plugins/AccountsService/AccountsServer.h' |
2664 | --- tests/plugins/AccountsService/AccountsServer.h 2016-12-19 19:55:07 +0000 |
2665 | +++ tests/plugins/AccountsService/AccountsServer.h 2017-01-26 16:33:43 +0000 |
2666 | @@ -23,6 +23,7 @@ |
2667 | #include <QDBusContext> |
2668 | #include <QDBusObjectPath> |
2669 | #include <QObject> |
2670 | +#include <QSet> |
2671 | #include <QString> |
2672 | |
2673 | class AccountsServer: public QObject, protected QDBusContext |
2674 | @@ -39,6 +40,10 @@ |
2675 | // mock only. |
2676 | bool AddUser(const QString &user); |
2677 | bool RemoveUser(const QString &user); |
2678 | + void RemoveAllUsers(); |
2679 | + |
2680 | +private: |
2681 | + QSet<QString> m_users; |
2682 | }; |
2683 | |
2684 | #endif |
2685 | |
2686 | === modified file 'tests/plugins/AccountsService/client.cpp' |
2687 | --- tests/plugins/AccountsService/client.cpp 2016-12-19 19:55:07 +0000 |
2688 | +++ tests/plugins/AccountsService/client.cpp 2017-01-26 16:33:43 +0000 |
2689 | @@ -26,6 +26,8 @@ |
2690 | #include <QDBusReply> |
2691 | #include <QDBusMetaType> |
2692 | |
2693 | +#include <glib.h> |
2694 | + |
2695 | template <class T> |
2696 | QVariant dbusVariant(const T& value) { return QVariant::fromValue(QDBusVariant(value)); } |
2697 | |
2698 | @@ -62,11 +64,7 @@ |
2699 | private Q_SLOTS: |
2700 | |
2701 | void init() { |
2702 | - QDBusReply<bool> addReply = QDBusInterface("org.freedesktop.Accounts", |
2703 | - "/org/freedesktop/Accounts", |
2704 | - "org.freedesktop.Accounts").call("AddUser", QTest::currentTestFunction()); |
2705 | - QVERIFY(addReply.isValid()); |
2706 | - QCOMPARE(addReply.value(), true); |
2707 | + addUser(QTest::currentTestFunction()); |
2708 | |
2709 | m_userInterface = new QDBusInterface("org.freedesktop.Accounts", |
2710 | QString("/%1").arg(QTest::currentTestFunction()), |
2711 | @@ -77,17 +75,46 @@ |
2712 | } |
2713 | |
2714 | void cleanup() { |
2715 | - QDBusReply<bool> reply = QDBusInterface("org.freedesktop.Accounts", |
2716 | + QDBusReply<void> reply = QDBusInterface("org.freedesktop.Accounts", |
2717 | "/org/freedesktop/Accounts", |
2718 | - "org.freedesktop.Accounts").call("RemoveUser", QTest::currentTestFunction()); |
2719 | + "org.freedesktop.Accounts").call("RemoveAllUsers"); |
2720 | QVERIFY(reply.isValid()); |
2721 | - QCOMPARE(reply.value(), true); |
2722 | |
2723 | delete m_userInterface; |
2724 | m_spy.clear(); |
2725 | m_mousePrimaryButtonSpy.clear(); |
2726 | } |
2727 | |
2728 | + void addUser(const QString &user) |
2729 | + { |
2730 | + QDBusReply<bool> addReply = QDBusInterface("org.freedesktop.Accounts", |
2731 | + "/org/freedesktop/Accounts", |
2732 | + "org.freedesktop.Accounts").call("AddUser", user); |
2733 | + QVERIFY(addReply.isValid()); |
2734 | + QCOMPARE(addReply.value(), true); |
2735 | + } |
2736 | + |
2737 | + QVariant getASProperty(const QString &interface, const QString &key, const QString &user = QString()) |
2738 | + { |
2739 | + QString ifaceUser = user; |
2740 | + if (ifaceUser.isEmpty()) |
2741 | + ifaceUser = QTest::currentTestFunction(); |
2742 | + |
2743 | + QDBusInterface iface("org.freedesktop.Accounts", |
2744 | + QString("/%1").arg(ifaceUser), |
2745 | + "org.freedesktop.DBus.Properties", |
2746 | + QDBusConnection::sessionBus()); |
2747 | + |
2748 | + auto message = iface.call("Get", interface, key); |
2749 | + if (message.type() == QDBusMessage::ReplyMessage) { |
2750 | + return message.arguments().first().value<QDBusVariant>().variant(); |
2751 | + } |
2752 | + else { |
2753 | + qWarning() << "Could not get property" << key << ":" << message.errorMessage(); |
2754 | + return QVariant(); |
2755 | + } |
2756 | + } |
2757 | + |
2758 | void testInvalids() |
2759 | { |
2760 | // Test various invalid calls |
2761 | @@ -323,25 +350,16 @@ |
2762 | QCOMPARE(message.type(), QDBusMessage::ErrorMessage); |
2763 | QCOMPARE(message.errorName(), QStringLiteral("org.freedesktop.DBus.Error.InvalidArgs")); |
2764 | |
2765 | - message = m_userInterface->call("Get", |
2766 | - "org.freedesktop.Accounts.User", |
2767 | - "RealName"); |
2768 | - QCOMPARE(message.type(), QDBusMessage::ReplyMessage); |
2769 | - auto response = message.arguments().first().value<QDBusVariant>().variant().toString(); |
2770 | - QCOMPARE(response, QStringLiteral("")); |
2771 | + auto response = getASProperty("org.freedesktop.Accounts.User", "RealName"); |
2772 | + QCOMPARE(response.toString(), QStringLiteral("")); |
2773 | |
2774 | // Now try it via our AS wrapper and confirm it did get through, unlike above |
2775 | session.setRealName("Stallman"); |
2776 | |
2777 | QCOMPARE(session.realName(), QStringLiteral("Stallman")); |
2778 | |
2779 | - message = m_userInterface->call("Get", |
2780 | - "org.freedesktop.Accounts.User", |
2781 | - "RealName"); |
2782 | - QCOMPARE(message.type(), QDBusMessage::ReplyMessage); |
2783 | - response = message.arguments().first().value<QDBusVariant>().variant().toString(); |
2784 | - QCOMPARE(response, QStringLiteral("Stallman")); |
2785 | - |
2786 | + response = getASProperty("org.freedesktop.Accounts.User", "RealName"); |
2787 | + QCOMPARE(response.toString(), QStringLiteral("Stallman")); |
2788 | } |
2789 | |
2790 | void testAsynchronousChangeForKeymaps() |
2791 | @@ -367,6 +385,38 @@ |
2792 | QTRY_COMPARE(session.keymaps(), result); |
2793 | } |
2794 | |
2795 | + void testGreeterMode() |
2796 | + { |
2797 | + addUser(g_get_user_name()); |
2798 | + addUser("OtherUser"); // presumably will never conflict with running user |
2799 | + AccountsService session(this); |
2800 | + QVERIFY(session.greeterMode()); |
2801 | + |
2802 | + session.setGreeterMode(false); |
2803 | + |
2804 | + // NOTE: we change real user data here, but it's a harmless change |
2805 | + session.setFailedLogins(1); |
2806 | + QCOMPARE(session.failedLogins(), 1u); |
2807 | + QCOMPARE(getASProperty("com.canonical.unity.AccountsService.Private", |
2808 | + "FailedLogins", session.user()), QVariant(1)); |
2809 | + |
2810 | + // This will fail because we aren't the active user |
2811 | + session.setUser("OtherUser"); |
2812 | + session.setFailedLogins(2); |
2813 | + QCOMPARE(session.failedLogins(), 2u); |
2814 | + QCOMPARE(getASProperty("com.canonical.unity.AccountsService.Private", |
2815 | + "FailedLogins", "OtherUser"), QVariant(0)); |
2816 | + |
2817 | + session.setGreeterMode(true); |
2818 | + |
2819 | + // But now a similar call will succeed because we're in greeter mode |
2820 | + session.setFailedLogins(3); |
2821 | + QCOMPARE(session.failedLogins(), 3u); |
2822 | + QCOMPARE(getASProperty("com.canonical.unity.AccountsService.Private", |
2823 | + "FailedLogins", "OtherUser"), QVariant(3)); |
2824 | + |
2825 | + } |
2826 | + |
2827 | Q_SIGNALS: |
2828 | void propertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalid); |
2829 | void setMousePrimaryButtonCalled(int button); |
2830 | |
2831 | === modified file 'tests/plugins/AccountsService/interfaces.xml' |
2832 | --- tests/plugins/AccountsService/interfaces.xml 2016-12-19 19:55:07 +0000 |
2833 | +++ tests/plugins/AccountsService/interfaces.xml 2017-01-26 16:33:43 +0000 |
2834 | @@ -36,6 +36,7 @@ |
2835 | <arg name="user" type="s" direction="in" /> |
2836 | <arg name="success" type="b" direction="out" /> |
2837 | </method> |
2838 | + <method name="RemoveAllUsers"/> |
2839 | </interface> |
2840 | <interface name="com.ubuntu.AccountsService.Input" /> |
2841 | <interface name="com.ubuntu.touch.AccountsService.SecurityPrivacy" /> |
2842 | |
2843 | === removed file 'tests/plugins/LightDM/CMakeLists.txt' |
2844 | --- tests/plugins/LightDM/CMakeLists.txt 2015-09-28 18:21:40 +0000 |
2845 | +++ tests/plugins/LightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
2846 | @@ -1,1 +0,0 @@ |
2847 | -add_subdirectory(IntegratedLightDM) |
2848 | |
2849 | === renamed file 'tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt' => 'tests/plugins/LightDM/CMakeLists.txt' |
2850 | --- tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt 2017-01-19 15:37:24 +0000 |
2851 | +++ tests/plugins/LightDM/CMakeLists.txt 2017-01-26 16:33:43 +0000 |
2852 | @@ -1,54 +1,40 @@ |
2853 | include_directories( |
2854 | - ${GLIB_INCLUDE_DIRS} |
2855 | ${CMAKE_CURRENT_BINARY_DIR} |
2856 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM |
2857 | - ) |
2858 | - |
2859 | + ${CMAKE_SOURCE_DIR}/plugins/LightDM |
2860 | + ${CMAKE_SOURCE_DIR}/plugins/Utils |
2861 | + ${CMAKE_SOURCE_DIR}/tests/mocks/liblightdm |
2862 | + ) |
2863 | + |
2864 | +include_directories( |
2865 | + SYSTEM |
2866 | + ${GLIB_INCLUDE_DIRS} |
2867 | + ${LIBLIGHTDM_INCLUDE_DIRS} |
2868 | + ) |
2869 | + |
2870 | +link_libraries( |
2871 | + LightDM-qml |
2872 | + MockLightDM |
2873 | + ) |
2874 | + |
2875 | +# DBusTest |
2876 | add_executable(GreeterDBusTestExec |
2877 | dbus.cpp |
2878 | ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp |
2879 | ${CMAKE_SOURCE_DIR}/plugins/LightDM/PromptsModel.cpp |
2880 | ) |
2881 | -# This add_dependencies is needed since we're linking with with -L and -l below |
2882 | -# make seems to work but ninja breaks without it |
2883 | -add_dependencies(GreeterDBusTestExec MockLightDM) |
2884 | qt5_use_modules(GreeterDBusTestExec Core DBus Quick Test) |
2885 | -target_link_libraries(GreeterDBusTestExec |
2886 | - MockLightDM |
2887 | - ) |
2888 | -target_include_directories(GreeterDBusTestExec PUBLIC |
2889 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM |
2890 | - ) |
2891 | -set_target_properties(GreeterDBusTestExec PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/mocks/IntegratedLightDM/liblightdm") |
2892 | +set_target_properties(GreeterDBusTestExec PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/mocks/liblightdm") |
2893 | install(TARGETS GreeterDBusTestExec |
2894 | - DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM" |
2895 | + DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM" |
2896 | ) |
2897 | install(FILES greeter.qml |
2898 | - DESTINATION "${SHELL_APP_DIR}/tests/plugins/LightDM/IntegratedLightDM" |
2899 | + DESTINATION "${SHELL_APP_DIR}/tests/plugins/LightDM" |
2900 | ) |
2901 | add_unity8_uitest(GreeterDBus dbus-test-runner |
2902 | ARG_PREFIX "--parameter" |
2903 | ARGS --task $<TARGET_FILE:GreeterDBusTestExec> |
2904 | - DEPENDS MockLightDM |
2905 | - ) |
2906 | - |
2907 | -add_executable(GreeterPamTestExec |
2908 | - pam.cpp |
2909 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp |
2910 | - ) |
2911 | -qt5_use_modules(GreeterPamTestExec Concurrent Core Test) |
2912 | -target_link_libraries(GreeterPamTestExec |
2913 | - integratedLightDM |
2914 | - ) |
2915 | - |
2916 | -target_include_directories(GreeterPamTestExec PUBLIC |
2917 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM |
2918 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm |
2919 | - ) |
2920 | -install(TARGETS GreeterPamTestExec |
2921 | - DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM" |
2922 | - ) |
2923 | -add_qmltest_target(testGreeterPam GreeterPamTestExec COMMAND $<TARGET_FILE:GreeterPamTestExec>) |
2924 | + DEPENDS LightDM-qml;MockLightDM |
2925 | + ) |
2926 | |
2927 | # SessionsModelTest |
2928 | add_executable(GreeterSessionsModelTestExec |
2929 | @@ -56,21 +42,12 @@ |
2930 | ${CMAKE_SOURCE_DIR}/plugins/LightDM/SessionsModel.cpp |
2931 | ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp |
2932 | ) |
2933 | -add_dependencies(GreeterSessionsModelTestExec MockLightDM) |
2934 | qt5_use_modules(GreeterSessionsModelTestExec Core Test) |
2935 | -target_link_libraries(GreeterSessionsModelTestExec |
2936 | - MockLightDM |
2937 | - ) |
2938 | -target_include_directories(GreeterSessionsModelTestExec PUBLIC |
2939 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM |
2940 | - ${CMAKE_SOURCE_DIR}/plugins/Utils |
2941 | - ${CMAKE_SOURCE_DIR}/tests/mocks/liblightdm/ |
2942 | - ) |
2943 | install(TARGETS GreeterSessionsModelTestExec |
2944 | - DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM" |
2945 | + DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM" |
2946 | ) |
2947 | -add_unity8_uitest(GreeterSessions GreeterSessionsModelTestExec |
2948 | - DEPENDS MockLightDM |
2949 | +add_unity8_unittest(GreeterSessions GreeterSessionsModelTestExec |
2950 | + DEPENDS LightDM-qml;MockLightDM |
2951 | ) |
2952 | |
2953 | # UsersModelTest |
2954 | @@ -81,24 +58,13 @@ |
2955 | ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp |
2956 | ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp |
2957 | ) |
2958 | -# This add_dependencies is needed since we're linking with with -L and -l below |
2959 | -# make seems to work but ninja breaks without it |
2960 | -add_dependencies(GreeterUsersModelTestExec MockLightDM) |
2961 | qt5_use_modules(GreeterUsersModelTestExec Core Test) |
2962 | -target_link_libraries(GreeterUsersModelTestExec |
2963 | - MockLightDM |
2964 | - ) |
2965 | -target_include_directories(GreeterUsersModelTestExec PUBLIC |
2966 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM |
2967 | - ${CMAKE_SOURCE_DIR}/plugins/Utils |
2968 | - ${CMAKE_SOURCE_DIR}/tests/mocks/liblightdm |
2969 | - ) |
2970 | -set_target_properties(GreeterUsersModelTestExec PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/mocks/IntegratedLightDM/liblightdm") |
2971 | +set_target_properties(GreeterUsersModelTestExec PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/mocks/liblightdm") |
2972 | install(TARGETS GreeterUsersModelTestExec |
2973 | - DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM" |
2974 | + DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM" |
2975 | ) |
2976 | -add_unity8_uitest(GreeterUsers GreeterUsersModelTestExec |
2977 | - DEPENDS MockLightDM |
2978 | +add_unity8_unittest(GreeterUsers GreeterUsersModelTestExec |
2979 | + DEPENDS LightDM-qml;MockLightDM |
2980 | ) |
2981 | |
2982 | # PromptsModelTest |
2983 | @@ -108,50 +74,10 @@ |
2984 | ${CMAKE_SOURCE_DIR}/plugins/LightDM/PromptsModel.cpp |
2985 | ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp |
2986 | ) |
2987 | -# This add_dependencies is needed since we're linking with with -L and -l below |
2988 | -# make seems to work but ninja breaks without it |
2989 | -add_dependencies(GreeterPromptsModelTestExec MockLightDM) |
2990 | qt5_use_modules(GreeterPromptsModelTestExec Core Test) |
2991 | -target_link_libraries(GreeterPromptsModelTestExec |
2992 | - MockLightDM |
2993 | - ) |
2994 | -target_include_directories(GreeterPromptsModelTestExec PUBLIC |
2995 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM |
2996 | - ${CMAKE_SOURCE_DIR}/plugins/Utils |
2997 | - ${CMAKE_SOURCE_DIR}/tests/mocks/liblightdm |
2998 | - ) |
2999 | install(TARGETS GreeterPromptsModelTestExec |
3000 | - DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM" |
3001 | - ) |
3002 | -add_unity8_uitest(GreeterPrompts GreeterPromptsModelTestExec |
3003 | - DEPENDS MockLightDM |
3004 | - ) |
3005 | - |
3006 | -# IntegratedTest |
3007 | -add_executable(GreeterIntegratedTestExec |
3008 | - integrated.cpp |
3009 | - ) |
3010 | -qt5_use_modules(GreeterIntegratedTestExec Core DBus Quick Test) |
3011 | -target_link_libraries(GreeterIntegratedTestExec |
3012 | - ${GLIB_LIBRARIES} |
3013 | - integratedLightDMSession |
3014 | - ) |
3015 | -target_include_directories(GreeterIntegratedTestExec PUBLIC |
3016 | - ${GLIB_INCLUDE_DIRS} |
3017 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm |
3018 | - ) |
3019 | -install(TARGETS GreeterIntegratedTestExec |
3020 | - DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM" |
3021 | - ) |
3022 | -add_unity8_unittest(GreeterIntegrated dbus-test-runner |
3023 | - ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/IntegratedLightDM/liblightdm/ |
3024 | - ARG_PREFIX "--parameter" |
3025 | - ARGS |
3026 | - --task $<TARGET_FILE:mock-server> |
3027 | - --task-name server |
3028 | - --ignore-return |
3029 | - --task $<TARGET_FILE:GreeterIntegratedTestExec> |
3030 | - --task-name client |
3031 | - --wait-for org.freedesktop.Accounts |
3032 | - DEPENDS integratedLightDMSession |
3033 | + DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM" |
3034 | + ) |
3035 | +add_unity8_unittest(GreeterPrompts GreeterPromptsModelTestExec |
3036 | + DEPENDS LightDM-qml;MockLightDM |
3037 | ) |
3038 | |
3039 | === removed directory 'tests/plugins/LightDM/IntegratedLightDM' |
3040 | === removed file 'tests/plugins/LightDM/IntegratedLightDM/integrated.cpp' |
3041 | --- tests/plugins/LightDM/IntegratedLightDM/integrated.cpp 2016-05-02 18:43:06 +0000 |
3042 | +++ tests/plugins/LightDM/IntegratedLightDM/integrated.cpp 1970-01-01 00:00:00 +0000 |
3043 | @@ -1,88 +0,0 @@ |
3044 | -/* |
3045 | - * Copyright (C) 2016 Canonical, Ltd. |
3046 | - * |
3047 | - * This program is free software; you can redistribute it and/or modify |
3048 | - * it under the terms of the GNU General Public License as published by |
3049 | - * the Free Software Foundation; version 3. |
3050 | - * |
3051 | - * This program is distributed in the hope that it will be useful, |
3052 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3053 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3054 | - * GNU General Public License for more details. |
3055 | - * |
3056 | - * You should have received a copy of the GNU General Public License |
3057 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3058 | - */ |
3059 | - |
3060 | -#include "UsersModel.h" |
3061 | - |
3062 | -#include <glib.h> |
3063 | -#include <QDBusInterface> |
3064 | -#include <QDBusReply> |
3065 | -#include <QtTest> |
3066 | - |
3067 | -class GreeterIntegratedTest : public QObject |
3068 | -{ |
3069 | - Q_OBJECT |
3070 | - |
3071 | -private Q_SLOTS: |
3072 | - |
3073 | - void init() |
3074 | - { |
3075 | - m_accounts = new QDBusInterface(QStringLiteral("org.freedesktop.Accounts"), |
3076 | - QStringLiteral("/org/freedesktop/Accounts"), |
3077 | - QStringLiteral("org.freedesktop.Accounts"), |
3078 | - QDBusConnection::sessionBus()); |
3079 | - QDBusReply<bool> addReply = m_accounts->call(QStringLiteral("AddUser"), |
3080 | - g_get_user_name()); |
3081 | - QVERIFY(addReply.isValid()); |
3082 | - QCOMPARE(addReply.value(), true); |
3083 | - |
3084 | - m_user = new QDBusInterface(QStringLiteral("org.freedesktop.Accounts"), |
3085 | - QStringLiteral("/%1").arg(g_get_user_name()), |
3086 | - QStringLiteral("org.freedesktop.DBus.Properties"), |
3087 | - QDBusConnection::sessionBus()); |
3088 | - |
3089 | - m_model = new QLightDM::UsersModel(); |
3090 | - QVERIFY(m_model); |
3091 | - } |
3092 | - |
3093 | - void cleanup() |
3094 | - { |
3095 | - QDBusReply<bool> addReply = m_accounts->call(QStringLiteral("RemoveUser"), |
3096 | - g_get_user_name()); |
3097 | - QVERIFY(addReply.isValid()); |
3098 | - QCOMPARE(addReply.value(), true); |
3099 | - |
3100 | - delete m_model; |
3101 | - delete m_accounts; |
3102 | - delete m_user; |
3103 | - } |
3104 | - |
3105 | - void testWatchRealName() |
3106 | - { |
3107 | - auto index = m_model->index(0, 0); |
3108 | - |
3109 | - QCOMPARE(m_model->data(index, QLightDM::UsersModel::RealNameRole).toString(), |
3110 | - QStringLiteral("")); |
3111 | - |
3112 | - QDBusInterface accountsIface(m_user->service(), |
3113 | - m_user->path(), |
3114 | - "org.freedesktop.Accounts.User"); |
3115 | - QDBusReply<void> reply = accountsIface.call(QStringLiteral("SetRealName"), |
3116 | - QStringLiteral("Test User")); |
3117 | - QVERIFY(reply.isValid()); |
3118 | - |
3119 | - QTRY_COMPARE(m_model->data(index, QLightDM::UsersModel::RealNameRole).toString(), |
3120 | - QStringLiteral("Test User")); |
3121 | - } |
3122 | - |
3123 | -private: |
3124 | - QLightDM::UsersModel *m_model; |
3125 | - QDBusInterface *m_accounts; |
3126 | - QDBusInterface *m_user; |
3127 | -}; |
3128 | - |
3129 | -QTEST_MAIN(GreeterIntegratedTest) |
3130 | - |
3131 | -#include "integrated.moc" |
3132 | |
3133 | === removed file 'tests/plugins/LightDM/IntegratedLightDM/pam.cpp' |
3134 | --- tests/plugins/LightDM/IntegratedLightDM/pam.cpp 2016-05-02 18:43:06 +0000 |
3135 | +++ tests/plugins/LightDM/IntegratedLightDM/pam.cpp 1970-01-01 00:00:00 +0000 |
3136 | @@ -1,54 +0,0 @@ |
3137 | -/* |
3138 | - * Copyright (C) 2015 Canonical, Ltd. |
3139 | - * |
3140 | - * This program is free software; you can redistribute it and/or modify |
3141 | - * it under the terms of the GNU General Public License as published by |
3142 | - * the Free Software Foundation; version 3. |
3143 | - * |
3144 | - * This program is distributed in the hope that it will be useful, |
3145 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3146 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3147 | - * GNU General Public License for more details. |
3148 | - * |
3149 | - * You should have received a copy of the GNU General Public License |
3150 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3151 | - */ |
3152 | - |
3153 | -#include "GreeterPrivate.h" |
3154 | - |
3155 | -#include <QtTest> |
3156 | - |
3157 | -#include <glib.h> |
3158 | - |
3159 | -class GreeterPamTest : public QObject |
3160 | -{ |
3161 | - Q_OBJECT |
3162 | - |
3163 | -private Q_SLOTS: |
3164 | - |
3165 | - void init() |
3166 | - { |
3167 | - m_greeterpriv = new QLightDM::GreeterPrivate(); |
3168 | - } |
3169 | - |
3170 | - void cleanup() |
3171 | - { |
3172 | - delete m_greeterpriv; |
3173 | - QTRY_COMPARE(QThreadPool::globalInstance()->activeThreadCount(), 0); |
3174 | - } |
3175 | - |
3176 | - void testRapidFireAuthentication() |
3177 | - { |
3178 | - m_greeterpriv->authenticationUser = QString::fromUtf8(g_get_user_name()); |
3179 | - for (int i = 0; i < 100; i++) { |
3180 | - m_greeterpriv->handleAuthenticate(); |
3181 | - } |
3182 | - } |
3183 | - |
3184 | -private: |
3185 | - QLightDM::GreeterPrivate *m_greeterpriv; |
3186 | -}; |
3187 | - |
3188 | -QTEST_GUILESS_MAIN(GreeterPamTest) |
3189 | - |
3190 | -#include "pam.moc" |
3191 | |
3192 | === renamed file 'tests/plugins/LightDM/IntegratedLightDM/dbus.cpp' => 'tests/plugins/LightDM/dbus.cpp' |
3193 | --- tests/plugins/LightDM/IntegratedLightDM/dbus.cpp 2017-01-19 15:37:24 +0000 |
3194 | +++ tests/plugins/LightDM/dbus.cpp 2017-01-26 16:33:43 +0000 |
3195 | @@ -59,7 +59,7 @@ |
3196 | void init() |
3197 | { |
3198 | view = new QQuickView(); |
3199 | - view->setSource(QUrl::fromLocalFile(testDataDir() + "/plugins/LightDM/IntegratedLightDM/greeter.qml")); |
3200 | + view->setSource(QUrl::fromLocalFile(testDataDir() + "/plugins/LightDM/greeter.qml")); |
3201 | greeter = dynamic_cast<Greeter*>(view->rootObject()->property("greeter").value<QObject*>()); |
3202 | QVERIFY(greeter); |
3203 | QVERIFY(greeter->authenticationUser() == ""); |
3204 | |
3205 | === renamed file 'tests/plugins/LightDM/IntegratedLightDM/greeter.qml' => 'tests/plugins/LightDM/greeter.qml' |
3206 | --- tests/plugins/LightDM/IntegratedLightDM/greeter.qml 2016-12-19 19:55:07 +0000 |
3207 | +++ tests/plugins/LightDM/greeter.qml 2017-01-26 16:33:43 +0000 |
3208 | @@ -15,7 +15,7 @@ |
3209 | */ |
3210 | |
3211 | import QtQuick 2.4 |
3212 | -import LightDM.FullLightDM 0.1 as LightDM |
3213 | +import LightDM 0.1 as LightDM |
3214 | |
3215 | Item { |
3216 | property var greeter: LightDM.Greeter |
3217 | |
3218 | === renamed file 'tests/plugins/LightDM/IntegratedLightDM/promptsmodel.cpp' => 'tests/plugins/LightDM/promptsmodel.cpp' |
3219 | === renamed file 'tests/plugins/LightDM/IntegratedLightDM/sessionsmodel.cpp' => 'tests/plugins/LightDM/sessionsmodel.cpp' |
3220 | === renamed file 'tests/plugins/LightDM/IntegratedLightDM/usersmodel.cpp' => 'tests/plugins/LightDM/usersmodel.cpp' |
3221 | === modified file 'tests/plugins/Unity/Session/sessionbackendtest.cpp' |
3222 | --- tests/plugins/Unity/Session/sessionbackendtest.cpp 2016-12-19 19:55:07 +0000 |
3223 | +++ tests/plugins/Unity/Session/sessionbackendtest.cpp 2017-01-26 16:33:43 +0000 |
3224 | @@ -62,7 +62,6 @@ |
3225 | QTest::newRow("Shutdown") << "RequestShutdown" << "ShutdownRequested(bool)"; |
3226 | QTest::newRow("PromptLock") << "PromptLock" << "LockRequested()"; |
3227 | QTest::newRow("Lock") << "Lock" << "LockRequested()"; |
3228 | - QTest::newRow("LockLightDM") << "Lock" << "Locked()"; // happens when we lock LightDM, only for Lock() |
3229 | } |
3230 | |
3231 | void testUnitySessionLogoutRequested() { |
3232 | |
3233 | === modified file 'tests/qmltests/Dash/tst_DashShell.qml' |
3234 | --- tests/qmltests/Dash/tst_DashShell.qml 2017-01-24 07:42:24 +0000 |
3235 | +++ tests/qmltests/Dash/tst_DashShell.qml 2017-01-26 16:33:43 +0000 |
3236 | @@ -20,8 +20,8 @@ |
3237 | import "../../../qml/" |
3238 | import Ubuntu.Components 1.3 |
3239 | import Unity.Test 0.1 as UT |
3240 | +import LightDM 0.1 as LightDM |
3241 | import LightDMController 0.1 |
3242 | -import LightDM.FullLightDM 0.1 as LightDM |
3243 | |
3244 | Item { |
3245 | id: root |
3246 | |
3247 | === modified file 'tests/qmltests/Greeter/tst_Greeter.qml' |
3248 | --- tests/qmltests/Greeter/tst_Greeter.qml 2017-01-19 17:52:57 +0000 |
3249 | +++ tests/qmltests/Greeter/tst_Greeter.qml 2017-01-26 16:33:43 +0000 |
3250 | @@ -22,8 +22,8 @@ |
3251 | import AccountsService 0.1 |
3252 | import Biometryd 0.0 |
3253 | import GSettings 1.0 |
3254 | +import LightDM 0.1 as LightDM |
3255 | import LightDMController 0.1 |
3256 | -import LightDM.FullLightDM 0.1 as LightDM |
3257 | import Unity.Test 0.1 as UT |
3258 | |
3259 | Item { |
3260 | @@ -173,7 +173,7 @@ |
3261 | |
3262 | function getIndexOf(name) { |
3263 | for (var i = 0; i < LightDM.Users.count; i++) { |
3264 | - if (name === LightDM.Users.data(i, LightDM.UserRoles.NameRole)) { |
3265 | + if (name === LightDM.Users.data(i, LightDM.Users.NameRole)) { |
3266 | return i; |
3267 | } |
3268 | } |
3269 | @@ -500,13 +500,13 @@ |
3270 | function test_selectUserHintUnset() { |
3271 | LightDMController.selectUserHint = ""; |
3272 | resetLoader(); |
3273 | - verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole)); |
3274 | + verifySelected(LightDM.Users.data(0, LightDM.Users.NameRole)); |
3275 | } |
3276 | |
3277 | function test_selectUserHintInvalid() { |
3278 | LightDMController.selectUserHint = "not-a-real-user"; |
3279 | resetLoader(); |
3280 | - verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole)); |
3281 | + verifySelected(LightDM.Users.data(0, LightDM.Users.NameRole)); |
3282 | } |
3283 | |
3284 | function test_selectUserHintGuest() { |
3285 | @@ -548,7 +548,7 @@ |
3286 | verify(biometryd.operation); |
3287 | verify(biometryd.operation.running); |
3288 | |
3289 | - biometryd.operation.mockSuccess(LightDM.Users.data(index, LightDM.UserRoles.UidRole)); |
3290 | + biometryd.operation.mockSuccess(LightDM.Users.data(index, LightDM.Users.UidRole)); |
3291 | verify(!greeter.active); |
3292 | } |
3293 | |
3294 | @@ -560,7 +560,7 @@ |
3295 | verify(biometryd.operation); |
3296 | verify(biometryd.operation.running); |
3297 | |
3298 | - biometryd.operation.mockSuccess(LightDM.Users.data(index, LightDM.UserRoles.UidRole)); |
3299 | + biometryd.operation.mockSuccess(LightDM.Users.data(index, LightDM.Users.UidRole)); |
3300 | compare(viewTryToUnlockSpy.count, 1); |
3301 | verify(greeter.locked); |
3302 | } |
3303 | @@ -603,12 +603,12 @@ |
3304 | compare(viewTryToUnlockSpy.count, 1); |
3305 | |
3306 | // Confirm that we are stuck in this mode until next login |
3307 | - biometryd.operation.mockSuccess(LightDM.Users.data(index, LightDM.UserRoles.UidRole)); |
3308 | + biometryd.operation.mockSuccess(LightDM.Users.data(index, LightDM.Users.UidRole)); |
3309 | compare(viewTryToUnlockSpy.count, 2); |
3310 | |
3311 | unlockAndShowGreeter(); |
3312 | |
3313 | - biometryd.operation.mockSuccess(LightDM.Users.data(index, LightDM.UserRoles.UidRole)); |
3314 | + biometryd.operation.mockSuccess(LightDM.Users.data(index, LightDM.Users.UidRole)); |
3315 | verify(!greeter.active); |
3316 | } |
3317 | |
3318 | |
3319 | === modified file 'tests/qmltests/Greeter/tst_Infographics.qml' |
3320 | --- tests/qmltests/Greeter/tst_Infographics.qml 2016-12-19 19:55:07 +0000 |
3321 | +++ tests/qmltests/Greeter/tst_Infographics.qml 2017-01-26 16:33:43 +0000 |
3322 | @@ -20,7 +20,7 @@ |
3323 | import "../../../qml/Greeter" |
3324 | import Ubuntu.Components 1.3 |
3325 | import Unity.Test 0.1 as UT |
3326 | -import LightDM.FullLightDM 0.1 as LightDM |
3327 | +import LightDM 0.1 as LightDM |
3328 | |
3329 | Item { |
3330 | property variant infographicModel: LightDM.Infographic |
3331 | |
3332 | === modified file 'tests/qmltests/Greeter/tst_NarrowView.qml' |
3333 | --- tests/qmltests/Greeter/tst_NarrowView.qml 2017-01-19 15:37:24 +0000 |
3334 | +++ tests/qmltests/Greeter/tst_NarrowView.qml 2017-01-26 16:33:43 +0000 |
3335 | @@ -18,8 +18,8 @@ |
3336 | import QtTest 1.0 |
3337 | import ".." |
3338 | import "../../../qml/Greeter" |
3339 | +import LightDM 0.1 as LightDM |
3340 | import LightDMController 0.1 |
3341 | -import LightDM.FullLightDM 0.1 as LightDM |
3342 | import Ubuntu.Components 1.3 |
3343 | import Ubuntu.Telephony 0.1 as Telephony |
3344 | import Unity.Test 0.1 as UT |
3345 | @@ -88,7 +88,7 @@ |
3346 | Row { |
3347 | Button { |
3348 | text: "Show Message" |
3349 | - onClicked: LightDMService.prompts.append(messageField.text, LightDMService.prompts.Message) |
3350 | + onClicked: LightDM.Prompts.append(messageField.text, LightDM.Prompts.Message) |
3351 | } |
3352 | TextField { |
3353 | id: messageField |
3354 | @@ -99,7 +99,7 @@ |
3355 | Row { |
3356 | Button { |
3357 | text: "Show Prompt" |
3358 | - onClicked: LightDMService.prompts.append(promptField.text, isSecretCheckBox.checked ? LightDMService.prompts.Secret : LightDMService.prompts.Question) |
3359 | + onClicked: LightDM.Prompts.append(promptField.text, isSecretCheckBox.checked ? LightDM.Prompts.Secret : LightDM.Prompts.Question) |
3360 | } |
3361 | TextField { |
3362 | id: promptField |
3363 | @@ -269,7 +269,7 @@ |
3364 | view.currentIndex = 0; // break binding with text field |
3365 | |
3366 | LightDM.Greeter.authenticate("no-password"); |
3367 | - tryCompare(LightDMService.prompts, "count", 1); |
3368 | + tryCompare(LightDM.Prompts, "count", 1); |
3369 | |
3370 | telepathyHelper.ready = true; |
3371 | telepathyHelper.emergencyCallsAvailable = true; |
3372 | |
3373 | === modified file 'tests/qmltests/Greeter/tst_WideView.qml' |
3374 | --- tests/qmltests/Greeter/tst_WideView.qml 2017-01-24 07:40:40 +0000 |
3375 | +++ tests/qmltests/Greeter/tst_WideView.qml 2017-01-26 16:33:43 +0000 |
3376 | @@ -18,8 +18,8 @@ |
3377 | import QtTest 1.0 |
3378 | import ".." |
3379 | import "../../../qml/Greeter" |
3380 | +import LightDM 0.1 as LightDM |
3381 | import LightDMController 0.1 |
3382 | -import LightDM.FullLightDM 0.1 as LightDM |
3383 | import Ubuntu.Components 1.3 |
3384 | import Unity.Test 0.1 as UT |
3385 | |
3386 | @@ -119,7 +119,7 @@ |
3387 | Row { |
3388 | Button { |
3389 | text: "Show Message" |
3390 | - onClicked: LightDMService.prompts.append(messageField.text, LightDMService.prompts.Message) |
3391 | + onClicked: LightDM.Prompts.append(messageField.text, LightDM.Prompts.Message) |
3392 | } |
3393 | TextField { |
3394 | id: messageField |
3395 | @@ -130,7 +130,7 @@ |
3396 | Row { |
3397 | Button { |
3398 | text: "Show Prompt" |
3399 | - onClicked: LightDMService.prompts.append(promptField.text, isSecretCheckBox.checked ? LightDMService.prompts.Secret : LightDMService.prompts.Question) |
3400 | + onClicked: LightDM.Prompts.append(promptField.text, isSecretCheckBox.checked ? LightDM.Prompts.Secret : LightDM.Prompts.Question) |
3401 | } |
3402 | TextField { |
3403 | id: promptField |
3404 | @@ -331,7 +331,7 @@ |
3405 | |
3406 | function init() { |
3407 | selectIndex(0); // break binding with text field |
3408 | - tryCompare(LightDMService.prompts, "count", 1); |
3409 | + tryCompare(LightDM.Prompts, "count", 1); |
3410 | selectedSpy.clear(); |
3411 | respondedSpy.clear(); |
3412 | teaseSpy.clear(); |
3413 | @@ -359,7 +359,7 @@ |
3414 | |
3415 | function getIndexOf(name) { |
3416 | for (var i = 0; i < LightDM.Users.count; i++) { |
3417 | - if (name === LightDM.Users.data(i, LightDM.UserRoles.NameRole)) { |
3418 | + if (name === LightDM.Users.data(i, LightDM.Users.NameRole)) { |
3419 | return i; |
3420 | } |
3421 | } |
3422 | @@ -368,7 +368,7 @@ |
3423 | } |
3424 | |
3425 | function selectIndex(i) { |
3426 | - var user = LightDM.Users.data(i, LightDM.UserRoles.NameRole); |
3427 | + var user = LightDM.Users.data(i, LightDM.Users.NameRole); |
3428 | LightDM.Greeter.authenticate(user); |
3429 | |
3430 | var userList = findChild(view, "userList"); |
3431 | @@ -449,7 +449,7 @@ |
3432 | for(var i = 0; i < LightDM.Sessions.count; i++) { |
3433 | var delegateName = "sessionDelegate" + String(i); |
3434 | var currentDelegate = findChild(view, delegateName); |
3435 | - var sessionKey = LightDM.Sessions.data(i,LightDM.SessionRoles.KeyRole); |
3436 | + var sessionKey = LightDM.Sessions.data(i,LightDM.Sessions.KeyRole); |
3437 | if (sessionKey === "gnome-classic") { |
3438 | waitForRendering(currentDelegate); |
3439 | tap(currentDelegate); |
3440 | |
3441 | === modified file 'tests/qmltests/Tutorial/tst_Tutorial.qml' |
3442 | --- tests/qmltests/Tutorial/tst_Tutorial.qml 2016-12-21 18:55:46 +0000 |
3443 | +++ tests/qmltests/Tutorial/tst_Tutorial.qml 2017-01-26 16:33:43 +0000 |
3444 | @@ -17,8 +17,8 @@ |
3445 | import QtQuick 2.4 |
3446 | import QtTest 1.0 |
3447 | import AccountsService 0.1 |
3448 | +import LightDM 0.1 as LightDM |
3449 | import LightDMController 0.1 |
3450 | -import LightDM.FullLightDM 0.1 as LightDM |
3451 | import Ubuntu.Components 1.3 |
3452 | import Ubuntu.Components.ListItems 1.3 |
3453 | import Ubuntu.Telephony 0.1 as Telephony |
3454 | |
3455 | === modified file 'tests/qmltests/tst_OrientedShell.qml' |
3456 | --- tests/qmltests/tst_OrientedShell.qml 2017-01-24 07:43:17 +0000 |
3457 | +++ tests/qmltests/tst_OrientedShell.qml 2017-01-26 16:33:43 +0000 |
3458 | @@ -22,8 +22,8 @@ |
3459 | import Ubuntu.Components.ListItems 1.3 as ListItem |
3460 | import Unity.Application 0.1 |
3461 | import Unity.Test 0.1 |
3462 | +import LightDM 0.1 as LightDM |
3463 | import LightDMController 0.1 |
3464 | -import LightDM.FullLightDM 0.1 as LightDM |
3465 | import Powerd 0.1 |
3466 | import Unity.InputInfo 0.1 |
3467 | import Utils 0.1 |
3468 | |
3469 | === modified file 'tests/qmltests/tst_Shell.qml' |
3470 | --- tests/qmltests/tst_Shell.qml 2017-01-24 07:43:54 +0000 |
3471 | +++ tests/qmltests/tst_Shell.qml 2017-01-26 16:33:43 +0000 |
3472 | @@ -18,8 +18,8 @@ |
3473 | import QtTest 1.0 |
3474 | import AccountsService 0.1 |
3475 | import GSettings 1.0 |
3476 | +import LightDM 0.1 as LightDM |
3477 | import LightDMController 0.1 |
3478 | -import LightDM.FullLightDM 0.1 as LightDM |
3479 | import SessionBroadcast 0.1 |
3480 | import Ubuntu.Components 1.3 |
3481 | import Ubuntu.Components.ListItems 1.3 as ListItem |
3482 | @@ -450,8 +450,8 @@ |
3483 | var biometryd = testCase.findInvisibleChild(shellContainer, "biometryd"); |
3484 | var uid = 0; |
3485 | for (var i = 0; i < LightDM.Users.count; i++) { |
3486 | - if (LightDM.Users.data(i, LightDM.UserRoles.NameRole) == AccountsService.user) { |
3487 | - uid = LightDM.Users.data(i, LightDM.UserRoles.UidRole); |
3488 | + if (LightDM.Users.data(i, LightDM.Users.NameRole) == AccountsService.user) { |
3489 | + uid = LightDM.Users.data(i, LightDM.Users.UidRole); |
3490 | break; |
3491 | } |
3492 | } |
3493 | @@ -832,7 +832,7 @@ |
3494 | function selectUser(name) { |
3495 | // Find index of user with the right name |
3496 | for (var i = 0; i < LightDM.Users.count; i++) { |
3497 | - if (LightDM.Users.data(i, LightDM.UserRoles.NameRole) == name) { |
3498 | + if (LightDM.Users.data(i, LightDM.Users.NameRole) == name) { |
3499 | break |
3500 | } |
3501 | } |
3502 | |
3503 | === modified file 'tests/qmltests/tst_ShellWithPin.qml' |
3504 | --- tests/qmltests/tst_ShellWithPin.qml 2017-01-24 07:42:24 +0000 |
3505 | +++ tests/qmltests/tst_ShellWithPin.qml 2017-01-26 16:33:43 +0000 |
3506 | @@ -19,8 +19,8 @@ |
3507 | import QtTest 1.0 |
3508 | import AccountsService 0.1 |
3509 | import GSettings 1.0 |
3510 | +import LightDM 0.1 as LightDM |
3511 | import LightDMController 0.1 |
3512 | -import LightDM.FullLightDM 0.1 as LightDM |
3513 | import Ubuntu.SystemImage 0.1 |
3514 | import Ubuntu.Telephony 0.1 as Telephony |
3515 | import Unity.Application 0.1 |