Merge lp:~josharenson/unity8/fix-session-icon into lp:unity8
- fix-session-icon
- Merge into trunk
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~josharenson/unity8/fix-session-icon | ||||
Merge into: | lp:unity8 | ||||
Diff against target: |
6015 lines (+948/-3202) 106 files modified
CMakeLists.txt (+1/-0) cmake/modules/QmlTest.cmake (+3/-3) data/unity8.conf (+12/-12) debian/rules (+0/-5) plugins/AccountsService/AccountsService.cpp (+27/-1) plugins/AccountsService/AccountsService.h (+8/-0) plugins/LightDM/CMakeLists.txt (+16/-9) plugins/LightDM/FullLightDM/CMakeLists.txt (+0/-28) plugins/LightDM/Greeter.cpp (+7/-1) plugins/LightDM/Greeter.h (+5/-1) 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/-179) plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.h (+0/-108) plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp (+0/-304) plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h (+0/-51) plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp (+0/-88) 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/-67) plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp (+0/-94) plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h (+0/-72) plugins/LightDM/IntegratedLightDM/qmldir (+0/-3) plugins/LightDM/SessionsModel.cpp (+6/-2) plugins/LightDM/SessionsModel.h (+7/-1) plugins/LightDM/UsersModel.cpp (+8/-1) plugins/LightDM/UsersModel.h (+4/-0) plugins/LightDM/plugin.cpp (+2/-9) 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 (+4/-4) qml/Greeter/FullLightDMImpl.qml (+0/-30) qml/Greeter/Greeter.qml (+36/-36) qml/Greeter/IntegratedLightDMImpl.qml (+0/-29) qml/Greeter/LightDMService.qml (+0/-54) qml/Greeter/LoginList.qml (+7/-7) qml/Greeter/NarrowView.qml (+1/-1) qml/Greeter/SessionsList.qml (+4/-4) qml/Greeter/WideView.qml (+10/-3) qml/Greeter/qmldir (+0/-1) qml/Shell.qml (+9/-2) tests/CMakeLists.txt (+1/-1) tests/autopilot/unity8/fixture_setup.py (+1/-1) tests/autopilot/unity8/shell/tests/__init__.py (+1/-1) tests/mocks/AccountsService/AccountsService.cpp (+17/-3) tests/mocks/AccountsService/AccountsService.h (+10/-2) tests/mocks/AccountsService/CMakeLists.txt (+6/-2) tests/mocks/CMakeLists.txt (+1/-1) tests/mocks/LightDM/CMakeLists.txt (+0/-1) tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt (+0/-51) tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp (+0/-51) tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h (+0/-42) tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp (+0/-66) tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h (+0/-44) tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp (+0/-44) tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h (+0/-39) tests/mocks/LightDM/IntegratedLightDM/QLightDM/Greeter (+0/-17) tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel (+0/-17) tests/mocks/LightDM/IntegratedLightDM/QLightDM/UsersModel (+0/-17) tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp (+0/-132) tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h (+0/-54) tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp (+0/-83) tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h (+0/-63) tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp (+0/-124) tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h (+0/-64) tests/mocks/LightDM/IntegratedLightDM/plugin.cpp (+0/-79) tests/mocks/LightDM/IntegratedLightDM/plugin.h (+0/-32) tests/mocks/LightDM/IntegratedLightDM/qmldir (+0/-2) tests/mocks/liblightdm/CMakeLists.txt (+10/-12) tests/mocks/liblightdm/MockController.cpp (+148/-0) tests/mocks/liblightdm/MockController.h (+98/-0) tests/mocks/liblightdm/MockGreeter.cpp (+88/-33) tests/mocks/liblightdm/MockGreeter.h (+9/-15) tests/mocks/liblightdm/MockSessionsModel.cpp (+49/-48) tests/mocks/liblightdm/MockSessionsModel.h (+11/-12) tests/mocks/liblightdm/MockUsersModel.cpp (+108/-23) tests/mocks/liblightdm/MockUsersModel.h (+10/-11) 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 (+21/-80) tests/plugins/LightDM/IntegratedLightDM/integrated.cpp (+0/-88) tests/plugins/LightDM/IntegratedLightDM/pam.cpp (+0/-54) tests/plugins/LightDM/greeter.qml (+1/-6) tests/plugins/LightDM/sessionsmodel.cpp (+14/-15) tests/plugins/LightDM/usersmodel.cpp (+4/-14) tests/plugins/Unity/Session/sessionbackendtest.cpp (+0/-1) tests/qmltests/Dash/tst_DashShell.qml (+7/-0) tests/qmltests/Greeter/TestView.qml (+1/-0) tests/qmltests/Greeter/tst_Greeter.qml (+5/-8) tests/qmltests/Greeter/tst_Infographics.qml (+1/-11) tests/qmltests/Greeter/tst_NarrowView.qml (+8/-2) tests/qmltests/Greeter/tst_WideView.qml (+29/-23) tests/qmltests/Tutorial/tst_Tutorial.qml (+2/-3) tests/qmltests/tst_OrientedShell.qml (+7/-1) tests/qmltests/tst_Shell.qml (+4/-7) tests/qmltests/tst_ShellWithPin.qml (+2/-3) |
||||
To merge this branch: | bzr merge lp:~josharenson/unity8/fix-session-icon | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Albert Astals Cid (community) | Needs Information | ||
Unity8 CI Bot | continuous-integration | Approve | |
Review via email: mp+308891@code.launchpad.net |
This proposal has been superseded by a proposal from 2016-11-08.
Commit message
Enable the greeter to remember which session the user last logged into
This also fixes a small issue with how the default session was handled.
Description of the change
* Are there any related MPs required for this MP to build/function as expected? Please list.
No
* 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?
N/A
* If you changed the UI, has there been a design review?
N/A
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
Albert Astals Cid (aacid) wrote : | # |
Tested, seems to work well.
Is this something that we can autotest?
Josh Arenson (josharenson) wrote : | # |
> Tested, seems to work well.
>
> Is this something that we can autotest?
There are some existing tests for the session icons. I think the level of effort to test this small issue would be very high, if even possible. The information for this field is delivered from AccountService via LightDM and thus, would likely require substantial updates to the mocks. Perhaps I'm overthinking this...
It may be a good candidate for an autopilot test, however. If you disagree, lets discuss in person.
Albert Astals Cid (aacid) wrote : | # |
talked in person, agreed that Josh will evaluate how hard is to add an autotest for the Greeter in which we have two users, set the last used session of user2 to be X (non default) and then while moving to user2 we check that the selected session is the one we set.
- 2581. By Josh Arenson
-
Correct a null parent
- 2582. By Josh Arenson
-
Return the correct role for the user session name
- 2583. By Josh Arenson
-
Add a test
- 2584. By Josh Arenson
-
Complete weird test
- 2585. By Josh Arenson
-
Fix whitespace
Unmerged revisions
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2016-10-24 11:34:08 +0000 |
3 | +++ CMakeLists.txt 2016-11-08 23:03:16 +0000 |
4 | @@ -61,6 +61,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 2016-03-04 15:07:31 +0000 |
15 | +++ cmake/modules/QmlTest.cmake 2016-11-08 23:03:16 +0000 |
16 | @@ -65,11 +65,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 | endfunction() |
30 | |
31 | |
32 | === modified file 'data/unity8.conf' |
33 | --- data/unity8.conf 2016-06-27 18:42:23 +0000 |
34 | +++ data/unity8.conf 2016-11-08 23:03:16 +0000 |
35 | @@ -15,23 +15,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 | @@ -65,7 +65,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 | @@ -74,7 +74,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 | @@ -82,7 +82,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 2016-08-11 17:55:45 +0000 |
98 | +++ debian/rules 2016-11-08 23:03:16 +0000 |
99 | @@ -36,8 +36,3 @@ |
100 | # use private lib directories |
101 | override_dh_makeshlibs: |
102 | dh_makeshlibs -Nunity8-private -Nunity8-fake-env |
103 | - |
104 | -override_dh_shlibdeps: |
105 | - # Some mock libraries link against liblightdm-qt5-3.so which we want to |
106 | - # avoid, since we only really link against our mock one, not the system one. |
107 | - dh_shlibdeps -XlibMockLightDM-qml.so -XlibMockAccountsService-qml.so |
108 | |
109 | === modified file 'plugins/AccountsService/AccountsService.cpp' |
110 | --- plugins/AccountsService/AccountsService.cpp 2016-08-11 06:25:34 +0000 |
111 | +++ plugins/AccountsService/AccountsService.cpp 2016-11-08 23:03:16 +0000 |
112 | @@ -80,6 +80,7 @@ |
113 | AccountsService::AccountsService(QObject* parent, const QString &user) |
114 | : QObject(parent) |
115 | , m_service(new AccountsServiceDBusAdaptor(this)) |
116 | + , m_greeterMode(true) |
117 | { |
118 | m_unityInput = new QDBusInterface(QStringLiteral("com.canonical.Unity.Input"), |
119 | QStringLiteral("/com/canonical/Unity/Input"), |
120 | @@ -155,6 +156,19 @@ |
121 | refresh(!wasEmpty); |
122 | } |
123 | |
124 | +bool AccountsService::greeterMode() const |
125 | +{ |
126 | + return m_greeterMode; |
127 | +} |
128 | + |
129 | +void AccountsService::setGreeterMode(bool greeterMode) |
130 | +{ |
131 | + if (m_greeterMode != greeterMode) { |
132 | + m_greeterMode = greeterMode; |
133 | + Q_EMIT greeterModeChanged(); |
134 | + } |
135 | +} |
136 | + |
137 | bool AccountsService::demoEdges() const |
138 | { |
139 | auto value = getProperty(IFACE_UNITY, PROP_DEMO_EDGES); |
140 | @@ -341,7 +355,19 @@ |
141 | { |
142 | if (m_properties[interface][property].value != value) { |
143 | m_properties[interface][property].value = value; |
144 | - m_service->setUserPropertyAsync(m_user, interface, property, value); |
145 | + if (m_greeterMode || m_user == g_get_user_name()) { |
146 | + // Only write any changes back to AccountsService if we are running |
147 | + // as a proper LightDM greeter (or are writing values for our own |
148 | + // user). |
149 | + // (A) Only the lightdm user has permission to set everyone's |
150 | + // properties. |
151 | + // (B) We don't want to have policykit throw up a password dialog |
152 | + // when we are running in the user session. |
153 | + // (C) We only write things to AS that are safe to ignore for other |
154 | + // users anyway (like failedLogins count, which does not NEED |
155 | + // to be persistent). |
156 | + m_service->setUserPropertyAsync(m_user, interface, property, value); |
157 | + } |
158 | emitChangedForProperty(interface, property); |
159 | } |
160 | } |
161 | |
162 | === modified file 'plugins/AccountsService/AccountsService.h' |
163 | --- plugins/AccountsService/AccountsService.h 2016-08-08 10:10:25 +0000 |
164 | +++ plugins/AccountsService/AccountsService.h 2016-11-08 23:03:16 +0000 |
165 | @@ -34,6 +34,10 @@ |
166 | READ user |
167 | WRITE setUser |
168 | NOTIFY userChanged) |
169 | + Q_PROPERTY (bool greeterMode |
170 | + READ greeterMode |
171 | + WRITE setGreeterMode |
172 | + NOTIFY greeterModeChanged) |
173 | Q_PROPERTY (bool demoEdges |
174 | READ demoEdges |
175 | WRITE setDemoEdges |
176 | @@ -92,6 +96,8 @@ |
177 | |
178 | QString user() const; |
179 | void setUser(const QString &user); |
180 | + bool greeterMode() const; |
181 | + void setGreeterMode(bool greeterMode); |
182 | bool demoEdges() const; |
183 | void setDemoEdges(bool demoEdges); |
184 | QStringList demoEdgesCompleted() const; |
185 | @@ -119,6 +125,7 @@ |
186 | |
187 | Q_SIGNALS: |
188 | void userChanged(); |
189 | + void greeterModeChanged(); |
190 | void demoEdgesChanged(); |
191 | void demoEdgesCompletedChanged(); |
192 | void enableFingerprintIdentificationChanged(); |
193 | @@ -167,6 +174,7 @@ |
194 | AccountsServiceDBusAdaptor *m_service; |
195 | QDBusInterface *m_unityInput; |
196 | QString m_user; |
197 | + bool m_greeterMode; |
198 | }; |
199 | |
200 | #endif |
201 | |
202 | === modified file 'plugins/LightDM/CMakeLists.txt' |
203 | --- plugins/LightDM/CMakeLists.txt 2016-03-02 02:54:30 +0000 |
204 | +++ plugins/LightDM/CMakeLists.txt 2016-11-08 23:03:16 +0000 |
205 | @@ -1,19 +1,20 @@ |
206 | pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1) |
207 | |
208 | -find_package(Qt5Core REQUIRED) |
209 | -find_package(Qt5Quick REQUIRED) |
210 | - |
211 | include_directories( |
212 | ${CMAKE_CURRENT_SOURCE_DIR} |
213 | ${CMAKE_CURRENT_BINARY_DIR} |
214 | ${CMAKE_SOURCE_DIR}/plugins/Utils |
215 | - ${CMAKE_BINARY_DIR}/tests/mocks/LightDM/IntegratedLightDM |
216 | ${libunity8-private_SOURCE_DIR} |
217 | + ) |
218 | + |
219 | +include_directories( |
220 | + SYSTEM |
221 | + ${LIBLIGHTDM_INCLUDE_DIRS} |
222 | ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS} |
223 | -) |
224 | + ) |
225 | |
226 | -set(QMLPLUGIN_SRC |
227 | - ../Utils/unitysortfilterproxymodelqml.cpp |
228 | +add_library(LightDM-qml MODULE |
229 | + ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp |
230 | DBusGreeter.cpp |
231 | DBusGreeterList.cpp |
232 | Greeter.cpp |
233 | @@ -22,5 +23,11 @@ |
234 | UsersModel.cpp |
235 | ) |
236 | |
237 | -add_subdirectory(FullLightDM) |
238 | -add_subdirectory(IntegratedLightDM) |
239 | +target_link_libraries(LightDM-qml |
240 | + unity8-private |
241 | + ${LIBLIGHTDM_LDFLAGS} |
242 | + ${LIBUSERMETRICSOUTPUT_LDFLAGS} |
243 | + ) |
244 | + |
245 | +qt5_use_modules(LightDM-qml DBus Gui Qml) |
246 | +add_unity8_plugin(LightDM 0.1 LightDM TARGETS LightDM-qml) |
247 | |
248 | === removed directory 'plugins/LightDM/FullLightDM' |
249 | === removed file 'plugins/LightDM/FullLightDM/CMakeLists.txt' |
250 | --- plugins/LightDM/FullLightDM/CMakeLists.txt 2016-07-08 15:44:53 +0000 |
251 | +++ plugins/LightDM/FullLightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
252 | @@ -1,28 +0,0 @@ |
253 | -pkg_check_modules(LIBLIGHTDM REQUIRED liblightdm-qt5-3) |
254 | - |
255 | -set(PLUGIN_CLASSNAME "FullLightDM") |
256 | - |
257 | -add_definitions(-DFULL_LIGHTDM) |
258 | - |
259 | -include_directories( |
260 | - ../ |
261 | - ${LIBLIGHTDM_INCLUDE_DIRS} |
262 | - ${CMAKE_CURRENT_BINARY_DIR} |
263 | - ) |
264 | - |
265 | -foreach(source_file ${QMLPLUGIN_SRC}) |
266 | - list(APPEND RELATIVE_QMLPLUGIN_SRC ../${source_file}) |
267 | -endforeach() |
268 | - |
269 | -add_library(FullLightDM-qml MODULE |
270 | - ${RELATIVE_QMLPLUGIN_SRC} |
271 | - ) |
272 | - |
273 | -target_link_libraries(FullLightDM-qml |
274 | - unity8-private |
275 | - ${LIBLIGHTDM_LDFLAGS} |
276 | - ${LIBUSERMETRICSOUTPUT_LDFLAGS} |
277 | - ) |
278 | - |
279 | -qt5_use_modules(FullLightDM-qml DBus Gui Qml) |
280 | -add_unity8_plugin(FullLightDM 0.1 LightDM/FullLightDM TARGETS FullLightDM-qml) |
281 | |
282 | === modified file 'plugins/LightDM/Greeter.cpp' |
283 | --- plugins/LightDM/Greeter.cpp 2016-07-28 15:34:29 +0000 |
284 | +++ plugins/LightDM/Greeter.cpp 2016-11-08 23:03:16 +0000 |
285 | @@ -1,5 +1,5 @@ |
286 | /* |
287 | - * Copyright (C) 2013, 2015 Canonical, Ltd. |
288 | + * Copyright (C) 2013-2016 Canonical, Ltd. |
289 | * |
290 | * This program is free software; you can redistribute it and/or modify |
291 | * it under the terms of the GNU General Public License as published by |
292 | @@ -147,3 +147,9 @@ |
293 | Q_EMIT isAuthenticatedChanged(); |
294 | Q_EMIT authenticationComplete(); |
295 | } |
296 | + |
297 | +QObject *Greeter::mock() |
298 | +{ |
299 | + Q_D(Greeter); |
300 | + return d->m_greeter->property("mock").value<QObject*>(); |
301 | +} |
302 | |
303 | === modified file 'plugins/LightDM/Greeter.h' |
304 | --- plugins/LightDM/Greeter.h 2016-07-28 15:34:29 +0000 |
305 | +++ plugins/LightDM/Greeter.h 2016-11-08 23:03:16 +0000 |
306 | @@ -1,5 +1,5 @@ |
307 | /* |
308 | - * Copyright (C) 2012,2013,2015 Canonical, Ltd. |
309 | + * Copyright (C) 2012-2016 Canonical, Ltd. |
310 | * |
311 | * This program is free software; you can redistribute it and/or modify |
312 | * it under the terms of the GNU General Public License as published by |
313 | @@ -40,6 +40,8 @@ |
314 | Q_PROPERTY(bool promptless READ promptless NOTIFY promptlessChanged) |
315 | Q_PROPERTY(QString selectUser READ selectUser CONSTANT) |
316 | |
317 | + Q_PROPERTY(QObject *mock READ mock CONSTANT) // for testing |
318 | + |
319 | public: |
320 | explicit Greeter(QObject* parent=0); |
321 | |
322 | @@ -50,6 +52,8 @@ |
323 | bool promptless() const; |
324 | QString selectUser() const; |
325 | |
326 | + QObject *mock(); |
327 | + |
328 | public Q_SLOTS: |
329 | void authenticate(const QString &username=QString()); |
330 | void respond(const QString &response); |
331 | |
332 | === removed directory 'plugins/LightDM/IntegratedLightDM' |
333 | === removed file 'plugins/LightDM/IntegratedLightDM/CMakeLists.txt' |
334 | --- plugins/LightDM/IntegratedLightDM/CMakeLists.txt 2016-07-08 15:44:53 +0000 |
335 | +++ plugins/LightDM/IntegratedLightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
336 | @@ -1,33 +0,0 @@ |
337 | -set(PLUGIN_CLASSNAME "IntegratedLightDM") |
338 | - |
339 | -add_definitions(-DINTEGRATED_LIGHTDM) |
340 | - |
341 | -foreach(include_directory ${QMLPLUGIN_INCLUDES}) |
342 | - list(APPEND RELATIVE_QMLPLUGIN_INCLUDES ../${include_directory}) |
343 | -endforeach() |
344 | - |
345 | -include_directories( |
346 | - . #QLightDM |
347 | - ${QMLPLUGIN_INCLUDES} |
348 | - ${libunity8-private_SOURCE_DIR} |
349 | - ${CMAKE_CURRENT_BINARY_DIR} |
350 | -) |
351 | - |
352 | -foreach(source_file ${QMLPLUGIN_SRC}) |
353 | - list(APPEND RELATIVE_QMLPLUGIN_SRC ../${source_file}) |
354 | -endforeach() |
355 | - |
356 | -add_library(IntegratedLightDM-qml MODULE |
357 | - ${RELATIVE_QMLPLUGIN_SRC} |
358 | - ) |
359 | - |
360 | -target_link_libraries(IntegratedLightDM-qml |
361 | - integratedLightDM |
362 | - unity8-private |
363 | - ${LIBUSERMETRICSOUTPUT_LDFLAGS} |
364 | - ) |
365 | - |
366 | -qt5_use_modules(IntegratedLightDM-qml DBus Gui Qml) |
367 | -add_unity8_plugin(IntegratedLightDM 0.1 LightDM/IntegratedLightDM TARGETS IntegratedLightDM-qml) |
368 | - |
369 | -add_subdirectory(liblightdm) |
370 | |
371 | === removed directory 'plugins/LightDM/IntegratedLightDM/QLightDM' |
372 | === removed file 'plugins/LightDM/IntegratedLightDM/QLightDM/Greeter' |
373 | --- plugins/LightDM/IntegratedLightDM/QLightDM/Greeter 2016-06-13 21:21:57 +0000 |
374 | +++ plugins/LightDM/IntegratedLightDM/QLightDM/Greeter 1970-01-01 00:00:00 +0000 |
375 | @@ -1,17 +0,0 @@ |
376 | -/* |
377 | - * Copyright (C) 2016 Canonical, Ltd. |
378 | - * |
379 | - * This program is free software; you can redistribute it and/or modify |
380 | - * it under the terms of the GNU General Public License as published by |
381 | - * the Free Software Foundation; version 3. |
382 | - * |
383 | - * This program is distributed in the hope that it will be useful, |
384 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
385 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
386 | - * GNU General Public License for more details. |
387 | - * |
388 | - * You should have received a copy of the GNU General Public License |
389 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
390 | - */ |
391 | - |
392 | -#include "../liblightdm/Greeter.h" |
393 | |
394 | === removed file 'plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel' |
395 | --- plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel 2016-06-13 21:21:57 +0000 |
396 | +++ plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel 1970-01-01 00:00:00 +0000 |
397 | @@ -1,17 +0,0 @@ |
398 | -/* |
399 | - * Copyright (C) 2016 Canonical, Ltd. |
400 | - * |
401 | - * This program is free software; you can redistribute it and/or modify |
402 | - * it under the terms of the GNU General Public License as published by |
403 | - * the Free Software Foundation; version 3. |
404 | - * |
405 | - * This program is distributed in the hope that it will be useful, |
406 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
407 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
408 | - * GNU General Public License for more details. |
409 | - * |
410 | - * You should have received a copy of the GNU General Public License |
411 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
412 | - */ |
413 | - |
414 | -#include "../liblightdm/SessionsModel.h" |
415 | |
416 | === removed file 'plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel' |
417 | --- plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel 2016-06-13 21:21:57 +0000 |
418 | +++ plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel 1970-01-01 00:00:00 +0000 |
419 | @@ -1,17 +0,0 @@ |
420 | -/* |
421 | - * Copyright (C) 2016 Canonical, Ltd. |
422 | - * |
423 | - * This program is free software; you can redistribute it and/or modify |
424 | - * it under the terms of the GNU General Public License as published by |
425 | - * the Free Software Foundation; version 3. |
426 | - * |
427 | - * This program is distributed in the hope that it will be useful, |
428 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
430 | - * GNU General Public License for more details. |
431 | - * |
432 | - * You should have received a copy of the GNU General Public License |
433 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
434 | - */ |
435 | - |
436 | -#include "../liblightdm/UsersModel.h" |
437 | |
438 | === removed directory 'plugins/LightDM/IntegratedLightDM/liblightdm' |
439 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt' |
440 | --- plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt 2016-03-17 16:51:38 +0000 |
441 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
442 | @@ -1,55 +0,0 @@ |
443 | -pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1) |
444 | - |
445 | -set(LibLightDM_SOURCES |
446 | - Greeter.cpp |
447 | - SessionsModel.cpp |
448 | - UsersModel.cpp |
449 | - GreeterPrivate.cpp |
450 | - SessionsModelPrivate.cpp |
451 | - UsersModelPrivate.cpp |
452 | - ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsServiceDBusAdaptor.cpp |
453 | - ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp |
454 | - ) |
455 | - |
456 | -add_library(integratedLightDM STATIC ${LibLightDM_SOURCES}) |
457 | -add_library(integratedLightDMSession STATIC ${LibLightDM_SOURCES}) |
458 | -add_library(MockLightDM-demo-shared SHARED ${LibLightDM_SOURCES}) |
459 | - |
460 | -include_directories( |
461 | - ${CMAKE_SOURCE_DIR}/plugins/AccountsService |
462 | - ${CMAKE_CURRENT_BINARY_DIR} |
463 | - ${GLIB_INCLUDE_DIRS} |
464 | - ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS} |
465 | -) |
466 | - |
467 | -target_link_libraries(integratedLightDM |
468 | - ${GLIB_LIBRARIES} |
469 | - ${LIBUSERMETRICSOUTPUT_LDFLAGS} |
470 | - -lpam |
471 | -) |
472 | -target_link_libraries(integratedLightDMSession |
473 | - ${GLIB_LIBRARIES} |
474 | - ${LIBUSERMETRICSOUTPUT_LDFLAGS} |
475 | - -lpam |
476 | -) |
477 | -target_link_libraries(MockLightDM-demo-shared |
478 | - ${GLIB_LIBRARIES} |
479 | - ${LIBUSERMETRICSOUTPUT_LDFLAGS} |
480 | - -lpam |
481 | -) |
482 | - |
483 | -qt5_use_modules(integratedLightDM Concurrent DBus Gui) |
484 | -qt5_use_modules(integratedLightDMSession Concurrent DBus Gui) |
485 | -qt5_use_modules(MockLightDM-demo-shared Concurrent DBus Gui) |
486 | - |
487 | -set_target_properties(integratedLightDM PROPERTIES |
488 | - COMPILE_FLAGS "-DSM_BUSNAME=systemBus -fPIC") |
489 | -set_target_properties(integratedLightDMSession PROPERTIES |
490 | - COMPILE_FLAGS "-DSM_BUSNAME=sessionBus -fPIC") |
491 | -set_target_properties(MockLightDM-demo-shared PROPERTIES |
492 | - COMPILE_FLAGS "-DSM_BUSNAME=systemBus" |
493 | - OUTPUT_NAME lightdm-qt5-3) |
494 | - |
495 | -install(TARGETS MockLightDM-demo-shared |
496 | - DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/demo |
497 | - ) |
498 | |
499 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp' |
500 | --- plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp 2016-07-28 15:34:29 +0000 |
501 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp 1970-01-01 00:00:00 +0000 |
502 | @@ -1,179 +0,0 @@ |
503 | -/* |
504 | - * Copyright (C) 2013 Canonical, Ltd. |
505 | - * |
506 | - * This program is free software; you can redistribute it and/or modify |
507 | - * it under the terms of the GNU General Public License as published by |
508 | - * the Free Software Foundation; version 3. |
509 | - * |
510 | - * This program is distributed in the hope that it will be useful, |
511 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
512 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
513 | - * GNU General Public License for more details. |
514 | - * |
515 | - * You should have received a copy of the GNU General Public License |
516 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
517 | - * |
518 | - * Author: Michael Terry <michael.terry@canonical.com> |
519 | - */ |
520 | - |
521 | - |
522 | -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
523 | - * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB |
524 | - * COUNTERPART IN tests/mocks/Lightdm/liblightdm |
525 | - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ |
526 | - |
527 | - |
528 | -#include "Greeter.h" |
529 | -#include "GreeterPrivate.h" |
530 | -#include <QtCore/QCoreApplication> |
531 | -#include <QTimer> |
532 | - |
533 | -namespace QLightDM |
534 | -{ |
535 | - |
536 | -Greeter::Greeter(QObject *parent) |
537 | - : QObject(parent), |
538 | - d_ptr(new GreeterPrivate(this)) |
539 | -{ |
540 | -} |
541 | - |
542 | -Greeter::~Greeter() |
543 | -{ |
544 | -} |
545 | - |
546 | -QString Greeter::authenticationUser() const |
547 | -{ |
548 | - Q_D(const Greeter); |
549 | - return d->authenticationUser; |
550 | -} |
551 | - |
552 | -bool Greeter::hasGuestAccountHint() const |
553 | -{ |
554 | - return true; |
555 | -} |
556 | - |
557 | -QString Greeter::getHint(const QString &name) const |
558 | -{ |
559 | - Q_UNUSED(name) |
560 | - return QLatin1String(""); |
561 | -} |
562 | - |
563 | -QString Greeter::defaultSessionHint() const |
564 | -{ |
565 | - return QStringLiteral("ubuntu"); |
566 | -} |
567 | - |
568 | -bool Greeter::hideUsersHint() const |
569 | -{ |
570 | - return false; |
571 | -} |
572 | - |
573 | -bool Greeter::showManualLoginHint() const |
574 | -{ |
575 | - return true; |
576 | -} |
577 | - |
578 | -bool Greeter::showRemoteLoginHint() const |
579 | -{ |
580 | - return true; |
581 | -} |
582 | - |
583 | -QString Greeter::selectUserHint() const |
584 | -{ |
585 | - return QLatin1String(""); |
586 | -} |
587 | - |
588 | -bool Greeter::selectGuestHint() const |
589 | -{ |
590 | - return false; |
591 | -} |
592 | - |
593 | -QString Greeter::autologinUserHint() const |
594 | -{ |
595 | - return QLatin1String(""); |
596 | -} |
597 | - |
598 | -bool Greeter::autologinGuestHint() const |
599 | -{ |
600 | - return false; |
601 | -} |
602 | - |
603 | -int Greeter::autologinTimeoutHint() const |
604 | -{ |
605 | - return 0; |
606 | -} |
607 | - |
608 | -bool Greeter::inAuthentication() const |
609 | -{ |
610 | - return false; |
611 | -} |
612 | - |
613 | -QString Greeter::hostname() const |
614 | -{ |
615 | - return QStringLiteral("hostname1"); |
616 | -} |
617 | - |
618 | -bool Greeter::isAuthenticated() const |
619 | -{ |
620 | - Q_D(const Greeter); |
621 | - return d->authenticated; |
622 | -} |
623 | - |
624 | -bool Greeter::connectSync() |
625 | -{ |
626 | - return true; |
627 | -} |
628 | - |
629 | -void Greeter::authenticate(const QString &username) |
630 | -{ |
631 | - Q_D(Greeter); |
632 | - |
633 | - d->authenticated = false; |
634 | - d->authenticationUser = username; |
635 | - d->handleAuthenticate(); |
636 | -} |
637 | - |
638 | -void Greeter::authenticateAsGuest() |
639 | -{} |
640 | - |
641 | -void Greeter::authenticateAutologin() |
642 | -{} |
643 | - |
644 | -void Greeter::authenticateRemote(const QString &session, const QString &username) |
645 | -{ |
646 | - Q_UNUSED(session) |
647 | - Q_UNUSED(username) |
648 | -} |
649 | - |
650 | -void Greeter::cancelAuthentication() |
651 | -{} |
652 | - |
653 | -void Greeter::setLanguage (const QString &language) |
654 | -{ |
655 | - Q_UNUSED(language) |
656 | -} |
657 | - |
658 | -bool Greeter::startSessionSync(const QString &session) |
659 | -{ |
660 | - Q_UNUSED(session) |
661 | - return true; |
662 | -} |
663 | - |
664 | -void Greeter::respond(const QString &response) |
665 | -{ |
666 | - Q_D(Greeter); |
667 | - |
668 | - d->handleRespond(response); |
669 | -} |
670 | - |
671 | -void Greeter::sendAuthenticationComplete() |
672 | -{ |
673 | - if (qEnvironmentVariableIsEmpty("UNITY_TESTING")) { |
674 | - // simulate PAM's delay |
675 | - QTimer::singleShot(1000, this, &Greeter::authenticationComplete); |
676 | - } else { |
677 | - Q_EMIT authenticationComplete(); |
678 | - } |
679 | -} |
680 | - |
681 | -} |
682 | |
683 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.h' |
684 | --- plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.h 2016-07-28 15:34:29 +0000 |
685 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.h 1970-01-01 00:00:00 +0000 |
686 | @@ -1,108 +0,0 @@ |
687 | -/* |
688 | - * Copyright (C) 2013 Canonical, Ltd. |
689 | - * Copyright (C) 2010-2011 David Edmundson. |
690 | - * Copyright (C) 2010-2011 Robert Ancell |
691 | - * |
692 | - * This program is free software; you can redistribute it and/or modify |
693 | - * it under the terms of the GNU General Public License as published by |
694 | - * the Free Software Foundation; version 3. |
695 | - * |
696 | - * This program is distributed in the hope that it will be useful, |
697 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
698 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
699 | - * GNU General Public License for more details. |
700 | - * |
701 | - * You should have received a copy of the GNU General Public License |
702 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
703 | - * |
704 | - * Author: David Edmundson <kde@davidedmundson.co.uk> |
705 | - */ |
706 | - |
707 | -#ifndef UNITY_MOCK_GREETER_H |
708 | -#define UNITY_MOCK_GREETER_H |
709 | - |
710 | -#include <QtCore/QObject> |
711 | -#include <QtCore/QVariant> |
712 | - |
713 | -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
714 | - * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB |
715 | - * COUNTERPART IN tests/mocks/Lightdm/liblightdm |
716 | - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ |
717 | - |
718 | -namespace QLightDM |
719 | -{ |
720 | - class GreeterPrivate; |
721 | - |
722 | -class Q_DECL_EXPORT Greeter : public QObject |
723 | -{ |
724 | - Q_OBJECT |
725 | - |
726 | - Q_PROPERTY(bool authenticated READ isAuthenticated ) //NOTFIY authenticationComplete |
727 | - Q_PROPERTY(QString authenticationUser READ authenticationUser ) |
728 | - Q_PROPERTY(QString defaultSession READ defaultSessionHint CONSTANT) |
729 | - Q_PROPERTY(QString selectUser READ selectUserHint CONSTANT) |
730 | - Q_PROPERTY(bool selectGuest READ selectGuestHint CONSTANT) |
731 | - |
732 | - Q_PROPERTY(QString hostname READ hostname CONSTANT) |
733 | - Q_PROPERTY(bool hasGuestAccount READ hasGuestAccountHint CONSTANT) |
734 | - |
735 | - Q_ENUMS(PromptType MessageType) |
736 | - |
737 | -public: |
738 | - enum PromptType { |
739 | - PromptTypeQuestion, |
740 | - PromptTypeSecret |
741 | - }; |
742 | - |
743 | - enum MessageType { |
744 | - MessageTypeInfo, |
745 | - MessageTypeError |
746 | - }; |
747 | - |
748 | - explicit Greeter(QObject* parent=0); |
749 | - virtual ~Greeter(); |
750 | - |
751 | - QString getHint(const QString &name) const; |
752 | - QString defaultSessionHint() const; |
753 | - bool hideUsersHint() const; |
754 | - bool showManualLoginHint() const; |
755 | - bool showRemoteLoginHint() const; |
756 | - bool hasGuestAccountHint() const; |
757 | - QString selectUserHint() const; |
758 | - bool selectGuestHint() const; |
759 | - QString autologinUserHint() const; |
760 | - bool autologinGuestHint() const; |
761 | - int autologinTimeoutHint() const; |
762 | - |
763 | - bool inAuthentication() const; |
764 | - bool isAuthenticated() const; |
765 | - QString authenticationUser() const; |
766 | - QString hostname() const; |
767 | - |
768 | -public Q_SLOTS: |
769 | - bool connectSync(); |
770 | - void authenticate(const QString &username=QString()); |
771 | - void authenticateAsGuest(); |
772 | - void authenticateAutologin(); |
773 | - void authenticateRemote(const QString &session=QString(), const QString &username=QString()); |
774 | - void respond(const QString &response); |
775 | - void cancelAuthentication(); |
776 | - void setLanguage (const QString &language); |
777 | - bool startSessionSync(const QString &session=QString()); |
778 | - |
779 | -Q_SIGNALS: |
780 | - void showMessage(QString text, QLightDM::Greeter::MessageType type); |
781 | - void showPrompt(QString text, QLightDM::Greeter::PromptType type); |
782 | - void authenticationComplete(); |
783 | - void autologinTimerExpired(); |
784 | - |
785 | -protected: |
786 | - void sendAuthenticationComplete(); |
787 | - |
788 | -private: |
789 | - GreeterPrivate *d_ptr; |
790 | - Q_DECLARE_PRIVATE(Greeter) |
791 | -}; |
792 | -} |
793 | - |
794 | -#endif // UNITY_MOCK_GREETER_H |
795 | |
796 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp' |
797 | --- plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp 2015-11-02 17:22:30 +0000 |
798 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp 1970-01-01 00:00:00 +0000 |
799 | @@ -1,304 +0,0 @@ |
800 | -/* |
801 | - * Copyright (C) 2013 Canonical, Ltd. |
802 | - * |
803 | - * This program is free software; you can redistribute it and/or modify |
804 | - * it under the terms of the GNU General Public License as published by |
805 | - * the Free Software Foundation; version 3. |
806 | - * |
807 | - * This program is distributed in the hope that it will be useful, |
808 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
809 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
810 | - * GNU General Public License for more details. |
811 | - * |
812 | - * You should have received a copy of the GNU General Public License |
813 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
814 | - * |
815 | - * Author: Michael Terry <michael.terry@canonical.com> |
816 | - */ |
817 | - |
818 | -#include "Greeter.h" |
819 | -#include "GreeterPrivate.h" |
820 | -#include <QFuture> |
821 | -#include <QFutureInterface> |
822 | -#include <QFutureWatcher> |
823 | -#include <QQueue> |
824 | -#include <QtConcurrent> |
825 | -#include <QVector> |
826 | -#include <security/pam_appl.h> |
827 | - |
828 | -namespace QLightDM |
829 | -{ |
830 | - |
831 | -class GreeterImpl : public QObject |
832 | -{ |
833 | - Q_OBJECT |
834 | - |
835 | - struct AppData |
836 | - { |
837 | - GreeterImpl *impl; |
838 | - pam_handle *handle; |
839 | - }; |
840 | - |
841 | - typedef QFutureInterface<QString> ResponseFuture; |
842 | - |
843 | -public: |
844 | - explicit GreeterImpl(Greeter *parent, GreeterPrivate *greeterPrivate) |
845 | - : QObject(parent), |
846 | - greeter(parent), |
847 | - greeterPrivate(greeterPrivate), |
848 | - pamHandle(nullptr) |
849 | - { |
850 | - qRegisterMetaType<QLightDM::GreeterImpl::ResponseFuture>("QLightDM::GreeterImpl::ResponseFuture"); |
851 | - |
852 | - connect(&futureWatcher, &QFutureWatcher<int>::finished, this, &GreeterImpl::finishPam); |
853 | - connect(this, SIGNAL(showMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)), |
854 | - this, SLOT(handleMessage(pam_handle *, QString, QLightDM::Greeter::MessageType))); |
855 | - // This next connect is how we pass ResponseFutures between threads |
856 | - connect(this, SIGNAL(showPrompt(pam_handle *, QString, QLightDM::Greeter::PromptType, QLightDM::GreeterImpl::ResponseFuture)), |
857 | - this, SLOT(handlePrompt(pam_handle *, QString, QLightDM::Greeter::PromptType, QLightDM::GreeterImpl::ResponseFuture)), |
858 | - Qt::BlockingQueuedConnection); |
859 | - } |
860 | - |
861 | - ~GreeterImpl() |
862 | - { |
863 | - cancelPam(); |
864 | - } |
865 | - |
866 | - void start(QString username) |
867 | - { |
868 | - // Clear out any existing PAM interactions first |
869 | - cancelPam(); |
870 | - if (pamHandle != nullptr) { |
871 | - // While we were cancelling pam above, we processed Qt events. |
872 | - // Which may have allowed someone to call start() on us again. |
873 | - // In which case, we'll bail on our current start() call. |
874 | - // This isn't racy because it's all in the same thread. |
875 | - return; |
876 | - } |
877 | - |
878 | - AppData *appData = new AppData(); |
879 | - appData->impl = this; |
880 | - |
881 | - // Now actually start a new conversation with PAM |
882 | - pam_conv conversation; |
883 | - conversation.conv = converseWithPam; |
884 | - conversation.appdata_ptr = static_cast<void*>(appData); |
885 | - |
886 | - if (pam_start("lightdm", username.toUtf8(), &conversation, &pamHandle) == PAM_SUCCESS) { |
887 | - appData->handle = pamHandle; |
888 | - futureWatcher.setFuture(QtConcurrent::mapped(QList<pam_handle*>() << pamHandle, authenticateWithPam)); |
889 | - } else { |
890 | - delete appData; |
891 | - greeterPrivate->authenticated = false; |
892 | - Q_EMIT greeter->showMessage(QStringLiteral("Internal error: could not start PAM authentication"), QLightDM::Greeter::MessageTypeError); |
893 | - Q_EMIT greeter->authenticationComplete(); |
894 | - } |
895 | - } |
896 | - |
897 | - static int authenticateWithPam(pam_handle* const& pamHandle) |
898 | - { |
899 | - int pamStatus = pam_authenticate(pamHandle, 0); |
900 | - if (pamStatus == PAM_SUCCESS) { |
901 | - pamStatus = pam_acct_mgmt(pamHandle, 0); |
902 | - } |
903 | - if (pamStatus == PAM_NEW_AUTHTOK_REQD) { |
904 | - pamStatus = pam_chauthtok(pamHandle, PAM_CHANGE_EXPIRED_AUTHTOK); |
905 | - } |
906 | - if (pamStatus == PAM_SUCCESS) { |
907 | - pam_setcred(pamHandle, PAM_REINITIALIZE_CRED); |
908 | - } |
909 | - return pamStatus; |
910 | - } |
911 | - |
912 | - static int converseWithPam(int num_msg, const pam_message** msg, |
913 | - pam_response** resp, void* appdata_ptr) |
914 | - { |
915 | - if (num_msg <= 0) |
916 | - return PAM_CONV_ERR; |
917 | - |
918 | - auto* tmp_response = static_cast<pam_response*>(calloc(num_msg, sizeof(pam_response))); |
919 | - if (!tmp_response) |
920 | - return PAM_CONV_ERR; |
921 | - |
922 | - AppData *appData = static_cast<AppData*>(appdata_ptr); |
923 | - GreeterImpl *impl = appData->impl; |
924 | - pam_handle *handle = appData->handle; |
925 | - |
926 | - int count; |
927 | - QVector<ResponseFuture> responses; |
928 | - |
929 | - for (count = 0; count < num_msg; ++count) |
930 | - { |
931 | - switch (msg[count]->msg_style) |
932 | - { |
933 | - case PAM_PROMPT_ECHO_ON: |
934 | - { |
935 | - QString message(msg[count]->msg); |
936 | - responses.append(ResponseFuture()); |
937 | - responses.last().reportStarted(); |
938 | - Q_EMIT impl->showPrompt(handle, message, Greeter::PromptTypeQuestion, responses.last()); |
939 | - break; |
940 | - } |
941 | - case PAM_PROMPT_ECHO_OFF: |
942 | - { |
943 | - QString message(msg[count]->msg); |
944 | - responses.append(ResponseFuture()); |
945 | - responses.last().reportStarted(); |
946 | - Q_EMIT impl->showPrompt(handle, message, Greeter::PromptTypeSecret, responses.last()); |
947 | - break; |
948 | - } |
949 | - case PAM_TEXT_INFO: |
950 | - { |
951 | - QString message(msg[count]->msg); |
952 | - Q_EMIT impl->showMessage(handle, message, Greeter::MessageTypeInfo); |
953 | - break; |
954 | - } |
955 | - default: |
956 | - { |
957 | - QString message(msg[count]->msg); |
958 | - Q_EMIT impl->showMessage(handle, message, Greeter::MessageTypeError); |
959 | - break; |
960 | - } |
961 | - } |
962 | - } |
963 | - |
964 | - int i = 0; |
965 | - bool raise_error = false; |
966 | - |
967 | - for (auto &response : responses) |
968 | - { |
969 | - pam_response* resp_item = &tmp_response[i++]; |
970 | - resp_item->resp_retcode = 0; |
971 | - resp_item->resp = strdup(response.future().result().toUtf8()); |
972 | - |
973 | - if (!resp_item->resp) |
974 | - { |
975 | - raise_error = true; |
976 | - break; |
977 | - } |
978 | - } |
979 | - |
980 | - delete appData; |
981 | - |
982 | - if (raise_error) |
983 | - { |
984 | - for (int i = 0; i < count; ++i) |
985 | - free(tmp_response[i].resp); |
986 | - |
987 | - free(tmp_response); |
988 | - return PAM_CONV_ERR; |
989 | - } |
990 | - else |
991 | - { |
992 | - *resp = tmp_response; |
993 | - return PAM_SUCCESS; |
994 | - } |
995 | - } |
996 | - |
997 | -public Q_SLOTS: |
998 | - bool respond(QString response) |
999 | - { |
1000 | - if (!futures.isEmpty()) { |
1001 | - futures.dequeue().reportFinished(&response); |
1002 | - return true; |
1003 | - } else { |
1004 | - return false; |
1005 | - } |
1006 | - } |
1007 | - |
1008 | -Q_SIGNALS: |
1009 | - void showMessage(pam_handle *handle, QString text, QLightDM::Greeter::MessageType type); |
1010 | - void showPrompt(pam_handle *handle, QString text, QLightDM::Greeter::PromptType type, QLightDM::GreeterImpl::ResponseFuture response); |
1011 | - |
1012 | -private Q_SLOTS: |
1013 | - void finishPam() |
1014 | - { |
1015 | - if (pamHandle == nullptr) { |
1016 | - return; |
1017 | - } |
1018 | - |
1019 | - int pamStatus = futureWatcher.result(); |
1020 | - |
1021 | - pam_end(pamHandle, pamStatus); |
1022 | - pamHandle = nullptr; |
1023 | - |
1024 | - greeterPrivate->authenticated = (pamStatus == PAM_SUCCESS); |
1025 | - Q_EMIT greeter->authenticationComplete(); |
1026 | - } |
1027 | - |
1028 | - void handleMessage(pam_handle *handle, QString text, QLightDM::Greeter::MessageType type) |
1029 | - { |
1030 | - if (handle != pamHandle) |
1031 | - return; |
1032 | - |
1033 | - Q_EMIT greeter->showMessage(text, type); |
1034 | - } |
1035 | - |
1036 | - void handlePrompt(pam_handle *handle, QString text, QLightDM::Greeter::PromptType type, QLightDM::GreeterImpl::ResponseFuture future) |
1037 | - { |
1038 | - if (handle != pamHandle) { |
1039 | - future.reportResult(QString()); |
1040 | - future.reportFinished(); |
1041 | - return; |
1042 | - } |
1043 | - |
1044 | - futures.enqueue(future); |
1045 | - Q_EMIT greeter->showPrompt(text, type); |
1046 | - } |
1047 | - |
1048 | -private: |
1049 | - void cancelPam() |
1050 | - { |
1051 | - if (pamHandle != nullptr) { |
1052 | - QFuture<int> pamFuture = futureWatcher.future(); |
1053 | - pam_handle *handle = pamHandle; |
1054 | - pamHandle = nullptr; // to disable normal finishPam() handling |
1055 | - pamFuture.cancel(); |
1056 | - |
1057 | - // Note the empty loop, we just want to clear the futures queue. |
1058 | - // Any further prompts from the pam thread will be immediately |
1059 | - // responded to/dismissed in handlePrompt(). |
1060 | - while (respond(QString())); |
1061 | - |
1062 | - // Now let signal/slot handling happen so the thread can finish |
1063 | - while (!pamFuture.isFinished()) { |
1064 | - QCoreApplication::processEvents(); |
1065 | - } |
1066 | - |
1067 | - pam_end(handle, PAM_CONV_ERR); |
1068 | - } |
1069 | - } |
1070 | - |
1071 | - Greeter *greeter; |
1072 | - GreeterPrivate *greeterPrivate; |
1073 | - pam_handle* pamHandle; |
1074 | - QFutureWatcher<int> futureWatcher; |
1075 | - QQueue<ResponseFuture> futures; |
1076 | -}; |
1077 | - |
1078 | -GreeterPrivate::GreeterPrivate(Greeter* parent) |
1079 | - : authenticated(false), |
1080 | - authenticationUser(), |
1081 | - m_impl(new GreeterImpl(parent, this)), |
1082 | - q_ptr(parent) |
1083 | -{ |
1084 | -} |
1085 | - |
1086 | -GreeterPrivate::~GreeterPrivate() |
1087 | -{ |
1088 | - delete m_impl; |
1089 | -} |
1090 | - |
1091 | -void GreeterPrivate::handleAuthenticate() |
1092 | -{ |
1093 | - m_impl->start(authenticationUser); |
1094 | -} |
1095 | - |
1096 | -void GreeterPrivate::handleRespond(const QString &response) |
1097 | -{ |
1098 | - m_impl->respond(response); |
1099 | -} |
1100 | - |
1101 | -} |
1102 | - |
1103 | -#include "GreeterPrivate.moc" |
1104 | |
1105 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h' |
1106 | --- plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h 2015-09-11 13:38:45 +0000 |
1107 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h 1970-01-01 00:00:00 +0000 |
1108 | @@ -1,51 +0,0 @@ |
1109 | -/* |
1110 | - * Copyright (C) 2013 Canonical, Ltd. |
1111 | - * |
1112 | - * This program is free software; you can redistribute it and/or modify |
1113 | - * it under the terms of the GNU General Public License as published by |
1114 | - * the Free Software Foundation; version 3. |
1115 | - * |
1116 | - * This program is distributed in the hope that it will be useful, |
1117 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1118 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1119 | - * GNU General Public License for more details. |
1120 | - * |
1121 | - * You should have received a copy of the GNU General Public License |
1122 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1123 | - * |
1124 | - * Author: Michael Terry <michael.terry@canonical.com> |
1125 | - */ |
1126 | - |
1127 | -#ifndef UNITY_MOCK_GREETER_PRIVATE_H |
1128 | -#define UNITY_MOCK_GREETER_PRIVATE_H |
1129 | - |
1130 | -#include <QtCore/QObject> |
1131 | - |
1132 | -namespace QLightDM |
1133 | -{ |
1134 | -class Greeter; |
1135 | -class GreeterImpl; |
1136 | - |
1137 | -class GreeterPrivate |
1138 | -{ |
1139 | -public: |
1140 | - explicit GreeterPrivate(Greeter* parent=0); |
1141 | - virtual ~GreeterPrivate(); |
1142 | - |
1143 | - // These variables may not be used by all subclasses, that's no problem |
1144 | - bool authenticated; |
1145 | - QString authenticationUser; |
1146 | - |
1147 | - void handleAuthenticate(); |
1148 | - void handleRespond(const QString &response); |
1149 | - |
1150 | -protected: |
1151 | - GreeterImpl *m_impl; // if the backend needs more private data |
1152 | - Greeter * const q_ptr; |
1153 | - |
1154 | -private: |
1155 | - Q_DECLARE_PUBLIC(Greeter) |
1156 | -}; |
1157 | -} |
1158 | - |
1159 | -#endif // UNITY_MOCK_GREETER_PRIVATE_H |
1160 | |
1161 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp' |
1162 | --- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp 2016-06-15 15:29:34 +0000 |
1163 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp 1970-01-01 00:00:00 +0000 |
1164 | @@ -1,88 +0,0 @@ |
1165 | -/* |
1166 | - * Copyright (C) 2015 Canonical, Ltd. |
1167 | - * |
1168 | - * This program is free software; you can redistribute it and/or modify |
1169 | - * it under the terms of the GNU General Public License as published by |
1170 | - * the Free Software Foundation; version 3. |
1171 | - * |
1172 | - * This program is distributed in the hope that it will be useful, |
1173 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1174 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1175 | - * GNU General Public License for more details. |
1176 | - * |
1177 | - * You should have received a copy of the GNU General Public License |
1178 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1179 | - * |
1180 | - */ |
1181 | - |
1182 | - |
1183 | -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1184 | - * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB |
1185 | - * COUNTERPART IN tests/mocks/LightDM/IntegratedLightDM/liblightdm |
1186 | - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ |
1187 | - |
1188 | -// LightDM currently is Qt4 compatible, and so doesn't define setRoleNames. |
1189 | -// To use the same method of setting role name that it does, we |
1190 | -// set our compatibility to Qt4 here too. |
1191 | -#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0) |
1192 | - |
1193 | -#include "SessionsModel.h" |
1194 | -#include "SessionsModelPrivate.h" |
1195 | -#include <QtCore/QDir> |
1196 | -#include <QtCore/QString> |
1197 | - |
1198 | -namespace QLightDM |
1199 | -{ |
1200 | - |
1201 | -SessionsModel::SessionsModel(QObject* parent) : |
1202 | - QAbstractListModel(parent), |
1203 | - d_ptr(new SessionsModelPrivate(this)) |
1204 | -{ |
1205 | - Q_D(SessionsModel); |
1206 | - m_roleNames = QAbstractListModel::roleNames(); |
1207 | - m_roleNames[KeyRole] = "key"; |
1208 | - m_roleNames[TypeRole] = "type"; |
1209 | -} |
1210 | - |
1211 | -SessionsModel::~SessionsModel() |
1212 | -{ |
1213 | - delete d_ptr; |
1214 | -} |
1215 | - |
1216 | -QVariant SessionsModel::data(const QModelIndex& index, int role) const |
1217 | -{ |
1218 | - Q_D(const SessionsModel); |
1219 | - |
1220 | - if(!index.isValid()) { |
1221 | - return QVariant(); |
1222 | - } |
1223 | - |
1224 | - int row = index.row(); |
1225 | - |
1226 | - switch (role) { |
1227 | - case QLightDM::SessionsModel::KeyRole: |
1228 | - return d->sessionItems[row].key; |
1229 | - case Qt::DisplayRole: |
1230 | - return d->sessionItems[row].name; |
1231 | - default: |
1232 | - return QVariant(); |
1233 | - } |
1234 | -} |
1235 | - |
1236 | -QHash<int, QByteArray> SessionsModel::roleNames() const |
1237 | -{ |
1238 | - return m_roleNames; |
1239 | -} |
1240 | - |
1241 | -int SessionsModel::rowCount(const QModelIndex& parent) const |
1242 | -{ |
1243 | - Q_D(const SessionsModel); |
1244 | - |
1245 | - if (parent.isValid()) { |
1246 | - return 0; |
1247 | - } else { // parent is root |
1248 | - return d->sessionItems.size(); |
1249 | - } |
1250 | -} |
1251 | - |
1252 | -} // namespace QLightDM |
1253 | |
1254 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h' |
1255 | --- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h 2015-11-23 22:45:55 +0000 |
1256 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h 1970-01-01 00:00:00 +0000 |
1257 | @@ -1,72 +0,0 @@ |
1258 | -/* |
1259 | - * Copyright (C) 2015 Canonical, Ltd. |
1260 | - * |
1261 | - * This program is free software; you can redistribute it and/or modify |
1262 | - * it under the terms of the GNU General Public License as published by |
1263 | - * the Free Software Foundation; version 3. |
1264 | - * |
1265 | - * This program is distributed in the hope that it will be useful, |
1266 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1267 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1268 | - * GNU General Public License for more details. |
1269 | - * |
1270 | - * You should have received a copy of the GNU General Public License |
1271 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1272 | - * |
1273 | - */ |
1274 | - |
1275 | -#ifndef UNITY_INTEGRATED_SESSIONSMODEL_H |
1276 | -#define UNITY_INTEGRATED_SESSIONSMODEL_H |
1277 | - |
1278 | -#include <QtCore/QAbstractListModel> |
1279 | -#include <QtCore/QString> |
1280 | - |
1281 | -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1282 | - * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB |
1283 | - * COUNTERPART IN tests/mocks/LightDM/IntegratedLightDM/liblightdm |
1284 | - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ |
1285 | - |
1286 | -// This is taken from liblightdm and modified to confirm to our syle conventions |
1287 | -namespace QLightDM |
1288 | -{ |
1289 | -class SessionsModelPrivate; |
1290 | - |
1291 | -class Q_DECL_EXPORT SessionsModel : public QAbstractListModel |
1292 | - { |
1293 | - Q_OBJECT |
1294 | - |
1295 | - Q_ENUMS(SessionModelRoles SessionType) |
1296 | - |
1297 | - public: |
1298 | - |
1299 | - enum SessionModelRoles { |
1300 | - //name is exposed as Qt::DisplayRole |
1301 | - //comment is exposed as Qt::TooltipRole |
1302 | - KeyRole = Qt::UserRole, |
1303 | - IdRole = KeyRole, /** Deprecated */ |
1304 | - TypeRole |
1305 | - }; |
1306 | - |
1307 | - enum SessionType { |
1308 | - LocalSessions, |
1309 | - RemoteSessions |
1310 | - }; |
1311 | - |
1312 | - explicit SessionsModel(QObject* parent=0); /** Deprecated. Loads local sessions*/ |
1313 | - explicit SessionsModel(SessionsModel::SessionType, QObject* parent=0); |
1314 | - virtual ~SessionsModel(); |
1315 | - |
1316 | - QHash<int, QByteArray> roleNames() const override; |
1317 | - int rowCount(const QModelIndex& parent) const override; |
1318 | - QVariant data(const QModelIndex& index, int role) const override; |
1319 | - |
1320 | - protected: |
1321 | - SessionsModelPrivate* const d_ptr; |
1322 | - |
1323 | - private: |
1324 | - QHash<int, QByteArray> m_roleNames; |
1325 | - Q_DECLARE_PRIVATE(SessionsModel) |
1326 | - }; |
1327 | -} |
1328 | - |
1329 | -#endif // UNITY_INTEGRATED_SESSIONSMODEL_H |
1330 | |
1331 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp' |
1332 | --- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 2016-06-24 15:47:41 +0000 |
1333 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 1970-01-01 00:00:00 +0000 |
1334 | @@ -1,36 +0,0 @@ |
1335 | -/* |
1336 | - * Copyright (C) 2015 Canonical, Ltd. |
1337 | - * |
1338 | - * This program is free software; you can redistribute it and/or modify |
1339 | - * it under the terms of the GNU General Public License as published by |
1340 | - * the Free Software Foundation; version 3. |
1341 | - * |
1342 | - * This program is distributed in the hope that it will be useful, |
1343 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1344 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1345 | - * GNU General Public License for more details. |
1346 | - * |
1347 | - * You should have received a copy of the GNU General Public License |
1348 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1349 | - * |
1350 | - */ |
1351 | - |
1352 | -#include "SessionsModelPrivate.h" |
1353 | - |
1354 | -#include <QDir> |
1355 | -#include <QSettings> |
1356 | -#include <QStringList> |
1357 | - |
1358 | -namespace QLightDM |
1359 | -{ |
1360 | - |
1361 | -SessionsModelPrivate::SessionsModelPrivate(SessionsModel* parent) |
1362 | - : q_ptr(parent) |
1363 | -{ |
1364 | - // Since this model is never visible, as there is only 1 session, |
1365 | - // just use the session name as the key |
1366 | - QString sessionName = qgetenv("XDG_SESSION_DESKTOP"); |
1367 | - sessionItems.append({sessionName, "", sessionName, ""}); |
1368 | -} |
1369 | - |
1370 | -} // namespace QLightDM |
1371 | |
1372 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h' |
1373 | --- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 2016-06-23 16:00:11 +0000 |
1374 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 1970-01-01 00:00:00 +0000 |
1375 | @@ -1,54 +0,0 @@ |
1376 | -/* |
1377 | - * Copyright (C) 2015 Canonical, Ltd. |
1378 | - * |
1379 | - * This program is free software; you can redistribute it and/or modify |
1380 | - * it under the terms of the GNU General Public License as published by |
1381 | - * the Free Software Foundation; version 3. |
1382 | - * |
1383 | - * This program is distributed in the hope that it will be useful, |
1384 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1385 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1386 | - * GNU General Public License for more details. |
1387 | - * |
1388 | - * You should have received a copy of the GNU General Public License |
1389 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1390 | - * |
1391 | - */ |
1392 | - |
1393 | -#ifndef UNITY_INTEGRATED_SESSIONSMODEL_PRIVATE_H |
1394 | -#define UNITY_INTEGRATED_SESSIONSMODEL_PRIVATE_H |
1395 | - |
1396 | -#include <QtCore/QList> |
1397 | -#include <QtCore/QString> |
1398 | - |
1399 | -namespace QLightDM |
1400 | -{ |
1401 | -class SessionsModel; |
1402 | - |
1403 | -class SessionItem |
1404 | -{ |
1405 | -public: |
1406 | - QString key; |
1407 | - QString type; // unused |
1408 | - QString name; |
1409 | - QString comment; // unused |
1410 | -}; |
1411 | - |
1412 | -class SessionsModelPrivate |
1413 | -{ |
1414 | -public: |
1415 | - explicit SessionsModelPrivate(SessionsModel* parent=0); |
1416 | - virtual ~SessionsModelPrivate() = default; |
1417 | - |
1418 | - QList<SessionItem> sessionItems; |
1419 | - |
1420 | -protected: |
1421 | - SessionsModel* const q_ptr; |
1422 | - |
1423 | -private: |
1424 | - Q_DECLARE_PUBLIC(SessionsModel) |
1425 | -}; |
1426 | - |
1427 | -} // namespace QLightDM |
1428 | - |
1429 | -#endif // UNITY_INTEGRATED_SESSIONSMODEL_PRIVATE_H |
1430 | |
1431 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp' |
1432 | --- plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp 2016-08-08 14:15:49 +0000 |
1433 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp 1970-01-01 00:00:00 +0000 |
1434 | @@ -1,110 +0,0 @@ |
1435 | -/* |
1436 | - * Copyright (C) 2013-2016 Canonical, Ltd. |
1437 | - * |
1438 | - * This program is free software; you can redistribute it and/or modify |
1439 | - * it under the terms of the GNU General Public License as published by |
1440 | - * the Free Software Foundation; version 3. |
1441 | - * |
1442 | - * This program is distributed in the hope that it will be useful, |
1443 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1444 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1445 | - * GNU General Public License for more details. |
1446 | - * |
1447 | - * You should have received a copy of the GNU General Public License |
1448 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1449 | - * |
1450 | - * Author: Michael Terry <michael.terry@canonical.com> |
1451 | - */ |
1452 | - |
1453 | - |
1454 | -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1455 | - * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB |
1456 | - * COUNTERPART IN tests/mocks/Lightdm/liblightdm |
1457 | - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ |
1458 | - |
1459 | -// LightDM currently is Qt4 compatible, and so doesn't define setRoleNames. |
1460 | -// To use the same method of setting role name that it does, we |
1461 | -// set our compatibility to Qt4 here too. |
1462 | -#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0) |
1463 | - |
1464 | -#include "UsersModel.h" |
1465 | -#include "UsersModelPrivate.h" |
1466 | -#include <QtCore/QDir> |
1467 | -#include <QtCore/QString> |
1468 | -#include <QtGui/QIcon> |
1469 | - |
1470 | -namespace QLightDM |
1471 | -{ |
1472 | - |
1473 | -UsersModel::UsersModel(QObject *parent) : |
1474 | - QAbstractListModel(parent), |
1475 | - d_ptr(new UsersModelPrivate(this)) |
1476 | -{ |
1477 | - // Extend roleNames (we want to keep the "display" role) |
1478 | - QHash<int, QByteArray> roles = roleNames(); |
1479 | - roles[NameRole] = "name"; |
1480 | - roles[RealNameRole] = "realName"; |
1481 | - roles[LoggedInRole] = "loggedIn"; |
1482 | - roles[BackgroundRole] = "background"; |
1483 | - roles[BackgroundPathRole] = "backgroundPath"; |
1484 | - roles[SessionRole] = "session"; |
1485 | - roles[HasMessagesRole] = "hasMessages"; |
1486 | - roles[ImagePathRole] = "imagePath"; |
1487 | - roles[UidRole] = "uid"; |
1488 | - setRoleNames(roles); |
1489 | - |
1490 | - connect(d_ptr, &UsersModelPrivate::dataChanged, this, [this](int i) { |
1491 | - QModelIndex index = createIndex(i, 0); |
1492 | - Q_EMIT dataChanged(index, index); |
1493 | - }); |
1494 | -} |
1495 | - |
1496 | -int UsersModel::rowCount(const QModelIndex &parent) const |
1497 | -{ |
1498 | - Q_D(const UsersModel); |
1499 | - |
1500 | - if (parent.isValid()) { |
1501 | - return 0; |
1502 | - } else { // parent is root |
1503 | - return d->entries.size(); |
1504 | - } |
1505 | -} |
1506 | - |
1507 | -QVariant UsersModel::data(const QModelIndex &index, int role) const |
1508 | -{ |
1509 | - Q_D(const UsersModel); |
1510 | - |
1511 | - if (!index.isValid()) { |
1512 | - return QVariant(); |
1513 | - } |
1514 | - |
1515 | - int row = index.row(); |
1516 | - switch (role) { |
1517 | - case Qt::DisplayRole: |
1518 | - return d->entries[row].real_name; |
1519 | - case Qt::DecorationRole: |
1520 | - return QIcon(); |
1521 | - case UsersModel::NameRole: |
1522 | - return d->entries[row].username; |
1523 | - case UsersModel::RealNameRole: |
1524 | - return d->entries[row].real_name; |
1525 | - case UsersModel::SessionRole: |
1526 | - return d->entries[row].session; |
1527 | - case UsersModel::LoggedInRole: |
1528 | - return d->entries[row].is_active; |
1529 | - case UsersModel::BackgroundRole: |
1530 | - return QPixmap(d->entries[row].background); |
1531 | - case UsersModel::BackgroundPathRole: |
1532 | - return d->entries[row].background; |
1533 | - case UsersModel::HasMessagesRole: |
1534 | - return d->entries[row].has_messages; |
1535 | - case UsersModel::ImagePathRole: |
1536 | - return ""; |
1537 | - case UsersModel::UidRole: |
1538 | - return d->entries[row].uid; |
1539 | - default: |
1540 | - return QVariant(); |
1541 | - } |
1542 | -} |
1543 | - |
1544 | -} |
1545 | |
1546 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.h' |
1547 | --- plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.h 2016-06-27 14:51:40 +0000 |
1548 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.h 1970-01-01 00:00:00 +0000 |
1549 | @@ -1,67 +0,0 @@ |
1550 | -/* |
1551 | - * Copyright (C) 2013 Canonical, Ltd. |
1552 | - * Copyright (C) 2010-2011 David Edmundson. |
1553 | - * |
1554 | - * This program is free software; you can redistribute it and/or modify |
1555 | - * it under the terms of the GNU General Public License as published by |
1556 | - * the Free Software Foundation; version 3. |
1557 | - * |
1558 | - * This program is distributed in the hope that it will be useful, |
1559 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1560 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1561 | - * GNU General Public License for more details. |
1562 | - * |
1563 | - * You should have received a copy of the GNU General Public License |
1564 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1565 | - * |
1566 | - * Author: David Edmundson <kde@davidedmundson.co.uk> |
1567 | - */ |
1568 | - |
1569 | -#ifndef UNITY_MOCK_USERSMODEL_H |
1570 | -#define UNITY_MOCK_USERSMODEL_H |
1571 | - |
1572 | -#include <QtCore/QString> |
1573 | -#include <QtCore/QSharedDataPointer> |
1574 | -#include <QAbstractListModel> |
1575 | - |
1576 | -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1577 | - * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB |
1578 | - * COUNTERPART IN tests/mocks/Lightdm/liblightdm |
1579 | - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ |
1580 | - |
1581 | -namespace QLightDM |
1582 | -{ |
1583 | -class UsersModelPrivate; |
1584 | - |
1585 | -class Q_DECL_EXPORT UsersModel : public QAbstractListModel |
1586 | -{ |
1587 | - Q_OBJECT |
1588 | - |
1589 | - Q_ENUMS(UserModelRoles) |
1590 | - |
1591 | -public: |
1592 | - explicit UsersModel(QObject *parent = 0); |
1593 | - virtual ~UsersModel() = default; |
1594 | - |
1595 | - enum UserModelRoles {NameRole = Qt::UserRole, |
1596 | - RealNameRole, |
1597 | - LoggedInRole, |
1598 | - BackgroundRole, |
1599 | - SessionRole, |
1600 | - HasMessagesRole, |
1601 | - ImagePathRole, |
1602 | - BackgroundPathRole, |
1603 | - UidRole |
1604 | - }; |
1605 | - |
1606 | - int rowCount(const QModelIndex &parent) const override; |
1607 | - QVariant data(const QModelIndex &index, int role) const override; |
1608 | - |
1609 | -private: |
1610 | - UsersModelPrivate * const d_ptr; |
1611 | - Q_DECLARE_PRIVATE(UsersModel) |
1612 | -}; |
1613 | - |
1614 | -} |
1615 | - |
1616 | -#endif // UNITY_MOCK_USERSMODEL_H |
1617 | |
1618 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp' |
1619 | --- plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 2016-07-05 13:52:07 +0000 |
1620 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 1970-01-01 00:00:00 +0000 |
1621 | @@ -1,94 +0,0 @@ |
1622 | -/* |
1623 | - * Copyright (C) 2013-2016 Canonical, Ltd. |
1624 | - * |
1625 | - * This program is free software; you can redistribute it and/or modify |
1626 | - * it under the terms of the GNU General Public License as published by |
1627 | - * the Free Software Foundation; version 3. |
1628 | - * |
1629 | - * This program is distributed in the hope that it will be useful, |
1630 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1631 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1632 | - * GNU General Public License for more details. |
1633 | - * |
1634 | - * You should have received a copy of the GNU General Public License |
1635 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1636 | - * |
1637 | - * Author: Michael Terry <michael.terry@canonical.com> |
1638 | - */ |
1639 | - |
1640 | -#include "UsersModelPrivate.h" |
1641 | - |
1642 | -#include "AccountsServiceDBusAdaptor.h" |
1643 | -#include "UsersModel.h" |
1644 | - |
1645 | -#include <glib.h> |
1646 | -#include <QDebug> |
1647 | -#include <QDir> |
1648 | -#include <QSettings> |
1649 | -#include <QStringList> |
1650 | -#include <unistd.h> |
1651 | - |
1652 | -namespace QLightDM |
1653 | -{ |
1654 | - |
1655 | -UsersModelPrivate::UsersModelPrivate(UsersModel* parent) |
1656 | - : QObject(parent), |
1657 | - q_ptr(parent), |
1658 | - m_service(new AccountsServiceDBusAdaptor(this)) |
1659 | -{ |
1660 | - QFileInfo demoFile(QDir::homePath() + "/.unity8-greeter-demo"); |
1661 | - QString currentUser = g_get_user_name(); |
1662 | - uid_t currentUid = getuid(); |
1663 | - |
1664 | - if (demoFile.exists()) { |
1665 | - QSettings settings(demoFile.filePath(), QSettings::NativeFormat); |
1666 | - QStringList users = settings.value(QStringLiteral("users"), QStringList() << currentUser).toStringList(); |
1667 | - |
1668 | - entries.reserve(users.count()); |
1669 | - Q_FOREACH(const QString &user, users) |
1670 | - { |
1671 | - QString name = settings.value(user + "/name", user).toString(); |
1672 | - entries.append({user, name, 0, 0, false, false, 0, 0, currentUid++}); |
1673 | - } |
1674 | - } else { |
1675 | - entries.append({currentUser, 0, 0, 0, false, false, 0, 0, currentUid}); |
1676 | - |
1677 | - connect(m_service, &AccountsServiceDBusAdaptor::maybeChanged, |
1678 | - this, [this](const QString &user) { |
1679 | - if (user == entries[0].username) { |
1680 | - updateName(true); |
1681 | - } |
1682 | - }); |
1683 | - updateName(false); |
1684 | - } |
1685 | -} |
1686 | - |
1687 | -void UsersModelPrivate::updateName(bool async) |
1688 | -{ |
1689 | - auto pendingReply = m_service->getUserPropertyAsync(entries[0].username, |
1690 | - QStringLiteral("org.freedesktop.Accounts.User"), |
1691 | - QStringLiteral("RealName")); |
1692 | - auto *watcher = new QDBusPendingCallWatcher(pendingReply, this); |
1693 | - |
1694 | - connect(watcher, &QDBusPendingCallWatcher::finished, |
1695 | - this, [this](QDBusPendingCallWatcher* watcher) { |
1696 | - |
1697 | - QDBusPendingReply<QVariant> reply = *watcher; |
1698 | - watcher->deleteLater(); |
1699 | - if (reply.isError()) { |
1700 | - qWarning() << "Failed to get 'RealName' property - " << reply.error().message(); |
1701 | - return; |
1702 | - } |
1703 | - |
1704 | - const QString realName = reply.value().toString(); |
1705 | - if (entries[0].real_name != realName) { |
1706 | - entries[0].real_name = realName; |
1707 | - Q_EMIT dataChanged(0); |
1708 | - } |
1709 | - }); |
1710 | - if (!async) { |
1711 | - watcher->waitForFinished(); |
1712 | - } |
1713 | -} |
1714 | - |
1715 | -} |
1716 | |
1717 | === removed file 'plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h' |
1718 | --- plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h 2016-06-27 14:51:40 +0000 |
1719 | +++ plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h 1970-01-01 00:00:00 +0000 |
1720 | @@ -1,72 +0,0 @@ |
1721 | -/* |
1722 | - * Copyright (C) 2013-2016 Canonical, Ltd. |
1723 | - * |
1724 | - * This program is free software; you can redistribute it and/or modify |
1725 | - * it under the terms of the GNU General Public License as published by |
1726 | - * the Free Software Foundation; version 3. |
1727 | - * |
1728 | - * This program is distributed in the hope that it will be useful, |
1729 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1730 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1731 | - * GNU General Public License for more details. |
1732 | - * |
1733 | - * You should have received a copy of the GNU General Public License |
1734 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1735 | - * |
1736 | - * Author: Michael Terry <michael.terry@canonical.com> |
1737 | - */ |
1738 | - |
1739 | -#ifndef UNITY_MOCK_USERSMODEL_PRIVATE_H |
1740 | -#define UNITY_MOCK_USERSMODEL_PRIVATE_H |
1741 | - |
1742 | -#include <QList> |
1743 | -#include <QObject> |
1744 | -#include <QString> |
1745 | - |
1746 | -class AccountsServiceDBusAdaptor; |
1747 | - |
1748 | -namespace QLightDM |
1749 | -{ |
1750 | -class UsersModel; |
1751 | - |
1752 | -class Entry |
1753 | -{ |
1754 | -public: |
1755 | - QString username; |
1756 | - QString real_name; |
1757 | - QString background; |
1758 | - QString layouts; |
1759 | - bool is_active; |
1760 | - bool has_messages; |
1761 | - QString session; |
1762 | - QString infographic; |
1763 | - uid_t uid; |
1764 | -}; |
1765 | - |
1766 | -class UsersModelPrivate : public QObject |
1767 | -{ |
1768 | - Q_OBJECT |
1769 | - |
1770 | -public: |
1771 | - explicit UsersModelPrivate(UsersModel *parent = 0); |
1772 | - virtual ~UsersModelPrivate() = default; |
1773 | - |
1774 | - QList<Entry> entries; |
1775 | - |
1776 | -Q_SIGNALS: |
1777 | - void dataChanged(int); |
1778 | - |
1779 | -protected: |
1780 | - UsersModel * const q_ptr; |
1781 | - |
1782 | -private: |
1783 | - Q_DECLARE_PUBLIC(UsersModel) |
1784 | - |
1785 | - void updateName(bool async); |
1786 | - |
1787 | - AccountsServiceDBusAdaptor *m_service; |
1788 | -}; |
1789 | - |
1790 | -} |
1791 | - |
1792 | -#endif // UNITY_MOCK_USERSMODEL_PRIVATE_H |
1793 | |
1794 | === removed file 'plugins/LightDM/IntegratedLightDM/qmldir' |
1795 | --- plugins/LightDM/IntegratedLightDM/qmldir 2016-02-03 23:45:45 +0000 |
1796 | +++ plugins/LightDM/IntegratedLightDM/qmldir 1970-01-01 00:00:00 +0000 |
1797 | @@ -1,3 +0,0 @@ |
1798 | -module LightDM.IntegratedLightDM |
1799 | -plugin IntegratedLightDM-qml |
1800 | -typeinfo IntegratedLightDM.qmltypes |
1801 | |
1802 | === modified file 'plugins/LightDM/SessionsModel.cpp' |
1803 | --- plugins/LightDM/SessionsModel.cpp 2016-06-15 20:28:58 +0000 |
1804 | +++ plugins/LightDM/SessionsModel.cpp 2016-11-08 23:03:16 +0000 |
1805 | @@ -1,5 +1,5 @@ |
1806 | /* |
1807 | - * Copyright (C) 2015 Canonical, Ltd. |
1808 | + * Copyright (C) 2015-2016 Canonical, Ltd. |
1809 | * |
1810 | * This program is free software; you can redistribute it and/or modify |
1811 | * it under the terms of the GNU General Public License as published by |
1812 | @@ -111,6 +111,11 @@ |
1813 | } |
1814 | } |
1815 | |
1816 | +QObject *SessionsModel::mock() |
1817 | +{ |
1818 | + return m_model->property("mock").value<QObject*>(); |
1819 | +} |
1820 | + |
1821 | SessionsModel::SessionsModel(QObject* parent) |
1822 | : UnitySortFilterProxyModelQML(parent) |
1823 | { |
1824 | @@ -120,7 +125,6 @@ |
1825 | m_roleNames[IconRole] = "icon_url"; |
1826 | |
1827 | setModel(m_model); |
1828 | - setSourceModel(m_model); |
1829 | setSortCaseSensitivity(Qt::CaseInsensitive); |
1830 | setSortLocaleAware(true); |
1831 | setSortRole(Qt::DisplayRole); |
1832 | |
1833 | === modified file 'plugins/LightDM/SessionsModel.h' |
1834 | --- plugins/LightDM/SessionsModel.h 2015-11-24 00:25:27 +0000 |
1835 | +++ plugins/LightDM/SessionsModel.h 2016-11-08 23:03:16 +0000 |
1836 | @@ -1,5 +1,5 @@ |
1837 | /* |
1838 | - * Copyright (C) 2015 Canonical, Ltd. |
1839 | + * Copyright (C) 2015-2016 Canonical, Ltd. |
1840 | * |
1841 | * This program is free software; you can redistribute it and/or modify |
1842 | * it under the terms of the GNU General Public License as published by |
1843 | @@ -32,6 +32,9 @@ |
1844 | |
1845 | Q_PROPERTY(QList<QUrl> iconSearchDirectories READ iconSearchDirectories |
1846 | WRITE setIconSearchDirectories NOTIFY iconSearchDirectoriesChanged) |
1847 | + |
1848 | + Q_PROPERTY(QObject *mock READ mock CONSTANT) // for testing |
1849 | + |
1850 | Q_SIGNALS: |
1851 | void iconSearchDirectoriesChanged(); |
1852 | |
1853 | @@ -55,6 +58,9 @@ |
1854 | Q_INVOKABLE QUrl iconUrl(const QString sessionName) const; |
1855 | |
1856 | void setIconSearchDirectories(const QList<QUrl> searchDirectories); |
1857 | + |
1858 | + QObject *mock(); |
1859 | + |
1860 | private: |
1861 | QLightDM::SessionsModel* m_model; |
1862 | QHash<int, QByteArray> m_roleNames; |
1863 | |
1864 | === modified file 'plugins/LightDM/UsersModel.cpp' |
1865 | --- plugins/LightDM/UsersModel.cpp 2015-10-26 20:15:08 +0000 |
1866 | +++ plugins/LightDM/UsersModel.cpp 2016-11-08 23:03:16 +0000 |
1867 | @@ -1,5 +1,5 @@ |
1868 | /* |
1869 | - * Copyright (C) 2013 Canonical, Ltd. |
1870 | + * Copyright (C) 2013,2015-2016 Canonical, Ltd. |
1871 | * |
1872 | * This program is free software; you can redistribute it and/or modify |
1873 | * it under the terms of the GNU General Public License as published by |
1874 | @@ -68,4 +68,11 @@ |
1875 | sort(0); |
1876 | } |
1877 | |
1878 | +QObject *UsersModel::mock() |
1879 | +{ |
1880 | + // get through MangleModel down to QLightDM::UsersModel |
1881 | + MangleModel *mangleModel = static_cast<MangleModel*>(sourceModel()); |
1882 | + return mangleModel->sourceModel()->property("mock").value<QObject*>(); |
1883 | +} |
1884 | + |
1885 | #include "UsersModel.moc" |
1886 | |
1887 | === modified file 'plugins/LightDM/UsersModel.h' |
1888 | --- plugins/LightDM/UsersModel.h 2015-09-11 13:38:45 +0000 |
1889 | +++ plugins/LightDM/UsersModel.h 2016-11-08 23:03:16 +0000 |
1890 | @@ -30,8 +30,12 @@ |
1891 | { |
1892 | Q_OBJECT |
1893 | |
1894 | + Q_PROPERTY(QObject *mock READ mock CONSTANT) // for testing |
1895 | + |
1896 | public: |
1897 | explicit UsersModel(QObject* parent=0); |
1898 | + |
1899 | + QObject *mock(); |
1900 | }; |
1901 | |
1902 | #endif |
1903 | |
1904 | === modified file 'plugins/LightDM/plugin.cpp' |
1905 | --- plugins/LightDM/plugin.cpp 2016-06-16 17:23:24 +0000 |
1906 | +++ plugins/LightDM/plugin.cpp 2016-11-08 23:03:16 +0000 |
1907 | @@ -63,20 +63,13 @@ |
1908 | return UserMetricsOutput::UserMetrics::getInstance(); |
1909 | } |
1910 | |
1911 | -void PLUGIN_CLASSNAME::registerTypes(const char *uri) |
1912 | +void LightDM::registerTypes(const char *uri) |
1913 | { |
1914 | qmlRegisterType<QAbstractItemModel>(); |
1915 | qmlRegisterType<UserMetricsOutput::ColorTheme>(); |
1916 | |
1917 | -#if defined INTEGRATED_LIGHTDM |
1918 | - Q_ASSERT(uri == QLatin1String("LightDM.IntegratedLightDM")); |
1919 | - qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider); |
1920 | -#elif defined FULL_LIGHTDM |
1921 | - Q_ASSERT(uri == QLatin1String("LightDM.FullLightDM")); |
1922 | + Q_ASSERT(uri == QLatin1String("LightDM")); |
1923 | qmlRegisterSingletonType<QLightDM::Greeter>(uri, 0, 1, "Greeter", greeter_provider); |
1924 | -#else |
1925 | - #error No library defined in LightDM plugin |
1926 | -#endif |
1927 | |
1928 | qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType"); |
1929 | qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType"); |
1930 | |
1931 | === modified file 'plugins/LightDM/plugin.h' |
1932 | --- plugins/LightDM/plugin.h 2015-11-02 17:37:26 +0000 |
1933 | +++ plugins/LightDM/plugin.h 2016-11-08 23:03:16 +0000 |
1934 | @@ -21,7 +21,7 @@ |
1935 | #include <QtQml/QQmlEngine> |
1936 | #include <QtQml/QQmlExtensionPlugin> |
1937 | |
1938 | -class PLUGIN_CLASSNAME : public QQmlExtensionPlugin |
1939 | +class LightDM : public QQmlExtensionPlugin |
1940 | { |
1941 | Q_OBJECT |
1942 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") |
1943 | |
1944 | === renamed file 'plugins/LightDM/FullLightDM/qmldir' => 'plugins/LightDM/qmldir' |
1945 | --- plugins/LightDM/FullLightDM/qmldir 2016-02-03 23:45:45 +0000 |
1946 | +++ plugins/LightDM/qmldir 2016-11-08 23:03:16 +0000 |
1947 | @@ -1,3 +1,2 @@ |
1948 | -module LightDM.FullLightDM |
1949 | -plugin FullLightDM-qml |
1950 | -typeinfo FullLightDM.qmltypes |
1951 | +module LightDM |
1952 | +plugin LightDM-qml |
1953 | |
1954 | === modified file 'plugins/Unity/Session/dbusunitysessionservice.cpp' |
1955 | --- plugins/Unity/Session/dbusunitysessionservice.cpp 2016-06-22 13:38:16 +0000 |
1956 | +++ plugins/Unity/Session/dbusunitysessionservice.cpp 2016-11-08 23:03:16 +0000 |
1957 | @@ -337,58 +337,16 @@ |
1958 | // user session. |
1959 | Q_EMIT LockRequested(); |
1960 | Q_EMIT lockRequested(); |
1961 | + Q_EMIT Locked(); |
1962 | } |
1963 | |
1964 | void DBusUnitySessionService::Lock() |
1965 | { |
1966 | // Normal lock (with animation, as compared to PromptLock above). Usually |
1967 | // used by indicator-session to lock the session in place. |
1968 | - // |
1969 | - // FIXME: We also -- as a bit of a hack around indicator-session not fully |
1970 | - // supporting a phone profile -- switch to greeter here. The unity7 flow is |
1971 | - // that the user chooses "Lock/Switch" from the indicator, and then can go |
1972 | - // to greeter by selecting "Switch" again from the indicator, which is now |
1973 | - // exposed by the desktop_lockscreen profile. But since in unity8, we try |
1974 | - // to expose most things all the time, we don't use the separate lockscreen |
1975 | - // profile. Instead, we just go directly to the greeter the first time |
1976 | - // a user presses "Lock/Switch". This isn't what this DBus call is |
1977 | - // supposed to do, but we can live with it for now. |
1978 | - // |
1979 | - // Here's a bug about indicator-session growing a converged Touch profile: |
1980 | - // https://launchpad.net/bugs/1557716 |
1981 | - // |
1982 | - // We only do this here in the animated-lock call because that's the only |
1983 | - // time the indicator locks without also asking the display manager to |
1984 | - // switch sessions on us. And since we are switching screens, we also |
1985 | - // don't bother respecting the animate request, simply doing a PromptLock. |
1986 | + // Though here we don't really worry about the difference and just call |
1987 | + // PromptLock. |
1988 | PromptLock(); |
1989 | - switchToGreeter(); |
1990 | -} |
1991 | - |
1992 | -void DBusUnitySessionService::switchToGreeter() |
1993 | -{ |
1994 | - // lock the session using the org.freedesktop.DisplayManager system DBUS service |
1995 | - const QString sessionPath = QString::fromLocal8Bit(qgetenv("XDG_SESSION_PATH")); |
1996 | - QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.DisplayManager"), |
1997 | - sessionPath, |
1998 | - QStringLiteral("org.freedesktop.DisplayManager.Session"), |
1999 | - QStringLiteral("Lock")); |
2000 | - |
2001 | - QDBusPendingCall pendingCall = QDBusConnection::SM_BUSNAME().asyncCall(msg); |
2002 | - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this); |
2003 | - connect(watcher, &QDBusPendingCallWatcher::finished, |
2004 | - this, [this](QDBusPendingCallWatcher* watcher) { |
2005 | - |
2006 | - QDBusPendingReply<void> reply = *watcher; |
2007 | - watcher->deleteLater(); |
2008 | - if (reply.isError()) { |
2009 | - qWarning() << "Lock call failed" << reply.error().message(); |
2010 | - return; |
2011 | - } |
2012 | - |
2013 | - // emit Locked when the call succeeds |
2014 | - Q_EMIT Locked(); |
2015 | - }); |
2016 | } |
2017 | |
2018 | void DBusUnitySessionService::doUnlock() |
2019 | |
2020 | === modified file 'plugins/Unity/Session/dbusunitysessionservice.h' |
2021 | --- plugins/Unity/Session/dbusunitysessionservice.h 2016-06-22 13:38:16 +0000 |
2022 | +++ plugins/Unity/Session/dbusunitysessionservice.h 2016-11-08 23:03:16 +0000 |
2023 | @@ -262,9 +262,6 @@ |
2024 | |
2025 | private Q_SLOTS: |
2026 | void doUnlock(); |
2027 | - |
2028 | -private: |
2029 | - void switchToGreeter(); |
2030 | }; |
2031 | |
2032 | class DBusGnomeSessionManagerWrapper : public UnityDBusObject |
2033 | |
2034 | === modified file 'qml/Components/Dialogs.qml' |
2035 | --- qml/Components/Dialogs.qml 2016-07-15 19:37:39 +0000 |
2036 | +++ qml/Components/Dialogs.qml 2016-11-08 23:03:16 +0000 |
2037 | @@ -19,10 +19,10 @@ |
2038 | import Unity.Application 0.1 |
2039 | import Unity.Session 0.1 |
2040 | import GlobalShortcut 1.0 |
2041 | +import LightDM 0.1 as LightDM |
2042 | import Ubuntu.Components 1.3 |
2043 | import Unity.Platform 1.0 |
2044 | import Utils 0.1 |
2045 | -import "../Greeter" |
2046 | |
2047 | Item { |
2048 | id: root |
2049 | @@ -112,12 +112,12 @@ |
2050 | |
2051 | GlobalShortcut { // lock screen |
2052 | shortcut: Qt.Key_ScreenSaver |
2053 | - onTriggered: LightDMService.greeter.showGreeter() |
2054 | + onTriggered: LightDM.Greeter.showGreeter() |
2055 | } |
2056 | |
2057 | GlobalShortcut { // lock screen |
2058 | shortcut: Qt.ControlModifier|Qt.AltModifier|Qt.Key_L |
2059 | - onTriggered: LightDMService.greeter.showGreeter() |
2060 | + onTriggered: LightDM.Greeter.showGreeter() |
2061 | } |
2062 | |
2063 | QtObject { |
2064 | @@ -151,7 +151,7 @@ |
2065 | Button { |
2066 | text: i18n.ctr("Button: Lock the system", "Lock") |
2067 | onClicked: { |
2068 | - LightDMService.greeter.showGreeter() |
2069 | + LightDM.Greeter.showGreeter() |
2070 | logoutDialog.hide(); |
2071 | } |
2072 | } |
2073 | |
2074 | === removed file 'qml/Greeter/FullLightDMImpl.qml' |
2075 | --- qml/Greeter/FullLightDMImpl.qml 2015-11-19 21:47:32 +0000 |
2076 | +++ qml/Greeter/FullLightDMImpl.qml 1970-01-01 00:00:00 +0000 |
2077 | @@ -1,30 +0,0 @@ |
2078 | -/* |
2079 | - * Copyright (C) 2015 Canonical, Ltd. |
2080 | - * |
2081 | - * This program is free software; you can redistribute it and/or modify |
2082 | - * it under the terms of the GNU General Public License as published by |
2083 | - * the Free Software Foundation; version 3. |
2084 | - * |
2085 | - * This program is distributed in the hope that it will be useful, |
2086 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2087 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2088 | - * GNU General Public License for more details. |
2089 | - * |
2090 | - * You should have received a copy of the GNU General Public License |
2091 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2092 | - */ |
2093 | - |
2094 | -import QtQuick 2.4 |
2095 | -import LightDM.FullLightDM 0.1 as LightDM |
2096 | - |
2097 | -Item{ |
2098 | - id: implementation |
2099 | - |
2100 | - property var greeter: LightDM.Greeter |
2101 | - property var infographic: LightDM.Infographic |
2102 | - property var sessions: LightDM.Sessions |
2103 | - property var sessionRoles: LightDM.SessionRoles |
2104 | - property var users: LightDM.Users |
2105 | - property var userRoles: LightDM.UserRoles |
2106 | - |
2107 | -} |
2108 | |
2109 | === modified file 'qml/Greeter/Greeter.qml' |
2110 | --- qml/Greeter/Greeter.qml 2016-09-22 10:33:39 +0000 |
2111 | +++ qml/Greeter/Greeter.qml 2016-11-08 23:03:16 +0000 |
2112 | @@ -18,13 +18,13 @@ |
2113 | import AccountsService 0.1 |
2114 | import Biometryd 0.0 |
2115 | import GSettings 1.0 |
2116 | +import LightDM 0.1 as LightDM |
2117 | import Powerd 0.1 |
2118 | import Ubuntu.Components 1.3 |
2119 | import Ubuntu.SystemImage 0.1 |
2120 | import Unity.Launcher 0.1 |
2121 | import Unity.Session 0.1 |
2122 | |
2123 | -import "." 0.1 |
2124 | import "../Components" |
2125 | |
2126 | Showable { |
2127 | @@ -51,7 +51,7 @@ |
2128 | readonly property bool hasLockedApp: lockedApp !== "" |
2129 | |
2130 | property bool forcedUnlock |
2131 | - readonly property bool locked: LightDMService.greeter.active && !LightDMService.greeter.authenticated && !forcedUnlock |
2132 | + readonly property bool locked: LightDM.Greeter.active && !LightDM.Greeter.authenticated && !forcedUnlock |
2133 | |
2134 | property bool tabletMode |
2135 | property url viewSource // only used for testing |
2136 | @@ -137,26 +137,21 @@ |
2137 | } |
2138 | |
2139 | function sessionToStart() { |
2140 | - for (var i = 0; i < LightDMService.sessions.count; i++) { |
2141 | - var session = LightDMService.sessions.data(i, |
2142 | - LightDMService.sessionRoles.KeyRole); |
2143 | + for (var i = 0; i < LightDM.Sessions.count; i++) { |
2144 | + var session = LightDM.Sessions.data(i, LightDM.SessionRoles.KeyRole); |
2145 | if (loader.item.sessionToStart === session) { |
2146 | return session; |
2147 | } |
2148 | } |
2149 | |
2150 | - if (loader.item.sessionToStart === LightDMService.greeter.defaultSession) { |
2151 | - return LightDMService.greeter.defaultSession; |
2152 | - } else { |
2153 | - return "ubuntu"; // The default / fallback |
2154 | - } |
2155 | + return LightDM.Greeter.defaultSession; |
2156 | } |
2157 | |
2158 | QtObject { |
2159 | id: d |
2160 | |
2161 | - readonly property bool multiUser: LightDMService.users.count > 1 |
2162 | - readonly property int selectUserIndex: d.getUserIndex(LightDMService.greeter.selectUser) |
2163 | + readonly property bool multiUser: LightDM.Users.count > 1 |
2164 | + readonly property int selectUserIndex: d.getUserIndex(LightDM.Greeter.selectUser) |
2165 | property int currentIndex: Math.max(selectUserIndex, 0) |
2166 | property bool waiting |
2167 | property bool isLockscreen // true when we are locking an active session, rather than first user login |
2168 | @@ -184,8 +179,8 @@ |
2169 | return -1; |
2170 | |
2171 | // Find index for requested user, if it exists |
2172 | - for (var i = 0; i < LightDMService.users.count; i++) { |
2173 | - if (username === LightDMService.users.data(i, LightDMService.userRoles.NameRole)) { |
2174 | + for (var i = 0; i < LightDM.Users.count; i++) { |
2175 | + if (username === LightDM.Users.data(i, LightDM.UserRoles.NameRole)) { |
2176 | return i; |
2177 | } |
2178 | } |
2179 | @@ -194,17 +189,17 @@ |
2180 | } |
2181 | |
2182 | function selectUser(index, reset) { |
2183 | - if (index < 0 || index >= LightDMService.users.count) |
2184 | + if (index < 0 || index >= LightDM.Users.count) |
2185 | return; |
2186 | d.waiting = true; |
2187 | if (reset) { |
2188 | loader.item.reset(false /* forceShow */); |
2189 | } |
2190 | currentIndex = index; |
2191 | - var user = LightDMService.users.data(index, LightDMService.userRoles.NameRole); |
2192 | + var user = LightDM.Users.data(index, LightDM.UserRoles.NameRole); |
2193 | AccountsService.user = user; |
2194 | LauncherModel.setUser(user); |
2195 | - LightDMService.greeter.authenticate(user); // always resets auth state |
2196 | + LightDM.Greeter.authenticate(user); // always resets auth state |
2197 | } |
2198 | |
2199 | function hideView() { |
2200 | @@ -212,18 +207,22 @@ |
2201 | loader.item.enabled = false; // drop OSK and prevent interaction |
2202 | loader.item.notifyAuthenticationSucceeded(false /* showFakePassword */); |
2203 | loader.item.hide(); |
2204 | + sessionStarted(); |
2205 | } |
2206 | } |
2207 | |
2208 | function login() { |
2209 | d.waiting = true; |
2210 | - if (LightDMService.greeter.startSessionSync(root.sessionToStart())) { |
2211 | - sessionStarted(); |
2212 | - hideView(); |
2213 | - } else if (loader.item) { |
2214 | + var success = LightDM.Greeter.startSessionSync(root.sessionToStart()); |
2215 | + d.waiting = false; |
2216 | + |
2217 | + // If successful as a lockscreen, we don't need to hide ourselves. |
2218 | + // logind will tell us to unlock if our current user logged in. |
2219 | + |
2220 | + if (!success) { |
2221 | loader.item.notifyAuthenticationFailed(); |
2222 | + d.selectUser(d.currentIndex, false); |
2223 | } |
2224 | - d.waiting = false; |
2225 | } |
2226 | |
2227 | function startUnlock(toTheRight) { |
2228 | @@ -236,6 +235,7 @@ |
2229 | |
2230 | function checkForcedUnlock(hideNow) { |
2231 | if (forcedUnlock && shown) { |
2232 | + d.waiting = false; |
2233 | hideView(); |
2234 | if (hideNow) { |
2235 | root.hideNow(); // skip hide animation |
2236 | @@ -382,7 +382,7 @@ |
2237 | root.lockedApp = ""; |
2238 | item.forceActiveFocus(); |
2239 | d.selectUser(d.currentIndex, true); |
2240 | - LightDMService.infographic.readyForDataChange(); |
2241 | + LightDM.Infographic.readyForDataChange(); |
2242 | } |
2243 | |
2244 | Connections { |
2245 | @@ -392,7 +392,7 @@ |
2246 | } |
2247 | onResponded: { |
2248 | if (root.locked) { |
2249 | - LightDMService.greeter.respond(response); |
2250 | + LightDM.Greeter.respond(response); |
2251 | } else { |
2252 | d.login(); |
2253 | } |
2254 | @@ -469,18 +469,18 @@ |
2255 | Binding { |
2256 | target: loader.item |
2257 | property: "userModel" |
2258 | - value: LightDMService.users |
2259 | + value: LightDM.Users |
2260 | } |
2261 | |
2262 | Binding { |
2263 | target: loader.item |
2264 | property: "infographicModel" |
2265 | - value: LightDMService.infographic |
2266 | + value: LightDM.Infographic |
2267 | } |
2268 | } |
2269 | |
2270 | Connections { |
2271 | - target: LightDMService.greeter |
2272 | + target: LightDM.Greeter |
2273 | |
2274 | onShowGreeter: root.forceShow() |
2275 | onHideGreeter: root.forcedUnlock = true |
2276 | @@ -498,12 +498,12 @@ |
2277 | onAuthenticationComplete: { |
2278 | d.waiting = false; |
2279 | |
2280 | - if (LightDMService.greeter.authenticated) { |
2281 | - if (!LightDMService.greeter.promptless) { |
2282 | + if (LightDM.Greeter.authenticated) { |
2283 | + if (!LightDM.Greeter.promptless) { |
2284 | d.login(); |
2285 | } |
2286 | } else { |
2287 | - if (!LightDMService.greeter.promptless) { |
2288 | + if (!LightDM.Greeter.promptless) { |
2289 | AccountsService.failedLogins++; |
2290 | } |
2291 | |
2292 | @@ -524,7 +524,7 @@ |
2293 | } |
2294 | |
2295 | loader.item.notifyAuthenticationFailed(); |
2296 | - if (!LightDMService.greeter.promptless) { |
2297 | + if (!LightDM.Greeter.promptless) { |
2298 | d.selectUser(d.currentIndex, false); |
2299 | } |
2300 | } |
2301 | @@ -543,20 +543,20 @@ |
2302 | } |
2303 | |
2304 | Binding { |
2305 | - target: LightDMService.greeter |
2306 | + target: LightDM.Greeter |
2307 | property: "active" |
2308 | value: root.active |
2309 | } |
2310 | |
2311 | Binding { |
2312 | - target: LightDMService.infographic |
2313 | + target: LightDM.Infographic |
2314 | property: "username" |
2315 | - value: AccountsService.statsWelcomeScreen ? LightDMService.users.data(d.currentIndex, LightDMService.userRoles.NameRole) : "" |
2316 | + value: AccountsService.statsWelcomeScreen ? LightDM.Users.data(d.currentIndex, LightDM.UserRoles.NameRole) : "" |
2317 | } |
2318 | |
2319 | Connections { |
2320 | target: i18n |
2321 | - onLanguageChanged: LightDMService.infographic.readyForDataChange() |
2322 | + onLanguageChanged: LightDM.Infographic.readyForDataChange() |
2323 | } |
2324 | |
2325 | Observer { |
2326 | @@ -606,7 +606,7 @@ |
2327 | failOperation("fingerprint reader is locked"); |
2328 | return; |
2329 | } |
2330 | - if (result !== LightDMService.users.data(d.currentIndex, LightDMService.userRoles.UidRole)) { |
2331 | + if (result !== LightDM.Users.data(d.currentIndex, LightDM.UserRoles.UidRole)) { |
2332 | AccountsService.failedFingerprintLogins++; |
2333 | failOperation("not the selected user"); |
2334 | return; |
2335 | |
2336 | === removed file 'qml/Greeter/IntegratedLightDMImpl.qml' |
2337 | --- qml/Greeter/IntegratedLightDMImpl.qml 2015-11-19 21:47:32 +0000 |
2338 | +++ qml/Greeter/IntegratedLightDMImpl.qml 1970-01-01 00:00:00 +0000 |
2339 | @@ -1,29 +0,0 @@ |
2340 | -/* |
2341 | - * Copyright (C) 2015 Canonical, Ltd. |
2342 | - * |
2343 | - * This program is free software; you can redistribute it and/or modify |
2344 | - * it under the terms of the GNU General Public License as published by |
2345 | - * the Free Software Foundation; version 3. |
2346 | - * |
2347 | - * This program is distributed in the hope that it will be useful, |
2348 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2349 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2350 | - * GNU General Public License for more details. |
2351 | - * |
2352 | - * You should have received a copy of the GNU General Public License |
2353 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2354 | - */ |
2355 | - |
2356 | -import QtQuick 2.4 |
2357 | -import LightDM.IntegratedLightDM 0.1 as LightDM |
2358 | - |
2359 | -Item{ |
2360 | - id: implementation |
2361 | - |
2362 | - property var greeter: LightDM.Greeter |
2363 | - property var infographic: LightDM.Infographic |
2364 | - property var sessions: LightDM.Sessions |
2365 | - property var sessionRoles: LightDM.SessionRoles |
2366 | - property var users: LightDM.Users |
2367 | - property var userRoles: LightDM.UserRoles |
2368 | -} |
2369 | |
2370 | === removed file 'qml/Greeter/LightDMService.qml' |
2371 | --- qml/Greeter/LightDMService.qml 2015-11-19 21:47:32 +0000 |
2372 | +++ qml/Greeter/LightDMService.qml 1970-01-01 00:00:00 +0000 |
2373 | @@ -1,54 +0,0 @@ |
2374 | -/* |
2375 | - * Copyright (C) 2015 Canonical, Ltd. |
2376 | - * |
2377 | - * This program is free software; you can redistribute it and/or modify |
2378 | - * it under the terms of the GNU General Public License as published by |
2379 | - * the Free Software Foundation; version 3. |
2380 | - * |
2381 | - * This program is distributed in the hope that it will be useful, |
2382 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2383 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2384 | - * GNU General Public License for more details. |
2385 | - * |
2386 | - * You should have received a copy of the GNU General Public License |
2387 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2388 | - */ |
2389 | - |
2390 | -/** |
2391 | - * Lightweight wrapper that allows for loading integrated/real LightDM |
2392 | - * plugin |
2393 | - */ |
2394 | - |
2395 | -pragma Singleton |
2396 | -import QtQuick 2.4 |
2397 | - |
2398 | -Loader { |
2399 | - id: loader |
2400 | - |
2401 | - property var greeter: d.valid ? loader.item.greeter : null |
2402 | - property var infographic: d.valid ? loader.item.infographic : null |
2403 | - property var sessions: d.valid ? loader.item.sessions : null |
2404 | - property var sessionRoles: d.valid ? loader.item.sessionRoles : null |
2405 | - property var users: d.valid ? loader.item.users : null |
2406 | - property var userRoles: d.valid ? loader.item.userRoles : null |
2407 | - |
2408 | - // This trickery handles cases where applicationArguments aren't provided |
2409 | - // such as during testing |
2410 | - property var fullLightDM: { |
2411 | - if (typeof applicationArguments !== "undefined") { |
2412 | - if (applicationArguments.mode === "greeter") { |
2413 | - return true; |
2414 | - } |
2415 | - } |
2416 | - return false; |
2417 | - } |
2418 | - |
2419 | - source: fullLightDM ? |
2420 | - "FullLightDMImpl.qml" : "IntegratedLightDMImpl.qml" |
2421 | - |
2422 | - QtObject { |
2423 | - id: d |
2424 | - |
2425 | - property bool valid: loader.item !== null |
2426 | - } |
2427 | -} |
2428 | |
2429 | === modified file 'qml/Greeter/LoginList.qml' |
2430 | --- qml/Greeter/LoginList.qml 2016-09-22 10:33:39 +0000 |
2431 | +++ qml/Greeter/LoginList.qml 2016-11-08 23:03:16 +0000 |
2432 | @@ -17,8 +17,8 @@ |
2433 | import QtQuick 2.4 |
2434 | import QtGraphicalEffects 1.0 |
2435 | import Ubuntu.Components 1.3 |
2436 | +import LightDM 0.1 as LightDM |
2437 | import "../Components" |
2438 | -import "." 0.1 |
2439 | |
2440 | StyledItem { |
2441 | id: root |
2442 | @@ -165,7 +165,7 @@ |
2443 | } |
2444 | |
2445 | delegate: Item { |
2446 | - width: parent.width |
2447 | + width: userList.width |
2448 | height: root.cellHeight |
2449 | |
2450 | readonly property bool belowHighlight: (userList.currentIndex < 0 && index > 0) || (userList.currentIndex >= 0 && index > userList.currentIndex) |
2451 | @@ -255,8 +255,8 @@ |
2452 | |
2453 | readonly property alias icon: badge.source |
2454 | |
2455 | - visible: LightDMService.sessions.count > 1 && |
2456 | - !LightDMService.users.data(userList.currentIndex, LightDMService.userRoles.LoggedInRole) |
2457 | + visible: LightDM.Sessions.count > 1 && |
2458 | + !LightDM.Users.data(userList.currentIndex, LightDM.UserRoles.LoggedInRole) |
2459 | |
2460 | height: units.gu(3.5) |
2461 | width: units.gu(3.5) |
2462 | @@ -287,7 +287,7 @@ |
2463 | anchors.margins: units.dp(3) |
2464 | keyColor: "#ffffff" // icon providers give us white icons |
2465 | color: theme.palette.normal.raisedSecondaryText |
2466 | - source: LightDMService.sessions.iconUrl(root.currentSession) |
2467 | + source: LightDM.Sessions.iconUrl(root.currentSession) |
2468 | } |
2469 | |
2470 | Keys.onReturnPressed: { |
2471 | @@ -302,9 +302,9 @@ |
2472 | // Refresh the icon path if looking at different places at runtime |
2473 | // this is mainly for testing |
2474 | Connections { |
2475 | - target: LightDMService.sessions |
2476 | + target: LightDM.Sessions |
2477 | onIconSearchDirectoriesChanged: { |
2478 | - badge.source = LightDMService.sessions.iconUrl(root.currentSession) |
2479 | + badge.source = LightDM.Sessions.iconUrl(root.currentSession) |
2480 | } |
2481 | } |
2482 | } |
2483 | |
2484 | === modified file 'qml/Greeter/NarrowView.qml' |
2485 | --- qml/Greeter/NarrowView.qml 2016-08-30 20:23:15 +0000 |
2486 | +++ qml/Greeter/NarrowView.qml 2016-11-08 23:03:16 +0000 |
2487 | @@ -34,7 +34,7 @@ |
2488 | property alias alphanumeric: loginList.alphanumeric |
2489 | property alias userModel: loginList.model |
2490 | property alias infographicModel: coverPage.infographicModel |
2491 | - property string sessionToStart |
2492 | + property alias sessionToStart: loginList.currentSession |
2493 | property bool waiting |
2494 | readonly property bool fullyShown: coverPage.showProgress === 1 || lockscreen.shown |
2495 | readonly property bool required: coverPage.required || lockscreen.required |
2496 | |
2497 | === modified file 'qml/Greeter/SessionsList.qml' |
2498 | --- qml/Greeter/SessionsList.qml 2016-09-13 17:13:27 +0000 |
2499 | +++ qml/Greeter/SessionsList.qml 2016-11-08 23:03:16 +0000 |
2500 | @@ -17,7 +17,7 @@ |
2501 | import QtQuick 2.4 |
2502 | import Ubuntu.Components 1.3 |
2503 | import Ubuntu.Components.ListItems 1.3 |
2504 | -import "." 0.1 |
2505 | +import LightDM 0.1 as LightDM |
2506 | import "../Components" |
2507 | |
2508 | Item { |
2509 | @@ -43,8 +43,8 @@ |
2510 | } |
2511 | |
2512 | function currentKey() { |
2513 | - var session = LightDMService.sessions.data( |
2514 | - sessionsList.currentIndex, LightDMService.sessionRoles.KeyRole) |
2515 | + var session = LightDM.Sessions.data( |
2516 | + sessionsList.currentIndex, LightDM.SessionRoles.KeyRole) |
2517 | return session; |
2518 | } |
2519 | |
2520 | @@ -111,7 +111,7 @@ |
2521 | |
2522 | boundsBehavior: Flickable.StopAtBounds |
2523 | |
2524 | - model: LightDMService.sessions |
2525 | + model: LightDM.Sessions |
2526 | header: ListItemLayout { |
2527 | id: header |
2528 | |
2529 | |
2530 | === modified file 'qml/Greeter/WideView.qml' |
2531 | --- qml/Greeter/WideView.qml 2016-09-07 17:13:38 +0000 |
2532 | +++ qml/Greeter/WideView.qml 2016-11-08 23:03:16 +0000 |
2533 | @@ -16,7 +16,7 @@ |
2534 | |
2535 | import QtQuick 2.4 |
2536 | import Ubuntu.Components 1.3 |
2537 | -import "." 0.1 |
2538 | +import LightDM 0.1 as LightDM |
2539 | |
2540 | FocusScope { |
2541 | id: root |
2542 | @@ -125,6 +125,8 @@ |
2543 | id: loginList |
2544 | objectName: "loginList" |
2545 | |
2546 | + property int selectedUserIndex: 0 |
2547 | + |
2548 | width: units.gu(40) |
2549 | anchors { |
2550 | left: parent.left |
2551 | @@ -139,9 +141,14 @@ |
2552 | Behavior on boxVerticalOffset { UbuntuNumberAnimation {} } |
2553 | |
2554 | model: root.userModel |
2555 | - currentSession: LightDMService.greeter.defaultSession |
2556 | + currentSession: LightDM.Users.data(selectedUserIndex, |
2557 | + LightDM.UserRoles.SessionRole); |
2558 | onResponded: root.responded(response) |
2559 | - onSelected: root.selected(index) |
2560 | + onSelected: { |
2561 | + LightDM.Users.mock.currentUsername = currentUser; |
2562 | + root.selected(index) |
2563 | + selectedUserIndex = index; |
2564 | + } |
2565 | onSessionChooserButtonClicked: parent.state = "SessionsList" |
2566 | |
2567 | Keys.forwardTo: [sessionChooserLoader.item] |
2568 | |
2569 | === removed file 'qml/Greeter/qmldir' |
2570 | --- qml/Greeter/qmldir 2015-10-20 00:59:12 +0000 |
2571 | +++ qml/Greeter/qmldir 1970-01-01 00:00:00 +0000 |
2572 | @@ -1,1 +0,0 @@ |
2573 | -singleton LightDMService 0.1 LightDMService.qml |
2574 | |
2575 | === modified file 'qml/Shell.qml' |
2576 | --- qml/Shell.qml 2016-10-03 11:15:27 +0000 |
2577 | +++ qml/Shell.qml 2016-11-08 23:03:16 +0000 |
2578 | @@ -27,6 +27,7 @@ |
2579 | import GlobalShortcut 1.0 // has to be before Utils, because of WindowInputFilter |
2580 | import GSettings 1.0 |
2581 | import ImageCache 0.1 |
2582 | +import LightDM 0.1 as LightDM |
2583 | import Utils 0.1 |
2584 | import Powerd 0.1 |
2585 | import SessionBroadcast 0.1 |
2586 | @@ -201,6 +202,12 @@ |
2587 | value: ApplicationManager |
2588 | } |
2589 | |
2590 | + Binding { |
2591 | + target: AccountsService |
2592 | + property: "greeterMode" |
2593 | + value: shell.mode === "greeter" |
2594 | + } |
2595 | + |
2596 | Component.onCompleted: { |
2597 | finishStartUpTimer.start(); |
2598 | } |
2599 | @@ -430,7 +437,7 @@ |
2600 | if (shell.mode === "greeter") { |
2601 | SessionBroadcast.requestHomeShown(AccountsService.user); |
2602 | } else { |
2603 | - var animate = !LightDMService.greeter.active && !stages.shown; |
2604 | + var animate = !LightDM.Greeter.active && !stages.shown; |
2605 | dash.setCurrentScope(0, animate, false); |
2606 | ApplicationManager.requestFocusApplication("unity8-dash"); |
2607 | } |
2608 | @@ -488,7 +495,7 @@ |
2609 | readonly property bool focusedSurfaceIsFullscreen: MirFocusController.focusedSurface |
2610 | ? MirFocusController.focusedSurface.state === Mir.FullscreenState |
2611 | : false |
2612 | - fullscreenMode: (focusedSurfaceIsFullscreen && !LightDMService.greeter.active && launcher.progress == 0) |
2613 | + fullscreenMode: (focusedSurfaceIsFullscreen && !LightDM.Greeter.active && launcher.progress === 0) |
2614 | || greeter.hasLockedApp |
2615 | locked: greeter && greeter.active |
2616 | } |
2617 | |
2618 | === modified file 'tests/CMakeLists.txt' |
2619 | --- tests/CMakeLists.txt 2016-08-22 15:39:16 +0000 |
2620 | +++ tests/CMakeLists.txt 2016-11-08 23:03:16 +0000 |
2621 | @@ -45,8 +45,8 @@ |
2622 | |
2623 | set(ld_paths) |
2624 | list(APPEND ld_paths |
2625 | + ${UNITY_MOCKPATH}/liblightdm |
2626 | ${UNITY_MOCKPATH}/libusermetrics |
2627 | - ${UNITY_MOCKPATH}/LightDM/IntegratedLightDM/liblightdm |
2628 | ) |
2629 | |
2630 | string(REPLACE ";" ":" ld_library_path "${ld_paths}") |
2631 | |
2632 | === modified file 'tests/autopilot/unity8/fixture_setup.py' |
2633 | --- tests/autopilot/unity8/fixture_setup.py 2015-10-26 20:15:08 +0000 |
2634 | +++ tests/autopilot/unity8/fixture_setup.py 2016-11-08 23:03:16 +0000 |
2635 | @@ -74,7 +74,7 @@ |
2636 | def _get_lightdm_mock_path(self): |
2637 | lib_path = get_mocks_library_path() |
2638 | lightdm_mock_path = os.path.abspath( |
2639 | - os.path.join(lib_path, "LightDM" ,"IntegratedLightDM", "liblightdm") |
2640 | + os.path.join(lib_path, "liblightdm") |
2641 | ) |
2642 | |
2643 | if not os.path.exists(lightdm_mock_path): |
2644 | |
2645 | === modified file 'tests/autopilot/unity8/shell/tests/__init__.py' |
2646 | --- tests/autopilot/unity8/shell/tests/__init__.py 2015-10-26 20:15:08 +0000 |
2647 | +++ tests/autopilot/unity8/shell/tests/__init__.py 2016-11-08 23:03:16 +0000 |
2648 | @@ -261,7 +261,7 @@ |
2649 | def _get_lightdm_mock_path(self): |
2650 | lib_path = get_mocks_library_path() |
2651 | lightdm_mock_path = os.path.abspath( |
2652 | - os.path.join(lib_path, "LightDM" ,"IntegratedLightDM", "liblightdm") |
2653 | + os.path.join(lib_path, "liblightdm") |
2654 | ) |
2655 | |
2656 | if not os.path.exists(lightdm_mock_path): |
2657 | |
2658 | === modified file 'tests/mocks/AccountsService/AccountsService.cpp' |
2659 | --- tests/mocks/AccountsService/AccountsService.cpp 2016-08-04 14:05:54 +0000 |
2660 | +++ tests/mocks/AccountsService/AccountsService.cpp 2016-11-08 23:03:16 +0000 |
2661 | @@ -15,7 +15,8 @@ |
2662 | */ |
2663 | |
2664 | #include "AccountsService.h" |
2665 | -#include "MockUsersModel.h" |
2666 | +#include "MockController.h" |
2667 | +#include "UsersModel.h" |
2668 | |
2669 | #include <QLightDM/UsersModel> |
2670 | #include <paths.h> |
2671 | @@ -26,6 +27,7 @@ |
2672 | m_enableLauncherWhileLocked(true), |
2673 | m_enableIndicatorsWhileLocked(true), |
2674 | m_backgroundFile(), |
2675 | + m_greeterMode(true), |
2676 | m_statsWelcomeScreen(true), |
2677 | m_failedLogins(0), |
2678 | m_failedFingerprintLogins(0), |
2679 | @@ -33,9 +35,8 @@ |
2680 | m_demoEdgesCompleted(), |
2681 | m_hereEnabled(false), |
2682 | m_hereLicensePath(""), |
2683 | - m_usersModel(new MockUsersModel(this)) |
2684 | + m_usersModel(new UsersModel(this)) |
2685 | { |
2686 | - m_usersModel->setMockMode("full"); |
2687 | } |
2688 | |
2689 | QString AccountsService::user() const |
2690 | @@ -51,6 +52,19 @@ |
2691 | Q_EMIT backgroundFileChanged(); |
2692 | } |
2693 | |
2694 | +bool AccountsService::greeterMode() const |
2695 | +{ |
2696 | + return m_greeterMode; |
2697 | +} |
2698 | + |
2699 | +void AccountsService::setGreeterMode(bool greeterMode) |
2700 | +{ |
2701 | + if (m_greeterMode != greeterMode) { |
2702 | + m_greeterMode = greeterMode; |
2703 | + Q_EMIT greeterModeChanged(); |
2704 | + } |
2705 | +} |
2706 | + |
2707 | bool AccountsService::demoEdges() const |
2708 | { |
2709 | return m_demoEdges; |
2710 | |
2711 | === modified file 'tests/mocks/AccountsService/AccountsService.h' |
2712 | --- tests/mocks/AccountsService/AccountsService.h 2016-08-30 13:43:08 +0000 |
2713 | +++ tests/mocks/AccountsService/AccountsService.h 2016-11-08 23:03:16 +0000 |
2714 | @@ -22,7 +22,7 @@ |
2715 | #include <QStringList> |
2716 | #include <QVariant> |
2717 | |
2718 | -class MockUsersModel; |
2719 | +class UsersModel; |
2720 | |
2721 | class AccountsService: public QObject |
2722 | { |
2723 | @@ -32,6 +32,10 @@ |
2724 | READ user |
2725 | WRITE setUser |
2726 | NOTIFY userChanged) |
2727 | + Q_PROPERTY (bool greeterMode |
2728 | + READ greeterMode |
2729 | + WRITE setGreeterMode |
2730 | + NOTIFY greeterModeChanged) |
2731 | Q_PROPERTY (bool demoEdges |
2732 | READ demoEdges |
2733 | WRITE setDemoEdges |
2734 | @@ -99,6 +103,8 @@ |
2735 | |
2736 | QString user() const; |
2737 | void setUser(const QString &user); |
2738 | + bool greeterMode() const; |
2739 | + void setGreeterMode(bool greeterMode); |
2740 | bool demoEdges() const; |
2741 | void setDemoEdges(bool demoEdges); |
2742 | QStringList demoEdgesCompleted() const; |
2743 | @@ -133,6 +139,7 @@ |
2744 | |
2745 | Q_SIGNALS: |
2746 | void userChanged(); |
2747 | + void greeterModeChanged(); |
2748 | void demoEdgesChanged(); |
2749 | void demoEdgesCompletedChanged(); |
2750 | void enableFingerprintIdentificationChanged(); |
2751 | @@ -155,6 +162,7 @@ |
2752 | bool m_enableIndicatorsWhileLocked; |
2753 | QString m_backgroundFile; |
2754 | QString m_user; |
2755 | + bool m_greeterMode; |
2756 | bool m_statsWelcomeScreen; |
2757 | uint m_failedLogins; |
2758 | uint m_failedFingerprintLogins; |
2759 | @@ -165,7 +173,7 @@ |
2760 | QString m_realName; |
2761 | QStringList m_kbdMap; |
2762 | QString m_email; |
2763 | - MockUsersModel *m_usersModel; |
2764 | + UsersModel *m_usersModel; |
2765 | }; |
2766 | |
2767 | #endif |
2768 | |
2769 | === modified file 'tests/mocks/AccountsService/CMakeLists.txt' |
2770 | --- tests/mocks/AccountsService/CMakeLists.txt 2016-08-04 14:05:54 +0000 |
2771 | +++ tests/mocks/AccountsService/CMakeLists.txt 2016-11-08 23:03:16 +0000 |
2772 | @@ -2,13 +2,17 @@ |
2773 | ${CMAKE_CURRENT_BINARY_DIR} |
2774 | ${CMAKE_SOURCE_DIR}/plugins/LightDM |
2775 | ${CMAKE_SOURCE_DIR}/plugins/Utils |
2776 | - ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM |
2777 | + ${CMAKE_SOURCE_DIR}/tests/mocks/liblightdm |
2778 | + ) |
2779 | + |
2780 | +include_directories( |
2781 | + SYSTEM |
2782 | + ${LIBLIGHTDM_INCLUDE_DIRS} |
2783 | ) |
2784 | |
2785 | add_library(MockAccountsService-qml MODULE |
2786 | ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp |
2787 | ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp |
2788 | - ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp |
2789 | AccountsService.cpp |
2790 | plugin.cpp |
2791 | ) |
2792 | |
2793 | === modified file 'tests/mocks/CMakeLists.txt' |
2794 | --- tests/mocks/CMakeLists.txt 2016-06-29 18:05:44 +0000 |
2795 | +++ tests/mocks/CMakeLists.txt 2016-11-08 23:03:16 +0000 |
2796 | @@ -33,8 +33,8 @@ |
2797 | add_subdirectory(Cursor) |
2798 | add_subdirectory(GSettings.1.0) |
2799 | add_subdirectory(indicator-service) |
2800 | +add_subdirectory(liblightdm) |
2801 | add_subdirectory(libusermetrics) |
2802 | -add_subdirectory(LightDM) |
2803 | add_subdirectory(Lights) |
2804 | add_subdirectory(MeeGo) |
2805 | add_subdirectory(Powerd) |
2806 | |
2807 | === removed directory 'tests/mocks/LightDM' |
2808 | === removed file 'tests/mocks/LightDM/CMakeLists.txt' |
2809 | --- tests/mocks/LightDM/CMakeLists.txt 2015-09-25 13:01:00 +0000 |
2810 | +++ tests/mocks/LightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
2811 | @@ -1,1 +0,0 @@ |
2812 | -add_subdirectory(IntegratedLightDM) |
2813 | |
2814 | === removed directory 'tests/mocks/LightDM/IntegratedLightDM' |
2815 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt' |
2816 | --- tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt 2015-11-19 00:25:25 +0000 |
2817 | +++ tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
2818 | @@ -1,51 +0,0 @@ |
2819 | -# This is a copy of the normal LightDM plugin, but instead of statically |
2820 | -# linking in the lightdm bits, this one uses shared libraries so we can swap |
2821 | -# out different sets of users for different tests. When we finally switch to |
2822 | -# actually using the system liblightdm in the normal plugin, this version can |
2823 | -# be deleted. |
2824 | - |
2825 | -add_subdirectory(liblightdm) |
2826 | - |
2827 | -include_directories( |
2828 | - ${CMAKE_CURRENT_SOURCE_DIR} |
2829 | - ${CMAKE_CURRENT_BINARY_DIR} |
2830 | - ${CMAKE_SOURCE_DIR}/plugins/Utils |
2831 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM |
2832 | - ${CMAKE_SOURCE_DIR}/tests/mocks/libusermetrics |
2833 | - ${libunity8-private_SOURCE_DIR} |
2834 | -) |
2835 | - |
2836 | -set(QMLPLUGIN_SRC |
2837 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeter.cpp |
2838 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeterList.cpp |
2839 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp |
2840 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM/SessionsModel.cpp |
2841 | - ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp |
2842 | - ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp |
2843 | - MockGreeter.cpp |
2844 | - MockSessionsModel.cpp |
2845 | - MockUsersModel.cpp |
2846 | - plugin.cpp |
2847 | - ) |
2848 | - |
2849 | -add_library(MockLightDM-qml MODULE |
2850 | - ${QMLPLUGIN_SRC} |
2851 | - ) |
2852 | - |
2853 | -# We want to link to liblightdm-qt5-3, but we don't want to depend on it being |
2854 | -# installed on the system. So we make sure we link to our full fake version |
2855 | -# At run time, we can point to whichever version we happen to be using via |
2856 | -# LD_LIBRARY_PATH. |
2857 | -target_link_libraries(MockLightDM-qml |
2858 | - MockLightDM |
2859 | - MockUserMetrics |
2860 | - unity8-private |
2861 | - ) |
2862 | - |
2863 | -qt5_use_modules(MockLightDM-qml DBus Gui Qml) |
2864 | - |
2865 | -add_unity8_mock(LightDM.IntegratedLightDM 0.1 LightDM/IntegratedLightDM |
2866 | - PREFIX mocks |
2867 | - TARGETS MockLightDM-qml |
2868 | - ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/liblightdm" |
2869 | -) |
2870 | |
2871 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp' |
2872 | --- tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp 2016-06-09 21:45:09 +0000 |
2873 | +++ tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp 1970-01-01 00:00:00 +0000 |
2874 | @@ -1,51 +0,0 @@ |
2875 | -/* |
2876 | - * Copyright (C) 2014 Canonical, Ltd. |
2877 | - * |
2878 | - * This program is free software; you can redistribute it and/or modify |
2879 | - * it under the terms of the GNU General Public License as published by |
2880 | - * the Free Software Foundation; version 3. |
2881 | - * |
2882 | - * This program is distributed in the hope that it will be useful, |
2883 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2884 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2885 | - * GNU General Public License for more details. |
2886 | - * |
2887 | - * You should have received a copy of the GNU General Public License |
2888 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2889 | - * |
2890 | - */ |
2891 | - |
2892 | -#include "MockGreeter.h" |
2893 | -#include <GreeterPrivate.h> |
2894 | - |
2895 | -QString MockGreeter::mockMode() const |
2896 | -{ |
2897 | - Q_D(const Greeter); |
2898 | - return d->m_greeter->mockMode(); |
2899 | -} |
2900 | - |
2901 | -void MockGreeter::setMockMode(QString mockMode) |
2902 | -{ |
2903 | - Q_D(Greeter); |
2904 | - |
2905 | - if (d->m_greeter->mockMode() != mockMode) { |
2906 | - d->m_greeter->setMockMode(mockMode); |
2907 | - Q_EMIT mockModeChanged(mockMode); |
2908 | - } |
2909 | -} |
2910 | - |
2911 | -QString MockGreeter::selectUserHint() const |
2912 | -{ |
2913 | - Q_D(const Greeter); |
2914 | - return d->m_greeter->selectUserHint(); |
2915 | -} |
2916 | - |
2917 | -void MockGreeter::setSelectUserHint(const QString &selectUserHint) |
2918 | -{ |
2919 | - Q_D(Greeter); |
2920 | - |
2921 | - if (d->m_greeter->selectUserHint() != selectUserHint) { |
2922 | - d->m_greeter->setSelectUserHint(selectUserHint); |
2923 | - Q_EMIT selectUserHintChanged(); |
2924 | - } |
2925 | -} |
2926 | |
2927 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h' |
2928 | --- tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h 2016-06-09 21:45:09 +0000 |
2929 | +++ tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h 1970-01-01 00:00:00 +0000 |
2930 | @@ -1,42 +0,0 @@ |
2931 | -/* |
2932 | - * Copyright (C) 2014 Canonical, Ltd. |
2933 | - * |
2934 | - * This program is free software; you can redistribute it and/or modify |
2935 | - * it under the terms of the GNU General Public License as published by |
2936 | - * the Free Software Foundation; version 3. |
2937 | - * |
2938 | - * This program is distributed in the hope that it will be useful, |
2939 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2940 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2941 | - * GNU General Public License for more details. |
2942 | - * |
2943 | - * You should have received a copy of the GNU General Public License |
2944 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2945 | - * |
2946 | - */ |
2947 | - |
2948 | -// The real, production, Greeter |
2949 | -#include <Greeter.h> |
2950 | - |
2951 | -#ifndef MOCK_UNITY_GREETER_H |
2952 | -#define MOCK_UNITY_GREETER_H |
2953 | - |
2954 | -class MockGreeter : public Greeter { |
2955 | - Q_OBJECT |
2956 | - |
2957 | - Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged) |
2958 | - Q_PROPERTY(QString selectUser READ selectUserHint WRITE setSelectUserHint NOTIFY selectUserHintChanged) |
2959 | - |
2960 | -public: |
2961 | - QString mockMode() const; |
2962 | - void setMockMode(QString mockMode); |
2963 | - |
2964 | - QString selectUserHint() const; |
2965 | - void setSelectUserHint(const QString &selectUserHint); |
2966 | - |
2967 | -Q_SIGNALS: |
2968 | - void mockModeChanged(QString mode); |
2969 | - void selectUserHintChanged(); |
2970 | -}; |
2971 | - |
2972 | -#endif // MOCK_UNITY_GREETER_H |
2973 | |
2974 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp' |
2975 | --- tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp 2016-07-13 20:24:24 +0000 |
2976 | +++ tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp 1970-01-01 00:00:00 +0000 |
2977 | @@ -1,66 +0,0 @@ |
2978 | -/* |
2979 | - * Copyright (C) 2015 Canonical, Ltd. |
2980 | - * |
2981 | - * This program is free software; you can redistribute it and/or modify |
2982 | - * it under the terms of the GNU General Public License as published by |
2983 | - * the Free Software Foundation; version 3. |
2984 | - * |
2985 | - * This program is distributed in the hope that it will be useful, |
2986 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2987 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2988 | - * GNU General Public License for more details. |
2989 | - * |
2990 | - * You should have received a copy of the GNU General Public License |
2991 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2992 | - * |
2993 | - */ |
2994 | - |
2995 | -#include "MockSessionsModel.h" |
2996 | -#include <QLightDM/SessionsModel> |
2997 | - |
2998 | - |
2999 | -int MockSessionsModel::numSessions() const |
3000 | -{ |
3001 | - QLightDM::SessionsModel* qSessionsModel = |
3002 | - static_cast<QLightDM::SessionsModel*>(sourceModel()); |
3003 | - |
3004 | - return qSessionsModel->numSessions(); |
3005 | -} |
3006 | - |
3007 | -int MockSessionsModel::numAvailableSessions() const |
3008 | -{ |
3009 | - QLightDM::SessionsModel* qSessionsModel = |
3010 | - static_cast<QLightDM::SessionsModel*>(sourceModel()); |
3011 | - |
3012 | - return qSessionsModel->numAvailableSessions(); |
3013 | -} |
3014 | - |
3015 | -QString MockSessionsModel::testScenario() const |
3016 | -{ |
3017 | - QLightDM::SessionsModel* qSessionsModel = |
3018 | - static_cast<QLightDM::SessionsModel*>(sourceModel()); |
3019 | - |
3020 | - return qSessionsModel->testScenario(); |
3021 | -} |
3022 | - |
3023 | -void MockSessionsModel::setNumSessions(const int numSessions) |
3024 | -{ |
3025 | - QLightDM::SessionsModel* qSessionsModel = |
3026 | - static_cast<QLightDM::SessionsModel*>(sourceModel()); |
3027 | - |
3028 | - if (qSessionsModel->numSessions() != numSessions) { |
3029 | - qSessionsModel->setNumSessions(numSessions); |
3030 | - Q_EMIT numSessionsChanged(); |
3031 | - } |
3032 | -} |
3033 | - |
3034 | -void MockSessionsModel::setTestScenario(const QString testScenario) |
3035 | -{ |
3036 | - QLightDM::SessionsModel* qSessionsModel = |
3037 | - static_cast<QLightDM::SessionsModel*>(sourceModel()); |
3038 | - |
3039 | - if (qSessionsModel->testScenario() != testScenario) { |
3040 | - qSessionsModel->setTestScenario(testScenario); |
3041 | - Q_EMIT testScenarioChanged(); |
3042 | - } |
3043 | -} |
3044 | |
3045 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h' |
3046 | --- tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h 2016-07-13 20:24:24 +0000 |
3047 | +++ tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h 1970-01-01 00:00:00 +0000 |
3048 | @@ -1,44 +0,0 @@ |
3049 | -/* |
3050 | - * Copyright (C) 2015 Canonical, Ltd. |
3051 | - * |
3052 | - * This program is free software; you can redistribute it and/or modify |
3053 | - * it under the terms of the GNU General Public License as published by |
3054 | - * the Free Software Foundation; version 3. |
3055 | - * |
3056 | - * This program is distributed in the hope that it will be useful, |
3057 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3058 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3059 | - * GNU General Public License for more details. |
3060 | - * |
3061 | - * You should have received a copy of the GNU General Public License |
3062 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3063 | - * |
3064 | - */ |
3065 | - |
3066 | -#ifndef MOCK_UNITY_SESSIONSMODEL_H |
3067 | -#define MOCK_UNITY_SESSIONSMODEL_H |
3068 | - |
3069 | -#include <SessionsModel.h> |
3070 | - |
3071 | -class MockSessionsModel : public SessionsModel |
3072 | -{ |
3073 | - Q_OBJECT |
3074 | - |
3075 | - Q_PROPERTY(int numAvailableSessions READ numAvailableSessions CONSTANT) |
3076 | - Q_PROPERTY(int numSessions READ numSessions WRITE setNumSessions NOTIFY numSessionsChanged) |
3077 | - Q_PROPERTY(QString testScenario READ testScenario WRITE setTestScenario NOTIFY testScenarioChanged) |
3078 | - |
3079 | -public: |
3080 | - int numAvailableSessions() const; |
3081 | - int numSessions() const; |
3082 | - QString testScenario() const; |
3083 | - void setNumSessions(const int numSessions); |
3084 | - void setTestScenario(const QString testScenario); |
3085 | - |
3086 | -Q_SIGNALS: |
3087 | - void numSessionsChanged(); |
3088 | - void testScenarioChanged(); |
3089 | - |
3090 | -}; |
3091 | - |
3092 | -#endif // MOCK_UNITY_SESSIONSMODEL_H |
3093 | |
3094 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp' |
3095 | --- tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp 2016-08-04 14:05:54 +0000 |
3096 | +++ tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp 1970-01-01 00:00:00 +0000 |
3097 | @@ -1,44 +0,0 @@ |
3098 | -/* |
3099 | - * Copyright (C) 2014 Canonical, Ltd. |
3100 | - * |
3101 | - * This program is free software; you can redistribute it and/or modify |
3102 | - * it under the terms of the GNU General Public License as published by |
3103 | - * the Free Software Foundation; version 3. |
3104 | - * |
3105 | - * This program is distributed in the hope that it will be useful, |
3106 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3107 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3108 | - * GNU General Public License for more details. |
3109 | - * |
3110 | - * You should have received a copy of the GNU General Public License |
3111 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3112 | - * |
3113 | - */ |
3114 | - |
3115 | -#include "MockUsersModel.h" |
3116 | -#include <QLightDM/UsersModel> |
3117 | -#include <QSortFilterProxyModel> |
3118 | - |
3119 | -MockUsersModel::MockUsersModel(QObject* parent) |
3120 | - : UsersModel(parent) |
3121 | -{ |
3122 | -} |
3123 | - |
3124 | -QString MockUsersModel::mockMode() const |
3125 | -{ |
3126 | - QLightDM::UsersModel* qUsersModel = |
3127 | - static_cast<QLightDM::UsersModel*>(static_cast<QSortFilterProxyModel*>(sourceModel())->sourceModel()); |
3128 | - |
3129 | - return qUsersModel->mockMode(); |
3130 | -} |
3131 | - |
3132 | -void MockUsersModel::setMockMode(QString mockMode) |
3133 | -{ |
3134 | - QLightDM::UsersModel* qUsersModel = |
3135 | - static_cast<QLightDM::UsersModel*>(static_cast<QSortFilterProxyModel*>(sourceModel())->sourceModel()); |
3136 | - |
3137 | - if (qUsersModel->mockMode() != mockMode) { |
3138 | - qUsersModel->setMockMode(mockMode); |
3139 | - Q_EMIT mockModeChanged(mockMode); |
3140 | - } |
3141 | -} |
3142 | |
3143 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h' |
3144 | --- tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h 2016-08-04 14:05:54 +0000 |
3145 | +++ tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h 1970-01-01 00:00:00 +0000 |
3146 | @@ -1,39 +0,0 @@ |
3147 | -/* |
3148 | - * Copyright (C) 2014 Canonical, Ltd. |
3149 | - * |
3150 | - * This program is free software; you can redistribute it and/or modify |
3151 | - * it under the terms of the GNU General Public License as published by |
3152 | - * the Free Software Foundation; version 3. |
3153 | - * |
3154 | - * This program is distributed in the hope that it will be useful, |
3155 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3156 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3157 | - * GNU General Public License for more details. |
3158 | - * |
3159 | - * You should have received a copy of the GNU General Public License |
3160 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3161 | - * |
3162 | - */ |
3163 | - |
3164 | -#ifndef MOCK_UNITY_USERSMODEL_H |
3165 | -#define MOCK_UNITY_USERSMODEL_H |
3166 | - |
3167 | -#include <UsersModel.h> |
3168 | - |
3169 | -class MockUsersModel : public UsersModel |
3170 | -{ |
3171 | - Q_OBJECT |
3172 | - |
3173 | - Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged) |
3174 | - |
3175 | -public: |
3176 | - explicit MockUsersModel(QObject* parent=0); |
3177 | - |
3178 | - QString mockMode() const; |
3179 | - void setMockMode(QString mockMode); |
3180 | - |
3181 | -Q_SIGNALS: |
3182 | - void mockModeChanged(QString mode); |
3183 | -}; |
3184 | - |
3185 | -#endif // MOCK_UNITY_USERSMODEL_H |
3186 | |
3187 | === removed directory 'tests/mocks/LightDM/IntegratedLightDM/QLightDM' |
3188 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/QLightDM/Greeter' |
3189 | --- tests/mocks/LightDM/IntegratedLightDM/QLightDM/Greeter 2015-01-20 11:50:19 +0000 |
3190 | +++ tests/mocks/LightDM/IntegratedLightDM/QLightDM/Greeter 1970-01-01 00:00:00 +0000 |
3191 | @@ -1,17 +0,0 @@ |
3192 | -/* |
3193 | - * Copyright (C) 2014 Canonical, Ltd. |
3194 | - * |
3195 | - * This program is free software; you can redistribute it and/or modify |
3196 | - * it under the terms of the GNU General Public License as published by |
3197 | - * the Free Software Foundation; version 3. |
3198 | - * |
3199 | - * This program is distributed in the hope that it will be useful, |
3200 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3201 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3202 | - * GNU General Public License for more details. |
3203 | - * |
3204 | - * You should have received a copy of the GNU General Public License |
3205 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3206 | - */ |
3207 | - |
3208 | -#include "../liblightdm/Greeter.h" |
3209 | |
3210 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel' |
3211 | --- tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel 2015-11-18 03:52:01 +0000 |
3212 | +++ tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel 1970-01-01 00:00:00 +0000 |
3213 | @@ -1,17 +0,0 @@ |
3214 | -/* |
3215 | - * Copyright (C) 2015 Canonical, Ltd. |
3216 | - * |
3217 | - * This program is free software; you can redistribute it and/or modify |
3218 | - * it under the terms of the GNU General Public License as published by |
3219 | - * the Free Software Foundation; version 3. |
3220 | - * |
3221 | - * This program is distributed in the hope that it will be useful, |
3222 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3223 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3224 | - * GNU General Public License for more details. |
3225 | - * |
3226 | - * You should have received a copy of the GNU General Public License |
3227 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3228 | - */ |
3229 | - |
3230 | -#include "../liblightdm/SessionsModel.h" |
3231 | |
3232 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/QLightDM/UsersModel' |
3233 | --- tests/mocks/LightDM/IntegratedLightDM/QLightDM/UsersModel 2015-01-20 11:50:19 +0000 |
3234 | +++ tests/mocks/LightDM/IntegratedLightDM/QLightDM/UsersModel 1970-01-01 00:00:00 +0000 |
3235 | @@ -1,17 +0,0 @@ |
3236 | -/* |
3237 | - * Copyright (C) 2014 Canonical, Ltd. |
3238 | - * |
3239 | - * This program is free software; you can redistribute it and/or modify |
3240 | - * it under the terms of the GNU General Public License as published by |
3241 | - * the Free Software Foundation; version 3. |
3242 | - * |
3243 | - * This program is distributed in the hope that it will be useful, |
3244 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3245 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3246 | - * GNU General Public License for more details. |
3247 | - * |
3248 | - * You should have received a copy of the GNU General Public License |
3249 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3250 | - */ |
3251 | - |
3252 | -#include "../liblightdm/UsersModel.h" |
3253 | |
3254 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp' |
3255 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp 2016-06-09 21:45:09 +0000 |
3256 | +++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp 1970-01-01 00:00:00 +0000 |
3257 | @@ -1,132 +0,0 @@ |
3258 | -/* |
3259 | - * Copyright (C) 2014 Canonical, Ltd. |
3260 | - * |
3261 | - * This program is free software; you can redistribute it and/or modify |
3262 | - * it under the terms of the GNU General Public License as published by |
3263 | - * the Free Software Foundation; version 3. |
3264 | - * |
3265 | - * This program is distributed in the hope that it will be useful, |
3266 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3267 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3268 | - * GNU General Public License for more details. |
3269 | - * |
3270 | - * You should have received a copy of the GNU General Public License |
3271 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3272 | - */ |
3273 | - |
3274 | -#include "Greeter.h" |
3275 | -#include "GreeterPrivate.h" |
3276 | - |
3277 | -namespace QLightDM |
3278 | -{ |
3279 | - |
3280 | -GreeterPrivate::GreeterPrivate(Greeter* parent) |
3281 | - : authenticated(false), |
3282 | - authenticationUser(), |
3283 | - twoFactorDone(false), |
3284 | - mockMode("single"), |
3285 | - q_ptr(parent) |
3286 | -{ |
3287 | - char *envMockMode = getenv("LIBLIGHTDM_MOCK_MODE"); |
3288 | - if (envMockMode) { |
3289 | - mockMode = envMockMode; |
3290 | - } |
3291 | -} |
3292 | - |
3293 | -void GreeterPrivate::handleAuthenticate() |
3294 | -{ |
3295 | - Q_Q(Greeter); |
3296 | - |
3297 | - if (mockMode == "single") { |
3298 | - authenticated = true; |
3299 | - Q_EMIT q->authenticationComplete(); |
3300 | - } else if (mockMode == "single-passphrase" || mockMode == "single-pin") { |
3301 | - Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret); |
3302 | - } else if (mockMode == "full") { |
3303 | - handleAuthenticate_full(); |
3304 | - } |
3305 | -} |
3306 | - |
3307 | -void GreeterPrivate::handleAuthenticate_full() |
3308 | -{ |
3309 | - Q_Q(Greeter); |
3310 | - |
3311 | - // Send out any messages we need to |
3312 | - if (authenticationUser == "info-prompt") |
3313 | - Q_EMIT q->showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo); |
3314 | - else if (authenticationUser == "wide-info-prompt") |
3315 | - Q_EMIT q->showMessage("Welcome to Unity Greeter, the greeteriest greeter that ever did appear in these fine lands", Greeter::MessageTypeInfo); |
3316 | - else if (authenticationUser == "html-info-prompt") |
3317 | - Q_EMIT q->showMessage("<b>&</b>", Greeter::MessageTypeInfo); |
3318 | - else if (authenticationUser == "long-info-prompt") |
3319 | - Q_EMIT q->showMessage("Welcome to Unity Greeter\n\nWe like to annoy you with super ridiculously long messages.\nLike this one\n\nThis is the last line of a multiple line message.", Greeter::MessageTypeInfo); |
3320 | - else if (authenticationUser == "multi-info-prompt") { |
3321 | - Q_EMIT q->showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo); |
3322 | - Q_EMIT q->showMessage("This is an error", Greeter::MessageTypeError); |
3323 | - Q_EMIT q->showMessage("You should have seen three messages", Greeter::MessageTypeInfo); |
3324 | - } |
3325 | - |
3326 | - // OK, now actually do the prompt |
3327 | - if (authenticationUser == "no-password") { |
3328 | - authenticated = true; |
3329 | - Q_EMIT q->authenticationComplete(); |
3330 | - } else if (authenticationUser == "has-pin"){ |
3331 | - Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret); |
3332 | - } else if (authenticationUser == "auth-error") { |
3333 | - authenticated = false; |
3334 | - Q_EMIT q->authenticationComplete(); |
3335 | - } else if (authenticationUser == "different-prompt") { |
3336 | - Q_EMIT q->showPrompt("Secret word: ", Greeter::PromptTypeSecret); |
3337 | - } else { |
3338 | - Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret); |
3339 | - } |
3340 | -} |
3341 | - |
3342 | -void GreeterPrivate::handleRespond(QString const &response) |
3343 | -{ |
3344 | - Q_Q(Greeter); |
3345 | - |
3346 | - if (mockMode == "single") { |
3347 | - // NOOP |
3348 | - } else if (mockMode == "single-passphrase") { |
3349 | - authenticated = (response == "password"); |
3350 | - q->sendAuthenticationComplete(); |
3351 | - } else if (mockMode == "single-pin") { |
3352 | - authenticated = (response == "1234"); |
3353 | - q->sendAuthenticationComplete(); |
3354 | - } else if (mockMode == "full") { |
3355 | - handleRespond_full(response); |
3356 | - } |
3357 | -} |
3358 | - |
3359 | -void GreeterPrivate::handleRespond_full(const QString &response) |
3360 | -{ |
3361 | - Q_Q(Greeter); |
3362 | - |
3363 | - if (authenticationUser == "no-response") |
3364 | - return; |
3365 | - else if (authenticationUser == "two-factor") { |
3366 | - if (!twoFactorDone) { |
3367 | - if (response == "password") { |
3368 | - twoFactorDone = true; |
3369 | - Q_EMIT q->showPrompt("otp", Greeter::PromptTypeQuestion); |
3370 | - } else { |
3371 | - authenticated = false; |
3372 | - q->sendAuthenticationComplete(); |
3373 | - } |
3374 | - } else { |
3375 | - authenticated = (response == "otp"); |
3376 | - q->sendAuthenticationComplete(); |
3377 | - } |
3378 | - return; |
3379 | - } |
3380 | - |
3381 | - if (authenticationUser == "has-pin") { |
3382 | - authenticated = (response == "1234"); |
3383 | - } else { |
3384 | - authenticated = (response == "password"); |
3385 | - } |
3386 | - q->sendAuthenticationComplete(); |
3387 | -} |
3388 | - |
3389 | -} |
3390 | |
3391 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h' |
3392 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h 2016-06-09 21:45:09 +0000 |
3393 | +++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h 1970-01-01 00:00:00 +0000 |
3394 | @@ -1,54 +0,0 @@ |
3395 | -/* |
3396 | - * Copyright (C) 2014 Canonical, Ltd. |
3397 | - * |
3398 | - * This program is free software; you can redistribute it and/or modify |
3399 | - * it under the terms of the GNU General Public License as published by |
3400 | - * the Free Software Foundation; version 3. |
3401 | - * |
3402 | - * This program is distributed in the hope that it will be useful, |
3403 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3404 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3405 | - * GNU General Public License for more details. |
3406 | - * |
3407 | - * You should have received a copy of the GNU General Public License |
3408 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3409 | - */ |
3410 | - |
3411 | -#ifndef UNITY_MOCK_GREETER_PRIVATE_H |
3412 | -#define UNITY_MOCK_GREETER_PRIVATE_H |
3413 | - |
3414 | -#include <QtCore/QObject> |
3415 | - |
3416 | -namespace QLightDM |
3417 | -{ |
3418 | -class Greeter; |
3419 | -class GreeterImpl; |
3420 | - |
3421 | -class GreeterPrivate |
3422 | -{ |
3423 | -public: |
3424 | - explicit GreeterPrivate(Greeter* parent=0); |
3425 | - virtual ~GreeterPrivate() = default; |
3426 | - |
3427 | - // These variables may not be used by all subclasses, that's no problem |
3428 | - bool authenticated; |
3429 | - QString authenticationUser; |
3430 | - bool twoFactorDone; |
3431 | - QString selectUserHint; |
3432 | - |
3433 | - QString mockMode; |
3434 | - |
3435 | - void handleAuthenticate(); |
3436 | - void handleRespond(const QString &response); |
3437 | - |
3438 | -protected: |
3439 | - Greeter * const q_ptr; |
3440 | - |
3441 | -private: |
3442 | - void handleAuthenticate_full(); |
3443 | - void handleRespond_full(const QString &response); |
3444 | - Q_DECLARE_PUBLIC(Greeter) |
3445 | -}; |
3446 | -} |
3447 | - |
3448 | -#endif // UNITY_MOCK_GREETER_PRIVATE_H |
3449 | |
3450 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp' |
3451 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 2016-07-13 20:24:24 +0000 |
3452 | +++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 1970-01-01 00:00:00 +0000 |
3453 | @@ -1,83 +0,0 @@ |
3454 | -/* |
3455 | - * Copyright (C) 2015 Canonical, Ltd. |
3456 | - * |
3457 | - * This program is free software; you can redistribute it and/or modify |
3458 | - * it under the terms of the GNU General Public License as published by |
3459 | - * the Free Software Foundation; version 3. |
3460 | - * |
3461 | - * This program is distributed in the hope that it will be useful, |
3462 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3463 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3464 | - * GNU General Public License for more details. |
3465 | - * |
3466 | - * You should have received a copy of the GNU General Public License |
3467 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3468 | - */ |
3469 | - |
3470 | -#include "SessionsModel.h" |
3471 | -#include "SessionsModelPrivate.h" |
3472 | -#include <QDebug> |
3473 | -namespace QLightDM |
3474 | -{ |
3475 | - |
3476 | -SessionsModelPrivate::SessionsModelPrivate(SessionsModel* parent) |
3477 | - : testScenario("singleSession") |
3478 | - , m_availableSessions( |
3479 | - { |
3480 | - {"ubuntu", "", "Ubuntu", ""}, |
3481 | - {"ubuntu-2d", "", "Ubuntu 2D", ""}, |
3482 | - {"gnome", "", "GNOME", ""}, |
3483 | - {"gnome-classic", "", "GNOME Classic", ""}, |
3484 | - {"gnome-flashback-compiz", "", "GNOME Flashback (Compiz)", ""}, |
3485 | - {"gnome-flashback-metacity", "", "GNOME Flashback (Metacity)", ""}, |
3486 | - {"gnome-wayland", "", "GNOME on Wayland", ""}, |
3487 | - {"plasma", "", "Plasma", ""}, |
3488 | - {"kde", "", "KDE" , ""}, |
3489 | - {"xterm", "", "Recovery Console", ""}, |
3490 | - {"", "", "Unknown?", ""} |
3491 | - }) |
3492 | - , q_ptr(parent) |
3493 | -{ |
3494 | - numSessions = numAvailableSessions(); |
3495 | - resetEntries(); |
3496 | -} |
3497 | - |
3498 | -int SessionsModelPrivate::numAvailableSessions() const |
3499 | -{ |
3500 | - return m_availableSessions.length(); |
3501 | -} |
3502 | - |
3503 | -void SessionsModelPrivate::resetEntries() |
3504 | -{ |
3505 | - Q_Q(SessionsModel); |
3506 | - |
3507 | - q->beginResetModel(); |
3508 | - if (testScenario == "multipleSessions") { |
3509 | - resetEntries_multipleSessions(numSessions); |
3510 | - } else if (testScenario == "noSessions") { |
3511 | - resetEntries_noSessions(); |
3512 | - } else { |
3513 | - resetEntries_singleSession(); |
3514 | - } |
3515 | - q->endResetModel(); |
3516 | -} |
3517 | - |
3518 | -void SessionsModelPrivate::resetEntries_multipleSessions(int numSessions) |
3519 | -{ |
3520 | - sessionItems.clear(); |
3521 | - for (int i = 0; i < numSessions; i++) { |
3522 | - sessionItems.append(m_availableSessions.value(i)); |
3523 | - } |
3524 | -} |
3525 | - |
3526 | -void SessionsModelPrivate::resetEntries_noSessions() |
3527 | -{ |
3528 | - sessionItems = {}; |
3529 | -} |
3530 | - |
3531 | -void SessionsModelPrivate::resetEntries_singleSession() |
3532 | -{ |
3533 | - sessionItems = {{"ubuntu", "", "Ubuntu", ""}}; |
3534 | -} |
3535 | - |
3536 | -} // namespace QLightDM |
3537 | |
3538 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h' |
3539 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 2016-07-13 20:24:24 +0000 |
3540 | +++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 1970-01-01 00:00:00 +0000 |
3541 | @@ -1,63 +0,0 @@ |
3542 | -/* |
3543 | - * Copyright (C) 2015 Canonical, Ltd. |
3544 | - * |
3545 | - * This program is free software; you can redistribute it and/or modify |
3546 | - * it under the terms of the GNU General Public License as published by |
3547 | - * the Free Software Foundation; version 3. |
3548 | - * |
3549 | - * This program is distributed in the hope that it will be useful, |
3550 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3551 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3552 | - * GNU General Public License for more details. |
3553 | - * |
3554 | - * You should have received a copy of the GNU General Public License |
3555 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3556 | - * |
3557 | - */ |
3558 | - |
3559 | -#ifndef UNITY_MOCK_SESSIONSMODEL_PRIVATE_H |
3560 | -#define UNITY_MOCK_SESSIONSMODEL_PRIVATE_H |
3561 | - |
3562 | -#include <QtCore/QList> |
3563 | -#include <QtCore/QString> |
3564 | - |
3565 | -namespace QLightDM |
3566 | -{ |
3567 | -class SessionsModel; |
3568 | - |
3569 | -class SessionItem |
3570 | -{ |
3571 | -public: |
3572 | - QString key; |
3573 | - QString type; // unused |
3574 | - QString name; |
3575 | - QString comment; // unused |
3576 | -}; |
3577 | - |
3578 | -class SessionsModelPrivate |
3579 | -{ |
3580 | -public: |
3581 | - explicit SessionsModelPrivate(SessionsModel* parent=0); |
3582 | - virtual ~SessionsModelPrivate() = default; |
3583 | - |
3584 | - int numAvailableSessions() const; |
3585 | - |
3586 | - QList<SessionItem> sessionItems; |
3587 | - int numSessions; |
3588 | - QString testScenario; |
3589 | - |
3590 | - void resetEntries(); |
3591 | -protected: |
3592 | - SessionsModel* const q_ptr; |
3593 | - |
3594 | -private: |
3595 | - const QList<SessionItem> m_availableSessions; |
3596 | - void resetEntries_multipleSessions(int numSessions); |
3597 | - void resetEntries_noSessions(); |
3598 | - void resetEntries_singleSession(); |
3599 | - Q_DECLARE_PUBLIC(SessionsModel) |
3600 | -}; |
3601 | - |
3602 | -} // namespace QLightDM |
3603 | - |
3604 | -#endif // UNITY_MOCK_SESSIONSMODEL_PRIVATE_H |
3605 | |
3606 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp' |
3607 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 2016-08-30 13:46:17 +0000 |
3608 | +++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 1970-01-01 00:00:00 +0000 |
3609 | @@ -1,124 +0,0 @@ |
3610 | -/* |
3611 | - * Copyright (C) 2014-2016 Canonical, Ltd. |
3612 | - * |
3613 | - * This program is free software; you can redistribute it and/or modify |
3614 | - * it under the terms of the GNU General Public License as published by |
3615 | - * the Free Software Foundation; version 3. |
3616 | - * |
3617 | - * This program is distributed in the hope that it will be useful, |
3618 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3619 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3620 | - * GNU General Public License for more details. |
3621 | - * |
3622 | - * You should have received a copy of the GNU General Public License |
3623 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3624 | - */ |
3625 | - |
3626 | -#include "UsersModelPrivate.h" |
3627 | -#include "UsersModel.h" |
3628 | - |
3629 | -#include <QDir> |
3630 | - |
3631 | -namespace QLightDM |
3632 | -{ |
3633 | - |
3634 | -UsersModelPrivate::UsersModelPrivate(UsersModel* parent) |
3635 | - : mockMode("single") |
3636 | - , q_ptr(parent) |
3637 | -{ |
3638 | - char *envMockMode = getenv("LIBLIGHTDM_MOCK_MODE"); |
3639 | - if (envMockMode) { |
3640 | - mockMode = envMockMode; |
3641 | - } |
3642 | - resetEntries(); |
3643 | -} |
3644 | - |
3645 | -void UsersModelPrivate::resetEntries() |
3646 | -{ |
3647 | - Q_Q(UsersModel); |
3648 | - |
3649 | - q->beginResetModel(); |
3650 | - |
3651 | - if (mockMode == "single") { |
3652 | - resetEntries_single(); |
3653 | - } else if (mockMode == "single-passphrase") { |
3654 | - resetEntries_singlePassphrase(); |
3655 | - } else if (mockMode == "single-pin") { |
3656 | - resetEntries_singlePin(); |
3657 | - } else if (mockMode == "full") { |
3658 | - resetEntries_full(); |
3659 | - } |
3660 | - |
3661 | - // Assign uids in a loop, just to avoid having to muck with them when |
3662 | - // adding or removing test users. |
3663 | - for (int i = 0; i < entries.size(); i++) { |
3664 | - entries[i].uid = i + 1; |
3665 | - } |
3666 | - |
3667 | - // Assign backgrounds |
3668 | - QDir backgroundDir("/usr/share/backgrounds"); |
3669 | - QStringList backgrounds = backgroundDir.entryList(QDir::Files); |
3670 | - if (!backgrounds.empty()) { |
3671 | - for (int i = 0; i < entries.size(); i++) { |
3672 | - if (entries[i].background.isNull()) { |
3673 | - entries[i].background = backgroundDir.filePath(backgrounds[i % backgrounds.size()]); |
3674 | - } |
3675 | - } |
3676 | - } |
3677 | - |
3678 | - q->endResetModel(); |
3679 | -} |
3680 | - |
3681 | -void UsersModelPrivate::resetEntries_single() |
3682 | -{ |
3683 | - entries = |
3684 | - { |
3685 | - { "single", "Single User", 0, 0, false, false, "ubuntu", 0 }, |
3686 | - }; |
3687 | -} |
3688 | - |
3689 | -void UsersModelPrivate::resetEntries_singlePassphrase() |
3690 | -{ |
3691 | - entries = |
3692 | - { |
3693 | - { "single", "Single User", 0, 0, false, false, "ubuntu", 0 }, |
3694 | - }; |
3695 | -} |
3696 | - |
3697 | -void UsersModelPrivate::resetEntries_singlePin() |
3698 | -{ |
3699 | - entries = |
3700 | - { |
3701 | - { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 }, |
3702 | - }; |
3703 | -} |
3704 | - |
3705 | -void UsersModelPrivate::resetEntries_full() |
3706 | -{ |
3707 | - entries = |
3708 | - { |
3709 | - { "has-password", "Has Password", 0, 0, false, false, "ubuntu", 0 }, |
3710 | - { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 }, |
3711 | - { "different-prompt", "Different Prompt", 0, 0, false, false, "ubuntu", 0 }, |
3712 | - { "no-password", "No Password", 0, 0, false, false, "ubuntu", 0 }, |
3713 | - { "auth-error", "Auth Error", 0, 0, false, false, "ubuntu", 0 }, |
3714 | - { "two-factor", "Two Factor", 0, 0, false, false, "ubuntu", 0 }, |
3715 | - { "info-prompt", "Info Prompt", 0, 0, false, false, "ubuntu", 0 }, |
3716 | - { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, "ubuntu", 0 }, |
3717 | - { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, "ubuntu", 0 }, |
3718 | - { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, "ubuntu", 0 }, |
3719 | - { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, "ubuntu", 0 }, |
3720 | - { "long-name", "Long name (far far too long to fit, seriously this would never fit on the screen, you will never see this part of the name)", 0, 0, false, false, "ubuntu", 0 }, |
3721 | - { "color-background", "Color Background", "#E95420", 0, false, false, "ubuntu", 0 }, |
3722 | - // white and black are a bit redundant, but useful for manually testing if UI is still readable |
3723 | - { "white-background", "White Background", "#ffffff", 0, false, false, "ubuntu", 0 }, |
3724 | - { "black-background", "Black Background", "#000000", 0, false, false, "ubuntu", 0 }, |
3725 | - { "no-background", "No Background", "", 0, false, false, "ubuntu", 0 }, |
3726 | - { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 }, |
3727 | - { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 }, |
3728 | - { "empty-name", "", 0, 0, false, false, "ubuntu", 0 }, |
3729 | - { "active", "Active Account", 0, 0, true, false, "ubuntu", 0 }, |
3730 | - }; |
3731 | -} |
3732 | - |
3733 | -} // namespace QLightDM |
3734 | |
3735 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h' |
3736 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h 2016-05-24 22:11:21 +0000 |
3737 | +++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h 1970-01-01 00:00:00 +0000 |
3738 | @@ -1,64 +0,0 @@ |
3739 | -/* |
3740 | - * Copyright (C) 2014-2016 Canonical, Ltd. |
3741 | - * |
3742 | - * This program is free software; you can redistribute it and/or modify |
3743 | - * it under the terms of the GNU General Public License as published by |
3744 | - * the Free Software Foundation; version 3. |
3745 | - * |
3746 | - * This program is distributed in the hope that it will be useful, |
3747 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3748 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3749 | - * GNU General Public License for more details. |
3750 | - * |
3751 | - * You should have received a copy of the GNU General Public License |
3752 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3753 | - */ |
3754 | - |
3755 | -#ifndef UNITY_MOCK_USERSMODEL_PRIVATE_H |
3756 | -#define UNITY_MOCK_USERSMODEL_PRIVATE_H |
3757 | - |
3758 | -#include <QtCore/QList> |
3759 | -#include <QtCore/QString> |
3760 | - |
3761 | -namespace QLightDM |
3762 | -{ |
3763 | -class UsersModel; |
3764 | - |
3765 | -class Entry |
3766 | -{ |
3767 | -public: |
3768 | - QString username; |
3769 | - QString real_name; |
3770 | - QString background; |
3771 | - QString layouts; |
3772 | - bool is_active; |
3773 | - bool has_messages; |
3774 | - QString session; |
3775 | - QString infographic; |
3776 | - uid_t uid; |
3777 | -}; |
3778 | - |
3779 | -class UsersModelPrivate |
3780 | -{ |
3781 | -public: |
3782 | - explicit UsersModelPrivate(UsersModel *parent = 0); |
3783 | - virtual ~UsersModelPrivate() = default; |
3784 | - |
3785 | - QList<Entry> entries; |
3786 | - QString mockMode; |
3787 | - |
3788 | - void resetEntries(); |
3789 | -protected: |
3790 | - UsersModel * const q_ptr; |
3791 | - |
3792 | -private: |
3793 | - void resetEntries_single(); |
3794 | - void resetEntries_singlePassphrase(); |
3795 | - void resetEntries_singlePin(); |
3796 | - void resetEntries_full(); |
3797 | - Q_DECLARE_PUBLIC(UsersModel) |
3798 | -}; |
3799 | - |
3800 | -} |
3801 | - |
3802 | -#endif // UNITY_MOCK_USERSMODEL_PRIVATE_H |
3803 | |
3804 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/plugin.cpp' |
3805 | --- tests/mocks/LightDM/IntegratedLightDM/plugin.cpp 2016-06-16 17:23:24 +0000 |
3806 | +++ tests/mocks/LightDM/IntegratedLightDM/plugin.cpp 1970-01-01 00:00:00 +0000 |
3807 | @@ -1,79 +0,0 @@ |
3808 | -/* |
3809 | - * Copyright (C) 2014, 2015 Canonical, Ltd. |
3810 | - * |
3811 | - * This program is free software; you can redistribute it and/or modify |
3812 | - * it under the terms of the GNU General Public License as published by |
3813 | - * the Free Software Foundation; version 3. |
3814 | - * |
3815 | - * This program is distributed in the hope that it will be useful, |
3816 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3817 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3818 | - * GNU General Public License for more details. |
3819 | - * |
3820 | - * You should have received a copy of the GNU General Public License |
3821 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3822 | - */ |
3823 | - |
3824 | -#include "plugin.h" |
3825 | -#include <DBusGreeter.h> |
3826 | -#include <DBusGreeterList.h> |
3827 | -#include "MockGreeter.h" |
3828 | -#include "MockSessionsModel.h" |
3829 | -#include "MockUsersModel.h" |
3830 | -#include <QLightDM/SessionsModel> |
3831 | -#include "ColorTheme.h" |
3832 | -#include "UserMetrics.h" |
3833 | -#include <QLightDM/UsersModel> |
3834 | - |
3835 | -#include <QAbstractItemModel> |
3836 | -#include <QDBusConnection> |
3837 | -#include <QtQml/qqml.h> |
3838 | - |
3839 | -static QObject *greeter_provider(QQmlEngine *engine, QJSEngine *scriptEngine) |
3840 | -{ |
3841 | - Q_UNUSED(engine) |
3842 | - Q_UNUSED(scriptEngine) |
3843 | - |
3844 | - MockGreeter *greeter = new MockGreeter; |
3845 | - new DBusGreeter(greeter, "/"); |
3846 | - new DBusGreeterList(greeter, "/list"); |
3847 | - |
3848 | - return greeter; |
3849 | -} |
3850 | - |
3851 | -static QObject *sessions_provider(QQmlEngine *engine, QJSEngine *scriptEngine) |
3852 | -{ |
3853 | - Q_UNUSED(engine) |
3854 | - Q_UNUSED(scriptEngine) |
3855 | - return new MockSessionsModel; |
3856 | -} |
3857 | - |
3858 | -static QObject *users_provider(QQmlEngine *engine, QJSEngine *scriptEngine) |
3859 | -{ |
3860 | - Q_UNUSED(engine) |
3861 | - Q_UNUSED(scriptEngine) |
3862 | - return new MockUsersModel; |
3863 | -} |
3864 | - |
3865 | -static QObject *infographic_provider(QQmlEngine *engine, QJSEngine *scriptEngine) |
3866 | -{ |
3867 | - Q_UNUSED(engine) |
3868 | - Q_UNUSED(scriptEngine) |
3869 | - return UserMetricsOutput::UserMetrics::getInstance(); |
3870 | -} |
3871 | - |
3872 | -void LightDMPlugin::registerTypes(const char *uri) |
3873 | -{ |
3874 | - qmlRegisterType<QAbstractItemModel>(); |
3875 | - qmlRegisterType<UserMetricsOutput::ColorTheme>(); |
3876 | - |
3877 | - Q_ASSERT(uri == QLatin1String("LightDM.IntegratedLightDM")); |
3878 | - qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType"); |
3879 | - qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType"); |
3880 | - qmlRegisterSingletonType<MockGreeter>(uri, 0, 1, "Greeter", greeter_provider); |
3881 | - qmlRegisterSingletonType<MockSessionsModel>(uri, 0, 1, "Sessions", sessions_provider); |
3882 | - qmlRegisterUncreatableType<QLightDM::SessionsModel>(uri, 0, 1, "SessionRoles", "Type is not instantiable"); |
3883 | - qmlRegisterSingletonType<MockUsersModel>(uri, 0, 1, "Users", users_provider); |
3884 | - qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", "Type is not instantiable"); |
3885 | - qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider); |
3886 | -} |
3887 | |
3888 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/plugin.h' |
3889 | --- tests/mocks/LightDM/IntegratedLightDM/plugin.h 2015-09-25 13:01:00 +0000 |
3890 | +++ tests/mocks/LightDM/IntegratedLightDM/plugin.h 1970-01-01 00:00:00 +0000 |
3891 | @@ -1,32 +0,0 @@ |
3892 | -/* |
3893 | - * Copyright (C) 2014, 2015 Canonical, Ltd. |
3894 | - * |
3895 | - * This program is free software; you can redistribute it and/or modify |
3896 | - * it under the terms of the GNU General Public License as published by |
3897 | - * the Free Software Foundation; version 3. |
3898 | - * |
3899 | - * This program is distributed in the hope that it will be useful, |
3900 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3901 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3902 | - * GNU General Public License for more details. |
3903 | - * |
3904 | - * You should have received a copy of the GNU General Public License |
3905 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3906 | - */ |
3907 | - |
3908 | -#ifndef MOCK_LIGHTDM_PLUGIN_H |
3909 | -#define MOCK_LIGHTDM_PLUGIN_H |
3910 | - |
3911 | -#include <QtQml/QQmlEngine> |
3912 | -#include <QtQml/QQmlExtensionPlugin> |
3913 | - |
3914 | -class LightDMPlugin : public QQmlExtensionPlugin |
3915 | -{ |
3916 | - Q_OBJECT |
3917 | - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") |
3918 | - |
3919 | -public: |
3920 | - void registerTypes(const char *uri) override; |
3921 | -}; |
3922 | - |
3923 | -#endif |
3924 | |
3925 | === removed file 'tests/mocks/LightDM/IntegratedLightDM/qmldir' |
3926 | --- tests/mocks/LightDM/IntegratedLightDM/qmldir 2015-09-25 13:01:00 +0000 |
3927 | +++ tests/mocks/LightDM/IntegratedLightDM/qmldir 1970-01-01 00:00:00 +0000 |
3928 | @@ -1,2 +0,0 @@ |
3929 | -module LightDM.IntegratedLightDM |
3930 | -plugin MockLightDM-qml |
3931 | |
3932 | === renamed directory 'tests/mocks/LightDM/IntegratedLightDM/liblightdm' => 'tests/mocks/liblightdm' |
3933 | === modified file 'tests/mocks/liblightdm/CMakeLists.txt' |
3934 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt 2015-11-18 03:52:01 +0000 |
3935 | +++ tests/mocks/liblightdm/CMakeLists.txt 2016-11-08 23:03:16 +0000 |
3936 | @@ -1,20 +1,18 @@ |
3937 | -set(LibLightDM_SOURCES |
3938 | - Greeter.cpp |
3939 | - SessionsModel.cpp |
3940 | - UsersModel.cpp |
3941 | - GreeterPrivate.cpp |
3942 | - SessionsModelPrivate.cpp |
3943 | - UsersModelPrivate.cpp |
3944 | - ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp |
3945 | +set(MockLightDM_SOURCES |
3946 | + MockController.cpp |
3947 | + MockGreeter.cpp |
3948 | + MockSessionsModel.cpp |
3949 | + MockUsersModel.cpp |
3950 | ) |
3951 | |
3952 | -add_library(MockLightDM SHARED ${LibLightDM_SOURCES}) |
3953 | +add_library(MockLightDM SHARED ${MockLightDM_SOURCES}) |
3954 | |
3955 | -qt5_use_modules(MockLightDM Gui) |
3956 | +qt5_use_modules(MockLightDM DBus Gui) |
3957 | |
3958 | set_target_properties(MockLightDM PROPERTIES |
3959 | - OUTPUT_NAME lightdm-qt5-3) |
3960 | + OUTPUT_NAME lightdm-qt5-3 |
3961 | + VERSION 0) |
3962 | |
3963 | install(TARGETS MockLightDM |
3964 | - DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/liblightdm |
3965 | + DESTINATION ${SHELL_INSTALL_QML}/mocks/liblightdm |
3966 | ) |
3967 | |
3968 | === added file 'tests/mocks/liblightdm/MockController.cpp' |
3969 | --- tests/mocks/liblightdm/MockController.cpp 1970-01-01 00:00:00 +0000 |
3970 | +++ tests/mocks/liblightdm/MockController.cpp 2016-11-08 23:03:16 +0000 |
3971 | @@ -0,0 +1,148 @@ |
3972 | +/* |
3973 | + * Copyright (C) 2016 Canonical, Ltd. |
3974 | + * |
3975 | + * This program is free software; you can redistribute it and/or modify |
3976 | + * it under the terms of the GNU General Public License as published by |
3977 | + * the Free Software Foundation; version 3. |
3978 | + * |
3979 | + * This program is distributed in the hope that it will be useful, |
3980 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3981 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3982 | + * GNU General Public License for more details. |
3983 | + * |
3984 | + * You should have received a copy of the GNU General Public License |
3985 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3986 | + */ |
3987 | + |
3988 | +#include "MockController.h" |
3989 | + |
3990 | +static QLightDM::MockController *m_instance = nullptr; |
3991 | + |
3992 | +namespace QLightDM |
3993 | +{ |
3994 | + |
3995 | +MockController::MockController(QObject *parent) |
3996 | + : QObject(parent) |
3997 | + , m_fullSessions( |
3998 | + { |
3999 | + {"ubuntu", "Ubuntu"}, |
4000 | + {"ubuntu-2d", "Ubuntu 2D"}, |
4001 | + {"gnome", "GNOME"}, |
4002 | + {"gnome-classic", "GNOME Classic"}, |
4003 | + {"gnome-flashback-compiz", "GNOME Flashback (Compiz)"}, |
4004 | + {"gnome-flashback-metacity", "GNOME Flashback (Metacity)"}, |
4005 | + {"gnome-wayland", "GNOME on Wayland"}, |
4006 | + {"plasma", "Plasma"}, |
4007 | + {"kde", "KDE" }, |
4008 | + {"xterm", "Recovery Console"}, |
4009 | + {"", "Unknown?"} |
4010 | + }) |
4011 | +{ |
4012 | + m_userMode = qgetenv("LIBLIGHTDM_MOCK_MODE"); |
4013 | + if (m_userMode.isEmpty()) { |
4014 | + m_userMode = "full"; |
4015 | + } |
4016 | + m_sessionMode = "full"; |
4017 | + m_numSessions = numFullSessions(); |
4018 | +} |
4019 | + |
4020 | +MockController::~MockController() |
4021 | +{ |
4022 | + m_instance = nullptr; |
4023 | +} |
4024 | + |
4025 | +MockController *MockController::instance() |
4026 | +{ |
4027 | + if (!m_instance) { |
4028 | + m_instance = new MockController; |
4029 | + } |
4030 | + return m_instance; |
4031 | +} |
4032 | + |
4033 | +QString MockController::selectUserHint() const |
4034 | +{ |
4035 | + return m_selectUserHint; |
4036 | +} |
4037 | + |
4038 | +void MockController::setSelectUserHint(const QString &selectUserHint) |
4039 | +{ |
4040 | + if (m_selectUserHint != selectUserHint) { |
4041 | + m_selectUserHint = selectUserHint; |
4042 | + Q_EMIT selectUserHintChanged(); |
4043 | + } |
4044 | +} |
4045 | + |
4046 | +QString MockController::userMode() const |
4047 | +{ |
4048 | + return m_userMode; |
4049 | +} |
4050 | + |
4051 | +void MockController::setUserMode(const QString &userMode) |
4052 | +{ |
4053 | + if (m_userMode != userMode) { |
4054 | + m_userMode = userMode; |
4055 | + Q_EMIT userModeChanged(); |
4056 | + } |
4057 | +} |
4058 | + |
4059 | +QString MockController::sessionMode() const |
4060 | +{ |
4061 | + return m_sessionMode; |
4062 | +} |
4063 | + |
4064 | +void MockController::setSessionMode(const QString &sessionMode) |
4065 | +{ |
4066 | + if (m_sessionMode != sessionMode) { |
4067 | + m_sessionMode = sessionMode; |
4068 | + Q_EMIT sessionModeChanged(); |
4069 | + } |
4070 | +} |
4071 | + |
4072 | +QString MockController::sessionName() const |
4073 | +{ |
4074 | + return QString("INVALID - Please read directly from the UserModel"); |
4075 | +} |
4076 | + |
4077 | +void MockController::setSessionName(const QString &sessionName) |
4078 | +{ |
4079 | + // Let the user model deal with this |
4080 | + Q_EMIT sessionNameChanged(sessionName, m_currentUsername); |
4081 | +} |
4082 | + |
4083 | +QString MockController::currentUsername() const |
4084 | +{ |
4085 | + return m_currentUsername; |
4086 | +} |
4087 | + |
4088 | +void MockController::setCurrentUsername(const QString &username) |
4089 | +{ |
4090 | + if (m_currentUsername != username) { |
4091 | + m_currentUsername = username; |
4092 | + Q_EMIT currentUsernameChanged(); |
4093 | + } |
4094 | +} |
4095 | + |
4096 | +const QList<MockController::SessionItem> &MockController::fullSessionItems() const |
4097 | +{ |
4098 | + return m_fullSessions; |
4099 | +} |
4100 | + |
4101 | +int MockController::numFullSessions() const |
4102 | +{ |
4103 | + return m_fullSessions.size(); |
4104 | +} |
4105 | + |
4106 | +int MockController::numSessions() const |
4107 | +{ |
4108 | + return m_numSessions; |
4109 | +} |
4110 | + |
4111 | +void MockController::setNumSessions(int numSessions) |
4112 | +{ |
4113 | + if (m_numSessions != numSessions) { |
4114 | + m_numSessions = numSessions; |
4115 | + Q_EMIT numSessionsChanged(); |
4116 | + } |
4117 | +} |
4118 | + |
4119 | +} |
4120 | |
4121 | === added file 'tests/mocks/liblightdm/MockController.h' |
4122 | --- tests/mocks/liblightdm/MockController.h 1970-01-01 00:00:00 +0000 |
4123 | +++ tests/mocks/liblightdm/MockController.h 2016-11-08 23:03:16 +0000 |
4124 | @@ -0,0 +1,98 @@ |
4125 | +/* |
4126 | + * Copyright (C) 2016 Canonical, Ltd. |
4127 | + * |
4128 | + * This program is free software; you can redistribute it and/or modify |
4129 | + * it under the terms of the GNU General Public License as published by |
4130 | + * the Free Software Foundation; version 3. |
4131 | + * |
4132 | + * This program is distributed in the hope that it will be useful, |
4133 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4134 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4135 | + * GNU General Public License for more details. |
4136 | + * |
4137 | + * You should have received a copy of the GNU General Public License |
4138 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4139 | + */ |
4140 | + |
4141 | +#ifndef UNITY_MOCK_LIBLIGHTDM_CONTROLLER_H |
4142 | +#define UNITY_MOCK_LIBLIGHTDM_CONTROLLER_H |
4143 | + |
4144 | +#include <QObject> |
4145 | +#include <QString> |
4146 | + |
4147 | + |
4148 | +namespace QLightDM |
4149 | +{ |
4150 | +class Q_DECL_EXPORT MockController : public QObject |
4151 | +{ |
4152 | + Q_OBJECT |
4153 | + |
4154 | + Q_PROPERTY(QString selectUserHint READ selectUserHint WRITE setSelectUserHint NOTIFY selectUserHintChanged) |
4155 | + |
4156 | + // single, single-pin, single-passphrase, full |
4157 | + Q_PROPERTY(QString userMode READ userMode WRITE setUserMode NOTIFY userModeChanged) |
4158 | + |
4159 | + // single, none, full |
4160 | + Q_PROPERTY(QString sessionMode READ sessionMode WRITE setSessionMode NOTIFY sessionModeChanged) |
4161 | + |
4162 | + // This would be best as a Q_INVOKABLE, but using a property allows for |
4163 | + // keeping the mock cleaner |
4164 | + Q_PROPERTY(QString sessionName READ sessionName WRITE setSessionName NOTIFY sessionNameChanged) |
4165 | + Q_PROPERTY(QString currentUsername READ currentUsername WRITE setCurrentUsername NOTIFY currentUsernameChanged) |
4166 | + |
4167 | + Q_PROPERTY(int numAvailableSessions READ numFullSessions CONSTANT) |
4168 | + Q_PROPERTY(int numSessions READ numSessions WRITE setNumSessions NOTIFY numSessionsChanged) |
4169 | + |
4170 | +public: |
4171 | + static MockController *instance(); |
4172 | + virtual ~MockController(); |
4173 | + |
4174 | + QString selectUserHint() const; |
4175 | + void setSelectUserHint(const QString &selectUserHint); |
4176 | + |
4177 | + QString userMode() const; |
4178 | + void setUserMode(const QString &userMode); |
4179 | + |
4180 | + QString sessionMode() const; |
4181 | + void setSessionMode(const QString &sessionMode); |
4182 | + |
4183 | + QString sessionName() const; |
4184 | + void setSessionName(const QString &sessionName); |
4185 | + |
4186 | + QString currentUsername() const; |
4187 | + void setCurrentUsername(const QString &userIndex); |
4188 | + |
4189 | + class SessionItem |
4190 | + { |
4191 | + public: |
4192 | + QString key; |
4193 | + QString name; |
4194 | + }; |
4195 | + int numFullSessions() const; |
4196 | + const QList<SessionItem> &fullSessionItems() const; |
4197 | + |
4198 | + int numSessions() const; |
4199 | + void setNumSessions(int numSessions); |
4200 | + |
4201 | +Q_SIGNALS: |
4202 | + void currentUsernameChanged(); |
4203 | + void selectUserHintChanged(); |
4204 | + void userModeChanged(); |
4205 | + void sessionModeChanged(); |
4206 | + void sessionNameChanged(const QString &sessionName, const QString &username); |
4207 | + void numSessionsChanged(); |
4208 | + |
4209 | +private: |
4210 | + explicit MockController(QObject* parent=0); |
4211 | + |
4212 | + QString m_currentUsername; |
4213 | + QString m_sessionName; |
4214 | + QString m_selectUserHint; |
4215 | + QString m_userMode; |
4216 | + QString m_sessionMode; |
4217 | + QList<SessionItem> m_fullSessions; |
4218 | + int m_numSessions; |
4219 | +}; |
4220 | +} |
4221 | + |
4222 | +#endif |
4223 | |
4224 | === renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp' => 'tests/mocks/liblightdm/MockGreeter.cpp' |
4225 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp 2016-07-28 15:34:29 +0000 |
4226 | +++ tests/mocks/liblightdm/MockGreeter.cpp 2016-11-08 23:03:16 +0000 |
4227 | @@ -1,5 +1,5 @@ |
4228 | /* |
4229 | - * Copyright (C) 2014 Canonical, Ltd. |
4230 | + * Copyright (C) 2014-2016 Canonical, Ltd. |
4231 | * |
4232 | * This program is free software; you can redistribute it and/or modify |
4233 | * it under the terms of the GNU General Public License as published by |
4234 | @@ -14,27 +14,38 @@ |
4235 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4236 | */ |
4237 | |
4238 | -#include "Greeter.h" |
4239 | -#include "GreeterPrivate.h" |
4240 | -#include <QtCore/QCoreApplication> |
4241 | +#include "MockController.h" |
4242 | +#include "MockGreeter.h" |
4243 | +#include <QDBusInterface> |
4244 | +#include <QDBusPendingCall> |
4245 | #include <QTimer> |
4246 | |
4247 | namespace QLightDM |
4248 | { |
4249 | |
4250 | +class GreeterPrivate |
4251 | +{ |
4252 | +public: |
4253 | + bool authenticated = false; |
4254 | + QString authenticationUser; |
4255 | + bool twoFactorDone = false; |
4256 | +}; |
4257 | + |
4258 | Greeter::Greeter(QObject *parent) |
4259 | - : QObject(parent), |
4260 | - d_ptr(new GreeterPrivate(this)) |
4261 | + : QObject(parent) |
4262 | + , d_ptr(new GreeterPrivate) |
4263 | { |
4264 | } |
4265 | |
4266 | Greeter::~Greeter() |
4267 | { |
4268 | + delete d_ptr; |
4269 | } |
4270 | |
4271 | QString Greeter::authenticationUser() const |
4272 | { |
4273 | Q_D(const Greeter); |
4274 | + |
4275 | return d->authenticationUser; |
4276 | } |
4277 | |
4278 | @@ -71,14 +82,7 @@ |
4279 | |
4280 | QString Greeter::selectUserHint() const |
4281 | { |
4282 | - Q_D(const Greeter); |
4283 | - return d->selectUserHint; |
4284 | -} |
4285 | - |
4286 | -void Greeter::setSelectUserHint(const QString &selectUserHint) |
4287 | -{ |
4288 | - Q_D(Greeter); |
4289 | - d->selectUserHint = selectUserHint; |
4290 | + return MockController::instance()->selectUserHint(); |
4291 | } |
4292 | |
4293 | bool Greeter::selectGuestHint() const |
4294 | @@ -114,6 +118,7 @@ |
4295 | bool Greeter::isAuthenticated() const |
4296 | { |
4297 | Q_D(const Greeter); |
4298 | + |
4299 | return d->authenticated; |
4300 | } |
4301 | |
4302 | @@ -129,13 +134,42 @@ |
4303 | d->authenticated = false; |
4304 | d->authenticationUser = username; |
4305 | d->twoFactorDone = false; |
4306 | - QTimer::singleShot(0, this, &Greeter::delayedAuthentication); |
4307 | + QTimer::singleShot(0, this, &Greeter::handleAuthenticate); |
4308 | } |
4309 | |
4310 | -void Greeter::delayedAuthentication() |
4311 | +void Greeter::handleAuthenticate() |
4312 | { |
4313 | Q_D(Greeter); |
4314 | - d->handleAuthenticate(); |
4315 | + |
4316 | + // Send out any messages we need to |
4317 | + if (d->authenticationUser == "info-prompt") |
4318 | + Q_EMIT showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo); |
4319 | + else if (d->authenticationUser == "wide-info-prompt") |
4320 | + Q_EMIT showMessage("Welcome to Unity Greeter, the greeteriest greeter that ever did appear in these fine lands", Greeter::MessageTypeInfo); |
4321 | + else if (d->authenticationUser == "html-info-prompt") |
4322 | + Q_EMIT showMessage("<b>&</b>", Greeter::MessageTypeInfo); |
4323 | + else if (d->authenticationUser == "long-info-prompt") |
4324 | + Q_EMIT showMessage("Welcome to Unity Greeter\n\nWe like to annoy you with super ridiculously long messages.\nLike this one\n\nThis is the last line of a multiple line message.", Greeter::MessageTypeInfo); |
4325 | + else if (d->authenticationUser == "multi-info-prompt") { |
4326 | + Q_EMIT showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo); |
4327 | + Q_EMIT showMessage("This is an error", Greeter::MessageTypeError); |
4328 | + Q_EMIT showMessage("You should have seen three messages", Greeter::MessageTypeInfo); |
4329 | + } |
4330 | + |
4331 | + // OK, now actually do the prompt |
4332 | + if (d->authenticationUser == "no-password") { |
4333 | + d->authenticated = true; |
4334 | + Q_EMIT authenticationComplete(); |
4335 | + } else if (d->authenticationUser == "has-pin"){ |
4336 | + Q_EMIT showPrompt("Password: ", Greeter::PromptTypeSecret); |
4337 | + } else if (d->authenticationUser == "auth-error") { |
4338 | + d->authenticated = false; |
4339 | + Q_EMIT authenticationComplete(); |
4340 | + } else if (d->authenticationUser == "different-prompt") { |
4341 | + Q_EMIT showPrompt("Secret word: ", Greeter::PromptTypeSecret); |
4342 | + } else { |
4343 | + Q_EMIT showPrompt("Password: ", Greeter::PromptTypeSecret); |
4344 | + } |
4345 | } |
4346 | |
4347 | void Greeter::authenticateAsGuest() |
4348 | @@ -161,6 +195,16 @@ |
4349 | bool Greeter::startSessionSync(const QString &session) |
4350 | { |
4351 | Q_UNUSED(session) |
4352 | + |
4353 | + // Send a request to hide the greeter. This is normally done by logind, |
4354 | + // but when testing, we don't want the bother of mocking that out. Instead, |
4355 | + // just send the request directly ourselves. |
4356 | + QDBusInterface iface("com.canonical.UnityGreeter", |
4357 | + "/", |
4358 | + "com.canonical.UnityGreeter", |
4359 | + QDBusConnection::sessionBus()); |
4360 | + iface.asyncCall("HideGreeter"); |
4361 | + |
4362 | return true; |
4363 | } |
4364 | |
4365 | @@ -168,7 +212,30 @@ |
4366 | { |
4367 | Q_D(Greeter); |
4368 | |
4369 | - d->handleRespond(response); |
4370 | + if (d->authenticationUser == "no-response") |
4371 | + return; |
4372 | + else if (d->authenticationUser == "two-factor") { |
4373 | + if (!d->twoFactorDone) { |
4374 | + if (response == "password") { |
4375 | + d->twoFactorDone = true; |
4376 | + Q_EMIT showPrompt("otp", Greeter::PromptTypeQuestion); |
4377 | + } else { |
4378 | + d->authenticated = false; |
4379 | + sendAuthenticationComplete(); |
4380 | + } |
4381 | + } else { |
4382 | + d->authenticated = (response == "otp"); |
4383 | + sendAuthenticationComplete(); |
4384 | + } |
4385 | + return; |
4386 | + } |
4387 | + |
4388 | + if (d->authenticationUser == "has-pin") { |
4389 | + d->authenticated = (response == "1234"); |
4390 | + } else { |
4391 | + d->authenticated = (response == "password"); |
4392 | + } |
4393 | + sendAuthenticationComplete(); |
4394 | } |
4395 | |
4396 | void Greeter::sendAuthenticationComplete() |
4397 | @@ -181,21 +248,9 @@ |
4398 | } |
4399 | } |
4400 | |
4401 | -QString Greeter::mockMode() const |
4402 | -{ |
4403 | - Q_D(const Greeter); |
4404 | - return d->mockMode; |
4405 | -} |
4406 | - |
4407 | - |
4408 | -void Greeter::setMockMode(QString mockMode) |
4409 | -{ |
4410 | - Q_D(Greeter); |
4411 | - |
4412 | - if (d->mockMode != mockMode) { |
4413 | - d->mockMode = mockMode; |
4414 | - Q_EMIT mockModeChanged(mockMode); |
4415 | - } |
4416 | +QObject *Greeter::mock() |
4417 | +{ |
4418 | + return MockController::instance(); |
4419 | } |
4420 | |
4421 | } |
4422 | |
4423 | === renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.h' => 'tests/mocks/liblightdm/MockGreeter.h' |
4424 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.h 2016-07-28 15:34:29 +0000 |
4425 | +++ tests/mocks/liblightdm/MockGreeter.h 2016-11-08 23:03:16 +0000 |
4426 | @@ -1,5 +1,5 @@ |
4427 | /* |
4428 | - * Copyright (C) 2013 Canonical, Ltd. |
4429 | + * Copyright (C) 2013-2016 Canonical, Ltd. |
4430 | * Copyright (C) 2010-2011 David Edmundson. |
4431 | * Copyright (C) 2010-2011 Robert Ancell |
4432 | * |
4433 | @@ -21,13 +21,12 @@ |
4434 | #ifndef UNITY_MOCK_GREETER_H |
4435 | #define UNITY_MOCK_GREETER_H |
4436 | |
4437 | -#include <QtCore/QObject> |
4438 | -#include <QtCore/QVariant> |
4439 | - |
4440 | +#include <QObject> |
4441 | +#include <QVariant> |
4442 | |
4443 | namespace QLightDM |
4444 | { |
4445 | - class GreeterPrivate; |
4446 | +class GreeterPrivate; |
4447 | |
4448 | class Q_DECL_EXPORT Greeter : public QObject |
4449 | { |
4450 | @@ -44,8 +43,7 @@ |
4451 | |
4452 | Q_ENUMS(PromptType MessageType) |
4453 | |
4454 | - //Mock-only API for testing purposes |
4455 | - Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged) |
4456 | + Q_PROPERTY(QObject *mock READ mock CONSTANT) // only in mock |
4457 | |
4458 | public: |
4459 | enum PromptType { |
4460 | @@ -68,7 +66,6 @@ |
4461 | bool showRemoteLoginHint() const; |
4462 | bool hasGuestAccountHint() const; |
4463 | QString selectUserHint() const; |
4464 | - void setSelectUserHint(const QString &selectUserHint); // only in mock |
4465 | bool selectGuestHint() const; |
4466 | QString autologinUserHint() const; |
4467 | bool autologinGuestHint() const; |
4468 | @@ -79,8 +76,7 @@ |
4469 | QString authenticationUser() const; |
4470 | QString hostname() const; |
4471 | |
4472 | - QString mockMode() const; |
4473 | - void setMockMode(QString mockMode); |
4474 | + QObject *mock(); |
4475 | |
4476 | public Q_SLOTS: |
4477 | bool connectSync(); |
4478 | @@ -98,15 +94,13 @@ |
4479 | void showPrompt(QString text, QLightDM::Greeter::PromptType type); |
4480 | void authenticationComplete(); |
4481 | void autologinTimerExpired(); |
4482 | - void mockModeChanged(QString mode); |
4483 | - |
4484 | -protected: |
4485 | - void sendAuthenticationComplete(); |
4486 | |
4487 | private Q_SLOTS: |
4488 | - void delayedAuthentication(); |
4489 | + void handleAuthenticate(); |
4490 | |
4491 | private: |
4492 | + void sendAuthenticationComplete(); |
4493 | + |
4494 | GreeterPrivate *d_ptr; |
4495 | Q_DECLARE_PRIVATE(Greeter) |
4496 | }; |
4497 | |
4498 | === renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp' => 'tests/mocks/liblightdm/MockSessionsModel.cpp' |
4499 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp 2016-07-13 20:24:24 +0000 |
4500 | +++ tests/mocks/liblightdm/MockSessionsModel.cpp 2016-11-08 23:03:16 +0000 |
4501 | @@ -1,5 +1,5 @@ |
4502 | /* |
4503 | - * Copyright (C) 2015 Canonical, Ltd. |
4504 | + * Copyright (C) 2015-2016 Canonical, Ltd. |
4505 | * |
4506 | * This program is free software; you can redistribute it and/or modify |
4507 | * it under the terms of the GNU General Public License as published by |
4508 | @@ -21,22 +21,34 @@ |
4509 | // set our compatibility to Qt4 here too. |
4510 | #define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0) |
4511 | |
4512 | -#include "SessionsModel.h" |
4513 | -#include "SessionsModelPrivate.h" |
4514 | -#include <QtCore/QDir> |
4515 | -#include <QtCore/QString> |
4516 | +#include "MockController.h" |
4517 | +#include "MockSessionsModel.h" |
4518 | |
4519 | namespace QLightDM |
4520 | { |
4521 | |
4522 | -SessionsModel::SessionsModel(QObject* parent) : |
4523 | - QAbstractListModel(parent), |
4524 | - d_ptr(new SessionsModelPrivate(this)) |
4525 | +class SessionsModelPrivate |
4526 | +{ |
4527 | +public: |
4528 | + QHash<int, QByteArray> roleNames; |
4529 | + QList<MockController::SessionItem> sessionItems; |
4530 | +}; |
4531 | + |
4532 | +SessionsModel::SessionsModel(QObject* parent) |
4533 | + : QAbstractListModel(parent) |
4534 | + , d_ptr(new SessionsModelPrivate) |
4535 | { |
4536 | Q_D(SessionsModel); |
4537 | - m_roleNames = QAbstractListModel::roleNames(); |
4538 | - m_roleNames[KeyRole] = "key"; |
4539 | - m_roleNames[TypeRole] = "type"; |
4540 | + |
4541 | + d->roleNames = QAbstractListModel::roleNames(); |
4542 | + d->roleNames[KeyRole] = "key"; |
4543 | + d->roleNames[TypeRole] = "type"; |
4544 | + |
4545 | + connect(MockController::instance(), &MockController::sessionModeChanged, |
4546 | + this, &SessionsModel::resetEntries); |
4547 | + connect(MockController::instance(), &MockController::numSessionsChanged, |
4548 | + this, &SessionsModel::resetEntries); |
4549 | + resetEntries(); |
4550 | } |
4551 | |
4552 | SessionsModel::~SessionsModel() |
4553 | @@ -66,7 +78,9 @@ |
4554 | |
4555 | QHash<int, QByteArray> SessionsModel::roleNames() const |
4556 | { |
4557 | - return m_roleNames; |
4558 | + Q_D(const SessionsModel); |
4559 | + |
4560 | + return d->roleNames; |
4561 | } |
4562 | |
4563 | int SessionsModel::rowCount(const QModelIndex& parent) const |
4564 | @@ -80,42 +94,29 @@ |
4565 | } |
4566 | } |
4567 | |
4568 | -int SessionsModel::numSessions() const |
4569 | -{ |
4570 | - Q_D(const SessionsModel); |
4571 | - return d->numSessions; |
4572 | -} |
4573 | - |
4574 | -int SessionsModel::numAvailableSessions() const |
4575 | -{ |
4576 | - Q_D(const SessionsModel); |
4577 | - return d->numAvailableSessions(); |
4578 | -} |
4579 | - |
4580 | -QString SessionsModel::testScenario() const |
4581 | -{ |
4582 | - Q_D(const SessionsModel); |
4583 | - return d->testScenario; |
4584 | -} |
4585 | - |
4586 | -void SessionsModel::setNumSessions(int numSessions) |
4587 | -{ |
4588 | - Q_D(SessionsModel); |
4589 | - |
4590 | - if (d->numSessions != numSessions) { |
4591 | - d->numSessions = numSessions; |
4592 | - d->resetEntries(); |
4593 | - } |
4594 | -} |
4595 | - |
4596 | -void SessionsModel::setTestScenario(QString testScenario) |
4597 | -{ |
4598 | - Q_D(SessionsModel); |
4599 | - |
4600 | - if (d->testScenario != testScenario) { |
4601 | - d->testScenario = testScenario; |
4602 | - d->resetEntries(); |
4603 | - } |
4604 | +void SessionsModel::resetEntries() |
4605 | +{ |
4606 | + Q_D(SessionsModel); |
4607 | + |
4608 | + beginResetModel(); |
4609 | + |
4610 | + QString sessionMode = MockController::instance()->sessionMode(); |
4611 | + |
4612 | + if (sessionMode == "full") { |
4613 | + d->sessionItems = MockController::instance()->fullSessionItems(); |
4614 | + d->sessionItems = d->sessionItems.mid(0, MockController::instance()->numSessions()); |
4615 | + } else if (sessionMode == "single") { |
4616 | + d->sessionItems = {MockController::instance()->fullSessionItems()[0]}; |
4617 | + } else { |
4618 | + d->sessionItems = {}; |
4619 | + } |
4620 | + |
4621 | + endResetModel(); |
4622 | +} |
4623 | + |
4624 | +QObject *SessionsModel::mock() |
4625 | +{ |
4626 | + return MockController::instance(); |
4627 | } |
4628 | |
4629 | } // namespace QLightDM |
4630 | |
4631 | === renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h' => 'tests/mocks/liblightdm/MockSessionsModel.h' |
4632 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h 2016-07-13 20:24:24 +0000 |
4633 | +++ tests/mocks/liblightdm/MockSessionsModel.h 2016-11-08 23:03:16 +0000 |
4634 | @@ -1,5 +1,5 @@ |
4635 | /* |
4636 | - * Copyright (C) 2015 Canonical, Ltd. |
4637 | + * Copyright (C) 2015-2016 Canonical, Ltd. |
4638 | * |
4639 | * This program is free software; you can redistribute it and/or modify |
4640 | * it under the terms of the GNU General Public License as published by |
4641 | @@ -18,8 +18,10 @@ |
4642 | #ifndef UNITY_MOCK_SESSIONSMODEL_H |
4643 | #define UNITY_MOCK_SESSIONSMODEL_H |
4644 | |
4645 | -#include <QtCore/QAbstractListModel> |
4646 | -#include <QtCore/QString> |
4647 | +#include <QAbstractListModel> |
4648 | +#include <QByteArray> |
4649 | +#include <QHash> |
4650 | +#include <QString> |
4651 | |
4652 | namespace QLightDM |
4653 | { |
4654 | @@ -29,10 +31,11 @@ |
4655 | { |
4656 | Q_OBJECT |
4657 | |
4658 | + Q_PROPERTY(QObject *mock READ mock CONSTANT) // only in mock |
4659 | + |
4660 | Q_ENUMS(SessionModelRoles SessionType) |
4661 | |
4662 | public: |
4663 | - |
4664 | enum SessionModelRoles { |
4665 | //name is exposed as Qt::DisplayRole |
4666 | //comment is exposed as Qt::TooltipRole |
4667 | @@ -54,17 +57,13 @@ |
4668 | int rowCount(const QModelIndex& parent) const override; |
4669 | QVariant data(const QModelIndex& index, int role) const override; |
4670 | |
4671 | - int numSessions() const; |
4672 | - int numAvailableSessions() const; |
4673 | - QString testScenario() const; |
4674 | - void setNumSessions(int numSessions); |
4675 | - void setTestScenario(QString testScenario); |
4676 | + QObject *mock(); |
4677 | |
4678 | - protected: |
4679 | - SessionsModelPrivate* const d_ptr; |
4680 | + private Q_SLOTS: |
4681 | + void resetEntries(); |
4682 | |
4683 | private: |
4684 | - QHash<int, QByteArray> m_roleNames; |
4685 | + SessionsModelPrivate *d_ptr; |
4686 | Q_DECLARE_PRIVATE(SessionsModel) |
4687 | }; |
4688 | } |
4689 | |
4690 | === renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp' => 'tests/mocks/liblightdm/MockUsersModel.cpp' |
4691 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp 2016-05-24 22:11:21 +0000 |
4692 | +++ tests/mocks/liblightdm/MockUsersModel.cpp 2016-11-08 23:03:16 +0000 |
4693 | @@ -21,21 +21,37 @@ |
4694 | // set our compatibility to Qt4 here too. |
4695 | #define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0) |
4696 | |
4697 | -#include "UsersModel.h" |
4698 | -#include "UsersModelPrivate.h" |
4699 | -#include <QtCore/QDir> |
4700 | -#include <QtCore/QString> |
4701 | -#include <QtGui/QIcon> |
4702 | +#include "MockController.h" |
4703 | +#include "MockUsersModel.h" |
4704 | +#include <QDir> |
4705 | +#include <QIcon> |
4706 | |
4707 | namespace QLightDM |
4708 | { |
4709 | |
4710 | -UsersModel::UsersModel(QObject *parent) : |
4711 | - QAbstractListModel(parent), |
4712 | - d_ptr(new UsersModelPrivate(this)) |
4713 | -{ |
4714 | - Q_D(UsersModel); |
4715 | - |
4716 | +class Entry |
4717 | +{ |
4718 | +public: |
4719 | + QString username; |
4720 | + QString real_name; |
4721 | + QString background; |
4722 | + QString layouts; |
4723 | + bool is_active; |
4724 | + bool has_messages; |
4725 | + QString session; |
4726 | + uid_t uid; |
4727 | +}; |
4728 | + |
4729 | +class UsersModelPrivate |
4730 | +{ |
4731 | +public: |
4732 | + QList<Entry> entries; |
4733 | +}; |
4734 | + |
4735 | +UsersModel::UsersModel(QObject *parent) |
4736 | + : QAbstractListModel(parent) |
4737 | + , d_ptr(new UsersModelPrivate) |
4738 | +{ |
4739 | // Extend roleNames (we want to keep the "display" role) |
4740 | QHash<int, QByteArray> roles = roleNames(); |
4741 | roles[NameRole] = "name"; |
4742 | @@ -48,6 +64,12 @@ |
4743 | roles[ImagePathRole] = "imagePath"; |
4744 | roles[UidRole] = "uid"; |
4745 | setRoleNames(roles); |
4746 | + |
4747 | + connect(MockController::instance(), &MockController::userModeChanged, |
4748 | + this, &UsersModel::resetEntries); |
4749 | + connect(MockController::instance(), &MockController::sessionNameChanged, |
4750 | + this, &UsersModel::setCurrentSessionName); |
4751 | + resetEntries(); |
4752 | } |
4753 | |
4754 | UsersModel::~UsersModel() |
4755 | @@ -55,6 +77,21 @@ |
4756 | delete d_ptr; |
4757 | } |
4758 | |
4759 | +void UsersModel::setCurrentSessionName(const QString &sessionName, const QString &username) |
4760 | +{ |
4761 | + Q_D(UsersModel); |
4762 | + |
4763 | + for (auto &entry : d->entries) { |
4764 | + if (username == entry.username) { |
4765 | + entry.session = sessionName; |
4766 | + |
4767 | + // Since the incides are mangled, there is no easy way to emit dataChanged |
4768 | + // and that doesn't matter for the limited use of this function |
4769 | + return; |
4770 | + } |
4771 | + } |
4772 | +} |
4773 | + |
4774 | int UsersModel::rowCount(const QModelIndex &parent) const |
4775 | { |
4776 | Q_D(const UsersModel); |
4777 | @@ -103,21 +140,69 @@ |
4778 | } |
4779 | } |
4780 | |
4781 | -QString UsersModel::mockMode() const |
4782 | -{ |
4783 | - Q_D(const UsersModel); |
4784 | - return d->mockMode; |
4785 | -} |
4786 | - |
4787 | -void UsersModel::setMockMode(QString mockMode) |
4788 | +void UsersModel::resetEntries() |
4789 | { |
4790 | Q_D(UsersModel); |
4791 | |
4792 | - if (d->mockMode != mockMode) { |
4793 | - d->mockMode = mockMode; |
4794 | - Q_EMIT mockModeChanged(mockMode); |
4795 | - d->resetEntries(); |
4796 | - } |
4797 | + beginResetModel(); |
4798 | + |
4799 | + QString userMode = MockController::instance()->userMode(); |
4800 | + |
4801 | + if (userMode == "single") { |
4802 | + d->entries = {{"no-password", "No Password", "", 0, false, false, "ubuntu", 0}}; |
4803 | + } else if (userMode == "single-passphrase") { |
4804 | + d->entries = {{"has-password", "Has Password", "", 0, false, false, "ubuntu", 0}}; |
4805 | + } else if (userMode == "single-pin") { |
4806 | + d->entries = {{"has-pin", "Has PIN", "", 0, false, false, "ubuntu", 0}}; |
4807 | + } else if (userMode == "full") { |
4808 | + d->entries = { |
4809 | + { "has-password", "Has Password", 0, 0, false, false, "ubuntu", 0 }, |
4810 | + { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 }, |
4811 | + { "different-prompt", "Different Prompt", 0, 0, false, false, "ubuntu", 0 }, |
4812 | + { "no-password", "No Password", 0, 0, false, false, "ubuntu", 0 }, |
4813 | + { "auth-error", "Auth Error", 0, 0, false, false, "ubuntu", 0 }, |
4814 | + { "two-factor", "Two Factor", 0, 0, false, false, "ubuntu", 0 }, |
4815 | + { "info-prompt", "Info Prompt", 0, 0, false, false, "ubuntu", 0 }, |
4816 | + { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, "ubuntu", 0 }, |
4817 | + { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, "ubuntu", 0 }, |
4818 | + { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, "ubuntu", 0 }, |
4819 | + { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, "ubuntu", 0 }, |
4820 | + { "long-name", "Long name (far far too long to fit, seriously this would never fit on the screen, you will never see this part of the name)", 0, 0, false, false, "ubuntu", 0 }, |
4821 | + { "color-background", "Color Background", "#E95420", 0, false, false, "ubuntu", 0 }, |
4822 | + // white and black are a bit redundant, but useful for manually testing if UI is still readable |
4823 | + { "white-background", "White Background", "#ffffff", 0, false, false, "ubuntu", 0 }, |
4824 | + { "black-background", "Black Background", "#000000", 0, false, false, "ubuntu", 0 }, |
4825 | + { "no-background", "No Background", "", 0, false, false, "ubuntu", 0 }, |
4826 | + { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 }, |
4827 | + { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 }, |
4828 | + { "empty-name", "", 0, 0, false, false, "ubuntu", 0 }, |
4829 | + { "active", "Active Account", 0, 0, true, false, "ubuntu", 0 }, |
4830 | + }; |
4831 | + } |
4832 | + |
4833 | + // Assign uids in a loop, just to avoid having to muck with them when |
4834 | + // adding or removing test users. |
4835 | + for (int i = 0; i < d->entries.size(); i++) { |
4836 | + d->entries[i].uid = i + 1; |
4837 | + } |
4838 | + |
4839 | + // Assign backgrounds |
4840 | + QDir backgroundDir("/usr/share/backgrounds"); |
4841 | + QStringList backgrounds = backgroundDir.entryList(QDir::Files); |
4842 | + if (!backgrounds.empty()) { |
4843 | + for (int i = 0; i < d->entries.size(); i++) { |
4844 | + if (d->entries[i].background.isNull()) { |
4845 | + d->entries[i].background = backgroundDir.filePath(backgrounds[i % backgrounds.size()]); |
4846 | + } |
4847 | + } |
4848 | + } |
4849 | + |
4850 | + endResetModel(); |
4851 | +} |
4852 | + |
4853 | +QObject *UsersModel::mock() |
4854 | +{ |
4855 | + return MockController::instance(); |
4856 | } |
4857 | |
4858 | } |
4859 | |
4860 | === renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.h' => 'tests/mocks/liblightdm/MockUsersModel.h' |
4861 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.h 2016-05-24 22:11:21 +0000 |
4862 | +++ tests/mocks/liblightdm/MockUsersModel.h 2016-11-08 23:03:16 +0000 |
4863 | @@ -1,5 +1,5 @@ |
4864 | /* |
4865 | - * Copyright (C) 2013-2014 Canonical, Ltd. |
4866 | + * Copyright (C) 2013-2016 Canonical, Ltd. |
4867 | * Copyright (C) 2010-2011 David Edmundson. |
4868 | * |
4869 | * This program is free software; you can redistribute it and/or modify |
4870 | @@ -18,10 +18,9 @@ |
4871 | #ifndef UNITY_MOCK_USERSMODEL_H |
4872 | #define UNITY_MOCK_USERSMODEL_H |
4873 | |
4874 | -#include <QtCore/QString> |
4875 | -#include <QtCore/QSharedDataPointer> |
4876 | #include <QAbstractListModel> |
4877 | - |
4878 | +#include <QList> |
4879 | +#include <QString> |
4880 | |
4881 | namespace QLightDM |
4882 | { |
4883 | @@ -33,11 +32,7 @@ |
4884 | |
4885 | Q_ENUMS(UserModelRoles) |
4886 | |
4887 | - //Mock-only API for testing purposes |
4888 | - Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged) |
4889 | - |
4890 | -Q_SIGNALS: |
4891 | - void mockModeChanged(QString mode); |
4892 | + Q_PROPERTY(QObject *mock READ mock CONSTANT) // only in mock |
4893 | |
4894 | public: |
4895 | explicit UsersModel(QObject *parent = 0); |
4896 | @@ -57,8 +52,12 @@ |
4897 | int rowCount(const QModelIndex &parent) const override; |
4898 | QVariant data(const QModelIndex &index, int role) const override; |
4899 | |
4900 | - QString mockMode() const; |
4901 | - void setMockMode(QString mockMode); |
4902 | + void setCurrentSessionName(const QString &sessionName, const QString &username); |
4903 | + |
4904 | + QObject *mock(); |
4905 | + |
4906 | +private Q_SLOTS: |
4907 | + void resetEntries(); |
4908 | |
4909 | private: |
4910 | UsersModelPrivate * const d_ptr; |
4911 | |
4912 | === modified file 'tests/mocks/libusermetrics/UserMetrics.cpp' |
4913 | --- tests/mocks/libusermetrics/UserMetrics.cpp 2016-05-26 13:15:35 +0000 |
4914 | +++ tests/mocks/libusermetrics/UserMetrics.cpp 2016-11-08 23:03:16 +0000 |
4915 | @@ -288,7 +288,7 @@ |
4916 | QSharedPointer<UserMetricsData> data( |
4917 | new UserMetricsData("<b>52km</b> travelled", first, firstMonth, |
4918 | ninth, secondMonth, this)); |
4919 | - m_fakeData.insert("single", data); |
4920 | + m_fakeData.insert("has-password", data); |
4921 | m_fakeData.insert("has-pin", data); |
4922 | } |
4923 | |
4924 | @@ -304,7 +304,7 @@ |
4925 | QSharedPointer<UserMetricsData> data( |
4926 | new UserMetricsData("<b>33</b> messages today", second, |
4927 | firstMonth, eighth, secondMonth, this)); |
4928 | - m_fakeData.insert("single", data); |
4929 | + m_fakeData.insert("has-password", data); |
4930 | m_fakeData.insert("has-pin", data); |
4931 | } |
4932 | |
4933 | @@ -321,10 +321,8 @@ |
4934 | QSharedPointer<UserMetricsData> data( |
4935 | new UserMetricsData("<b>19</b> minutes talk time", eighth, |
4936 | firstMonth, second, secondMonth, this)); |
4937 | - m_fakeData.insert("single", data); |
4938 | + m_fakeData.insert("has-password", data); |
4939 | m_fakeData.insert("has-pin", data); |
4940 | - // Also use same data for some tablet users |
4941 | - m_fakeData.insert("has-password", data); |
4942 | m_fakeData.insert("no-password", data); |
4943 | m_fakeData.insert("empty-name", data); |
4944 | } |
4945 | |
4946 | === modified file 'tests/plugins/AccountsService/AccountsServer.cpp' |
4947 | --- tests/plugins/AccountsService/AccountsServer.cpp 2015-10-26 14:05:14 +0000 |
4948 | +++ tests/plugins/AccountsService/AccountsServer.cpp 2016-11-08 23:03:16 +0000 |
4949 | @@ -40,6 +40,8 @@ |
4950 | if (QDBusConnection::sessionBus().objectRegisteredAt(path) != nullptr) |
4951 | return true; |
4952 | |
4953 | + m_users.insert(path); |
4954 | + |
4955 | auto props = new PropertiesServer(this); |
4956 | new PropertiesAdaptor(props); |
4957 | new AccountsUserAdaptor(props); |
4958 | @@ -52,6 +54,15 @@ |
4959 | if (QDBusConnection::sessionBus().objectRegisteredAt(path) == nullptr) |
4960 | return false; |
4961 | |
4962 | + m_users.remove(path); |
4963 | QDBusConnection::sessionBus().unregisterObject(path); |
4964 | return true; |
4965 | } |
4966 | + |
4967 | +void AccountsServer::RemoveAllUsers() |
4968 | +{ |
4969 | + Q_FOREACH(const QString &path, m_users) { |
4970 | + m_users.remove(path); |
4971 | + QDBusConnection::sessionBus().unregisterObject(path); |
4972 | + } |
4973 | +} |
4974 | |
4975 | === modified file 'tests/plugins/AccountsService/AccountsServer.h' |
4976 | --- tests/plugins/AccountsService/AccountsServer.h 2015-10-26 14:05:14 +0000 |
4977 | +++ tests/plugins/AccountsService/AccountsServer.h 2016-11-08 23:03:16 +0000 |
4978 | @@ -23,6 +23,7 @@ |
4979 | #include <QDBusContext> |
4980 | #include <QDBusObjectPath> |
4981 | #include <QObject> |
4982 | +#include <QSet> |
4983 | #include <QString> |
4984 | |
4985 | class AccountsServer: public QObject, protected QDBusContext |
4986 | @@ -39,6 +40,10 @@ |
4987 | // mock only. |
4988 | bool AddUser(const QString &user); |
4989 | bool RemoveUser(const QString &user); |
4990 | + void RemoveAllUsers(); |
4991 | + |
4992 | +private: |
4993 | + QSet<QString> m_users; |
4994 | }; |
4995 | |
4996 | #endif |
4997 | |
4998 | === modified file 'tests/plugins/AccountsService/client.cpp' |
4999 | --- tests/plugins/AccountsService/client.cpp 2016-03-31 03:15:03 +0000 |
5000 | +++ tests/plugins/AccountsService/client.cpp 2016-11-08 23:03:16 +0000 |
PASSED: Continuous integration, rev:2659 /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/2419/ /unity8- jenkins. ubuntu. com/job/ build/3173 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= vivid+overlay, testname= qmluitests. sh/1810 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= xenial+ overlay, testname= qmluitests. sh/1810 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= yakkety, testname= qmluitests. sh/1810 /unity8- jenkins. ubuntu. com/job/ build-0- fetch/3201 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 3057 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 3057/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 3057 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 3057/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 3057 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 3057/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 3057 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 3057/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 3057 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 3057/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 3057 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 3057/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 3057 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 3057/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 3057 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 3057/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= yakkety/ 3057 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= yakkety/ 3057/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/2419/ rebuild
https:/