Merge lp:~mterry/unity8/greeter-hide-indicators into lp:unity8

Proposed by Michael Terry
Status: Superseded
Proposed branch: lp:~mterry/unity8/greeter-hide-indicators
Merge into: lp:unity8
Diff against target: 3150 lines (+1610/-240)
85 files modified
CMakeLists.txt (+1/-0)
data/51-unity8-greeter.conf (+2/-0)
data/CMakeLists.txt (+11/-0)
data/unity8-greeter-init.conf (+12/-0)
data/unity8-greeter-wrapper (+98/-0)
data/unity8-greeter.desktop.in (+7/-0)
data/unity8-greeter.pkla (+44/-0)
debian/control (+12/-0)
debian/rules (+1/-1)
debian/unity8-greeter.install (+5/-0)
debian/unity8-private.install (+1/-1)
plugins/CMakeLists.txt (+1/-1)
plugins/IntegratedLightDM/qmldir (+0/-3)
plugins/LightDM/CMakeLists.txt (+7/-21)
plugins/LightDM/DBusGreeter.cpp (+5/-4)
plugins/LightDM/FullLightDM/CMakeLists.txt (+27/-0)
plugins/LightDM/FullLightDM/qmldir (+3/-0)
plugins/LightDM/Greeter.cpp (+13/-2)
plugins/LightDM/Greeter.h (+5/-2)
plugins/LightDM/IntegratedLightDM/CMakeLists.txt (+30/-0)
plugins/LightDM/IntegratedLightDM/QLightDM/Greeter (+17/-0)
plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel (+17/-0)
plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel (+17/-0)
plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt (+4/-2)
plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp (+1/-2)
plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp (+88/-0)
plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h (+72/-0)
plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp (+36/-0)
plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h (+54/-0)
plugins/LightDM/IntegratedLightDM/qmldir (+3/-0)
plugins/LightDM/SessionsModel.cpp (+122/-0)
plugins/LightDM/SessionsModel.h (+68/-0)
plugins/LightDM/plugin.cpp (+26/-4)
plugins/LightDM/plugin.h (+5/-5)
plugins/Unity/Indicators/indicatorsmanager.cpp (+1/-1)
qml/Components/Dialogs.qml (+3/-5)
qml/Greeter/FullLightDMImpl.qml (+28/-0)
qml/Greeter/Greeter.qml (+49/-37)
qml/Greeter/IntegratedLightDMImpl.qml (+1/-1)
qml/Greeter/LightDMService.qml (+14/-3)
qml/Greeter/LoginList.qml (+2/-0)
qml/Greeter/WideView.qml (+2/-0)
qml/Greeter/qmldir (+1/-0)
qml/Shell.qml (+11/-6)
qml/Stages/ShimStage.qml (+0/-43)
qml/Wizard/Wizard.qml (+6/-2)
src/ShellApplication.cpp (+11/-1)
tests/CMakeLists.txt (+1/-1)
tests/autopilot/unity8/fixture_setup.py (+1/-1)
tests/autopilot/unity8/greeter/tests/test_args.py (+0/-5)
tests/autopilot/unity8/shell/tests/__init__.py (+1/-1)
tests/mocks/CMakeLists.txt (+1/-1)
tests/mocks/LightDM/CMakeLists.txt (+1/-0)
tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt (+9/-7)
tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp (+16/-0)
tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h (+5/-0)
tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp (+37/-0)
tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h (+34/-0)
tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel (+17/-0)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt (+4/-2)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp (+9/-2)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.h (+1/-0)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h (+1/-0)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp (+99/-0)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h (+72/-0)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp (+73/-0)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h (+59/-0)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp (+22/-22)
tests/mocks/LightDM/IntegratedLightDM/plugin.cpp (+15/-4)
tests/mocks/LightDM/IntegratedLightDM/plugin.h (+1/-1)
tests/mocks/LightDM/IntegratedLightDM/qmldir (+1/-2)
tests/plugins/CMakeLists.txt (+1/-1)
tests/plugins/LightDM/CMakeLists.txt (+1/-0)
tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt (+36/-13)
tests/plugins/LightDM/IntegratedLightDM/greeter.qml (+1/-1)
tests/plugins/LightDM/IntegratedLightDM/sessionsmodel.cpp (+96/-0)
tests/qmltests/Greeter/TestView.qml (+1/-0)
tests/qmltests/Greeter/tst_Greeter.qml (+28/-10)
tests/qmltests/Greeter/tst_Infographics.qml (+1/-1)
tests/qmltests/Greeter/tst_NarrowView.qml (+1/-1)
tests/qmltests/Greeter/tst_WideView.qml (+1/-1)
tests/qmltests/Tutorial/tst_Tutorial.qml (+1/-1)
tests/qmltests/tst_OrientedShell.qml (+1/-1)
tests/qmltests/tst_Shell.qml (+16/-13)
tests/qmltests/tst_ShellWithPin.qml (+1/-1)
To merge this branch: bzr merge lp:~mterry/unity8/greeter-hide-indicators
Reviewer Review Type Date Requested Status
Lukáš Tinkl (community) Approve
Unity8 CI Bot continuous-integration Needs Fixing
Review via email: mp+298775@code.launchpad.net

This proposal has been superseded by a proposal from 2016-07-06.

Commit message

Make sure indicators and launcher hide when power button is pressed on greeter.

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?
 NA

 * If you changed the UI, has there been a design review?
 NA

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2527
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1653/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2193
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2221
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2127
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2127
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2127
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2118
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2118/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2118
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2118/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2118
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2118/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2118
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2118/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2118
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2118/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2118
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2118/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2118
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2118/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2118
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2118/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2118
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2118/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1653/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Better but not quite; you can still see the indicators "rolling up" when you wake the phone up. Previously you couldn't even see the animation, you were taken straight to the lockscreen.

review: Needs Information
Revision history for this message
Michael Terry (mterry) wrote :

Are you sure that's a regression? I think it just depends on how long you wait until turning the screen back on.

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Ah :) I stand corrected, indeed if you wait a moment, it will hide completely.

* Did you perform an exploratory manual test run of the code change and any related functionality?

Yes

* Did CI run pass? If not, please explain why.

Not completely, passing locally

review: Approve
2528. By Michael Terry

Merge in lp:~josharenson/unity8/sessions-model to make it easier to stack greeter changes

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2016-06-27 18:41:15 +0000
3+++ CMakeLists.txt 2016-07-06 19:43:31 +0000
4@@ -128,6 +128,7 @@
5 set(DASH_APP unity8-dash)
6 set(SCOPE_TOOL unity-scope-tool)
7 set(INDICATORS_CLIENT_APP indicators-client)
8+set(GREETER_APP unity8-greeter)
9 set(MOCK_INDICATOR_SERVICE_APP unity-mock-indicator-service)
10
11 include_directories(
12
13=== added file 'data/51-unity8-greeter.conf'
14--- data/51-unity8-greeter.conf 1970-01-01 00:00:00 +0000
15+++ data/51-unity8-greeter.conf 2016-07-06 19:43:31 +0000
16@@ -0,0 +1,2 @@
17+[Seat:*]
18+greeter-session=unity8-greeter
19
20=== modified file 'data/CMakeLists.txt'
21--- data/CMakeLists.txt 2016-05-31 10:16:09 +0000
22+++ data/CMakeLists.txt 2016-07-06 19:43:31 +0000
23@@ -2,6 +2,7 @@
24 configure_file(${SHELL_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${SHELL_APP}.desktop @ONLY)
25 configure_file(${DASH_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${DASH_APP}.desktop @ONLY)
26 configure_file(${INDICATORS_CLIENT_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${INDICATORS_CLIENT_APP}.desktop @ONLY)
27+configure_file(${GREETER_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${GREETER_APP}.desktop @ONLY)
28
29 # install desktop files
30 install(FILES
31@@ -11,6 +12,16 @@
32 DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
33 )
34
35+install(FILES
36+ ${CMAKE_CURRENT_BINARY_DIR}/${GREETER_APP}.desktop
37+ DESTINATION ${CMAKE_INSTALL_DATADIR}/lightdm/greeters
38+ )
39+
40+install(FILES
41+ 51-unity8-greeter.conf
42+ DESTINATION ${CMAKE_INSTALL_DATADIR}/lightdm/lightdm.conf.d
43+ )
44+
45 # install dash icon
46 install(FILES
47 ${CMAKE_CURRENT_SOURCE_DIR}/${DASH_APP}.png
48
49=== added file 'data/unity8-greeter-init.conf'
50--- data/unity8-greeter-init.conf 1970-01-01 00:00:00 +0000
51+++ data/unity8-greeter-init.conf 2016-07-06 19:43:31 +0000
52@@ -0,0 +1,12 @@
53+description "Unity 8 Greeter initialization"
54+author "Michael Terry <mterry@ubuntu.com>"
55+
56+start on unity8-greeter-started
57+task
58+emits indicator-services-start
59+
60+script
61+ start --no-wait ofono-setup || true
62+ initctl emit --no-wait indicator-services-start || true
63+ start --no-wait maliit-server || true
64+end script
65
66=== added file 'data/unity8-greeter-wrapper'
67--- data/unity8-greeter-wrapper 1970-01-01 00:00:00 +0000
68+++ data/unity8-greeter-wrapper 2016-07-06 19:43:31 +0000
69@@ -0,0 +1,98 @@
70+#!/bin/sh
71+# -*- Mode: sh; indent-tabs-mode: nil; tab-width: 4 -*-
72+#
73+# Copyright (C) 2011,2013 Canonical Ltd
74+# Author: Michael Terry <michael.terry@canonical.com>
75+#
76+# This program is free software: you can redistribute it and/or modify it under
77+# the terms of the GNU General Public License as published by the Free Software
78+# Foundation, version 3 of the License.
79+#
80+# See http://www.gnu.org/copyleft/gpl.html the full text of the license.
81+
82+# This wrapper merely ensures that init and friends live only as long as this
83+# script does. Otherwise, it's very easy for some processes to not notice that
84+# the session died. We could try to do this in-process, but we want to do this
85+# cleanup even if the greeter aborts.
86+
87+trap cleanup TERM EXIT
88+
89+cleanup()
90+{
91+ trap - TERM EXIT
92+ # Kill upstart and indicators
93+ if [ -n "$INIT_PID" ]; then
94+ kill "$INIT_PID"
95+ fi
96+ if [ -n "$CMD_PID" ]; then
97+ kill "$CMD_PID"
98+ fi
99+ exit 0
100+}
101+
102+set_greeter_var()
103+{
104+ export "$1=$2"
105+ gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "{'$1': '$2'}"
106+ if [ -n "$INIT_PID" ]; then
107+ initctl set-env --global "$1=$2"
108+ fi
109+}
110+
111+SUB_SOCKET=$XDG_RUNTIME_DIR/mir_socket
112+rm -f $SUB_SOCKET # clear socket in case we were hard shut down
113+
114+# If touch session script (which sets up grid units and mir variables) is available, use it
115+TOUCH_WRAPPER=
116+if [ -x /usr/bin/ubuntu-touch-session ]; then
117+ TOUCH_WRAPPER=/usr/bin/ubuntu-touch-session
118+fi
119+
120+# Pretend that we're in an ubuntu-touch session, so that indicator-network
121+# will start.
122+export DESKTOP_SESSION=ubuntu-touch
123+
124+# We disable ofono using pulse. It causes problems with racing with the user's
125+# pulse. We need to come up with a better long-term fix for this, because we
126+# eventually need the greeter to play ringtones for users that aren't logged in.
127+set_greeter_var PA_DISABLED 1
128+
129+# Normal unity8 sessions are entirely driven by Upstart. But greeters
130+# are special. They need access to the file descriptors that lightdm
131+# creates for them and don't want to start all the services that a normal
132+# session would. So it's inconvenient to live within an upstart session.
133+# But... we still want to use Upstart for some services. So launch here.
134+MIR_SOCKET=$SUB_SOCKET $TOUCH_WRAPPER /sbin/upstart --user --no-startup-event &
135+INIT_PID=$!
136+while [ ! -e "$XDG_RUNTIME_DIR/upstart/sessions/$INIT_PID.session" ]; do sleep 0.1; done
137+export UPSTART_SESSION=$(/sbin/initctl list-sessions | grep "^$INIT_PID " | cut -d' ' -f2)
138+
139+# Start any pre-greeter tasks if needed (like wizard)
140+/sbin/initctl emit unity8-greeter-starting
141+
142+# Define language here for phone if available. When phone user switches their
143+# language, they expect that to affect the greeter too. But the user doesn't
144+# have permission to switch system language, only their own. So we notice if
145+# the phablet user exists and use their language if so. TODO: talk to design
146+# about whether we should switch language on fly as users are selected (this
147+# is very hard to do technically).
148+#
149+# Do this after unity8-greeter-starting, in case a customization upstart job
150+# changes language.
151+if [ "$(id -u phablet 2>/dev/null)" = "32011" ]; then
152+ USER_LANG=$(gdbus call --system --dest org.freedesktop.Accounts --object-path /org/freedesktop/Accounts/User32011 --method org.freedesktop.DBus.Properties.Get org.freedesktop.Accounts.User Language | cut -d\' -f2)
153+ if [ -n "$USER_LANG" ]; then
154+ set_greeter_var LANGUAGE "$USER_LANG"
155+ fi
156+ USER_LOCALE=$(gdbus call --system --dest org.freedesktop.Accounts --object-path /org/freedesktop/Accounts/User32011 --method org.freedesktop.DBus.Properties.Get org.freedesktop.Accounts.User FormatsLocale | cut -d\' -f2)
157+ if [ -n "$USER_LOCALE" ]; then
158+ set_greeter_var LANG "$USER_LOCALE"
159+ set_greeter_var LC_ALL "$USER_LOCALE"
160+ fi
161+fi
162+
163+# And finally actually start the greeter
164+exec env QT_QPA_PLATFORM=ubuntumirclient MIR_SERVER_FILE=$SUB_SOCKET $TOUCH_WRAPPER $@ &
165+CMD_PID=$!
166+wait $CMD_PID
167+CMD_PID=
168
169=== added file 'data/unity8-greeter.desktop.in'
170--- data/unity8-greeter.desktop.in 1970-01-01 00:00:00 +0000
171+++ data/unity8-greeter.desktop.in 2016-07-06 19:43:31 +0000
172@@ -0,0 +1,7 @@
173+[Desktop Entry]
174+Type=Application
175+Name=Unity 8 Greeter
176+Comment=The converged Unity shell's Greeter
177+Exec=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity8-greeter-wrapper @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity8 --mode=greeter
178+X-LightDM-Session-Type=mir
179+X-Ubuntu-Touch=true
180
181=== added file 'data/unity8-greeter.pkla'
182--- data/unity8-greeter.pkla 1970-01-01 00:00:00 +0000
183+++ data/unity8-greeter.pkla 2016-07-06 19:43:31 +0000
184@@ -0,0 +1,44 @@
185+# DO NOT EDIT THIS FILE, it will be overwritten on update
186+# Place your local configurations under /etc/polkit-1/localauthority/
187+
188+[Disable Controlling of Network Devices]
189+Identity=unix-user:lightdm
190+Action=org.freedesktop.NetworkManager.enable-disable-network;org.freedesktop.NetworkManager.enable-disable-wifi;org.freedesktop.NetworkManager.enable-disable-wwan;org.freedesktop.NetworkManager.enable-disable-wimax;
191+ResultActive=no
192+ResultInactive=no
193+ResultsAny=no
194+
195+[Disable Sleep and Wake]
196+Identity=unix-user:lightdm
197+Action=org.freedesktop.NetworkManager.sleep-wake
198+ResultActive=no
199+ResultInactive=no
200+ResultsAny=no
201+
202+[Disable WiFi Sharing]
203+Identity=unix-user:lightdm
204+Action=org.freedesktop.NetworkManager.wifi.share.protected;org.freedesktop.NetworkManager.wifi.share.open
205+ResultActive=no
206+ResultInactive=no
207+ResultsAny=no
208+
209+[Disable Settings Modifications]
210+Identity=unix-user:lightdm
211+Action=org.freedesktop.NetworkManager.settings.modify.own;org.freedesktop.NetworkManager.settings.modify.system;org.freedesktop.NetworkManager.settings.modify.hostname
212+ResultActive=no
213+ResultInactive=no
214+ResultsAny=no
215+
216+[Disable User Connections]
217+Identity=unix-user:lightdm
218+Action=org.freedesktop.NetworkManager.use-user-connections
219+ResultActive=no
220+ResultInactive=no
221+ResultsAny=no
222+
223+[Enable Controlling of Network Connections]
224+Identity=unix-user:lightdm
225+Action=org.freedesktop.NetworkManager.network-control
226+ResultActive=yes
227+ResultInactive=no
228+ResultsAny=no
229
230=== modified file 'debian/control'
231--- debian/control 2016-06-27 18:44:35 +0000
232+++ debian/control 2016-07-06 19:43:31 +0000
233@@ -23,6 +23,7 @@
234 libglib2.0-dev,
235 libgsettings-qt-dev,
236 libhardware-dev,
237+ liblightdm-qt5-3-dev,
238 libpam0g-dev,
239 libpay2-dev,
240 libpulse-dev,
241@@ -82,6 +83,17 @@
242 Description: Indicators client test application
243 This package contains the client application for indicators used by autopilot
244
245+Package: unity8-greeter
246+Architecture: any
247+Depends: unity8 (= ${binary:Version}),
248+ unity-system-compositor,
249+ ${misc:Depends},
250+ ${shlibs:Depends}
251+Recommends: lightdm
252+Provides: lightdm-greeter
253+Description: The Unity8 Greeter
254+ The Unity 8 greeter is the primary login greeter for Ubuntu devices.
255+
256 Package: unity-scope-tool
257 Architecture: any
258 Depends: unity8-common (= ${source:Version}),
259
260=== modified file 'debian/rules'
261--- debian/rules 2016-05-31 10:05:16 +0000
262+++ debian/rules 2016-07-06 19:43:31 +0000
263@@ -37,6 +37,6 @@
264 override_dh_makeshlibs:
265 dh_makeshlibs -Nunity8-private -Nunity8-fake-env
266
267-# libMockLightDM-qml.so links against liblightdm-qt5-2.so which doesn't exist
268+# libMockLightDM-qml.so links against liblightdm-qt5-3.so which doesn't exist
269 override_dh_shlibdeps:
270 dh_shlibdeps -XlibMockLightDM-qml.so
271
272=== added file 'debian/unity8-greeter.install'
273--- debian/unity8-greeter.install 1970-01-01 00:00:00 +0000
274+++ debian/unity8-greeter.install 2016-07-06 19:43:31 +0000
275@@ -0,0 +1,5 @@
276+data/unity8-greeter-wrapper usr/bin/
277+data/unity8-greeter-init.conf usr/share/upstart/sessions/
278+data/unity8-greeter.pkla /var/lib/polkit-1/localauthority/10-vendor.d/
279+usr/share/lightdm/greeters/unity8-greeter.desktop
280+usr/share/lightdm/lightdm.conf.d/51-unity8-greeter.conf
281
282=== modified file 'debian/unity8-private.install'
283--- debian/unity8-private.install 2016-05-27 13:49:53 +0000
284+++ debian/unity8-private.install 2016-07-06 19:43:31 +0000
285@@ -4,7 +4,7 @@
286 usr/lib/*/unity8/qml/Dash
287 usr/lib/*/unity8/qml/GlobalShortcut
288 usr/lib/*/unity8/qml/Greeter
289-usr/lib/*/unity8/qml/IntegratedLightDM
290+usr/lib/*/unity8/qml/LightDM
291 usr/lib/*/unity8/qml/Lights
292 usr/lib/*/unity8/qml/Powerd
293 usr/lib/*/unity8/qml/ScreenshotDirectory
294
295=== modified file 'plugins/CMakeLists.txt'
296--- plugins/CMakeLists.txt 2016-04-28 12:06:22 +0000
297+++ plugins/CMakeLists.txt 2016-07-06 19:43:31 +0000
298@@ -15,7 +15,7 @@
299 add_subdirectory(Cursor)
300 add_subdirectory(GlobalShortcut)
301 add_subdirectory(Greeter)
302-add_subdirectory(IntegratedLightDM)
303+add_subdirectory(LightDM)
304 add_subdirectory(Lights)
305 add_subdirectory(Dash)
306 add_subdirectory(Powerd)
307
308=== removed file 'plugins/IntegratedLightDM/qmldir'
309--- plugins/IntegratedLightDM/qmldir 2015-05-22 16:23:08 +0000
310+++ plugins/IntegratedLightDM/qmldir 1970-01-01 00:00:00 +0000
311@@ -1,3 +0,0 @@
312-module IntegratedLightDM
313-plugin IntegratedLightDM-qml
314-typeinfo IntegratedLightDM.qmltypes
315
316=== renamed directory 'plugins/IntegratedLightDM' => 'plugins/LightDM'
317=== modified file 'plugins/LightDM/CMakeLists.txt'
318--- plugins/IntegratedLightDM/CMakeLists.txt 2015-05-22 17:29:52 +0000
319+++ plugins/LightDM/CMakeLists.txt 2016-07-06 19:43:31 +0000
320@@ -1,40 +1,26 @@
321 pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1)
322-# TODO: Once we split out a separate greeter process, uncomment these lines
323-#pkg_check_modules(LIBLIGHTDM REQUIRED liblightdm-qt5-2)
324
325-add_subdirectory(liblightdm)
326+find_package(Qt5Core REQUIRED)
327+find_package(Qt5Quick REQUIRED)
328
329 include_directories(
330 ${CMAKE_CURRENT_SOURCE_DIR}
331 ${CMAKE_CURRENT_BINARY_DIR}
332 ${CMAKE_SOURCE_DIR}/plugins/Utils
333- ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
334- #${LIBLIGHTDM_INCLUDE_DIRS}
335+ ${CMAKE_BINARY_DIR}/tests/mocks/LightDM/IntegratedLightDM
336 ${libunity8-private_SOURCE_DIR}
337 ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS}
338 )
339
340 set(QMLPLUGIN_SRC
341- ../Utils/unitysortfilterproxymodelqml.cpp # FIXME evaluate a more generic approach for using other plugins
342+ ../Utils/unitysortfilterproxymodelqml.cpp
343 DBusGreeter.cpp
344 DBusGreeterList.cpp
345 Greeter.cpp
346 plugin.cpp
347+ SessionsModel.cpp
348 UsersModel.cpp
349 )
350
351-add_library(IntegratedLightDM-qml MODULE
352- ${QMLPLUGIN_SRC}
353- )
354-
355-target_link_libraries(IntegratedLightDM-qml
356- integratedLightDM
357- unity8-private
358-# TODO: Once we split out a separate greeter process, uncomment these lines
359-# ${LIBLIGHTDM_LDFLAGS}
360- ${LIBUSERMETRICSOUTPUT_LDFLAGS}
361- )
362-
363-qt5_use_modules(IntegratedLightDM-qml DBus Gui Qml)
364-
365-add_unity8_plugin(IntegratedLightDM 0.1 IntegratedLightDM TARGETS IntegratedLightDM-qml)
366+add_subdirectory(FullLightDM)
367+add_subdirectory(IntegratedLightDM)
368
369=== modified file 'plugins/LightDM/DBusGreeter.cpp'
370--- plugins/IntegratedLightDM/DBusGreeter.cpp 2015-09-14 09:11:08 +0000
371+++ plugins/LightDM/DBusGreeter.cpp 2016-07-06 19:43:31 +0000
372@@ -1,5 +1,5 @@
373 /*
374- * Copyright (C) 2014 Canonical, Ltd.
375+ * Copyright (C) 2014, 2015 Canonical, Ltd.
376 *
377 * This program is free software; you can redistribute it and/or modify
378 * it under the terms of the GNU General Public License as published by
379@@ -24,7 +24,8 @@
380 : UnityDBusObject(path, QStringLiteral("com.canonical.UnityGreeter"), true, greeter),
381 m_greeter(greeter)
382 {
383- connect(m_greeter, &Greeter::isActiveChanged, this, &DBusGreeter::isActiveChangedHandler);
384+ connect(m_greeter, &Greeter::isActiveChanged,
385+ this, &DBusGreeter::isActiveChangedHandler);
386 }
387
388 bool DBusGreeter::isActive() const
389@@ -34,12 +35,12 @@
390
391 void DBusGreeter::ShowGreeter()
392 {
393- return Q_EMIT m_greeter->showGreeter();
394+ Q_EMIT m_greeter->showGreeter();
395 }
396
397 void DBusGreeter::HideGreeter()
398 {
399- return Q_EMIT m_greeter->hideGreeter();
400+ Q_EMIT m_greeter->hideGreeter();
401 }
402
403 void DBusGreeter::isActiveChangedHandler()
404
405=== added directory 'plugins/LightDM/FullLightDM'
406=== added file 'plugins/LightDM/FullLightDM/CMakeLists.txt'
407--- plugins/LightDM/FullLightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000
408+++ plugins/LightDM/FullLightDM/CMakeLists.txt 2016-07-06 19:43:31 +0000
409@@ -0,0 +1,27 @@
410+pkg_check_modules(LIBLIGHTDM REQUIRED liblightdm-qt5-3)
411+
412+set(PLUGIN_CLASSNAME "FullLightDM")
413+
414+add_definitions(-DFULL_LIGHTDM)
415+
416+include_directories(
417+ ../
418+ ${LIBLIGHTDM_INCLUDE_DIRS}
419+ )
420+
421+foreach(source_file ${QMLPLUGIN_SRC})
422+ list(APPEND RELATIVE_QMLPLUGIN_SRC ../${source_file})
423+endforeach()
424+
425+add_library(FullLightDM-qml MODULE
426+ ${RELATIVE_QMLPLUGIN_SRC}
427+ )
428+
429+target_link_libraries(FullLightDM-qml
430+ unity8-private
431+ ${LIBLIGHTDM_LDFLAGS}
432+ ${LIBUSERMETRICSOUTPUT_LDFLAGS}
433+ )
434+
435+qt5_use_modules(FullLightDM-qml DBus Gui Qml)
436+add_unity8_plugin(FullLightDM 0.1 LightDM/FullLightDM TARGETS FullLightDM-qml)
437
438=== added file 'plugins/LightDM/FullLightDM/qmldir'
439--- plugins/LightDM/FullLightDM/qmldir 1970-01-01 00:00:00 +0000
440+++ plugins/LightDM/FullLightDM/qmldir 2016-07-06 19:43:31 +0000
441@@ -0,0 +1,3 @@
442+module LightDM.FullLightDM
443+plugin FullLightDM-qml
444+typeinfo FullLightDM.qmltypes
445
446=== modified file 'plugins/LightDM/Greeter.cpp'
447--- plugins/IntegratedLightDM/Greeter.cpp 2015-09-14 13:08:29 +0000
448+++ plugins/LightDM/Greeter.cpp 2016-07-06 19:43:31 +0000
449@@ -1,5 +1,5 @@
450 /*
451- * Copyright (C) 2013 Canonical, Ltd.
452+ * Copyright (C) 2013, 2015 Canonical, Ltd.
453 *
454 * This program is free software; you can redistribute it and/or modify
455 * it under the terms of the GNU General Public License as published by
456@@ -13,7 +13,6 @@
457 * You should have received a copy of the GNU General Public License
458 * along with this program. If not, see <http://www.gnu.org/licenses/>.
459 *
460- * Author: Michael Terry <michael.terry@canonical.com>
461 */
462
463 #include "Greeter.h"
464@@ -72,12 +71,24 @@
465 return d->m_greeter->authenticationUser();
466 }
467
468+QString Greeter::defaultSessionHint() const
469+{
470+ Q_D(const Greeter);
471+ return d->m_greeter->defaultSessionHint();
472+}
473+
474 bool Greeter::promptless() const
475 {
476 Q_D(const Greeter);
477 return d->promptless;
478 }
479
480+QString Greeter::selectUser() const
481+{
482+ Q_D(const Greeter);
483+ return d->m_greeter->selectUserHint();
484+}
485+
486 void Greeter::authenticate(const QString &username)
487 {
488 Q_D(Greeter);
489
490=== modified file 'plugins/LightDM/Greeter.h'
491--- plugins/IntegratedLightDM/Greeter.h 2015-01-20 11:50:19 +0000
492+++ plugins/LightDM/Greeter.h 2016-07-06 19:43:31 +0000
493@@ -1,5 +1,5 @@
494 /*
495- * Copyright (C) 2012,2013 Canonical, Ltd.
496+ * Copyright (C) 2012,2013,2015 Canonical, Ltd.
497 *
498 * This program is free software; you can redistribute it and/or modify
499 * it under the terms of the GNU General Public License as published by
500@@ -13,7 +13,6 @@
501 * You should have received a copy of the GNU General Public License
502 * along with this program. If not, see <http://www.gnu.org/licenses/>.
503 *
504- * Authors: Michael Terry <michael.terry@canonical.com>
505 */
506
507 /* This class is a really tiny filter around QLightDM::Greeter. There are some
508@@ -37,7 +36,9 @@
509 Q_PROPERTY(bool active READ isActive WRITE setIsActive NOTIFY isActiveChanged)
510 Q_PROPERTY(bool authenticated READ isAuthenticated NOTIFY isAuthenticatedChanged)
511 Q_PROPERTY(QString authenticationUser READ authenticationUser NOTIFY authenticationUserChanged)
512+ Q_PROPERTY(QString defaultSession READ defaultSessionHint CONSTANT)
513 Q_PROPERTY(bool promptless READ promptless NOTIFY promptlessChanged)
514+ Q_PROPERTY(QString selectUser READ selectUser CONSTANT)
515
516 public:
517 explicit Greeter(QObject* parent=0);
518@@ -45,7 +46,9 @@
519 bool isActive() const;
520 bool isAuthenticated() const;
521 QString authenticationUser() const;
522+ QString defaultSessionHint() const;
523 bool promptless() const;
524+ QString selectUser() const;
525
526 public Q_SLOTS:
527 void authenticate(const QString &username=QString());
528
529=== added directory 'plugins/LightDM/IntegratedLightDM'
530=== added file 'plugins/LightDM/IntegratedLightDM/CMakeLists.txt'
531--- plugins/LightDM/IntegratedLightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000
532+++ plugins/LightDM/IntegratedLightDM/CMakeLists.txt 2016-07-06 19:43:31 +0000
533@@ -0,0 +1,30 @@
534+set(PLUGIN_CLASSNAME "IntegratedLightDM")
535+
536+add_definitions(-DINTEGRATED_LIGHTDM)
537+
538+foreach(include_directory ${QMLPLUGIN_INCLUDES})
539+ list(APPEND RELATIVE_QMLPLUGIN_INCLUDES ../${include_directory})
540+endforeach()
541+
542+include_directories(
543+ . #QLightDM
544+ )
545+
546+foreach(source_file ${QMLPLUGIN_SRC})
547+ list(APPEND RELATIVE_QMLPLUGIN_SRC ../${source_file})
548+endforeach()
549+
550+add_library(IntegratedLightDM-qml MODULE
551+ ${RELATIVE_QMLPLUGIN_SRC}
552+ )
553+
554+target_link_libraries(IntegratedLightDM-qml
555+ integratedLightDM
556+ unity8-private
557+ ${LIBUSERMETRICSOUTPUT_LDFLAGS}
558+ )
559+
560+qt5_use_modules(IntegratedLightDM-qml DBus Gui Qml)
561+add_unity8_plugin(IntegratedLightDM 0.1 LightDM/IntegratedLightDM TARGETS IntegratedLightDM-qml)
562+
563+add_subdirectory(liblightdm)
564
565=== added directory 'plugins/LightDM/IntegratedLightDM/QLightDM'
566=== added file 'plugins/LightDM/IntegratedLightDM/QLightDM/Greeter'
567--- plugins/LightDM/IntegratedLightDM/QLightDM/Greeter 1970-01-01 00:00:00 +0000
568+++ plugins/LightDM/IntegratedLightDM/QLightDM/Greeter 2016-07-06 19:43:31 +0000
569@@ -0,0 +1,17 @@
570+/*
571+ * Copyright (C) 2016 Canonical, Ltd.
572+ *
573+ * This program is free software; you can redistribute it and/or modify
574+ * it under the terms of the GNU General Public License as published by
575+ * the Free Software Foundation; version 3.
576+ *
577+ * This program is distributed in the hope that it will be useful,
578+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
579+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
580+ * GNU General Public License for more details.
581+ *
582+ * You should have received a copy of the GNU General Public License
583+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
584+ */
585+
586+#include "../liblightdm/Greeter.h"
587
588=== added file 'plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel'
589--- plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel 1970-01-01 00:00:00 +0000
590+++ plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModel 2016-07-06 19:43:31 +0000
591@@ -0,0 +1,17 @@
592+/*
593+ * Copyright (C) 2016 Canonical, Ltd.
594+ *
595+ * This program is free software; you can redistribute it and/or modify
596+ * it under the terms of the GNU General Public License as published by
597+ * the Free Software Foundation; version 3.
598+ *
599+ * This program is distributed in the hope that it will be useful,
600+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
601+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
602+ * GNU General Public License for more details.
603+ *
604+ * You should have received a copy of the GNU General Public License
605+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
606+ */
607+
608+#include "../liblightdm/SessionsModel.h"
609
610=== added file 'plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel'
611--- plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel 1970-01-01 00:00:00 +0000
612+++ plugins/LightDM/IntegratedLightDM/QLightDM/UsersModel 2016-07-06 19:43:31 +0000
613@@ -0,0 +1,17 @@
614+/*
615+ * Copyright (C) 2016 Canonical, Ltd.
616+ *
617+ * This program is free software; you can redistribute it and/or modify
618+ * it under the terms of the GNU General Public License as published by
619+ * the Free Software Foundation; version 3.
620+ *
621+ * This program is distributed in the hope that it will be useful,
622+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
623+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
624+ * GNU General Public License for more details.
625+ *
626+ * You should have received a copy of the GNU General Public License
627+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
628+ */
629+
630+#include "../liblightdm/UsersModel.h"
631
632=== renamed directory 'plugins/IntegratedLightDM/liblightdm' => 'plugins/LightDM/IntegratedLightDM/liblightdm'
633=== modified file 'plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt'
634--- plugins/IntegratedLightDM/liblightdm/CMakeLists.txt 2016-03-08 18:07:38 +0000
635+++ plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt 2016-07-06 19:43:31 +0000
636@@ -2,8 +2,10 @@
637
638 set(LibLightDM_SOURCES
639 Greeter.cpp
640+ SessionsModel.cpp
641 UsersModel.cpp
642 GreeterPrivate.cpp
643+ SessionsModelPrivate.cpp
644 UsersModelPrivate.cpp
645 ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsServiceDBusAdaptor.cpp
646 ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
647@@ -46,8 +48,8 @@
648 COMPILE_FLAGS "-DSM_BUSNAME=sessionBus -fPIC")
649 set_target_properties(MockLightDM-demo-shared PROPERTIES
650 COMPILE_FLAGS "-DSM_BUSNAME=systemBus"
651- OUTPUT_NAME lightdm-qt5-2)
652+ OUTPUT_NAME lightdm-qt5-3)
653
654 install(TARGETS MockLightDM-demo-shared
655- DESTINATION ${SHELL_INSTALL_QML}/mocks/IntegratedLightDM/demo
656+ DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/demo
657 )
658
659=== modified file 'plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp'
660--- plugins/IntegratedLightDM/liblightdm/GreeterPrivate.cpp 2015-09-14 09:11:08 +0000
661+++ plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp 2016-07-06 19:43:31 +0000
662@@ -50,8 +50,7 @@
663 {
664 qRegisterMetaType<QLightDM::GreeterImpl::ResponseFuture>("QLightDM::GreeterImpl::ResponseFuture");
665
666- connect(&futureWatcher, &QFutureWatcher<int>::finished,
667- this, &GreeterImpl::finishPam);
668+ connect(&futureWatcher, &QFutureWatcher<int>::finished, this, &GreeterImpl::finishPam);
669 connect(this, SIGNAL(showMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)),
670 this, SLOT(handleMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)));
671 // This next connect is how we pass ResponseFutures between threads
672
673=== added file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp'
674--- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp 1970-01-01 00:00:00 +0000
675+++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp 2016-07-06 19:43:31 +0000
676@@ -0,0 +1,88 @@
677+/*
678+ * Copyright (C) 2015 Canonical, Ltd.
679+ *
680+ * This program is free software; you can redistribute it and/or modify
681+ * it under the terms of the GNU General Public License as published by
682+ * the Free Software Foundation; version 3.
683+ *
684+ * This program is distributed in the hope that it will be useful,
685+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
686+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
687+ * GNU General Public License for more details.
688+ *
689+ * You should have received a copy of the GNU General Public License
690+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
691+ *
692+ */
693+
694+
695+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
696+ * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
697+ * COUNTERPART IN tests/mocks/LightDM/IntegratedLightDM/liblightdm
698+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
699+
700+// LightDM currently is Qt4 compatible, and so doesn't define setRoleNames.
701+// To use the same method of setting role name that it does, we
702+// set our compatibility to Qt4 here too.
703+#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0)
704+
705+#include "SessionsModel.h"
706+#include "SessionsModelPrivate.h"
707+#include <QtCore/QDir>
708+#include <QtCore/QString>
709+
710+namespace QLightDM
711+{
712+
713+SessionsModel::SessionsModel(QObject* parent) :
714+ QAbstractListModel(parent),
715+ d_ptr(new SessionsModelPrivate(this))
716+{
717+ Q_D(SessionsModel);
718+ m_roleNames = QAbstractListModel::roleNames();
719+ m_roleNames[KeyRole] = "key";
720+ m_roleNames[TypeRole] = "type";
721+}
722+
723+SessionsModel::~SessionsModel()
724+{
725+ delete d_ptr;
726+}
727+
728+QVariant SessionsModel::data(const QModelIndex& index, int role) const
729+{
730+ Q_D(const SessionsModel);
731+
732+ if(!index.isValid()) {
733+ return QVariant();
734+ }
735+
736+ int row = index.row();
737+
738+ switch (role) {
739+ case QLightDM::SessionsModel::KeyRole:
740+ return d->sessionItems[row].key;
741+ case Qt::DisplayRole:
742+ return d->sessionItems[row].name;
743+ default:
744+ return QVariant();
745+ }
746+}
747+
748+QHash<int, QByteArray> SessionsModel::roleNames() const
749+{
750+ return m_roleNames;
751+}
752+
753+int SessionsModel::rowCount(const QModelIndex& parent) const
754+{
755+ Q_D(const SessionsModel);
756+
757+ if (parent.isValid()) {
758+ return 0;
759+ } else { // parent is root
760+ return d->sessionItems.size();
761+ }
762+}
763+
764+} // namespace QLightDM
765
766=== added file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h'
767--- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h 1970-01-01 00:00:00 +0000
768+++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h 2016-07-06 19:43:31 +0000
769@@ -0,0 +1,72 @@
770+/*
771+ * Copyright (C) 2015 Canonical, Ltd.
772+ *
773+ * This program is free software; you can redistribute it and/or modify
774+ * it under the terms of the GNU General Public License as published by
775+ * the Free Software Foundation; version 3.
776+ *
777+ * This program is distributed in the hope that it will be useful,
778+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
779+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
780+ * GNU General Public License for more details.
781+ *
782+ * You should have received a copy of the GNU General Public License
783+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
784+ *
785+ */
786+
787+#ifndef UNITY_INTEGRATED_SESSIONSMODEL_H
788+#define UNITY_INTEGRATED_SESSIONSMODEL_H
789+
790+#include <QtCore/QAbstractListModel>
791+#include <QtCore/QString>
792+
793+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
794+ * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
795+ * COUNTERPART IN tests/mocks/LightDM/IntegratedLightDM/liblightdm
796+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
797+
798+// This is taken from liblightdm and modified to confirm to our syle conventions
799+namespace QLightDM
800+{
801+class SessionsModelPrivate;
802+
803+class Q_DECL_EXPORT SessionsModel : public QAbstractListModel
804+ {
805+ Q_OBJECT
806+
807+ Q_ENUMS(SessionModelRoles SessionType)
808+
809+ public:
810+
811+ enum SessionModelRoles {
812+ //name is exposed as Qt::DisplayRole
813+ //comment is exposed as Qt::TooltipRole
814+ KeyRole = Qt::UserRole,
815+ IdRole = KeyRole, /** Deprecated */
816+ TypeRole
817+ };
818+
819+ enum SessionType {
820+ LocalSessions,
821+ RemoteSessions
822+ };
823+
824+ explicit SessionsModel(QObject* parent=0); /** Deprecated. Loads local sessions*/
825+ explicit SessionsModel(SessionsModel::SessionType, QObject* parent=0);
826+ virtual ~SessionsModel();
827+
828+ QHash<int, QByteArray> roleNames() const override;
829+ int rowCount(const QModelIndex& parent) const override;
830+ QVariant data(const QModelIndex& index, int role) const override;
831+
832+ protected:
833+ SessionsModelPrivate* const d_ptr;
834+
835+ private:
836+ QHash<int, QByteArray> m_roleNames;
837+ Q_DECLARE_PRIVATE(SessionsModel)
838+ };
839+}
840+
841+#endif // UNITY_INTEGRATED_SESSIONSMODEL_H
842
843=== added file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp'
844--- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 1970-01-01 00:00:00 +0000
845+++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 2016-07-06 19:43:31 +0000
846@@ -0,0 +1,36 @@
847+/*
848+ * Copyright (C) 2015 Canonical, Ltd.
849+ *
850+ * This program is free software; you can redistribute it and/or modify
851+ * it under the terms of the GNU General Public License as published by
852+ * the Free Software Foundation; version 3.
853+ *
854+ * This program is distributed in the hope that it will be useful,
855+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
856+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
857+ * GNU General Public License for more details.
858+ *
859+ * You should have received a copy of the GNU General Public License
860+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
861+ *
862+ */
863+
864+#include "SessionsModelPrivate.h"
865+
866+#include <QDir>
867+#include <QSettings>
868+#include <QStringList>
869+
870+namespace QLightDM
871+{
872+
873+SessionsModelPrivate::SessionsModelPrivate(SessionsModel* parent)
874+ : q_ptr(parent)
875+{
876+ // Since this model is never visible, as there is only 1 session,
877+ // just use the session name as the key
878+ QString sessionName = qgetenv("XDG_SESSION_DESKTOP");
879+ sessionItems.append({sessionName, "", sessionName, ""});
880+}
881+
882+} // namespace QLightDM
883
884=== added file 'plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h'
885--- plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 1970-01-01 00:00:00 +0000
886+++ plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 2016-07-06 19:43:31 +0000
887@@ -0,0 +1,54 @@
888+/*
889+ * Copyright (C) 2015 Canonical, Ltd.
890+ *
891+ * This program is free software; you can redistribute it and/or modify
892+ * it under the terms of the GNU General Public License as published by
893+ * the Free Software Foundation; version 3.
894+ *
895+ * This program is distributed in the hope that it will be useful,
896+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
897+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
898+ * GNU General Public License for more details.
899+ *
900+ * You should have received a copy of the GNU General Public License
901+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
902+ *
903+ */
904+
905+#ifndef UNITY_INTEGRATED_SESSIONSMODEL_PRIVATE_H
906+#define UNITY_INTEGRATED_SESSIONSMODEL_PRIVATE_H
907+
908+#include <QtCore/QList>
909+#include <QtCore/QString>
910+
911+namespace QLightDM
912+{
913+class SessionsModel;
914+
915+class SessionItem
916+{
917+public:
918+ QString key;
919+ QString type; // unused
920+ QString name;
921+ QString comment; // unused
922+};
923+
924+class SessionsModelPrivate
925+{
926+public:
927+ explicit SessionsModelPrivate(SessionsModel* parent=0);
928+ virtual ~SessionsModelPrivate() = default;
929+
930+ QList<SessionItem> sessionItems;
931+
932+protected:
933+ SessionsModel* const q_ptr;
934+
935+private:
936+ Q_DECLARE_PUBLIC(SessionsModel)
937+};
938+
939+} // namespace QLightDM
940+
941+#endif // UNITY_INTEGRATED_SESSIONSMODEL_PRIVATE_H
942
943=== added file 'plugins/LightDM/IntegratedLightDM/qmldir'
944--- plugins/LightDM/IntegratedLightDM/qmldir 1970-01-01 00:00:00 +0000
945+++ plugins/LightDM/IntegratedLightDM/qmldir 2016-07-06 19:43:31 +0000
946@@ -0,0 +1,3 @@
947+module LightDM.IntegratedLightDM
948+plugin IntegratedLightDM-qml
949+typeinfo IntegratedLightDM.qmltypes
950
951=== added file 'plugins/LightDM/SessionsModel.cpp'
952--- plugins/LightDM/SessionsModel.cpp 1970-01-01 00:00:00 +0000
953+++ plugins/LightDM/SessionsModel.cpp 2016-07-06 19:43:31 +0000
954@@ -0,0 +1,122 @@
955+/*
956+ * Copyright (C) 2015 Canonical, Ltd.
957+ *
958+ * This program is free software; you can redistribute it and/or modify
959+ * it under the terms of the GNU General Public License as published by
960+ * the Free Software Foundation; version 3.
961+ *
962+ * This program is distributed in the hope that it will be useful,
963+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
964+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
965+ * GNU General Public License for more details.
966+ *
967+ * You should have received a copy of the GNU General Public License
968+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
969+ *
970+ */
971+
972+#include "SessionsModel.h"
973+#include <QtCore/QFile>
974+#include <QtCore/QSortFilterProxyModel>
975+
976+QHash<int, QByteArray> SessionsModel::roleNames() const
977+{
978+ return m_roleNames;
979+}
980+
981+int SessionsModel::rowCount(const QModelIndex& parent) const
982+{
983+ return m_model->rowCount(parent);
984+}
985+
986+QList<QUrl> SessionsModel::iconSearchDirectories() const
987+{
988+ return m_iconSearchDirectories;
989+}
990+
991+void SessionsModel::setIconSearchDirectories(const QList<QUrl> searchDirectories)
992+{
993+ // QML gives us a url with file:// prepended which breaks QFile::exists()
994+ // so convert the url to a local file
995+ QList<QUrl> localList = {};
996+ Q_FOREACH(const QUrl& searchDirectory, searchDirectories)
997+ {
998+ localList.append(searchDirectory.toLocalFile());
999+ }
1000+ m_iconSearchDirectories = localList;
1001+ Q_EMIT iconSearchDirectoriesChanged();
1002+}
1003+
1004+QUrl SessionsModel::iconUrl(const QString sessionName) const
1005+{
1006+ Q_FOREACH(const QUrl& searchDirectory, m_iconSearchDirectories)
1007+ {
1008+ // This is an established icon naming convention
1009+ QString customIconUrl = searchDirectory.toString(QUrl::StripTrailingSlash) +
1010+ "/custom_" + sessionName + "_badge.png";
1011+ QString iconUrl = searchDirectory.toString(QUrl::StripTrailingSlash) +
1012+ "/" + sessionName + "_badge.png";
1013+
1014+ QFile customIconFile(customIconUrl);
1015+ QFile iconFile(iconUrl);
1016+ if (customIconFile.exists()) {
1017+ return QUrl(customIconUrl);
1018+ } else if (iconFile.exists()) {
1019+ return QUrl(iconUrl);
1020+ } else{
1021+ // Search the legacy way
1022+ QString path = searchDirectory.toString(QUrl::StripTrailingSlash) + "/";
1023+ if (sessionName == "ubuntu" || sessionName == "ubuntu-2d") {
1024+ path += "ubuntu_badge.png";
1025+ } else if(
1026+ sessionName == "gnome-classic" ||
1027+ sessionName == "gnome-flashback-compiz" ||
1028+ sessionName == "gnome-flashback-metacity" ||
1029+ sessionName == "gnome-shell" ||
1030+ sessionName == "gnome-wayland" ||
1031+ sessionName == "gnome"
1032+ ){
1033+ path += "gnome_badge.png";
1034+ } else if (sessionName == "plasma") {
1035+ path += "kde_badge.png";
1036+ } else if (sessionName == "xterm") {
1037+ path += "recovery_console_badge.png";
1038+ } else if (sessionName == "remote-login") {
1039+ path += "remote_login_help.png";
1040+ }
1041+
1042+ if (QFile(path).exists()) {
1043+ return path;
1044+ }
1045+ }
1046+ }
1047+
1048+ // FIXME make this smarter
1049+ return QUrl("./graphics/session_icons/unknown_badge.png");
1050+}
1051+
1052+QVariant SessionsModel::data(const QModelIndex& index, int role) const
1053+{
1054+ switch (role) {
1055+ case SessionsModel::IconRole:
1056+ return iconUrl(m_model->data(index, Qt::DisplayRole).toString());
1057+ default:
1058+ return m_model->data(index, role);
1059+ }
1060+}
1061+
1062+SessionsModel::SessionsModel(QObject* parent)
1063+ : UnitySortFilterProxyModelQML(parent)
1064+{
1065+ // Add a custom IconRole that isn't in either of the lightdm implementations
1066+ m_model = new QLightDM::SessionsModel(this);
1067+ m_roleNames = m_model->roleNames();
1068+ m_roleNames[IconRole] = "icon_url";
1069+
1070+ setModel(m_model);
1071+ setSourceModel(m_model);
1072+ setSortCaseSensitivity(Qt::CaseInsensitive);
1073+ setSortLocaleAware(true);
1074+ setSortRole(Qt::DisplayRole);
1075+ sort(0);
1076+}
1077
1078=== added file 'plugins/LightDM/SessionsModel.h'
1079--- plugins/LightDM/SessionsModel.h 1970-01-01 00:00:00 +0000
1080+++ plugins/LightDM/SessionsModel.h 2016-07-06 19:43:31 +0000
1081@@ -0,0 +1,68 @@
1082+/*
1083+ * Copyright (C) 2015 Canonical, Ltd.
1084+ *
1085+ * This program is free software; you can redistribute it and/or modify
1086+ * it under the terms of the GNU General Public License as published by
1087+ * the Free Software Foundation; version 3.
1088+ *
1089+ * This program is distributed in the hope that it will be useful,
1090+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1091+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1092+ * GNU General Public License for more details.
1093+ *
1094+ * You should have received a copy of the GNU General Public License
1095+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1096+ *
1097+ */
1098+
1099+#ifndef UNITY_SESSIONSMODEL_H
1100+#define UNITY_SESSIONSMODEL_H
1101+
1102+#include <unitysortfilterproxymodelqml.h>
1103+#include <QLightDM/SessionsModel>
1104+#include <QtCore/QHash>
1105+#include <QtCore/QObject>
1106+#include <QtCore/QUrl>
1107+
1108+class SessionsModel : public UnitySortFilterProxyModelQML
1109+{
1110+ Q_OBJECT
1111+
1112+ Q_ENUMS(SessionModelRoles)
1113+
1114+ Q_PROPERTY(QList<QUrl> iconSearchDirectories READ iconSearchDirectories
1115+ WRITE setIconSearchDirectories NOTIFY iconSearchDirectoriesChanged)
1116+Q_SIGNALS:
1117+ void iconSearchDirectoriesChanged();
1118+
1119+public:
1120+ enum SessionModelRoles {
1121+ /* This is tricky / ugly. Since we are ultimately chaining 3 enums together,
1122+ * the _first_ value of this enum MUST be the _last_ value of
1123+ * QLightDM::SessionsModel::SessionModelRoles and consquently, this must
1124+ * also match the last value in the corresponding enum of the integrated lib
1125+ */
1126+ TypeRole = QLightDM::SessionsModel::SessionModelRoles::TypeRole,
1127+ IconRole
1128+ };
1129+
1130+ explicit SessionsModel(QObject* parent=nullptr);
1131+
1132+ QHash<int, QByteArray> roleNames() const override;
1133+ int rowCount(const QModelIndex& parent) const override;
1134+ QVariant data(const QModelIndex& index, int role) const override;
1135+ QList<QUrl> iconSearchDirectories() const;
1136+ Q_INVOKABLE QUrl iconUrl(const QString sessionName) const;
1137+
1138+ void setIconSearchDirectories(const QList<QUrl> searchDirectories);
1139+private:
1140+ QLightDM::SessionsModel* m_model;
1141+ QHash<int, QByteArray> m_roleNames;
1142+ QList<QUrl> m_iconSearchDirectories{
1143+ QUrl("/usr/share/unity8/Greeter/graphics/session_icons"),
1144+ QUrl("/usr/local/share/unity-greeter"),
1145+ QUrl("/usr/share/unity-greeter/")};
1146+
1147+};
1148+
1149+#endif // UNITY_SESSIONSMODEL_H
1150
1151=== modified file 'plugins/LightDM/plugin.cpp'
1152--- plugins/IntegratedLightDM/plugin.cpp 2015-09-14 09:11:08 +0000
1153+++ plugins/LightDM/plugin.cpp 2016-07-06 19:43:31 +0000
1154@@ -1,5 +1,5 @@
1155 /*
1156- * Copyright (C) 2012,2013, 2015 Canonical, Ltd.
1157+ * Copyright (C) 2012,2013,2015 Canonical, Ltd.
1158 *
1159 * This program is free software; you can redistribute it and/or modify
1160 * it under the terms of the GNU General Public License as published by
1161@@ -19,9 +19,11 @@
1162 #include "DBusGreeter.h"
1163 #include "DBusGreeterList.h"
1164 #include "Greeter.h"
1165+#include "SessionsModel.h"
1166 #include "UsersModel.h"
1167 #include <libusermetricsoutput/ColorTheme.h>
1168 #include <libusermetricsoutput/UserMetrics.h>
1169+#include <QLightDM/SessionsModel>
1170 #include <QLightDM/UsersModel>
1171
1172 #include <QAbstractItemModel>
1173@@ -40,6 +42,13 @@
1174 return greeter;
1175 }
1176
1177+static QObject *sessions_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
1178+{
1179+ Q_UNUSED(engine)
1180+ Q_UNUSED(scriptEngine)
1181+ return new SessionsModel();
1182+}
1183+
1184 static QObject *users_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
1185 {
1186 Q_UNUSED(engine)
1187@@ -54,16 +63,29 @@
1188 return UserMetricsOutput::UserMetrics::getInstance();
1189 }
1190
1191-void IntegratedLightDMPlugin::registerTypes(const char *uri)
1192+void PLUGIN_CLASSNAME::registerTypes(const char *uri)
1193 {
1194 qmlRegisterType<QAbstractItemModel>();
1195 qmlRegisterType<UserMetricsOutput::ColorTheme>();
1196
1197- Q_ASSERT(uri == QLatin1String("IntegratedLightDM"));
1198+#if defined INTEGRATED_LIGHTDM
1199+ Q_ASSERT(uri == QLatin1String("LightDM.IntegratedLightDM"));
1200+ qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider);
1201+#elif defined FULL_LIGHTDM
1202+ Q_ASSERT(uri == QLatin1String("LightDM.FullLightDM"));
1203+ qmlRegisterSingletonType<QLightDM::Greeter>(uri, 0, 1, "Greeter", greeter_provider);
1204+#else
1205+ #error No library defined in LightDM plugin
1206+#endif
1207+
1208 qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
1209 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
1210- qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider);
1211+
1212+ qmlRegisterSingletonType<SessionsModel>(uri, 0, 1, "Sessions", sessions_provider);
1213+ qmlRegisterUncreatableType<SessionsModel>(uri, 0, 1, "SessionRoles", QStringLiteral("Type is not instantiable"));
1214+
1215 qmlRegisterSingletonType<UsersModel>(uri, 0, 1, "Users", users_provider);
1216 qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", QStringLiteral("Type is not instantiable"));
1217+
1218 qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider);
1219 }
1220
1221=== modified file 'plugins/LightDM/plugin.h'
1222--- plugins/IntegratedLightDM/plugin.h 2015-05-29 19:10:28 +0000
1223+++ plugins/LightDM/plugin.h 2016-07-06 19:43:31 +0000
1224@@ -1,5 +1,5 @@
1225 /*
1226- * Copyright (C) 2012,2013, 2015 Canonical, Ltd.
1227+ * Copyright (C) 2012,2013,2015 Canonical, Ltd.
1228 *
1229 * This program is free software; you can redistribute it and/or modify
1230 * it under the terms of the GNU General Public License as published by
1231@@ -15,13 +15,13 @@
1232 *
1233 */
1234
1235-#ifndef INTEGRATED_LIGHTDM_PLUGIN_H
1236-#define INTEGRATED_LIGHTDM_PLUGIN_H
1237+#ifndef LIGHTDM_PLUGIN_H
1238+#define LIGHTDM_PLUGIN_H
1239
1240 #include <QtQml/QQmlEngine>
1241 #include <QtQml/QQmlExtensionPlugin>
1242
1243-class IntegratedLightDMPlugin : public QQmlExtensionPlugin
1244+class PLUGIN_CLASSNAME : public QQmlExtensionPlugin
1245 {
1246 Q_OBJECT
1247 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
1248@@ -30,4 +30,4 @@
1249 void registerTypes(const char *uri) override;
1250 };
1251
1252-#endif /* INTEGRATED_LIGHTDM_PLUGIN_H */
1253+#endif /* LIGHTDM_PLUGIN_H */
1254
1255=== modified file 'plugins/Unity/Indicators/indicatorsmanager.cpp'
1256--- plugins/Unity/Indicators/indicatorsmanager.cpp 2016-03-29 03:47:39 +0000
1257+++ plugins/Unity/Indicators/indicatorsmanager.cpp 2016-07-06 19:43:31 +0000
1258@@ -291,7 +291,7 @@
1259 // The rest of the indicators respect their default profile (which is "phone", even on desktop PCs)
1260 if ((new_indicator->identifier() == QStringLiteral("indicator-session"))
1261 || (new_indicator->identifier() == QStringLiteral("indicator-power") && m_platform.isPC())) {
1262- new_indicator->setProfile(QStringLiteral("desktop"));
1263+ new_indicator->setProfile(m_profile.replace(QStringLiteral("phone"), QStringLiteral("desktop")));
1264 } else {
1265 new_indicator->setProfile(m_profile);
1266 }
1267
1268=== modified file 'qml/Components/Dialogs.qml'
1269--- qml/Components/Dialogs.qml 2016-06-01 19:35:04 +0000
1270+++ qml/Components/Dialogs.qml 2016-07-06 19:43:31 +0000
1271@@ -107,12 +107,12 @@
1272
1273 GlobalShortcut { // lock screen
1274 shortcut: Qt.Key_ScreenSaver
1275- onTriggered: lightDM.greeter.showGreeter()
1276+ onTriggered: LightDMService.greeter.showGreeter()
1277 }
1278
1279 GlobalShortcut { // lock screen
1280 shortcut: Qt.ControlModifier|Qt.AltModifier|Qt.Key_L
1281- onTriggered: lightDM.greeter.showGreeter()
1282+ onTriggered: LightDMService.greeter.showGreeter()
1283 }
1284
1285 QtObject {
1286@@ -137,8 +137,6 @@
1287 active: false
1288 }
1289
1290- LightDM {id: lightDM} // Provide backend access
1291-
1292 Component {
1293 id: logoutDialogComponent
1294 ShellDialog {
1295@@ -148,7 +146,7 @@
1296 Button {
1297 text: i18n.ctr("Button: Lock the system", "Lock")
1298 onClicked: {
1299- lightDM.greeter.showGreeter()
1300+ LightDMService.greeter.showGreeter()
1301 logoutDialog.hide();
1302 }
1303 }
1304
1305=== added file 'qml/Greeter/FullLightDMImpl.qml'
1306--- qml/Greeter/FullLightDMImpl.qml 1970-01-01 00:00:00 +0000
1307+++ qml/Greeter/FullLightDMImpl.qml 2016-07-06 19:43:31 +0000
1308@@ -0,0 +1,28 @@
1309+/*
1310+ * Copyright (C) 2015 Canonical, Ltd.
1311+ *
1312+ * This program is free software; you can redistribute it and/or modify
1313+ * it under the terms of the GNU General Public License as published by
1314+ * the Free Software Foundation; version 3.
1315+ *
1316+ * This program is distributed in the hope that it will be useful,
1317+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1318+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1319+ * GNU General Public License for more details.
1320+ *
1321+ * You should have received a copy of the GNU General Public License
1322+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1323+ */
1324+
1325+import QtQuick 2.4
1326+import LightDM.FullLightDM 0.1 as LightDM
1327+
1328+Item{
1329+ id: implementation
1330+
1331+ property var greeter: LightDM.Greeter
1332+ property var infographic: LightDM.Infographic
1333+ property var users: LightDM.Users
1334+ property var userRoles: LightDM.UserRoles
1335+
1336+}
1337
1338=== modified file 'qml/Greeter/Greeter.qml'
1339--- qml/Greeter/Greeter.qml 2016-06-27 18:44:00 +0000
1340+++ qml/Greeter/Greeter.qml 2016-07-06 19:43:31 +0000
1341@@ -23,6 +23,8 @@
1342 import Ubuntu.SystemImage 0.1
1343 import Unity.Launcher 0.1
1344 import Unity.Session 0.1
1345+
1346+import "." 0.1
1347 import "../Components"
1348
1349 Showable {
1350@@ -48,7 +50,7 @@
1351 readonly property bool hasLockedApp: lockedApp !== ""
1352
1353 property bool forcedUnlock
1354- readonly property bool locked: lightDM.greeter.active && !lightDM.greeter.authenticated && !forcedUnlock
1355+ readonly property bool locked: LightDMService.greeter.active && !LightDMService.greeter.authenticated && !forcedUnlock
1356
1357 property bool tabletMode
1358 property url viewSource // only used for testing
1359@@ -69,11 +71,14 @@
1360 d.isLockscreen = true;
1361 }
1362 forcedUnlock = false;
1363- if (!required) {
1364- showNow(); // loader.onLoaded will select a user
1365- } else {
1366+ if (required) {
1367+ // Normally loader.onLoaded will select a user, but if we're
1368+ // already shown, do it manually.
1369 d.selectUser(d.currentIndex, true);
1370 }
1371+ // Even though we may already be shown, we want to call show() for its
1372+ // possible side effects, like hiding indicators and such.
1373+ showNow();
1374 }
1375
1376 function notifyAppFocusRequested(appId) {
1377@@ -120,12 +125,12 @@
1378 return d.startUnlock(true /* toTheRight */);
1379 }
1380
1381- LightDM{id:lightDM} // Provide backend access
1382 QtObject {
1383 id: d
1384
1385- readonly property bool multiUser: lightDM.users.count > 1
1386- property int currentIndex
1387+ readonly property bool multiUser: LightDMService.users.count > 1
1388+ readonly property int selectUserIndex: d.getUserIndex(LightDMService.greeter.selectUser)
1389+ property int currentIndex: Math.max(selectUserIndex, 0)
1390 property bool waiting
1391 property bool isLockscreen // true when we are locking an active session, rather than first user login
1392 readonly property bool secureFingerprint: isLockscreen &&
1393@@ -147,21 +152,37 @@
1394 UbuntuNumberAnimation {}
1395 }
1396
1397+ function getUserIndex(username) {
1398+ if (username === "")
1399+ return -1;
1400+
1401+ // Find index for requested user, if it exists
1402+ for (var i = 0; i < LightDMService.users.count; i++) {
1403+ if (username === LightDMService.users.data(i, LightDMService.userRoles.NameRole)) {
1404+ return i;
1405+ }
1406+ }
1407+
1408+ return -1;
1409+ }
1410+
1411 function selectUser(uid, reset) {
1412+ if (uid < 0)
1413+ return;
1414 d.waiting = true;
1415 if (reset) {
1416 loader.item.reset();
1417 }
1418 currentIndex = uid;
1419- var user = lightDM.users.data(uid, lightDM.userRoles.NameRole);
1420+ var user = LightDMService.users.data(uid, LightDMService.userRoles.NameRole);
1421 AccountsService.user = user;
1422 LauncherModel.setUser(user);
1423- lightDM.greeter.authenticate(user); // always resets auth state
1424+ LightDMService.greeter.authenticate(user); // always resets auth state
1425 }
1426
1427 function login() {
1428 enabled = false;
1429- if (lightDM.greeter.startSessionSync()) {
1430+ if (LightDMService.greeter.startSessionSync()) {
1431 sessionStarted();
1432 if (loader.item) {
1433 loader.item.notifyAuthenticationSucceeded(false /* showFakePassword */);
1434@@ -307,7 +328,7 @@
1435 root.lockedApp = "";
1436 root.forceActiveFocus();
1437 d.selectUser(d.currentIndex, true);
1438- lightDM.infographic.readyForDataChange();
1439+ LightDMService.infographic.readyForDataChange();
1440 }
1441
1442 Connections {
1443@@ -315,13 +336,12 @@
1444 onSelected: {
1445 d.selectUser(index, true);
1446 }
1447+ onPromptlessLogin: d.login();
1448 onResponded: {
1449 if (root.locked) {
1450- lightDM.greeter.respond(response);
1451+ LightDMService.greeter.respond(response);
1452 } else {
1453- if (lightDM.greeter.active && !lightDM.greeter.authenticated) { // could happen if forcedUnlock
1454- d.login();
1455- }
1456+ d.login();
1457 loader.item.hide();
1458 }
1459 }
1460@@ -385,18 +405,18 @@
1461 Binding {
1462 target: loader.item
1463 property: "userModel"
1464- value: lightDM.users
1465+ value: LightDMService.users
1466 }
1467
1468 Binding {
1469 target: loader.item
1470 property: "infographicModel"
1471- value: lightDM.infographic
1472+ value: LightDMService.infographic
1473 }
1474 }
1475
1476 Connections {
1477- target: lightDM.greeter
1478+ target: LightDMService.greeter
1479
1480 onShowGreeter: root.forceShow()
1481
1482@@ -431,13 +451,13 @@
1483 onAuthenticationComplete: {
1484 d.waiting = false;
1485
1486- if (lightDM.greeter.authenticated) {
1487- d.login();
1488- if (!lightDM.greeter.promptless) {
1489+ if (LightDMService.greeter.authenticated) {
1490+ if (!LightDMService.greeter.promptless) {
1491+ d.login();
1492 loader.item.hide();
1493 }
1494 } else {
1495- if (!lightDM.greeter.promptless) {
1496+ if (!LightDMService.greeter.promptless) {
1497 AccountsService.failedLogins++;
1498 }
1499
1500@@ -458,21 +478,13 @@
1501 }
1502
1503 loader.item.notifyAuthenticationFailed();
1504- if (!lightDM.greeter.promptless) {
1505+ if (!LightDMService.greeter.promptless) {
1506 d.selectUser(d.currentIndex, false);
1507 }
1508 }
1509 }
1510
1511- onRequestAuthenticationUser: {
1512- // Find index for requested user, if it exists
1513- for (var i = 0; i < lightDM.users.count; i++) {
1514- if (user === lightDM.users.data(i, lightDM.userRoles.NameRole)) {
1515- d.selectUser(i, true);
1516- return;
1517- }
1518- }
1519- }
1520+ onRequestAuthenticationUser: d.selectUser(d.getUserIndex(user), true)
1521 }
1522
1523 Connections {
1524@@ -485,20 +497,20 @@
1525 }
1526
1527 Binding {
1528- target: lightDM.greeter
1529+ target: LightDMService.greeter
1530 property: "active"
1531 value: root.active
1532 }
1533
1534 Binding {
1535- target: lightDM.infographic
1536+ target: LightDMService.infographic
1537 property: "username"
1538- value: AccountsService.statsWelcomeScreen ? lightDM.users.data(d.currentIndex, lightDM.userRoles.NameRole) : ""
1539+ value: AccountsService.statsWelcomeScreen ? LightDMService.users.data(d.currentIndex, LightDMService.userRoles.NameRole) : ""
1540 }
1541
1542 Connections {
1543 target: i18n
1544- onLanguageChanged: lightDM.infographic.readyForDataChange()
1545+ onLanguageChanged: LightDMService.infographic.readyForDataChange()
1546 }
1547
1548 Observer {
1549@@ -550,7 +562,7 @@
1550 failOperation("fingerprint reader is locked");
1551 return;
1552 }
1553- if (result !== lightDM.users.data(d.currentIndex, lightDM.userRoles.UidRole)) {
1554+ if (result !== LightDMService.users.data(d.currentIndex, LightDMService.userRoles.UidRole)) {
1555 AccountsService.failedFingerprintLogins++;
1556 failOperation("not the selected user");
1557 return;
1558
1559=== modified file 'qml/Greeter/IntegratedLightDMImpl.qml'
1560--- qml/Greeter/IntegratedLightDMImpl.qml 2015-09-02 07:42:27 +0000
1561+++ qml/Greeter/IntegratedLightDMImpl.qml 2016-07-06 19:43:31 +0000
1562@@ -15,7 +15,7 @@
1563 */
1564
1565 import QtQuick 2.4
1566-import IntegratedLightDM 0.1 as LightDM
1567+import LightDM.IntegratedLightDM 0.1 as LightDM
1568
1569 Item{
1570 id: implementation
1571
1572=== renamed file 'qml/Greeter/LightDM.qml' => 'qml/Greeter/LightDMService.qml'
1573--- qml/Greeter/LightDM.qml 2015-09-02 07:42:27 +0000
1574+++ qml/Greeter/LightDMService.qml 2016-07-06 19:43:31 +0000
1575@@ -19,6 +19,7 @@
1576 * plugin
1577 */
1578
1579+pragma Singleton
1580 import QtQuick 2.4
1581
1582 Loader {
1583@@ -29,13 +30,23 @@
1584 property var users: d.valid ? loader.item.users : null
1585 property var userRoles: d.valid ? loader.item.userRoles : null
1586
1587- // TODO: Conditionally load RealLightDMImpl if shellMode dictates it
1588- source: "./IntegratedLightDMImpl.qml"
1589+ // This trickery handles cases where applicationArguments aren't provided
1590+ // such as during testing
1591+ property var fullLightDM: {
1592+ if (typeof applicationArguments !== "undefined") {
1593+ if (applicationArguments.mode === "greeter") {
1594+ return true;
1595+ }
1596+ }
1597+ return false;
1598+ }
1599+
1600+ source: fullLightDM ?
1601+ "FullLightDMImpl.qml" : "IntegratedLightDMImpl.qml"
1602
1603 QtObject {
1604 id: d
1605
1606 property bool valid: loader.item !== null
1607 }
1608-
1609 }
1610
1611=== modified file 'qml/Greeter/LoginList.qml'
1612--- qml/Greeter/LoginList.qml 2016-05-31 13:16:03 +0000
1613+++ qml/Greeter/LoginList.qml 2016-07-06 19:43:31 +0000
1614@@ -36,6 +36,7 @@
1615
1616 signal selected(int index)
1617 signal responded(string response)
1618+ signal promptlessLogin()
1619
1620 function tryToUnlock() {
1621 if (wasPrompted) {
1622@@ -44,6 +45,7 @@
1623 if (root.locked) {
1624 root.selected(currentIndex);
1625 } else {
1626+ promptlessLogin();
1627 root.responded("");
1628 }
1629 }
1630
1631=== modified file 'qml/Greeter/WideView.qml'
1632--- qml/Greeter/WideView.qml 2016-06-18 22:37:48 +0000
1633+++ qml/Greeter/WideView.qml 2016-07-06 19:43:31 +0000
1634@@ -37,6 +37,7 @@
1635 // so that it can be replaced in tests with a mock object
1636 property var inputMethod: Qt.inputMethod
1637
1638+ signal promptlessLogin()
1639 signal selected(int index)
1640 signal responded(string response)
1641 signal tease()
1642@@ -132,6 +133,7 @@
1643
1644 locked: root.locked
1645
1646+ onPromptlessLogin: root.promptlessLogin()
1647 onSelected: root.selected(index)
1648 onResponded: root.responded(response)
1649 }
1650
1651=== added file 'qml/Greeter/qmldir'
1652--- qml/Greeter/qmldir 1970-01-01 00:00:00 +0000
1653+++ qml/Greeter/qmldir 2016-07-06 19:43:31 +0000
1654@@ -0,0 +1,1 @@
1655+singleton LightDMService 0.1 LightDMService.qml
1656
1657=== modified file 'qml/Shell.qml'
1658--- qml/Shell.qml 2016-07-05 09:57:08 +0000
1659+++ qml/Shell.qml 2016-07-06 19:43:31 +0000
1660@@ -175,7 +175,6 @@
1661 finishStartUpTimer.start();
1662 }
1663
1664- LightDM{id: lightDM} // Provide backend access
1665 VolumeControl {
1666 id: volumeControl
1667 indicators: panel.indicators
1668@@ -260,8 +259,8 @@
1669 ? "phone"
1670 : shell.usageScenario
1671 readonly property string qmlComponent: {
1672- if(shell.mode === "greeter") {
1673- return "Stages/ShimStage.qml"
1674+ if (shell.mode === "greeter") {
1675+ return "Stages/AbstractStage.qml"
1676 } else if (applicationsDisplayLoader.usageScenario === "phone") {
1677 return "Stages/PhoneStage.qml";
1678 } else if (applicationsDisplayLoader.usageScenario === "tablet") {
1679@@ -502,7 +501,7 @@
1680 function showHome() {
1681 greeter.notifyUserRequestedApp("unity8-dash");
1682
1683- var animate = !lightDM.greeter.active && !stages.shown
1684+ var animate = !LightDMService.greeter.active && !stages.shown
1685 dash.setCurrentScope(0, animate, false)
1686 ApplicationManager.requestFocusApplication("unity8-dash")
1687 }
1688@@ -541,7 +540,12 @@
1689
1690 indicatorsModel: Indicators.IndicatorsModel {
1691 // tablet and phone both use the same profile
1692- profile: "phone"
1693+ // FIXME: use just "phone" for greeter too, but first fix
1694+ // greeter app launching to either load the app inside the
1695+ // greeter or tell the session to load the app. This will
1696+ // involve taking the url-dispatcher dbus name and using
1697+ // SessionBroadcast to tell the session.
1698+ profile: shell.mode === "greeter" ? "desktop_greeter" : "phone"
1699 Component.onCompleted: load();
1700 }
1701 }
1702@@ -553,7 +557,7 @@
1703 readonly property bool focusedSurfaceIsFullscreen: MirFocusController.focusedSurface
1704 ? MirFocusController.focusedSurface.state === Mir.FullscreenState
1705 : false
1706- fullscreenMode: (focusedSurfaceIsFullscreen && !lightDM.greeter.active && launcher.progress == 0)
1707+ fullscreenMode: (focusedSurfaceIsFullscreen && !LightDMService.greeter.active && launcher.progress == 0)
1708 || greeter.hasLockedApp
1709 locked: greeter && greeter.active
1710 }
1711@@ -671,6 +675,7 @@
1712 id: wizard
1713 objectName: "wizard"
1714 anchors.fill: parent
1715+ deferred: shell.mode === "greeter"
1716
1717 function unlockWhenDoneWithWizard() {
1718 if (!active) {
1719
1720=== removed file 'qml/Stages/ShimStage.qml'
1721--- qml/Stages/ShimStage.qml 2016-04-14 13:28:11 +0000
1722+++ qml/Stages/ShimStage.qml 1970-01-01 00:00:00 +0000
1723@@ -1,43 +0,0 @@
1724-/*
1725- * Copyright (C) 2015 Canonical, Ltd.
1726- *
1727- * This program is free software; you can redistribute it and/or modify
1728- * it under the terms of the GNU General Public License as published by
1729- * the Free Software Foundation; version 3.
1730- *
1731- * This program is distributed in the hope that it will be useful,
1732- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1733- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1734- * GNU General Public License for more details.
1735- *
1736- * You should have received a copy of the GNU General Public License
1737- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1738- */
1739-
1740-import QtQuick 2.4
1741-import Ubuntu.Components 1.3
1742-
1743-AbstractStage {
1744- id: shimStage
1745-
1746- anchors.fill: parent
1747-
1748- Text {
1749- id: greeterModeText
1750-
1751- anchors.horizontalCenter: parent.horizontalCenter
1752- anchors.top: parent.top
1753- anchors.topMargin: units.gu(10)
1754- font.bold: true
1755- horizontalAlignment: Text.AlignHCenter
1756- text: "Shell is in \"greeter\" mode"
1757- }
1758-
1759- Text {
1760- anchors.centerIn: parent
1761- color: UbuntuColors.orange
1762- font.pointSize: units.gu(8)
1763- horizontalAlignment: Text.AlignHCenter
1764- text: "Shim \nStage"
1765- }
1766-}
1767
1768=== modified file 'qml/Wizard/Wizard.qml'
1769--- qml/Wizard/Wizard.qml 2016-03-29 03:47:39 +0000
1770+++ qml/Wizard/Wizard.qml 2016-07-06 19:43:31 +0000
1771@@ -1,5 +1,5 @@
1772 /*
1773- * Copyright (C) 2013 Canonical, Ltd.
1774+ * Copyright (C) 2013, 2015 Canonical, Ltd.
1775 *
1776 * This program is free software; you can redistribute it and/or modify
1777 * it under the terms of the GNU General Public License as published by
1778@@ -29,6 +29,10 @@
1779 // expected behavior of no emission on startup.
1780 readonly property bool active: loader.active
1781
1782+ // The wizard should be run at a later time if, for example, unity8 is
1783+ // in greeter mode
1784+ property bool deferred: false
1785+
1786 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
1787
1788 onRequiredChanged: {
1789@@ -40,7 +44,7 @@
1790 Loader {
1791 id: loader
1792 anchors.fill: parent
1793- active: System.wizardEnabled
1794+ active: System.wizardEnabled && !deferred
1795 source: "Pages.qml"
1796
1797 Connections {
1798
1799=== modified file 'src/ShellApplication.cpp'
1800--- src/ShellApplication.cpp 2016-04-28 12:06:22 +0000
1801+++ src/ShellApplication.cpp 2016-07-06 19:43:31 +0000
1802@@ -18,6 +18,7 @@
1803
1804 // Qt
1805 #include <QLibrary>
1806+#include <QProcess>
1807 #include <QScreen>
1808
1809 #include <libintl.h>
1810@@ -110,7 +111,16 @@
1811 m_secondaryWindow->setVisible(true);
1812 }
1813
1814- if (isMirServer || parser.hasFullscreen()) {
1815+ if (parser.mode().compare("greeter") == 0) {
1816+ QSize primaryScreenSize = this->primaryScreen()->size();
1817+ m_shellView->setHeight(primaryScreenSize.height());
1818+ m_shellView->setWidth(primaryScreenSize.width());
1819+ m_shellView->show();
1820+ m_shellView->requestActivate();
1821+ if (!QProcess::startDetached("/sbin/initctl emit --no-wait unity8-greeter-started")) {
1822+ qDebug() << "Unable to send unity8-greeter-started event to Upstart";
1823+ }
1824+ } else if (isMirServer || parser.hasFullscreen()) {
1825 m_shellView->showFullScreen();
1826 } else {
1827 m_shellView->show();
1828
1829=== modified file 'tests/CMakeLists.txt'
1830--- tests/CMakeLists.txt 2016-06-21 14:23:49 +0000
1831+++ tests/CMakeLists.txt 2016-07-06 19:43:31 +0000
1832@@ -47,7 +47,7 @@
1833 if(U8TEST_LIGHTDM)
1834 list(APPEND ld_paths
1835 ${UNITY_MOCKPATH}/libusermetrics
1836- ${UNITY_MOCKPATH}/IntegratedLightDM/liblightdm
1837+ ${UNITY_MOCKPATH}/LightDM/IntegratedLightDM/liblightdm
1838 )
1839 endif()
1840
1841
1842=== modified file 'tests/autopilot/unity8/fixture_setup.py'
1843--- tests/autopilot/unity8/fixture_setup.py 2015-10-19 14:16:23 +0000
1844+++ tests/autopilot/unity8/fixture_setup.py 2016-07-06 19:43:31 +0000
1845@@ -74,7 +74,7 @@
1846 def _get_lightdm_mock_path(self):
1847 lib_path = get_mocks_library_path()
1848 lightdm_mock_path = os.path.abspath(
1849- os.path.join(lib_path, "IntegratedLightDM", "liblightdm")
1850+ os.path.join(lib_path, "LightDM" ,"IntegratedLightDM", "liblightdm")
1851 )
1852
1853 if not os.path.exists(lightdm_mock_path):
1854
1855=== modified file 'tests/autopilot/unity8/greeter/tests/test_args.py'
1856--- tests/autopilot/unity8/greeter/tests/test_args.py 2015-07-06 12:52:08 +0000
1857+++ tests/autopilot/unity8/greeter/tests/test_args.py 2016-07-06 19:43:31 +0000
1858@@ -35,11 +35,6 @@
1859 shell = self.get_shell(unity_proxy)
1860 self.assertTrue(shell.mode == 'full-shell')
1861
1862- def test_greeter_mode(self):
1863- unity_proxy = self.launch_unity(mode='greeter')
1864- shell = self.get_shell(unity_proxy)
1865- self.assertTrue(shell.mode == 'greeter')
1866-
1867 def test_nonexistent_mode(self):
1868 unity_proxy = self.launch_unity(mode=self.NONEXISTENT_MODE)
1869 shell = self.get_shell(unity_proxy)
1870
1871=== modified file 'tests/autopilot/unity8/shell/tests/__init__.py'
1872--- tests/autopilot/unity8/shell/tests/__init__.py 2015-10-19 14:16:23 +0000
1873+++ tests/autopilot/unity8/shell/tests/__init__.py 2016-07-06 19:43:31 +0000
1874@@ -261,7 +261,7 @@
1875 def _get_lightdm_mock_path(self):
1876 lib_path = get_mocks_library_path()
1877 lightdm_mock_path = os.path.abspath(
1878- os.path.join(lib_path, "IntegratedLightDM", "liblightdm")
1879+ os.path.join(lib_path, "LightDM" ,"IntegratedLightDM", "liblightdm")
1880 )
1881
1882 if not os.path.exists(lightdm_mock_path):
1883
1884=== modified file 'tests/mocks/CMakeLists.txt'
1885--- tests/mocks/CMakeLists.txt 2016-05-03 13:41:11 +0000
1886+++ tests/mocks/CMakeLists.txt 2016-07-06 19:43:31 +0000
1887@@ -34,7 +34,7 @@
1888 add_subdirectory(GSettings.1.0)
1889 add_subdirectory(indicator-service)
1890 add_subdirectory(libusermetrics)
1891-add_subdirectory(IntegratedLightDM)
1892+add_subdirectory(LightDM)
1893 add_subdirectory(Lights)
1894 add_subdirectory(MeeGo)
1895 add_subdirectory(Powerd)
1896
1897=== renamed directory 'tests/mocks/IntegratedLightDM' => 'tests/mocks/LightDM'
1898=== added file 'tests/mocks/LightDM/CMakeLists.txt'
1899--- tests/mocks/LightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000
1900+++ tests/mocks/LightDM/CMakeLists.txt 2016-07-06 19:43:31 +0000
1901@@ -0,0 +1,1 @@
1902+add_subdirectory(IntegratedLightDM)
1903
1904=== added directory 'tests/mocks/LightDM/IntegratedLightDM'
1905=== renamed file 'tests/mocks/IntegratedLightDM/CMakeLists.txt' => 'tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt'
1906--- tests/mocks/IntegratedLightDM/CMakeLists.txt 2015-06-17 21:59:31 +0000
1907+++ tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt 2016-07-06 19:43:31 +0000
1908@@ -10,18 +10,20 @@
1909 ${CMAKE_CURRENT_SOURCE_DIR}
1910 ${CMAKE_CURRENT_BINARY_DIR}
1911 ${CMAKE_SOURCE_DIR}/plugins/Utils
1912- ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
1913+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
1914 ${CMAKE_SOURCE_DIR}/tests/mocks/libusermetrics
1915 ${libunity8-private_SOURCE_DIR}
1916 )
1917
1918 set(QMLPLUGIN_SRC
1919- ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/DBusGreeter.cpp
1920- ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/DBusGreeterList.cpp
1921- ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/Greeter.cpp
1922- ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/UsersModel.cpp
1923+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeter.cpp
1924+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeterList.cpp
1925+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
1926+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/SessionsModel.cpp
1927+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
1928 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
1929 MockGreeter.cpp
1930+ MockSessionsModel.cpp
1931 MockUsersModel.cpp
1932 plugin.cpp
1933 )
1934@@ -30,7 +32,7 @@
1935 ${QMLPLUGIN_SRC}
1936 )
1937
1938-# We want to link to liblightdm-qt5-2, but we don't want to depend on it being
1939+# We want to link to liblightdm-qt5-3, but we don't want to depend on it being
1940 # installed on the system. So we make sure we link to our full fake version
1941 # At run time, we can point to whichever version we happen to be using via
1942 # LD_LIBRARY_PATH.
1943@@ -42,7 +44,7 @@
1944
1945 qt5_use_modules(MockLightDM-qml DBus Gui Qml)
1946
1947-add_unity8_mock(IntegratedLightDM 0.1 IntegratedLightDM
1948+add_unity8_mock(LightDM.IntegratedLightDM 0.1 LightDM/IntegratedLightDM
1949 PREFIX mocks
1950 TARGETS MockLightDM-qml
1951 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/liblightdm"
1952
1953=== renamed file 'tests/mocks/IntegratedLightDM/MockGreeter.cpp' => 'tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp'
1954--- tests/mocks/IntegratedLightDM/MockGreeter.cpp 2015-01-20 11:50:19 +0000
1955+++ tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp 2016-07-06 19:43:31 +0000
1956@@ -33,3 +33,19 @@
1957 Q_EMIT mockModeChanged(mockMode);
1958 }
1959 }
1960+
1961+QString MockGreeter::selectUserHint() const
1962+{
1963+ Q_D(const Greeter);
1964+ return d->m_greeter->selectUserHint();
1965+}
1966+
1967+void MockGreeter::setSelectUserHint(const QString &selectUserHint)
1968+{
1969+ Q_D(Greeter);
1970+
1971+ if (d->m_greeter->selectUserHint() != selectUserHint) {
1972+ d->m_greeter->setSelectUserHint(selectUserHint);
1973+ Q_EMIT selectUserHintChanged();
1974+ }
1975+}
1976
1977=== renamed file 'tests/mocks/IntegratedLightDM/MockGreeter.h' => 'tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h'
1978--- tests/mocks/IntegratedLightDM/MockGreeter.h 2015-01-20 11:50:19 +0000
1979+++ tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h 2016-07-06 19:43:31 +0000
1980@@ -25,13 +25,18 @@
1981 Q_OBJECT
1982
1983 Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
1984+ Q_PROPERTY(QString selectUser READ selectUserHint WRITE setSelectUserHint NOTIFY selectUserHintChanged)
1985
1986 public:
1987 QString mockMode() const;
1988 void setMockMode(QString mockMode);
1989
1990+ QString selectUserHint() const;
1991+ void setSelectUserHint(const QString &selectUserHint);
1992+
1993 Q_SIGNALS:
1994 void mockModeChanged(QString mode);
1995+ void selectUserHintChanged();
1996 };
1997
1998 #endif // MOCK_UNITY_GREETER_H
1999
2000=== added file 'tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp'
2001--- tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp 1970-01-01 00:00:00 +0000
2002+++ tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp 2016-07-06 19:43:31 +0000
2003@@ -0,0 +1,37 @@
2004+/*
2005+ * Copyright (C) 2015 Canonical, Ltd.
2006+ *
2007+ * This program is free software; you can redistribute it and/or modify
2008+ * it under the terms of the GNU General Public License as published by
2009+ * the Free Software Foundation; version 3.
2010+ *
2011+ * This program is distributed in the hope that it will be useful,
2012+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2013+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2014+ * GNU General Public License for more details.
2015+ *
2016+ * You should have received a copy of the GNU General Public License
2017+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2018+ *
2019+ */
2020+
2021+#include "MockSessionsModel.h"
2022+#include <QLightDM/SessionsModel>
2023+
2024+QString MockSessionsModel::testScenario() const
2025+{
2026+ QLightDM::SessionsModel* qSessionsModel =
2027+ static_cast<QLightDM::SessionsModel*>(sourceModel());
2028+
2029+ return qSessionsModel->testScenario();
2030+}
2031+
2032+void MockSessionsModel::setTestScenario(const QString testScenario)
2033+{
2034+ QLightDM::SessionsModel* qSessionsModel =
2035+ static_cast<QLightDM::SessionsModel*>(sourceModel());
2036+
2037+ if (qSessionsModel->testScenario() != testScenario) {
2038+ qSessionsModel->setTestScenario(testScenario);
2039+ }
2040+}
2041
2042=== added file 'tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h'
2043--- tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h 1970-01-01 00:00:00 +0000
2044+++ tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h 2016-07-06 19:43:31 +0000
2045@@ -0,0 +1,34 @@
2046+/*
2047+ * Copyright (C) 2015 Canonical, Ltd.
2048+ *
2049+ * This program is free software; you can redistribute it and/or modify
2050+ * it under the terms of the GNU General Public License as published by
2051+ * the Free Software Foundation; version 3.
2052+ *
2053+ * This program is distributed in the hope that it will be useful,
2054+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2055+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2056+ * GNU General Public License for more details.
2057+ *
2058+ * You should have received a copy of the GNU General Public License
2059+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2060+ *
2061+ */
2062+
2063+#ifndef MOCK_UNITY_SESSIONSMODEL_H
2064+#define MOCK_UNITY_SESSIONSMODEL_H
2065+
2066+#include <SessionsModel.h>
2067+
2068+class MockSessionsModel : public SessionsModel
2069+{
2070+ Q_OBJECT
2071+
2072+ Q_PROPERTY(QString testScenario READ testScenario WRITE setTestScenario)
2073+
2074+public:
2075+ QString testScenario() const;
2076+ void setTestScenario(QString testScenario);
2077+};
2078+
2079+#endif // MOCK_UNITY_SESSIONSMODEL_H
2080
2081=== renamed file 'tests/mocks/IntegratedLightDM/MockUsersModel.cpp' => 'tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp'
2082=== renamed file 'tests/mocks/IntegratedLightDM/MockUsersModel.h' => 'tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h'
2083=== renamed directory 'tests/mocks/IntegratedLightDM/QLightDM' => 'tests/mocks/LightDM/IntegratedLightDM/QLightDM'
2084=== added file 'tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel'
2085--- tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel 1970-01-01 00:00:00 +0000
2086+++ tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel 2016-07-06 19:43:31 +0000
2087@@ -0,0 +1,17 @@
2088+/*
2089+ * Copyright (C) 2015 Canonical, Ltd.
2090+ *
2091+ * This program is free software; you can redistribute it and/or modify
2092+ * it under the terms of the GNU General Public License as published by
2093+ * the Free Software Foundation; version 3.
2094+ *
2095+ * This program is distributed in the hope that it will be useful,
2096+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2097+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2098+ * GNU General Public License for more details.
2099+ *
2100+ * You should have received a copy of the GNU General Public License
2101+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2102+ */
2103+
2104+#include "../liblightdm/SessionsModel.h"
2105
2106=== renamed directory 'tests/mocks/IntegratedLightDM/liblightdm' => 'tests/mocks/LightDM/IntegratedLightDM/liblightdm'
2107=== modified file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt'
2108--- tests/mocks/IntegratedLightDM/liblightdm/CMakeLists.txt 2015-09-21 12:14:55 +0000
2109+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt 2016-07-06 19:43:31 +0000
2110@@ -1,7 +1,9 @@
2111 set(LibLightDM_SOURCES
2112 Greeter.cpp
2113+ SessionsModel.cpp
2114 UsersModel.cpp
2115 GreeterPrivate.cpp
2116+ SessionsModelPrivate.cpp
2117 UsersModelPrivate.cpp
2118 ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
2119 )
2120@@ -11,8 +13,8 @@
2121 qt5_use_modules(MockLightDM Gui)
2122
2123 set_target_properties(MockLightDM PROPERTIES
2124- OUTPUT_NAME lightdm-qt5-2)
2125+ OUTPUT_NAME lightdm-qt5-3)
2126
2127 install(TARGETS MockLightDM
2128- DESTINATION ${SHELL_INSTALL_QML}/mocks/IntegratedLightDM/liblightdm
2129+ DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/liblightdm
2130 )
2131
2132=== modified file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp'
2133--- tests/mocks/IntegratedLightDM/liblightdm/Greeter.cpp 2015-08-19 14:24:07 +0000
2134+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp 2016-07-06 19:43:31 +0000
2135@@ -51,7 +51,7 @@
2136
2137 QString Greeter::defaultSessionHint() const
2138 {
2139- return "ubuntu";
2140+ return QStringLiteral("ubuntu");
2141 }
2142
2143 bool Greeter::hideUsersHint() const
2144@@ -76,7 +76,14 @@
2145
2146 QString Greeter::selectUserHint() const
2147 {
2148- return "";
2149+ Q_D(const Greeter);
2150+ return d->selectUserHint;
2151+}
2152+
2153+void Greeter::setSelectUserHint(const QString &selectUserHint)
2154+{
2155+ Q_D(Greeter);
2156+ d->selectUserHint = selectUserHint;
2157 }
2158
2159 bool Greeter::selectGuestHint() const
2160
2161=== modified file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.h'
2162--- tests/mocks/IntegratedLightDM/liblightdm/Greeter.h 2015-02-20 15:30:19 +0000
2163+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.h 2016-07-06 19:43:31 +0000
2164@@ -70,6 +70,7 @@
2165 bool lockHint () const;
2166 bool hasGuestAccountHint() const;
2167 QString selectUserHint() const;
2168+ void setSelectUserHint(const QString &selectUserHint); // only in mock
2169 bool selectGuestHint() const;
2170 QString autologinUserHint() const;
2171 bool autologinGuestHint() const;
2172
2173=== modified file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h'
2174--- tests/mocks/IntegratedLightDM/liblightdm/GreeterPrivate.h 2016-05-26 13:15:35 +0000
2175+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h 2016-07-06 19:43:31 +0000
2176@@ -34,6 +34,7 @@
2177 bool authenticated;
2178 QString authenticationUser;
2179 bool twoFactorDone;
2180+ QString selectUserHint;
2181
2182 QString mockMode;
2183
2184
2185=== added file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp'
2186--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp 1970-01-01 00:00:00 +0000
2187+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp 2016-07-06 19:43:31 +0000
2188@@ -0,0 +1,99 @@
2189+/*
2190+ * Copyright (C) 2015 Canonical, Ltd.
2191+ *
2192+ * This program is free software; you can redistribute it and/or modify
2193+ * it under the terms of the GNU General Public License as published by
2194+ * the Free Software Foundation; version 3.
2195+ *
2196+ * This program is distributed in the hope that it will be useful,
2197+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2198+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2199+ * GNU General Public License for more details.
2200+ *
2201+ * You should have received a copy of the GNU General Public License
2202+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2203+ *
2204+ */
2205+
2206+
2207+// LightDM currently is Qt4 compatible, and so doesn't define setRoleNames.
2208+// To use the same method of setting role name that it does, we
2209+// set our compatibility to Qt4 here too.
2210+#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0)
2211+
2212+#include "SessionsModel.h"
2213+#include "SessionsModelPrivate.h"
2214+#include <QtCore/QDir>
2215+#include <QtCore/QString>
2216+
2217+namespace QLightDM
2218+{
2219+
2220+SessionsModel::SessionsModel(QObject* parent) :
2221+ QAbstractListModel(parent),
2222+ d_ptr(new SessionsModelPrivate(this))
2223+{
2224+ Q_D(SessionsModel);
2225+ m_roleNames = QAbstractListModel::roleNames();
2226+ m_roleNames[KeyRole] = "key";
2227+ m_roleNames[TypeRole] = "type";
2228+}
2229+
2230+SessionsModel::~SessionsModel()
2231+{
2232+ delete d_ptr;
2233+}
2234+
2235+QVariant SessionsModel::data(const QModelIndex& index, int role) const
2236+{
2237+ Q_D(const SessionsModel);
2238+
2239+ if(!index.isValid()) {
2240+ return QVariant();
2241+ }
2242+
2243+ int row = index.row();
2244+
2245+ switch (role) {
2246+ case QLightDM::SessionsModel::KeyRole:
2247+ return d->sessionItems[row].key;
2248+ case Qt::DisplayRole:
2249+ return d->sessionItems[row].name;
2250+ default:
2251+ return QVariant();
2252+ }
2253+}
2254+
2255+QHash<int, QByteArray> SessionsModel::roleNames() const
2256+{
2257+ return m_roleNames;
2258+}
2259+
2260+int SessionsModel::rowCount(const QModelIndex& parent) const
2261+{
2262+ Q_D(const SessionsModel);
2263+
2264+ if (parent.isValid()) {
2265+ return 0;
2266+ } else { // parent is root
2267+ return d->sessionItems.size();
2268+ }
2269+}
2270+
2271+QString SessionsModel::testScenario() const
2272+{
2273+ Q_D(const SessionsModel);
2274+ return d->testScenario;
2275+}
2276+
2277+void SessionsModel::setTestScenario(QString testScenario)
2278+{
2279+ Q_D(SessionsModel);
2280+
2281+ if (d->testScenario != testScenario) {
2282+ d->testScenario = testScenario;
2283+ d->resetEntries();
2284+ }
2285+}
2286+
2287+} // namespace QLightDM
2288
2289=== added file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h'
2290--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h 1970-01-01 00:00:00 +0000
2291+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h 2016-07-06 19:43:31 +0000
2292@@ -0,0 +1,72 @@
2293+/*
2294+ * Copyright (C) 2015 Canonical, Ltd.
2295+ *
2296+ * This program is free software; you can redistribute it and/or modify
2297+ * it under the terms of the GNU General Public License as published by
2298+ * the Free Software Foundation; version 3.
2299+ *
2300+ * This program is distributed in the hope that it will be useful,
2301+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2302+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2303+ * GNU General Public License for more details.
2304+ *
2305+ * You should have received a copy of the GNU General Public License
2306+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2307+ *
2308+ */
2309+
2310+#ifndef UNITY_MOCK_SESSIONSMODEL_H
2311+#define UNITY_MOCK_SESSIONSMODEL_H
2312+
2313+#include <QtCore/QAbstractListModel>
2314+#include <QtCore/QString>
2315+
2316+namespace QLightDM
2317+{
2318+class SessionsModelPrivate;
2319+
2320+class Q_DECL_EXPORT SessionsModel : public QAbstractListModel
2321+ {
2322+ Q_OBJECT
2323+
2324+ Q_ENUMS(SessionModelRoles SessionType)
2325+
2326+ // Mock-only API for testing purposes
2327+ Q_PROPERTY(QString testScenario READ testScenario WRITE setTestScenario)
2328+
2329+ public:
2330+
2331+ enum SessionModelRoles {
2332+ //name is exposed as Qt::DisplayRole
2333+ //comment is exposed as Qt::TooltipRole
2334+ KeyRole = Qt::UserRole,
2335+ IdRole = KeyRole, /** Deprecated */
2336+ TypeRole
2337+ };
2338+
2339+ enum SessionType {
2340+ LocalSessions,
2341+ RemoteSessions
2342+ };
2343+
2344+ explicit SessionsModel(QObject* parent=nullptr); /** Deprecated. Loads local sessions*/
2345+ explicit SessionsModel(SessionsModel::SessionType, QObject* parent=nullptr);
2346+ virtual ~SessionsModel();
2347+
2348+ QHash<int, QByteArray> roleNames() const override;
2349+ int rowCount(const QModelIndex& parent) const override;
2350+ QVariant data(const QModelIndex& index, int role) const override;
2351+
2352+ QString testScenario() const;
2353+ void setTestScenario(QString testScenario);
2354+
2355+ protected:
2356+ SessionsModelPrivate* const d_ptr;
2357+
2358+ private:
2359+ QHash<int, QByteArray> m_roleNames;
2360+ Q_DECLARE_PRIVATE(SessionsModel)
2361+ };
2362+}
2363+
2364+#endif // UNITY_MOCK_SESSIONSMODEL_H
2365
2366=== added file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp'
2367--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 1970-01-01 00:00:00 +0000
2368+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 2016-07-06 19:43:31 +0000
2369@@ -0,0 +1,73 @@
2370+/*
2371+ * Copyright (C) 2015 Canonical, Ltd.
2372+ *
2373+ * This program is free software; you can redistribute it and/or modify
2374+ * it under the terms of the GNU General Public License as published by
2375+ * the Free Software Foundation; version 3.
2376+ *
2377+ * This program is distributed in the hope that it will be useful,
2378+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2379+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2380+ * GNU General Public License for more details.
2381+ *
2382+ * You should have received a copy of the GNU General Public License
2383+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2384+ */
2385+
2386+#include "SessionsModel.h"
2387+#include "SessionsModelPrivate.h"
2388+
2389+namespace QLightDM
2390+{
2391+
2392+SessionsModelPrivate::SessionsModelPrivate(SessionsModel* parent)
2393+ : testScenario("singleSession")
2394+ , q_ptr(parent)
2395+{
2396+ resetEntries();
2397+}
2398+
2399+void SessionsModelPrivate::resetEntries()
2400+{
2401+ Q_Q(SessionsModel);
2402+
2403+ q->beginResetModel();
2404+ if (testScenario == "multipleSessions") {
2405+ resetEntries_multipleSessions();
2406+ } else if (testScenario == "noSessions") {
2407+ resetEntries_noSessions();
2408+ } else {
2409+ resetEntries_singleSession();
2410+ }
2411+ q->endResetModel();
2412+}
2413+
2414+void SessionsModelPrivate::resetEntries_multipleSessions()
2415+{
2416+ sessionItems =
2417+ {
2418+ {"ubuntu", "", "Ubuntu", ""},
2419+ {"ubuntu-2d", "", "Ubuntu 2D", ""},
2420+ {"gnome", "", "GNOME", ""},
2421+ {"gnome-classic", "", "GNOME Classic", ""},
2422+ {"gnome-flashback-compiz", "", "GNOME Flashback (Compiz)", ""},
2423+ {"gnome-flashback-metacity", "", "GNOME Flashback (Metacity)", ""},
2424+ {"gnome-wayland", "", "GNOME on Wayland", ""},
2425+ {"plasma", "", "Plasma", ""},
2426+ {"kde", "", "KDE" , ""},
2427+ {"xterm", "", "Recovery Console", ""},
2428+ {"", "", "Unknown?", ""}
2429+ };
2430+}
2431+
2432+void SessionsModelPrivate::resetEntries_noSessions()
2433+{
2434+ sessionItems = {};
2435+}
2436+
2437+void SessionsModelPrivate::resetEntries_singleSession()
2438+{
2439+ sessionItems = {{"ubuntu", "", "Ubuntu", ""}};
2440+}
2441+
2442+} // namespace QLightDM
2443
2444=== added file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h'
2445--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 1970-01-01 00:00:00 +0000
2446+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 2016-07-06 19:43:31 +0000
2447@@ -0,0 +1,59 @@
2448+/*
2449+ * Copyright (C) 2015 Canonical, Ltd.
2450+ *
2451+ * This program is free software; you can redistribute it and/or modify
2452+ * it under the terms of the GNU General Public License as published by
2453+ * the Free Software Foundation; version 3.
2454+ *
2455+ * This program is distributed in the hope that it will be useful,
2456+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2457+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2458+ * GNU General Public License for more details.
2459+ *
2460+ * You should have received a copy of the GNU General Public License
2461+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2462+ *
2463+ */
2464+
2465+#ifndef UNITY_MOCK_SESSIONSMODEL_PRIVATE_H
2466+#define UNITY_MOCK_SESSIONSMODEL_PRIVATE_H
2467+
2468+#include <QtCore/QList>
2469+#include <QtCore/QString>
2470+
2471+namespace QLightDM
2472+{
2473+class SessionsModel;
2474+
2475+class SessionItem
2476+{
2477+public:
2478+ QString key;
2479+ QString type; // unused
2480+ QString name;
2481+ QString comment; // unused
2482+};
2483+
2484+class SessionsModelPrivate
2485+{
2486+public:
2487+ explicit SessionsModelPrivate(SessionsModel* parent=0);
2488+ virtual ~SessionsModelPrivate() = default;
2489+
2490+ QList<SessionItem> sessionItems;
2491+ QString testScenario;
2492+
2493+ void resetEntries();
2494+protected:
2495+ SessionsModel* const q_ptr;
2496+
2497+private:
2498+ void resetEntries_multipleSessions();
2499+ void resetEntries_noSessions();
2500+ void resetEntries_singleSession();
2501+ Q_DECLARE_PUBLIC(SessionsModel)
2502+};
2503+
2504+} // namespace QLightDM
2505+
2506+#endif // UNITY_MOCK_SESSIONSMODEL_PRIVATE_H
2507
2508=== modified file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp'
2509--- tests/mocks/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 2016-06-18 22:37:48 +0000
2510+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 2016-07-06 19:43:31 +0000
2511@@ -60,7 +60,7 @@
2512 {
2513 entries =
2514 {
2515- { "single", "Single User", 0, 0, false, false, 0, 0, 0 },
2516+ { "single", "Single User", 0, 0, false, false, "ubuntu", 0 },
2517 };
2518 }
2519
2520@@ -68,7 +68,7 @@
2521 {
2522 entries =
2523 {
2524- { "single", "Single User", 0, 0, false, false, 0, 0, 0 },
2525+ { "single", "Single User", 0, 0, false, false, "ubuntu", 0 },
2526 };
2527 }
2528
2529@@ -76,7 +76,7 @@
2530 {
2531 entries =
2532 {
2533- { "has-pin", "Has PIN", 0, 0, false, false, 0, 0, 0 },
2534+ { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
2535 };
2536 }
2537
2538@@ -84,26 +84,26 @@
2539 {
2540 entries =
2541 {
2542- { "has-password", "Has Password", 0, 0, false, false, 0, 0, 0 },
2543- { "has-pin", "Has PIN", 0, 0, false, false, 0, 0, 0 },
2544- { "different-prompt", "Different Prompt", 0, 0, false, false, 0, 0, 0 },
2545- { "no-password", "No Password", 0, 0, false, false, 0, 0, 0 },
2546- { "auth-error", "Auth Error", 0, 0, false, false, 0, 0, 0 },
2547- { "two-factor", "Two Factor", 0, 0, false, false, 0, 0, 0 },
2548- { "info-prompt", "Info Prompt", 0, 0, false, false, 0, 0, 0 },
2549- { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, 0, 0, 0 },
2550- { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, 0, 0, 0 },
2551- { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, 0, 0, 0 },
2552- { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, 0, 0, 0 },
2553- { "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, 0, 0, 0 },
2554- { "color-background", "Color Background", "#dd4814", 0, false, false, 0, 0, 0 },
2555+ { "has-password", "Has Password", 0, 0, false, false, "ubuntu", 0 },
2556+ { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
2557+ { "different-prompt", "Different Prompt", 0, 0, false, false, "ubuntu", 0 },
2558+ { "no-password", "No Password", 0, 0, false, false, "ubuntu", 0 },
2559+ { "auth-error", "Auth Error", 0, 0, false, false, "ubuntu", 0 },
2560+ { "two-factor", "Two Factor", 0, 0, false, false, "ubuntu", 0 },
2561+ { "info-prompt", "Info Prompt", 0, 0, false, false, "ubuntu", 0 },
2562+ { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, "ubuntu", 0 },
2563+ { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, "ubuntu", 0 },
2564+ { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, "ubuntu", 0 },
2565+ { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, "ubuntu", 0 },
2566+ { "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 },
2567+ { "color-background", "Color Background", "#dd4814", 0, false, false, "ubuntu", 0 },
2568 // white and black are a bit redundant, but useful for manually testing if UI is still readable
2569- { "white-background", "White Background", "#ffffff", 0, false, false, 0, 0, 0 },
2570- { "black-background", "Black Background", "#000000", 0, false, false, 0, 0, 0 },
2571- { "no-background", "No Background", "", 0, false, false, 0, 0, 0 },
2572- { "unicode", "가나다라마", 0, 0, false, false, 0, 0, 0 },
2573- { "no-response", "No Response", 0, 0, false, false, 0, 0, 0 },
2574- { "empty-name", "", 0, 0, false, false, 0, 0, 0 },
2575+ { "white-background", "White Background", "#ffffff", 0, false, false, "ubuntu", 0 },
2576+ { "black-background", "Black Background", "#000000", 0, false, false, "ubuntu", 0 },
2577+ { "no-background", "No Background", "", 0, false, false, "ubuntu", 0 },
2578+ { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 },
2579+ { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 },
2580+ { "empty-name", "", 0, 0, false, false, "ubuntu", 0 },
2581 };
2582 }
2583
2584
2585=== renamed file 'tests/mocks/IntegratedLightDM/plugin.cpp' => 'tests/mocks/LightDM/IntegratedLightDM/plugin.cpp'
2586--- tests/mocks/IntegratedLightDM/plugin.cpp 2015-05-22 17:29:52 +0000
2587+++ tests/mocks/LightDM/IntegratedLightDM/plugin.cpp 2016-07-06 19:43:31 +0000
2588@@ -18,9 +18,11 @@
2589 #include <DBusGreeter.h>
2590 #include <DBusGreeterList.h>
2591 #include "MockGreeter.h"
2592+#include "MockSessionsModel.h"
2593 #include "MockUsersModel.h"
2594-#include <libusermetricsoutput/ColorTheme.h>
2595-#include <libusermetricsoutput/UserMetrics.h>
2596+#include <QLightDM/SessionsModel>
2597+#include "ColorTheme.h"
2598+#include "UserMetrics.h"
2599 #include <QLightDM/UsersModel>
2600
2601 #include <QAbstractItemModel>
2602@@ -39,6 +41,13 @@
2603 return greeter;
2604 }
2605
2606+static QObject *sessions_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
2607+{
2608+ Q_UNUSED(engine)
2609+ Q_UNUSED(scriptEngine)
2610+ return new MockSessionsModel;
2611+}
2612+
2613 static QObject *users_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
2614 {
2615 Q_UNUSED(engine)
2616@@ -53,15 +62,17 @@
2617 return UserMetricsOutput::UserMetrics::getInstance();
2618 }
2619
2620-void IntegratedLightDMPlugin::registerTypes(const char *uri)
2621+void LightDMPlugin::registerTypes(const char *uri)
2622 {
2623 qmlRegisterType<QAbstractItemModel>();
2624 qmlRegisterType<UserMetricsOutput::ColorTheme>();
2625
2626- Q_ASSERT(uri == QLatin1String("IntegratedLightDM"));
2627+ Q_ASSERT(uri == QLatin1String("LightDM.IntegratedLightDM"));
2628 qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
2629 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
2630 qmlRegisterSingletonType<MockGreeter>(uri, 0, 1, "Greeter", greeter_provider);
2631+ qmlRegisterSingletonType<MockSessionsModel>(uri, 0, 1, "Sessions", sessions_provider);
2632+ qmlRegisterUncreatableType<SessionsModel>(uri, 0, 1, "SessionRoles", "Type is not instantiable");
2633 qmlRegisterSingletonType<MockUsersModel>(uri, 0, 1, "Users", users_provider);
2634 qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", "Type is not instantiable");
2635 qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider);
2636
2637=== renamed file 'tests/mocks/IntegratedLightDM/plugin.h' => 'tests/mocks/LightDM/IntegratedLightDM/plugin.h'
2638--- tests/mocks/IntegratedLightDM/plugin.h 2015-05-22 17:29:52 +0000
2639+++ tests/mocks/LightDM/IntegratedLightDM/plugin.h 2016-07-06 19:43:31 +0000
2640@@ -20,7 +20,7 @@
2641 #include <QtQml/QQmlEngine>
2642 #include <QtQml/QQmlExtensionPlugin>
2643
2644-class IntegratedLightDMPlugin : public QQmlExtensionPlugin
2645+class LightDMPlugin : public QQmlExtensionPlugin
2646 {
2647 Q_OBJECT
2648 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
2649
2650=== renamed file 'tests/mocks/IntegratedLightDM/qmldir' => 'tests/mocks/LightDM/IntegratedLightDM/qmldir'
2651--- tests/mocks/IntegratedLightDM/qmldir 2015-05-22 17:29:52 +0000
2652+++ tests/mocks/LightDM/IntegratedLightDM/qmldir 2016-07-06 19:43:31 +0000
2653@@ -1,3 +1,2 @@
2654-module IntegratedLightDM
2655+module LightDM.IntegratedLightDM
2656 plugin MockLightDM-qml
2657-typeinfo IntegratedLightDM.qmltypes
2658
2659=== removed symlink 'tests/mocks/libusermetrics/libusermetricsoutput/ColorTheme.h'
2660=== target was u'../ColorTheme.h'
2661=== removed symlink 'tests/mocks/libusermetrics/libusermetricsoutput/UserMetrics.h'
2662=== target was u'../UserMetrics.h'
2663=== modified file 'tests/plugins/CMakeLists.txt'
2664--- tests/plugins/CMakeLists.txt 2016-05-19 19:44:37 +0000
2665+++ tests/plugins/CMakeLists.txt 2016-07-06 19:43:31 +0000
2666@@ -3,7 +3,7 @@
2667 add_subdirectory(Dash)
2668 add_subdirectory(GlobalShortcut)
2669 add_subdirectory(Greeter)
2670-add_subdirectory(IntegratedLightDM)
2671+add_subdirectory(LightDM)
2672 add_subdirectory(Ubuntu)
2673 add_subdirectory(Unity)
2674 add_subdirectory(Utils)
2675
2676=== renamed directory 'tests/plugins/IntegratedLightDM' => 'tests/plugins/LightDM'
2677=== added file 'tests/plugins/LightDM/CMakeLists.txt'
2678--- tests/plugins/LightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000
2679+++ tests/plugins/LightDM/CMakeLists.txt 2016-07-06 19:43:31 +0000
2680@@ -0,0 +1,1 @@
2681+add_subdirectory(IntegratedLightDM)
2682
2683=== added directory 'tests/plugins/LightDM/IntegratedLightDM'
2684=== renamed file 'tests/plugins/IntegratedLightDM/CMakeLists.txt' => 'tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt'
2685--- tests/plugins/IntegratedLightDM/CMakeLists.txt 2016-04-19 20:36:29 +0000
2686+++ tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt 2016-07-06 19:43:31 +0000
2687@@ -8,19 +8,18 @@
2688
2689 add_executable(GreeterDBusTestExec
2690 dbus.cpp
2691- ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/Greeter.cpp
2692+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
2693 )
2694 # This add_dependencies is needed since we're linking with with -L and -l below
2695 # make seems to work but ninja breaks without it
2696 add_dependencies(GreeterDBusTestExec MockLightDM)
2697 qt5_use_modules(GreeterDBusTestExec Core DBus Quick Test)
2698 target_link_libraries(GreeterDBusTestExec
2699- -L${CMAKE_BINARY_DIR}/tests/mocks/IntegratedLightDM/liblightdm
2700- -llightdm-qt5-2
2701+ MockLightDM
2702 )
2703 target_include_directories(GreeterDBusTestExec PUBLIC
2704- ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
2705- ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
2706+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
2707+ ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
2708 )
2709 add_unity8_uitest(GreeterDBus dbus-test-runner
2710 ARG_PREFIX "--parameter"
2711@@ -32,20 +31,45 @@
2712
2713 add_executable(GreeterPamTestExec
2714 pam.cpp
2715- ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm/GreeterPrivate.cpp
2716+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp
2717 )
2718 qt5_use_modules(GreeterPamTestExec Concurrent Core Test)
2719 target_link_libraries(GreeterPamTestExec
2720 integratedLightDM
2721 )
2722+
2723 target_include_directories(GreeterPamTestExec PUBLIC
2724- ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm
2725+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM
2726+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm
2727 )
2728 add_qmltest_target(testGreeterPam GreeterPamTestExec COMMAND $<TARGET_FILE:GreeterPamTestExec>)
2729
2730+# SessionsModelTest
2731+add_executable(GreeterSessionsModelTestExec
2732+ sessionsmodel.cpp
2733+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/SessionsModel.cpp
2734+ ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
2735+ )
2736+add_dependencies(GreeterSessionsModelTestExec MockLightDM)
2737+qt5_use_modules(GreeterSessionsModelTestExec Core Test)
2738+target_link_libraries(GreeterSessionsModelTestExec
2739+ MockLightDM
2740+ )
2741+target_include_directories(GreeterSessionsModelTestExec PUBLIC
2742+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
2743+ ${CMAKE_SOURCE_DIR}/plugins/Utils
2744+ ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
2745+ )
2746+add_unity8_uitest(GreeterSessions GreeterSessionsModelTestExec
2747+ ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
2748+ DEPENDS MockLightDM
2749+ LIGHTDM
2750+ )
2751+
2752+# UsersModelTest
2753 add_executable(GreeterUsersModelTestExec
2754 usersmodel.cpp
2755- ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/UsersModel.cpp
2756+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
2757 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
2758 )
2759 # This add_dependencies is needed since we're linking with with -L and -l below
2760@@ -53,13 +77,12 @@
2761 add_dependencies(GreeterUsersModelTestExec MockLightDM)
2762 qt5_use_modules(GreeterUsersModelTestExec Core Test)
2763 target_link_libraries(GreeterUsersModelTestExec
2764- -L${CMAKE_BINARY_DIR}/tests/mocks/IntegratedLightDM/liblightdm
2765- -llightdm-qt5-2
2766+ MockLightDM
2767 )
2768 target_include_directories(GreeterUsersModelTestExec PUBLIC
2769- ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
2770+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
2771 ${CMAKE_SOURCE_DIR}/plugins/Utils
2772- ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
2773+ ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
2774 )
2775 add_unity8_uitest(GreeterUsers GreeterUsersModelTestExec
2776 ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
2777@@ -77,7 +100,7 @@
2778 )
2779 target_include_directories(GreeterIntegratedTestExec PUBLIC
2780 ${GLIB_INCLUDE_DIRS}
2781- ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm
2782+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm
2783 )
2784 add_unity8_unittest(GreeterIntegrated dbus-test-runner
2785 ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/IntegratedLightDM/liblightdm/
2786
2787=== renamed file 'tests/plugins/IntegratedLightDM/dbus.cpp' => 'tests/plugins/LightDM/IntegratedLightDM/dbus.cpp'
2788=== renamed file 'tests/plugins/IntegratedLightDM/greeter.qml' => 'tests/plugins/LightDM/IntegratedLightDM/greeter.qml'
2789--- tests/plugins/IntegratedLightDM/greeter.qml 2015-09-02 07:42:27 +0000
2790+++ tests/plugins/LightDM/IntegratedLightDM/greeter.qml 2016-07-06 19:43:31 +0000
2791@@ -15,7 +15,7 @@
2792 */
2793
2794 import QtQuick 2.4
2795-import IntegratedLightDM 0.1 as LightDM
2796+import LightDM.IntegratedLightDM 0.1 as LightDM
2797
2798 Item {
2799 property var greeter: LightDM.Greeter
2800
2801=== renamed file 'tests/plugins/IntegratedLightDM/integrated.cpp' => 'tests/plugins/LightDM/IntegratedLightDM/integrated.cpp'
2802=== renamed file 'tests/plugins/IntegratedLightDM/pam.cpp' => 'tests/plugins/LightDM/IntegratedLightDM/pam.cpp'
2803=== added file 'tests/plugins/LightDM/IntegratedLightDM/sessionsmodel.cpp'
2804--- tests/plugins/LightDM/IntegratedLightDM/sessionsmodel.cpp 1970-01-01 00:00:00 +0000
2805+++ tests/plugins/LightDM/IntegratedLightDM/sessionsmodel.cpp 2016-07-06 19:43:31 +0000
2806@@ -0,0 +1,96 @@
2807+/*
2808+ * Copyright (C) 2015 Canonical, Ltd.
2809+ *
2810+ * This program is free software; you can redistribute it and/or modify
2811+ * it under the terms of the GNU General Public License as published by
2812+ * the Free Software Foundation; version 3.
2813+ *
2814+ * This program is distributed in the hope that it will be useful,
2815+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2816+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2817+ * GNU General Public License for more details.
2818+ *
2819+ * You should have received a copy of the GNU General Public License
2820+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2821+ */
2822+
2823+#include "SessionsModel.h"
2824+
2825+#include <QLightDM/SessionsModel>
2826+#include <QtCore/QModelIndex>
2827+#include <QtTest>
2828+#include <QString>
2829+
2830+class GreeterSessionsModelTest : public QObject
2831+{
2832+ Q_OBJECT
2833+
2834+private Q_SLOTS:
2835+
2836+ void init()
2837+ {
2838+ model = new SessionsModel();
2839+ QVERIFY(model);
2840+ sourceModel = new QLightDM::SessionsModel();
2841+ QVERIFY(sourceModel);
2842+ }
2843+
2844+ void cleanup()
2845+ {
2846+ delete model;
2847+ delete sourceModel;
2848+ }
2849+
2850+ static QModelIndex findByKey(QAbstractItemModel *model, const QString& key)
2851+ {
2852+ for (int i = 0; i < model->rowCount(QModelIndex()); i++) {
2853+ if (model->data(model->index(i, 0), QLightDM::SessionsModel::KeyRole).toString() == key)
2854+ return model->index(i, 0);
2855+ }
2856+
2857+ return QModelIndex();
2858+ }
2859+
2860+ void testIconDirectoriesAreValid()
2861+ {
2862+ Q_FOREACH(const QUrl& searchDirectory, model->iconSearchDirectories())
2863+ {
2864+ QVERIFY(searchDirectory.isValid());
2865+ }
2866+ }
2867+
2868+ void testMultipleSessionsCountIsCorrect()
2869+ {
2870+ sourceModel->setTestScenario("multipleSessions");
2871+ QVERIFY(sourceModel->rowCount(QModelIndex()) > 1);
2872+ }
2873+
2874+ void testNoSessionsCountIsCorrect()
2875+ {
2876+ sourceModel->setTestScenario("noSessions");
2877+ QVERIFY(sourceModel->rowCount(QModelIndex()) == 0);
2878+ }
2879+
2880+ void testSingleSessionCountIsCorrect()
2881+ {
2882+ sourceModel->setTestScenario("singleSession");
2883+ QVERIFY(sourceModel->rowCount(QModelIndex()) == 1);
2884+ }
2885+
2886+ void testSessionNameIsCorrect()
2887+ {
2888+ // This is testing the lookup, not the correctness of the strings,
2889+ // so one test should be sufficient
2890+ sourceModel->setTestScenario("multipleSessions");
2891+ QVERIFY(model->data(findByKey(sourceModel, "ubuntu"),
2892+ Qt::DisplayRole).toString() == "Ubuntu");
2893+ }
2894+
2895+private:
2896+ SessionsModel *model;
2897+ QLightDM::SessionsModel *sourceModel;
2898+};
2899+
2900+QTEST_MAIN(GreeterSessionsModelTest)
2901+
2902+#include "sessionsmodel.moc"
2903
2904=== renamed file 'tests/plugins/IntegratedLightDM/usersmodel.cpp' => 'tests/plugins/LightDM/IntegratedLightDM/usersmodel.cpp'
2905=== modified file 'tests/qmltests/Greeter/TestView.qml'
2906--- tests/qmltests/Greeter/TestView.qml 2016-05-25 19:25:51 +0000
2907+++ tests/qmltests/Greeter/TestView.qml 2016-07-06 19:43:31 +0000
2908@@ -43,6 +43,7 @@
2909 signal responded(string response)
2910 signal tease()
2911 signal emergencyCall()
2912+ signal promptlessLogin()
2913
2914 signal _showMessageCalled(string html)
2915 signal _showPromptCalled(string text, bool isSecret, bool isDefaultPrompt)
2916
2917=== modified file 'tests/qmltests/Greeter/tst_Greeter.qml'
2918--- tests/qmltests/Greeter/tst_Greeter.qml 2016-06-20 17:37:25 +0000
2919+++ tests/qmltests/Greeter/tst_Greeter.qml 2016-07-06 19:43:31 +0000
2920@@ -22,7 +22,7 @@
2921 import AccountsService 0.1
2922 import Biometryd 0.0
2923 import GSettings 1.0
2924-import IntegratedLightDM 0.1 as LightDM
2925+import LightDM.IntegratedLightDM 0.1 as LightDM // This is the mock
2926 import Unity.Test 0.1 as UT
2927
2928 Item {
2929@@ -146,7 +146,9 @@
2930
2931 function init() {
2932 greeterSettings.lockedOutTime = 0;
2933- resetLoader();
2934+ LightDM.Greeter.selectUser = "";
2935+ greeter.failedLoginsDelayAttempts = 7;
2936+ greeter.failedLoginsDelayMinutes = 5;
2937 teaseSpy.clear();
2938 sessionStartedSpy.clear();
2939 activeChangedSpy.clear();
2940@@ -162,11 +164,7 @@
2941 viewShowErrorMessageSpy.clear();
2942 viewResetSpy.clear();
2943 viewTryToUnlockSpy.clear();
2944- tryCompare(greeter, "waiting", false);
2945- view = findChild(greeter, "testView");
2946- verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
2947- greeter.failedLoginsDelayAttempts = 7;
2948- greeter.failedLoginsDelayMinutes = 5;
2949+ resetLoader();
2950 }
2951
2952 function resetLoader() {
2953@@ -178,6 +176,8 @@
2954 loader.active = true;
2955 tryCompare(loader, "status", Loader.Ready);
2956 removeTimeConstraintsFromSwipeAreas(loader.item);
2957+ tryCompare(greeter, "waiting", false);
2958+ view = findChild(greeter, "testView");
2959 }
2960
2961 function getIndexOf(name) {
2962@@ -202,6 +202,7 @@
2963 compare(view.currentIndex, i);
2964 compare(AccountsService.user, name);
2965 compare(LightDM.Greeter.authenticationUser, name);
2966+ return i;
2967 }
2968
2969 function verifyLoggedIn() {
2970@@ -248,11 +249,9 @@
2971
2972 function test_promptless() {
2973 selectUser("no-password");
2974- tryCompare(viewAuthenticationSucceededSpy, "count", 1);
2975- compare(sessionStartedSpy.count, 1);
2976+ tryCompare(view, "locked", false);
2977 compare(viewShowPromptSpy.count, 0);
2978 compare(viewHideSpy.count, 0);
2979- compare(view.locked, false);
2980 }
2981
2982 function test_twoFactorPass() {
2983@@ -573,6 +572,25 @@
2984 tryCompare(viewShowPromptSpy, "count", 1);
2985 }
2986
2987+ function test_selectUserHint() {
2988+ LightDM.Greeter.selectUser = "info-prompt";
2989+ resetLoader();
2990+ var i = verifySelected("info-prompt");
2991+ verify(i != 0); // sanity-check that info-prompt isn't default 0 answer
2992+ }
2993+
2994+ function test_selectUserHintUnset() {
2995+ LightDM.Greeter.selectUser = "";
2996+ resetLoader();
2997+ verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
2998+ }
2999+
3000+ function test_selectUserHintInvalid() {
3001+ LightDM.Greeter.selectUser = "not-a-real-user";
3002+ resetLoader();
3003+ verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
3004+ }
3005+
3006 function test_fingerprintSuccess() {
3007 var index = selectUser("has-password");
3008 unlockAndShowGreeter(); // turn on lockscreen mode
3009
3010=== modified file 'tests/qmltests/Greeter/tst_Infographics.qml'
3011--- tests/qmltests/Greeter/tst_Infographics.qml 2015-09-29 12:28:10 +0000
3012+++ tests/qmltests/Greeter/tst_Infographics.qml 2016-07-06 19:43:31 +0000
3013@@ -20,7 +20,7 @@
3014 import "../../../qml/Greeter"
3015 import Ubuntu.Components 1.3
3016 import Unity.Test 0.1 as UT
3017-import IntegratedLightDM 0.1 as LightDM
3018+import LightDM.IntegratedLightDM 0.1 as LightDM
3019
3020 Item {
3021 Binding {
3022
3023=== modified file 'tests/qmltests/Greeter/tst_NarrowView.qml'
3024--- tests/qmltests/Greeter/tst_NarrowView.qml 2016-06-18 22:37:48 +0000
3025+++ tests/qmltests/Greeter/tst_NarrowView.qml 2016-07-06 19:43:31 +0000
3026@@ -18,7 +18,7 @@
3027 import QtTest 1.0
3028 import ".."
3029 import "../../../qml/Greeter"
3030-import IntegratedLightDM 0.1 as LightDM
3031+import LightDM.IntegratedLightDM 0.1 as LightDM
3032 import Ubuntu.Components 1.3
3033 import Unity.Test 0.1 as UT
3034
3035
3036=== modified file 'tests/qmltests/Greeter/tst_WideView.qml'
3037--- tests/qmltests/Greeter/tst_WideView.qml 2016-06-18 22:37:48 +0000
3038+++ tests/qmltests/Greeter/tst_WideView.qml 2016-07-06 19:43:31 +0000
3039@@ -18,7 +18,7 @@
3040 import QtTest 1.0
3041 import ".."
3042 import "../../../qml/Greeter"
3043-import IntegratedLightDM 0.1 as LightDM
3044+import LightDM.IntegratedLightDM 0.1 as LightDM
3045 import Ubuntu.Components 1.3
3046 import Unity.Test 0.1 as UT
3047
3048
3049=== modified file 'tests/qmltests/Tutorial/tst_Tutorial.qml'
3050--- tests/qmltests/Tutorial/tst_Tutorial.qml 2016-06-10 14:36:50 +0000
3051+++ tests/qmltests/Tutorial/tst_Tutorial.qml 2016-07-06 19:43:31 +0000
3052@@ -17,7 +17,7 @@
3053 import QtQuick 2.4
3054 import QtTest 1.0
3055 import AccountsService 0.1
3056-import IntegratedLightDM 0.1 as LightDM
3057+import LightDM.IntegratedLightDM 0.1 as LightDM
3058 import Ubuntu.Components 1.3
3059 import Ubuntu.Components.ListItems 1.3
3060 import Ubuntu.Telephony 0.1 as Telephony
3061
3062=== modified file 'tests/qmltests/tst_OrientedShell.qml'
3063--- tests/qmltests/tst_OrientedShell.qml 2016-06-20 12:07:20 +0000
3064+++ tests/qmltests/tst_OrientedShell.qml 2016-07-06 19:43:31 +0000
3065@@ -22,7 +22,7 @@
3066 import Ubuntu.Components.ListItems 1.3 as ListItem
3067 import Unity.Application 0.1
3068 import Unity.Test 0.1
3069-import IntegratedLightDM 0.1 as LightDM
3070+import LightDM.IntegratedLightDM 0.1 as LightDM
3071 import Powerd 0.1
3072 import Unity.InputInfo 0.1
3073 import Utils 0.1
3074
3075=== modified file 'tests/qmltests/tst_Shell.qml'
3076--- tests/qmltests/tst_Shell.qml 2016-06-18 22:37:48 +0000
3077+++ tests/qmltests/tst_Shell.qml 2016-07-06 19:43:31 +0000
3078@@ -18,7 +18,7 @@
3079 import QtTest 1.0
3080 import AccountsService 0.1
3081 import GSettings 1.0
3082-import IntegratedLightDM 0.1 as LightDM
3083+import LightDM.IntegratedLightDM 0.1 as LightDM
3084 import Ubuntu.Components 1.3
3085 import Ubuntu.Components.ListItems 1.3 as ListItem
3086 import Ubuntu.Telephony 0.1 as Telephony
3087@@ -1161,6 +1161,17 @@
3088 tryCompare(indicators, "fullyClosed", true);
3089 }
3090
3091+ function test_greeterShownAgainHidesIndicators() {
3092+ // Regression test for https://launchpad.net/bugs/1595569
3093+
3094+ loadShell("phone");
3095+ showIndicators();
3096+ showGreeter();
3097+
3098+ var indicators = findChild(shell, "indicators");
3099+ tryCompare(indicators, "fullyClosed", true);
3100+ }
3101+
3102 function test_showAndHideGreeterDBusCalls() {
3103 loadShell("phone");
3104 swipeAwayGreeter();
3105@@ -1176,16 +1187,13 @@
3106
3107 function test_greeterLoginsAutomaticallyWhenNoPasswordSet() {
3108 loadShell("phone");
3109- swipeAwayGreeter();
3110-
3111- sessionSpy.clear();
3112- verify(sessionSpy.valid);
3113-
3114- showGreeter();
3115
3116 var greeter = findChild(shell, "greeter");
3117 verify(!greeter.locked);
3118- verify(sessionSpy.count > 0);
3119+ compare(sessionSpy.count, 0);
3120+
3121+ swipeAwayGreeter();
3122+ compare(sessionSpy.count, 1);
3123 }
3124
3125 function test_fullscreen() {
3126@@ -2213,11 +2221,6 @@
3127 shell.usageScenario = "desktop";
3128 GSettingsController.setAutohideLauncher(!data.launcherLocked);
3129 waitForRendering(shell);
3130- // Not sure why 2 but it's the number of times
3131- // it triggers at this time and we need to wait
3132- // for them otherwise a sessionStarted signal will
3133- // hide the launcher and make the test fail
3134- tryCompare(sessionSpy, "count", 2);
3135
3136 var launcher = findChild(shell, "launcher");
3137 var launcherPanel = findChild(launcher, "launcherPanel");
3138
3139=== modified file 'tests/qmltests/tst_ShellWithPin.qml'
3140--- tests/qmltests/tst_ShellWithPin.qml 2016-05-02 07:57:07 +0000
3141+++ tests/qmltests/tst_ShellWithPin.qml 2016-07-06 19:43:31 +0000
3142@@ -19,7 +19,7 @@
3143 import QtTest 1.0
3144 import AccountsService 0.1
3145 import GSettings 1.0
3146-import IntegratedLightDM 0.1 as LightDM
3147+import LightDM.IntegratedLightDM 0.1 as LightDM
3148 import Ubuntu.SystemImage 0.1
3149 import Ubuntu.Telephony 0.1 as Telephony
3150 import Unity.Application 0.1

Subscribers

People subscribed via source and target branches