on xenial help sign in
Add unity8-greeter package which contains a basic, but usable LightDM greeter. (LP: #1324602)
commit8e548f2e1772b56c78fb7798193695fea06d1356 authorJosh Arenson <josh@blackbox> dateMon 11 Jul 2016, 17:22 (10 years ago) parenta0eac0712d13af
97 files changed+554−228
CMakeLists.txt+1 data/51-unity8-greeter.conf+2 data/CMakeLists.txt+11 data/unity8-greeter-init.conf+12 data/unity8-greeter-wrapper+98 data/unity8-greeter.desktop.in+7 data/unity8-greeter.pkla+44 debian/control+12 debian/rules+1−1 debian/unity8-greeter.install+5 debian/unity8-private.install+1−1 plugins/CMakeLists.txt+1−1 plugins/IntegratedLightDM/CMakeLists.txt−40 plugins/LightDM/CMakeLists.txt+27 plugins/IntegratedLightDM/DBusGreeter.cpp → plugins/LightDM/DBusGreeter.cpp+5−4 plugins/IntegratedLightDM/DBusGreeter.h → plugins/LightDM/DBusGreeter.h plugins/IntegratedLightDM/DBusGreeterList.cpp → plugins/LightDM/DBusGreeterList.cpp plugins/IntegratedLightDM/DBusGreeterList.h → plugins/LightDM/DBusGreeterList.h plugins/LightDM/FullLightDM/CMakeLists.txt+27 plugins/LightDM/FullLightDM/qmldir+3 plugins/IntegratedLightDM/Greeter.cpp → plugins/LightDM/Greeter.cpp+6 plugins/IntegratedLightDM/Greeter.h → plugins/LightDM/Greeter.h+2 plugins/IntegratedLightDM/GreeterPrivate.h → plugins/LightDM/GreeterPrivate.h plugins/LightDM/IntegratedLightDM/CMakeLists.txt+32 plugins/IntegratedLightDM/liblightdm/CMakeLists.txt → plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt+2−2 plugins/IntegratedLightDM/liblightdm/Greeter.cpp → plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp plugins/IntegratedLightDM/liblightdm/Greeter.h → plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.h plugins/IntegratedLightDM/liblightdm/GreeterPrivate.cpp → plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp+1−2 plugins/IntegratedLightDM/liblightdm/GreeterPrivate.h → plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h plugins/IntegratedLightDM/liblightdm/UsersModel.cpp → plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp plugins/IntegratedLightDM/liblightdm/UsersModel.h → plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.h plugins/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp → plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp plugins/IntegratedLightDM/liblightdm/UsersModelPrivate.h → plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h plugins/LightDM/IntegratedLightDM/qmldir+3 plugins/IntegratedLightDM/UsersModel.cpp → plugins/LightDM/UsersModel.cpp plugins/IntegratedLightDM/UsersModel.h → plugins/LightDM/UsersModel.h plugins/IntegratedLightDM/plugin.cpp → plugins/LightDM/plugin.cpp+15−3 plugins/IntegratedLightDM/plugin.h → plugins/LightDM/plugin.h+5−5 plugins/IntegratedLightDM/qmldir → plugins/LightDM/qmldir plugins/Unity/Indicators/indicatorsmanager.cpp+1−1 qml/Components/Dialogs.qml+3−5 qml/Greeter/FullLightDMImpl.qml+28 qml/Greeter/Greeter.qml+43−34 qml/Greeter/IntegratedLightDMImpl.qml+1−1 qml/Greeter/LightDM.qml → qml/Greeter/LightDMService.qml+14−3 qml/Greeter/LoginList.qml+2 qml/Greeter/WideView.qml+2 qml/Greeter/qmldir+1 qml/Shell.qml+11−6 qml/Stages/ShimStage.qml−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−5 tests/autopilot/unity8/shell/tests/__init__.py+1−1 tests/mocks/CMakeLists.txt+1−1 tests/mocks/IntegratedLightDM/qmldir−3 tests/mocks/LightDM/CMakeLists.txt+1 tests/mocks/IntegratedLightDM/CMakeLists.txt → tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt+7−7 tests/mocks/IntegratedLightDM/MockGreeter.cpp → tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp+16 tests/mocks/IntegratedLightDM/MockGreeter.h → tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h+5 tests/mocks/IntegratedLightDM/MockUsersModel.cpp → tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp tests/mocks/IntegratedLightDM/MockUsersModel.h → tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h tests/mocks/IntegratedLightDM/QLightDM/Greeter → tests/mocks/LightDM/IntegratedLightDM/QLightDM/Greeter tests/mocks/IntegratedLightDM/QLightDM/UsersModel → tests/mocks/LightDM/IntegratedLightDM/QLightDM/UsersModel tests/mocks/IntegratedLightDM/liblightdm/CMakeLists.txt → tests/mocks/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt+2−2 tests/mocks/IntegratedLightDM/liblightdm/Greeter.cpp → tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp+8−1 tests/mocks/IntegratedLightDM/liblightdm/Greeter.h → tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.h+1 tests/mocks/IntegratedLightDM/liblightdm/GreeterPrivate.cpp → tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp tests/mocks/IntegratedLightDM/liblightdm/GreeterPrivate.h → tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h+1 tests/mocks/IntegratedLightDM/liblightdm/UsersModel.cpp → tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp tests/mocks/IntegratedLightDM/liblightdm/UsersModel.h → tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.h tests/mocks/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp → tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp tests/mocks/IntegratedLightDM/liblightdm/UsersModelPrivate.h → tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h tests/mocks/IntegratedLightDM/plugin.cpp → tests/mocks/LightDM/IntegratedLightDM/plugin.cpp+4−4 tests/mocks/IntegratedLightDM/plugin.h → tests/mocks/LightDM/IntegratedLightDM/plugin.h+1−1 tests/mocks/LightDM/IntegratedLightDM/qmldir+2 tests/mocks/libusermetrics/libusermetricsoutput/ColorTheme.h−1 tests/mocks/libusermetrics/libusermetricsoutput/UserMetrics.h−1 tests/plugins/CMakeLists.txt+1−1 tests/plugins/LightDM/CMakeLists.txt+1 tests/plugins/IntegratedLightDM/CMakeLists.txt → tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt+13−13 tests/plugins/IntegratedLightDM/dbus.cpp → tests/plugins/LightDM/IntegratedLightDM/dbus.cpp tests/plugins/IntegratedLightDM/greeter.qml → tests/plugins/LightDM/IntegratedLightDM/greeter.qml+1−1 tests/plugins/IntegratedLightDM/integrated.cpp → tests/plugins/LightDM/IntegratedLightDM/integrated.cpp tests/plugins/IntegratedLightDM/pam.cpp → tests/plugins/LightDM/IntegratedLightDM/pam.cpp tests/plugins/IntegratedLightDM/usersmodel.cpp → tests/plugins/LightDM/IntegratedLightDM/usersmodel.cpp tests/qmltests/Greeter/TestView.qml+1 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+5−13 tests/qmltests/tst_ShellWithPin.qml+1−1
CMakeLists.txt+1
@@ -128,6 +128,7 @@ set(SHELL_APP unity8)
128128set(DASH_APP unity8-dash)
129129set(SCOPE_TOOL unity-scope-tool)
130130set(INDICATORS_CLIENT_APP indicators-client)
131+set(GREETER_APP unity8-greeter)
131132set(MOCK_INDICATOR_SERVICE_APP unity-mock-indicator-service)
132133
133134include_directories(
data/51-unity8-greeter.confnew file+2
@@ -0,0 +1,2 @@
1+[Seat:*]
2+greeter-session=unity8-greeter
data/CMakeLists.txt+11
@@ -2,6 +2,7 @@
22configure_file(${SHELL_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${SHELL_APP}.desktop @ONLY)
33configure_file(${DASH_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${DASH_APP}.desktop @ONLY)
44configure_file(${INDICATORS_CLIENT_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${INDICATORS_CLIENT_APP}.desktop @ONLY)
5+configure_file(${GREETER_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${GREETER_APP}.desktop @ONLY)
56
67# install desktop files
78install(FILES
@@ -11,6 +12,16 @@ install(FILES
1112 DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
1213 )
1314
15+install(FILES
16+ ${CMAKE_CURRENT_BINARY_DIR}/${GREETER_APP}.desktop
17+ DESTINATION ${CMAKE_INSTALL_DATADIR}/lightdm/greeters
18+ )
19+
20+install(FILES
21+ 51-unity8-greeter.conf
22+ DESTINATION ${CMAKE_INSTALL_DATADIR}/lightdm/lightdm.conf.d
23+ )
24+
1425# install dash icon
1526install(FILES
1627 ${CMAKE_CURRENT_SOURCE_DIR}/${DASH_APP}.png
data/unity8-greeter-init.confnew file+12
@@ -0,0 +1,12 @@
1+description "Unity 8 Greeter initialization"
2+author "Michael Terry <mterry@ubuntu.com>"
3+
4+start on unity8-greeter-started
5+task
6+emits indicator-services-start
7+
8+script
9+ start --no-wait ofono-setup || true
10+ initctl emit --no-wait indicator-services-start || true
11+ start --no-wait maliit-server || true
12+end script
data/unity8-greeter-wrappernew file+98
@@ -0,0 +1,98 @@
1+#!/bin/sh
2+# -*- Mode: sh; indent-tabs-mode: nil; tab-width: 4 -*-
3+#
4+# Copyright (C) 2011,2013 Canonical Ltd
5+# Author: Michael Terry <michael.terry@canonical.com>
6+#
7+# This program is free software: you can redistribute it and/or modify it under
8+# the terms of the GNU General Public License as published by the Free Software
9+# Foundation, version 3 of the License.
10+#
11+# See http://www.gnu.org/copyleft/gpl.html the full text of the license.
12+
13+# This wrapper merely ensures that init and friends live only as long as this
14+# script does. Otherwise, it's very easy for some processes to not notice that
15+# the session died. We could try to do this in-process, but we want to do this
16+# cleanup even if the greeter aborts.
17+
18+trap cleanup TERM EXIT
19+
20+cleanup()
21+{
22+ trap - TERM EXIT
23+ # Kill upstart and indicators
24+ if [ -n "$INIT_PID" ]; then
25+ kill "$INIT_PID"
26+ fi
27+ if [ -n "$CMD_PID" ]; then
28+ kill "$CMD_PID"
29+ fi
30+ exit 0
31+}
32+
33+set_greeter_var()
34+{
35+ export "$1=$2"
36+ gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "{'$1': '$2'}"
37+ if [ -n "$INIT_PID" ]; then
38+ initctl set-env --global "$1=$2"
39+ fi
40+}
41+
42+SUB_SOCKET=$XDG_RUNTIME_DIR/mir_socket
43+rm -f $SUB_SOCKET # clear socket in case we were hard shut down
44+
45+# If touch session script (which sets up grid units and mir variables) is available, use it
46+TOUCH_WRAPPER=
47+if [ -x /usr/bin/ubuntu-touch-session ]; then
48+ TOUCH_WRAPPER=/usr/bin/ubuntu-touch-session
49+fi
50+
51+# Pretend that we're in an ubuntu-touch session, so that indicator-network
52+# will start.
53+export DESKTOP_SESSION=ubuntu-touch
54+
55+# We disable ofono using pulse. It causes problems with racing with the user's
56+# pulse. We need to come up with a better long-term fix for this, because we
57+# eventually need the greeter to play ringtones for users that aren't logged in.
58+set_greeter_var PA_DISABLED 1
59+
60+# Normal unity8 sessions are entirely driven by Upstart. But greeters
61+# are special. They need access to the file descriptors that lightdm
62+# creates for them and don't want to start all the services that a normal
63+# session would. So it's inconvenient to live within an upstart session.
64+# But... we still want to use Upstart for some services. So launch here.
65+MIR_SOCKET=$SUB_SOCKET $TOUCH_WRAPPER /sbin/upstart --user --no-startup-event &
66+INIT_PID=$!
67+while [ ! -e "$XDG_RUNTIME_DIR/upstart/sessions/$INIT_PID.session" ]; do sleep 0.1; done
68+export UPSTART_SESSION=$(/sbin/initctl list-sessions | grep "^$INIT_PID " | cut -d' ' -f2)
69+
70+# Start any pre-greeter tasks if needed (like wizard)
71+/sbin/initctl emit unity8-greeter-starting
72+
73+# Define language here for phone if available. When phone user switches their
74+# language, they expect that to affect the greeter too. But the user doesn't
75+# have permission to switch system language, only their own. So we notice if
76+# the phablet user exists and use their language if so. TODO: talk to design
77+# about whether we should switch language on fly as users are selected (this
78+# is very hard to do technically).
79+#
80+# Do this after unity8-greeter-starting, in case a customization upstart job
81+# changes language.
82+if [ "$(id -u phablet 2>/dev/null)" = "32011" ]; then
83+ 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)
84+ if [ -n "$USER_LANG" ]; then
85+ set_greeter_var LANGUAGE "$USER_LANG"
86+ fi
87+ 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)
88+ if [ -n "$USER_LOCALE" ]; then
89+ set_greeter_var LANG "$USER_LOCALE"
90+ set_greeter_var LC_ALL "$USER_LOCALE"
91+ fi
92+fi
93+
94+# And finally actually start the greeter
95+exec env QT_QPA_PLATFORM=ubuntumirclient MIR_SERVER_FILE=$SUB_SOCKET $TOUCH_WRAPPER $@ &
96+CMD_PID=$!
97+wait $CMD_PID
98+CMD_PID=
data/unity8-greeter.desktop.innew file+7
@@ -0,0 +1,7 @@
1+[Desktop Entry]
2+Type=Application
3+Name=Unity 8 Greeter
4+Comment=The converged Unity shell's Greeter
5+Exec=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity8-greeter-wrapper @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity8 --mode=greeter
6+X-LightDM-Session-Type=mir
7+X-Ubuntu-Touch=true
data/unity8-greeter.pklanew file+44
@@ -0,0 +1,44 @@
1+# DO NOT EDIT THIS FILE, it will be overwritten on update
2+# Place your local configurations under /etc/polkit-1/localauthority/
3+
4+[Disable Controlling of Network Devices]
5+Identity=unix-user:lightdm
6+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;
7+ResultActive=no
8+ResultInactive=no
9+ResultsAny=no
10+
11+[Disable Sleep and Wake]
12+Identity=unix-user:lightdm
13+Action=org.freedesktop.NetworkManager.sleep-wake
14+ResultActive=no
15+ResultInactive=no
16+ResultsAny=no
17+
18+[Disable WiFi Sharing]
19+Identity=unix-user:lightdm
20+Action=org.freedesktop.NetworkManager.wifi.share.protected;org.freedesktop.NetworkManager.wifi.share.open
21+ResultActive=no
22+ResultInactive=no
23+ResultsAny=no
24+
25+[Disable Settings Modifications]
26+Identity=unix-user:lightdm
27+Action=org.freedesktop.NetworkManager.settings.modify.own;org.freedesktop.NetworkManager.settings.modify.system;org.freedesktop.NetworkManager.settings.modify.hostname
28+ResultActive=no
29+ResultInactive=no
30+ResultsAny=no
31+
32+[Disable User Connections]
33+Identity=unix-user:lightdm
34+Action=org.freedesktop.NetworkManager.use-user-connections
35+ResultActive=no
36+ResultInactive=no
37+ResultsAny=no
38+
39+[Enable Controlling of Network Connections]
40+Identity=unix-user:lightdm
41+Action=org.freedesktop.NetworkManager.network-control
42+ResultActive=yes
43+ResultInactive=no
44+ResultsAny=no
debian/control+12
@@ -23,6 +23,7 @@ Build-Depends: cmake,
2323 libglib2.0-dev,
2424 libgsettings-qt-dev,
2525 libhardware-dev,
26+ liblightdm-qt5-3-dev,
2627 libpam0g-dev,
2728 libpay2-dev,
2829 libpulse-dev,
@@ -82,6 +83,17 @@ Depends: qmenumodel-qml (>= 0.2.9),
8283Description: Indicators client test application
8384 This package contains the client application for indicators used by autopilot
8485
86+Package: unity8-greeter
87+Architecture: any
88+Depends: unity8 (= ${binary:Version}),
89+ unity-system-compositor,
90+ ${misc:Depends},
91+ ${shlibs:Depends}
92+Recommends: lightdm
93+Provides: lightdm-greeter
94+Description: The Unity8 Greeter
95+ The Unity 8 greeter is the primary login greeter for Ubuntu devices.
96+
8597Package: unity-scope-tool
8698Architecture: any
8799Depends: unity8-common (= ${source:Version}),
debian/rules+1−1
@@ -37,6 +37,6 @@ override_dh_installdeb:
3737override_dh_makeshlibs:
3838 dh_makeshlibs -Nunity8-private -Nunity8-fake-env
3939
40−# libMockLightDM-qml.so links against liblightdm-qt5-2.so which doesn't exist
40+# libMockLightDM-qml.so links against liblightdm-qt5-3.so which doesn't exist
4141override_dh_shlibdeps:
4242 dh_shlibdeps -XlibMockLightDM-qml.so
debian/unity8-greeter.installnew file+5
@@ -0,0 +1,5 @@
1+data/unity8-greeter-wrapper usr/bin/
2+data/unity8-greeter-init.conf usr/share/upstart/sessions/
3+data/unity8-greeter.pkla /var/lib/polkit-1/localauthority/10-vendor.d/
4+usr/share/lightdm/greeters/unity8-greeter.desktop
5+usr/share/lightdm/lightdm.conf.d/51-unity8-greeter.conf
debian/unity8-private.install+1−1
@@ -4,7 +4,7 @@ usr/lib/*/unity8/qml/Cursor
44usr/lib/*/unity8/qml/Dash
55usr/lib/*/unity8/qml/GlobalShortcut
66usr/lib/*/unity8/qml/Greeter
7−usr/lib/*/unity8/qml/IntegratedLightDM
7+usr/lib/*/unity8/qml/LightDM
88usr/lib/*/unity8/qml/Lights
99usr/lib/*/unity8/qml/Powerd
1010usr/lib/*/unity8/qml/ScreenshotDirectory
plugins/CMakeLists.txt+1−1
@@ -15,7 +15,7 @@ add_subdirectory(AccountsService)
1515add_subdirectory(Cursor)
1616add_subdirectory(GlobalShortcut)
1717add_subdirectory(Greeter)
18−add_subdirectory(IntegratedLightDM)
18+add_subdirectory(LightDM)
1919add_subdirectory(Lights)
2020add_subdirectory(Dash)
2121add_subdirectory(Powerd)
plugins/IntegratedLightDM/CMakeLists.txtdeleted−40
@@ -1,40 +0,0 @@
1−pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1)
2−# TODO: Once we split out a separate greeter process, uncomment these lines
3−#pkg_check_modules(LIBLIGHTDM REQUIRED liblightdm-qt5-2)
4−
5−add_subdirectory(liblightdm)
6−
7−include_directories(
8− ${CMAKE_CURRENT_SOURCE_DIR}
9− ${CMAKE_CURRENT_BINARY_DIR}
10− ${CMAKE_SOURCE_DIR}/plugins/Utils
11− ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
12− #${LIBLIGHTDM_INCLUDE_DIRS}
13− ${libunity8-private_SOURCE_DIR}
14− ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS}
15−)
16−
17−set(QMLPLUGIN_SRC
18− ../Utils/unitysortfilterproxymodelqml.cpp # FIXME evaluate a more generic approach for using other plugins
19− DBusGreeter.cpp
20− DBusGreeterList.cpp
21− Greeter.cpp
22− plugin.cpp
23− UsersModel.cpp
24− )
25−
26−add_library(IntegratedLightDM-qml MODULE
27− ${QMLPLUGIN_SRC}
28− )
29−
30−target_link_libraries(IntegratedLightDM-qml
31− integratedLightDM
32− unity8-private
33−# TODO: Once we split out a separate greeter process, uncomment these lines
34−# ${LIBLIGHTDM_LDFLAGS}
35− ${LIBUSERMETRICSOUTPUT_LDFLAGS}
36− )
37−
38−qt5_use_modules(IntegratedLightDM-qml DBus Gui Qml)
39−
40−add_unity8_plugin(IntegratedLightDM 0.1 IntegratedLightDM TARGETS IntegratedLightDM-qml)
plugins/LightDM/CMakeLists.txtnew file+27
@@ -0,0 +1,27 @@
1+pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1)
2+
3+find_package(Qt5Core REQUIRED)
4+find_package(Qt5Quick REQUIRED)
5+
6+include_directories(
7+ ${CMAKE_CURRENT_SOURCE_DIR}
8+ ${CMAKE_CURRENT_BINARY_DIR}
9+ ${CMAKE_SOURCE_DIR}/plugins/Utils
10+ ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
11+ ${CMAKE_BINARY_DIR}/tests/mocks/LightDM/IntegratedLightDM
12+ ${LIBLIGHTDM_INCLUDE_DIRS}
13+ ${libunity8-private_SOURCE_DIR}
14+ ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS}
15+)
16+
17+set(QMLPLUGIN_SRC
18+ ../Utils/unitysortfilterproxymodelqml.cpp
19+ DBusGreeter.cpp
20+ DBusGreeterList.cpp
21+ Greeter.cpp
22+ plugin.cpp
23+ UsersModel.cpp
24+ )
25+
26+add_subdirectory(FullLightDM)
27+add_subdirectory(IntegratedLightDM)
plugins/IntegratedLightDM/DBusGreeter.cpp → plugins/LightDM/DBusGreeter.cpprenamed+5−4
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014, 2015 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -24,7 +24,8 @@ DBusGreeter::DBusGreeter(Greeter *greeter, const QString &path)
2424 : UnityDBusObject(path, QStringLiteral("com.canonical.UnityGreeter"), true, greeter),
2525 m_greeter(greeter)
2626{
27− connect(m_greeter, &Greeter::isActiveChanged, this, &DBusGreeter::isActiveChangedHandler);
27+ connect(m_greeter, &Greeter::isActiveChanged,
28+ this, &DBusGreeter::isActiveChangedHandler);
2829}
2930
3031bool DBusGreeter::isActive() const
@@ -34,12 +35,12 @@ bool DBusGreeter::isActive() const
3435
3536void DBusGreeter::ShowGreeter()
3637{
37− return Q_EMIT m_greeter->showGreeter();
38+ Q_EMIT m_greeter->showGreeter();
3839}
3940
4041void DBusGreeter::HideGreeter()
4142{
42− return Q_EMIT m_greeter->hideGreeter();
43+ Q_EMIT m_greeter->hideGreeter();
4344}
4445
4546void DBusGreeter::isActiveChangedHandler()
plugins/IntegratedLightDM/DBusGreeter.h → plugins/LightDM/DBusGreeter.hrenamed

The content is the same.

plugins/IntegratedLightDM/DBusGreeterList.cpp → plugins/LightDM/DBusGreeterList.cpprenamed

The content is the same.

plugins/IntegratedLightDM/DBusGreeterList.h → plugins/LightDM/DBusGreeterList.hrenamed

The content is the same.

plugins/LightDM/FullLightDM/CMakeLists.txtnew file+27
@@ -0,0 +1,27 @@
1+pkg_check_modules(LIBLIGHTDM REQUIRED liblightdm-qt5-3)
2+
3+set(PLUGIN_CLASSNAME "FullLightDM")
4+
5+add_definitions(-DFULL_LIGHTDM)
6+
7+include_directories(
8+ ../
9+ ${CMAKE_CURRENT_BINARY_DIR}
10+ )
11+
12+foreach(source_file ${QMLPLUGIN_SRC})
13+ list(APPEND RELATIVE_QMLPLUGIN_SRC ../${source_file})
14+endforeach()
15+
16+add_library(FullLightDM-qml MODULE
17+ ${RELATIVE_QMLPLUGIN_SRC}
18+ )
19+
20+target_link_libraries(FullLightDM-qml
21+ unity8-private
22+ ${LIBLIGHTDM_LDFLAGS}
23+ ${LIBUSERMETRICSOUTPUT_LDFLAGS}
24+ )
25+
26+qt5_use_modules(FullLightDM-qml DBus Gui Qml)
27+add_unity8_plugin(FullLightDM 0.1 LightDM/FullLightDM TARGETS FullLightDM-qml)
plugins/LightDM/FullLightDM/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module LightDM.FullLightDM
2+plugin FullLightDM-qml
3+typeinfo FullLightDM.qmltypes
plugins/IntegratedLightDM/Greeter.cpp → plugins/LightDM/Greeter.cpprenamed+6
@@ -78,6 +78,12 @@ bool Greeter::promptless() const
7878 return d->promptless;
7979}
8080
81+QString Greeter::selectUser() const
82+{
83+ Q_D(const Greeter);
84+ return d->m_greeter->selectUserHint();
85+}
86+
8187void Greeter::authenticate(const QString &username)
8288{
8389 Q_D(Greeter);
plugins/IntegratedLightDM/Greeter.h → plugins/LightDM/Greeter.hrenamed+2
@@ -38,6 +38,7 @@ class Greeter : public QObject
3838 Q_PROPERTY(bool authenticated READ isAuthenticated NOTIFY isAuthenticatedChanged)
3939 Q_PROPERTY(QString authenticationUser READ authenticationUser NOTIFY authenticationUserChanged)
4040 Q_PROPERTY(bool promptless READ promptless NOTIFY promptlessChanged)
41+ Q_PROPERTY(QString selectUser READ selectUser CONSTANT)
4142
4243public:
4344 explicit Greeter(QObject* parent=0);
@@ -46,6 +47,7 @@ public:
4647 bool isAuthenticated() const;
4748 QString authenticationUser() const;
4849 bool promptless() const;
50+ QString selectUser() const;
4951
5052public Q_SLOTS:
5153 void authenticate(const QString &username=QString());
plugins/IntegratedLightDM/GreeterPrivate.h → plugins/LightDM/GreeterPrivate.hrenamed

The content is the same.

plugins/LightDM/IntegratedLightDM/CMakeLists.txtnew file+32
@@ -0,0 +1,32 @@
1+set(PLUGIN_CLASSNAME "IntegratedLightDM")
2+
3+add_definitions(-DINTEGRATED_LIGHTDM)
4+
5+foreach(include_directory ${QMLPLUGIN_INCLUDES})
6+ list(APPEND RELATIVE_QMLPLUGIN_INCLUDES ../${include_directory})
7+endforeach()
8+
9+include_directories(
10+ ${QMLPLUGIN_INCLUDES}
11+ ${libunity8-private_SOURCE_DIR}
12+ ${CMAKE_CURRENT_BINARY_DIR}
13+)
14+
15+foreach(source_file ${QMLPLUGIN_SRC})
16+ list(APPEND RELATIVE_QMLPLUGIN_SRC ../${source_file})
17+endforeach()
18+
19+add_library(IntegratedLightDM-qml MODULE
20+ ${RELATIVE_QMLPLUGIN_SRC}
21+ )
22+
23+target_link_libraries(IntegratedLightDM-qml
24+ integratedLightDM
25+ unity8-private
26+ ${LIBUSERMETRICSOUTPUT_LDFLAGS}
27+ )
28+
29+qt5_use_modules(IntegratedLightDM-qml DBus Gui Qml)
30+add_unity8_plugin(IntegratedLightDM 0.1 LightDM/IntegratedLightDM TARGETS IntegratedLightDM-qml)
31+
32+add_subdirectory(liblightdm)
plugins/IntegratedLightDM/liblightdm/CMakeLists.txt → plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txtrenamed+2−2
@@ -46,8 +46,8 @@ set_target_properties(integratedLightDMSession PROPERTIES
4646 COMPILE_FLAGS "-DSM_BUSNAME=sessionBus -fPIC")
4747set_target_properties(MockLightDM-demo-shared PROPERTIES
4848 COMPILE_FLAGS "-DSM_BUSNAME=systemBus"
49− OUTPUT_NAME lightdm-qt5-2)
49+ OUTPUT_NAME lightdm-qt5-3)
5050
5151install(TARGETS MockLightDM-demo-shared
52− DESTINATION ${SHELL_INSTALL_QML}/mocks/IntegratedLightDM/demo
52+ DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/demo
5353 )
plugins/IntegratedLightDM/liblightdm/Greeter.cpp → plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.cpprenamed

The content is the same.

plugins/IntegratedLightDM/liblightdm/Greeter.h → plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.hrenamed

The content is the same.

plugins/IntegratedLightDM/liblightdm/GreeterPrivate.cpp → plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpprenamed+1−2
@@ -50,8 +50,7 @@ public:
5050 {
5151 qRegisterMetaType<QLightDM::GreeterImpl::ResponseFuture>("QLightDM::GreeterImpl::ResponseFuture");
5252
53− connect(&futureWatcher, &QFutureWatcher<int>::finished,
54− this, &GreeterImpl::finishPam);
53+ connect(&futureWatcher, &QFutureWatcher<int>::finished, this, &GreeterImpl::finishPam);
5554 connect(this, SIGNAL(showMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)),
5655 this, SLOT(handleMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)));
5756 // This next connect is how we pass ResponseFutures between threads
plugins/IntegratedLightDM/liblightdm/GreeterPrivate.h → plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.hrenamed

The content is the same.

plugins/IntegratedLightDM/liblightdm/UsersModel.cpp → plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpprenamed

The content is the same.

plugins/IntegratedLightDM/liblightdm/UsersModel.h → plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.hrenamed

The content is the same.

plugins/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp → plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpprenamed

The content is the same.

plugins/IntegratedLightDM/liblightdm/UsersModelPrivate.h → plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.hrenamed

The content is the same.

plugins/LightDM/IntegratedLightDM/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module LightDM.IntegratedLightDM
2+plugin IntegratedLightDM-qml
3+typeinfo IntegratedLightDM.qmltypes
plugins/IntegratedLightDM/UsersModel.cpp → plugins/LightDM/UsersModel.cpprenamed

The content is the same.

plugins/IntegratedLightDM/UsersModel.h → plugins/LightDM/UsersModel.hrenamed

The content is the same.

plugins/IntegratedLightDM/plugin.cpp → plugins/LightDM/plugin.cpprenamed+15−3
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2012,2013, 2015 Canonical, Ltd.
2+ * Copyright (C) 2012,2013,2015 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -54,15 +54,27 @@ static QObject *infographic_provider(QQmlEngine *engine, QJSEngine *scriptEngine
5454 return UserMetricsOutput::UserMetrics::getInstance();
5555}
5656
57−void IntegratedLightDMPlugin::registerTypes(const char *uri)
57+void PLUGIN_CLASSNAME::registerTypes(const char *uri)
5858{
5959 qmlRegisterType<QAbstractItemModel>();
6060 qmlRegisterType<UserMetricsOutput::ColorTheme>();
6161
62− Q_ASSERT(uri == QLatin1String("IntegratedLightDM"));
62+#if defined INTEGRATED_LIGHTDM
63+ Q_ASSERT(uri == QLatin1String("LightDM.IntegratedLightDM"));
64+#elif defined FULL_LIGHTDM
65+ Q_ASSERT(uri == QLatin1String("LightDM.FullLightDM"));
66+#endif
6367 qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
6468 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
69+
70+#if defined INTEGRATED_LIGHTDM
6571 qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider);
72+#elif defined FULL_LIGHTDM
73+ qmlRegisterSingletonType<QLightDM::Greeter>(uri, 0, 1, "Greeter", greeter_provider);
74+#else
75+ #error No library defined in LightDM plugin
76+#endif
77+
6678 qmlRegisterSingletonType<UsersModel>(uri, 0, 1, "Users", users_provider);
6779 qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", QStringLiteral("Type is not instantiable"));
6880 qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider);
plugins/IntegratedLightDM/plugin.h → plugins/LightDM/plugin.hrenamed+5−5
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2012,2013, 2015 Canonical, Ltd.
2+ * Copyright (C) 2012,2013,2015 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -15,13 +15,13 @@
1515 *
1616 */
1717
18−#ifndef INTEGRATED_LIGHTDM_PLUGIN_H
19−#define INTEGRATED_LIGHTDM_PLUGIN_H
18+#ifndef LIGHTDM_PLUGIN_H
19+#define LIGHTDM_PLUGIN_H
2020
2121#include <QtQml/QQmlEngine>
2222#include <QtQml/QQmlExtensionPlugin>
2323
24−class IntegratedLightDMPlugin : public QQmlExtensionPlugin
24+class PLUGIN_CLASSNAME : public QQmlExtensionPlugin
2525{
2626 Q_OBJECT
2727 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
@@ -30,4 +30,4 @@ public:
3030 void registerTypes(const char *uri) override;
3131};
3232
33−#endif /* INTEGRATED_LIGHTDM_PLUGIN_H */
33+#endif /* LIGHTDM_PLUGIN_H */
plugins/IntegratedLightDM/qmldir → plugins/LightDM/qmldirrenamed

The content is the same.

plugins/Unity/Indicators/indicatorsmanager.cpp+1−1
@@ -291,7 +291,7 @@ Indicator::Ptr IndicatorsManager::indicator(const QString& indicator_name)
291291 // The rest of the indicators respect their default profile (which is "phone", even on desktop PCs)
292292 if ((new_indicator->identifier() == QStringLiteral("indicator-session"))
293293 || (new_indicator->identifier() == QStringLiteral("indicator-power") && m_platform.isPC())) {
294− new_indicator->setProfile(QStringLiteral("desktop"));
294+ new_indicator->setProfile(m_profile.replace(QStringLiteral("phone"), QStringLiteral("desktop")));
295295 } else {
296296 new_indicator->setProfile(m_profile);
297297 }
qml/Components/Dialogs.qml+3−5
@@ -107,12 +107,12 @@ Item {
107107
108108 GlobalShortcut { // lock screen
109109 shortcut: Qt.Key_ScreenSaver
110− onTriggered: lightDM.greeter.showGreeter()
110+ onTriggered: LightDMService.greeter.showGreeter()
111111 }
112112
113113 GlobalShortcut { // lock screen
114114 shortcut: Qt.ControlModifier|Qt.AltModifier|Qt.Key_L
115− onTriggered: lightDM.greeter.showGreeter()
115+ onTriggered: LightDMService.greeter.showGreeter()
116116 }
117117
118118 QtObject {
@@ -137,8 +137,6 @@ Item {
137137 active: false
138138 }
139139
140− LightDM {id: lightDM} // Provide backend access
141−
142140 Component {
143141 id: logoutDialogComponent
144142 ShellDialog {
@@ -148,7 +146,7 @@ Item {
148146 Button {
149147 text: i18n.ctr("Button: Lock the system", "Lock")
150148 onClicked: {
151− lightDM.greeter.showGreeter()
149+ LightDMService.greeter.showGreeter()
152150 logoutDialog.hide();
153151 }
154152 }
qml/Greeter/FullLightDMImpl.qmlnew file+28
@@ -0,0 +1,28 @@
1+/*
2+ * Copyright (C) 2015 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.4
18+import LightDM.FullLightDM 0.1 as LightDM
19+
20+Item{
21+ id: implementation
22+
23+ property var greeter: LightDM.Greeter
24+ property var infographic: LightDM.Infographic
25+ property var users: LightDM.Users
26+ property var userRoles: LightDM.UserRoles
27+
28+}
qml/Greeter/Greeter.qml+43−34
@@ -23,6 +23,8 @@ import Ubuntu.Components 1.3
2323import Ubuntu.SystemImage 0.1
2424import Unity.Launcher 0.1
2525import Unity.Session 0.1
26+
27+import "." 0.1
2628import "../Components"
2729
2830Showable {
@@ -48,7 +50,7 @@ Showable {
4850 readonly property bool hasLockedApp: lockedApp !== ""
4951
5052 property bool forcedUnlock
51− readonly property bool locked: lightDM.greeter.active && !lightDM.greeter.authenticated && !forcedUnlock
53+ readonly property bool locked: LightDMService.greeter.active && !LightDMService.greeter.authenticated && !forcedUnlock
5254
5355 property bool tabletMode
5456 property url viewSource // only used for testing
@@ -120,12 +122,12 @@ Showable {
120122 return d.startUnlock(true /* toTheRight */);
121123 }
122124
123− LightDM{id:lightDM} // Provide backend access
124125 QtObject {
125126 id: d
126127
127− readonly property bool multiUser: lightDM.users.count > 1
128− property int currentIndex
128+ readonly property bool multiUser: LightDMService.users.count > 1
129+ readonly property int selectUserIndex: d.getUserIndex(LightDMService.greeter.selectUser)
130+ property int currentIndex: Math.max(selectUserIndex, 0)
129131 property bool waiting
130132 property bool isLockscreen // true when we are locking an active session, rather than first user login
131133 readonly property bool secureFingerprint: isLockscreen &&
@@ -147,21 +149,37 @@ Showable {
147149 UbuntuNumberAnimation {}
148150 }
149151
152+ function getUserIndex(username) {
153+ if (username === "")
154+ return -1;
155+
156+ // Find index for requested user, if it exists
157+ for (var i = 0; i < LightDMService.users.count; i++) {
158+ if (username === LightDMService.users.data(i, LightDMService.userRoles.NameRole)) {
159+ return i;
160+ }
161+ }
162+
163+ return -1;
164+ }
165+
150166 function selectUser(uid, reset) {
167+ if (uid < 0)
168+ return;
151169 d.waiting = true;
152170 if (reset) {
153171 loader.item.reset();
154172 }
155173 currentIndex = uid;
156− var user = lightDM.users.data(uid, lightDM.userRoles.NameRole);
174+ var user = LightDMService.users.data(uid, LightDMService.userRoles.NameRole);
157175 AccountsService.user = user;
158176 LauncherModel.setUser(user);
159− lightDM.greeter.authenticate(user); // always resets auth state
177+ LightDMService.greeter.authenticate(user); // always resets auth state
160178 }
161179
162180 function login() {
163181 enabled = false;
164− if (lightDM.greeter.startSessionSync()) {
182+ if (LightDMService.greeter.startSessionSync()) {
165183 sessionStarted();
166184 if (loader.item) {
167185 loader.item.notifyAuthenticationSucceeded(false /* showFakePassword */);
@@ -307,7 +325,7 @@ Showable {
307325 root.lockedApp = "";
308326 root.forceActiveFocus();
309327 d.selectUser(d.currentIndex, true);
310− lightDM.infographic.readyForDataChange();
328+ LightDMService.infographic.readyForDataChange();
311329 }
312330
313331 Connections {
@@ -315,13 +333,12 @@ Showable {
315333 onSelected: {
316334 d.selectUser(index, true);
317335 }
336+ onPromptlessLogin: d.login();
318337 onResponded: {
319338 if (root.locked) {
320− lightDM.greeter.respond(response);
339+ LightDMService.greeter.respond(response);
321340 } else {
322− if (lightDM.greeter.active && !lightDM.greeter.authenticated) { // could happen if forcedUnlock
323− d.login();
324− }
341+ d.login();
325342 loader.item.hide();
326343 }
327344 }
@@ -385,18 +402,18 @@ Showable {
385402 Binding {
386403 target: loader.item
387404 property: "userModel"
388− value: lightDM.users
405+ value: LightDMService.users
389406 }
390407
391408 Binding {
392409 target: loader.item
393410 property: "infographicModel"
394− value: lightDM.infographic
411+ value: LightDMService.infographic
395412 }
396413 }
397414
398415 Connections {
399− target: lightDM.greeter
416+ target: LightDMService.greeter
400417
401418 onShowGreeter: root.forceShow()
402419
@@ -431,13 +448,13 @@ Showable {
431448 onAuthenticationComplete: {
432449 d.waiting = false;
433450
434− if (lightDM.greeter.authenticated) {
435− d.login();
436− if (!lightDM.greeter.promptless) {
451+ if (LightDMService.greeter.authenticated) {
452+ if (!LightDMService.greeter.promptless) {
453+ d.login();
437454 loader.item.hide();
438455 }
439456 } else {
440− if (!lightDM.greeter.promptless) {
457+ if (!LightDMService.greeter.promptless) {
441458 AccountsService.failedLogins++;
442459 }
443460
@@ -458,21 +475,13 @@ Showable {
458475 }
459476
460477 loader.item.notifyAuthenticationFailed();
461− if (!lightDM.greeter.promptless) {
478+ if (!LightDMService.greeter.promptless) {
462479 d.selectUser(d.currentIndex, false);
463480 }
464481 }
465482 }
466483
467− onRequestAuthenticationUser: {
468− // Find index for requested user, if it exists
469− for (var i = 0; i < lightDM.users.count; i++) {
470− if (user === lightDM.users.data(i, lightDM.userRoles.NameRole)) {
471− d.selectUser(i, true);
472− return;
473− }
474− }
475− }
484+ onRequestAuthenticationUser: d.selectUser(d.getUserIndex(user), true)
476485 }
477486
478487 Connections {
@@ -485,20 +494,20 @@ Showable {
485494 }
486495
487496 Binding {
488− target: lightDM.greeter
497+ target: LightDMService.greeter
489498 property: "active"
490499 value: root.active
491500 }
492501
493502 Binding {
494− target: lightDM.infographic
503+ target: LightDMService.infographic
495504 property: "username"
496− value: AccountsService.statsWelcomeScreen ? lightDM.users.data(d.currentIndex, lightDM.userRoles.NameRole) : ""
505+ value: AccountsService.statsWelcomeScreen ? LightDMService.users.data(d.currentIndex, LightDMService.userRoles.NameRole) : ""
497506 }
498507
499508 Connections {
500509 target: i18n
501− onLanguageChanged: lightDM.infographic.readyForDataChange()
510+ onLanguageChanged: LightDMService.infographic.readyForDataChange()
502511 }
503512
504513 Observer {
@@ -550,7 +559,7 @@ Showable {
550559 failOperation("fingerprint reader is locked");
551560 return;
552561 }
553− if (result !== lightDM.users.data(d.currentIndex, lightDM.userRoles.UidRole)) {
562+ if (result !== LightDMService.users.data(d.currentIndex, LightDMService.userRoles.UidRole)) {
554563 AccountsService.failedFingerprintLogins++;
555564 failOperation("not the selected user");
556565 return;
qml/Greeter/IntegratedLightDMImpl.qml+1−1
@@ -15,7 +15,7 @@
1515 */
1616
1717import QtQuick 2.4
18−import IntegratedLightDM 0.1 as LightDM
18+import LightDM.IntegratedLightDM 0.1 as LightDM
1919
2020Item{
2121 id: implementation
qml/Greeter/LightDM.qml → qml/Greeter/LightDMService.qmlrenamed+14−3
@@ -19,6 +19,7 @@
1919 * plugin
2020 */
2121
22+pragma Singleton
2223import QtQuick 2.4
2324
2425Loader {
@@ -29,13 +30,23 @@ Loader {
2930 property var users: d.valid ? loader.item.users : null
3031 property var userRoles: d.valid ? loader.item.userRoles : null
3132
32− // TODO: Conditionally load RealLightDMImpl if shellMode dictates it
33− source: "./IntegratedLightDMImpl.qml"
33+ // This trickery handles cases where applicationArguments aren't provided
34+ // such as during testing
35+ property var fullLightDM: {
36+ if (typeof applicationArguments !== "undefined") {
37+ if (applicationArguments.mode === "greeter") {
38+ return true;
39+ }
40+ }
41+ return false;
42+ }
43+
44+ source: fullLightDM ?
45+ "FullLightDMImpl.qml" : "IntegratedLightDMImpl.qml"
3446
3547 QtObject {
3648 id: d
3749
3850 property bool valid: loader.item !== null
3951 }
40−
4152}
qml/Greeter/LoginList.qml+2
@@ -36,6 +36,7 @@ StyledItem {
3636
3737 signal selected(int index)
3838 signal responded(string response)
39+ signal promptlessLogin()
3940
4041 function tryToUnlock() {
4142 if (wasPrompted) {
@@ -44,6 +45,7 @@ StyledItem {
4445 if (root.locked) {
4546 root.selected(currentIndex);
4647 } else {
48+ promptlessLogin();
4749 root.responded("");
4850 }
4951 }
qml/Greeter/WideView.qml+2
@@ -37,6 +37,7 @@ FocusScope {
3737 // so that it can be replaced in tests with a mock object
3838 property var inputMethod: Qt.inputMethod
3939
40+ signal promptlessLogin()
4041 signal selected(int index)
4142 signal responded(string response)
4243 signal tease()
@@ -132,6 +133,7 @@ FocusScope {
132133
133134 locked: root.locked
134135
136+ onPromptlessLogin: root.promptlessLogin()
135137 onSelected: root.selected(index)
136138 onResponded: root.responded(response)
137139 }
qml/Greeter/qmldirnew file+1
@@ -0,0 +1 @@
1+singleton LightDMService 0.1 LightDMService.qml
qml/Shell.qml+11−6
@@ -175,7 +175,6 @@ StyledItem {
175175 finishStartUpTimer.start();
176176 }
177177
178− LightDM{id: lightDM} // Provide backend access
179178 VolumeControl {
180179 id: volumeControl
181180 indicators: panel.indicators
@@ -260,8 +259,8 @@ StyledItem {
260259 ? "phone"
261260 : shell.usageScenario
262261 readonly property string qmlComponent: {
263− if(shell.mode === "greeter") {
264− return "Stages/ShimStage.qml"
262+ if (shell.mode === "greeter") {
263+ return "Stages/AbstractStage.qml"
265264 } else if (applicationsDisplayLoader.usageScenario === "phone") {
266265 return "Stages/PhoneStage.qml";
267266 } else if (applicationsDisplayLoader.usageScenario === "tablet") {
@@ -502,7 +501,7 @@ StyledItem {
502501 function showHome() {
503502 greeter.notifyUserRequestedApp("unity8-dash");
504503
505− var animate = !lightDM.greeter.active && !stages.shown
504+ var animate = !LightDMService.greeter.active && !stages.shown
506505 dash.setCurrentScope(0, animate, false)
507506 ApplicationManager.requestFocusApplication("unity8-dash")
508507 }
@@ -541,7 +540,12 @@ StyledItem {
541540
542541 indicatorsModel: Indicators.IndicatorsModel {
543542 // tablet and phone both use the same profile
544− profile: "phone"
543+ // FIXME: use just "phone" for greeter too, but first fix
544+ // greeter app launching to either load the app inside the
545+ // greeter or tell the session to load the app. This will
546+ // involve taking the url-dispatcher dbus name and using
547+ // SessionBroadcast to tell the session.
548+ profile: shell.mode === "greeter" ? "desktop_greeter" : "phone"
545549 Component.onCompleted: load();
546550 }
547551 }
@@ -553,7 +557,7 @@ StyledItem {
553557 readonly property bool focusedSurfaceIsFullscreen: MirFocusController.focusedSurface
554558 ? MirFocusController.focusedSurface.state === Mir.FullscreenState
555559 : false
556− fullscreenMode: (focusedSurfaceIsFullscreen && !lightDM.greeter.active && launcher.progress == 0)
560+ fullscreenMode: (focusedSurfaceIsFullscreen && !LightDMService.greeter.active && launcher.progress == 0)
557561 || greeter.hasLockedApp
558562 locked: greeter && greeter.active
559563 }
@@ -671,6 +675,7 @@ StyledItem {
671675 id: wizard
672676 objectName: "wizard"
673677 anchors.fill: parent
678+ deferred: shell.mode === "greeter"
674679
675680 function unlockWhenDoneWithWizard() {
676681 if (!active) {
qml/Stages/ShimStage.qmldeleted−43
@@ -1,43 +0,0 @@
1−/*
2− * Copyright (C) 2015 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.4
18−import Ubuntu.Components 1.3
19−
20−AbstractStage {
21− id: shimStage
22−
23− anchors.fill: parent
24−
25− Text {
26− id: greeterModeText
27−
28− anchors.horizontalCenter: parent.horizontalCenter
29− anchors.top: parent.top
30− anchors.topMargin: units.gu(10)
31− font.bold: true
32− horizontalAlignment: Text.AlignHCenter
33− text: "Shell is in \"greeter\" mode"
34− }
35−
36− Text {
37− anchors.centerIn: parent
38− color: UbuntuColors.orange
39− font.pointSize: units.gu(8)
40− horizontalAlignment: Text.AlignHCenter
41− text: "Shim \nStage"
42− }
43−}
qml/Wizard/Wizard.qml+6−2
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2013, 2015 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -29,6 +29,10 @@ Showable {
2929 // expected behavior of no emission on startup.
3030 readonly property bool active: loader.active
3131
32+ // The wizard should be run at a later time if, for example, unity8 is
33+ // in greeter mode
34+ property bool deferred: false
35+
3236 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
3337
3438 onRequiredChanged: {
@@ -40,7 +44,7 @@ Showable {
4044 Loader {
4145 id: loader
4246 anchors.fill: parent
43− active: System.wizardEnabled
47+ active: System.wizardEnabled && !deferred
4448 source: "Pages.qml"
4549
4650 Connections {
src/ShellApplication.cpp+11−1
@@ -18,6 +18,7 @@
1818
1919// Qt
2020#include <QLibrary>
21+#include <QProcess>
2122#include <QScreen>
2223
2324#include <libintl.h>
@@ -110,7 +111,16 @@ ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
110111 m_secondaryWindow->setVisible(true);
111112 }
112113
113− if (isMirServer || parser.hasFullscreen()) {
114+ if (parser.mode().compare("greeter") == 0) {
115+ QSize primaryScreenSize = this->primaryScreen()->size();
116+ m_shellView->setHeight(primaryScreenSize.height());
117+ m_shellView->setWidth(primaryScreenSize.width());
118+ m_shellView->show();
119+ m_shellView->requestActivate();
120+ if (!QProcess::startDetached("/sbin/initctl emit --no-wait unity8-greeter-started")) {
121+ qDebug() << "Unable to send unity8-greeter-started event to Upstart";
122+ }
123+ } else if (isMirServer || parser.hasFullscreen()) {
114124 m_shellView->showFullScreen();
115125 } else {
116126 m_shellView->show();
tests/CMakeLists.txt+1−1
@@ -47,7 +47,7 @@ macro(unity8_parse_arguments)
4747 if(U8TEST_LIGHTDM)
4848 list(APPEND ld_paths
4949 ${UNITY_MOCKPATH}/libusermetrics
50− ${UNITY_MOCKPATH}/IntegratedLightDM/liblightdm
50+ ${UNITY_MOCKPATH}/LightDM/IntegratedLightDM/liblightdm
5151 )
5252 endif()
5353
tests/autopilot/unity8/fixture_setup.py+1−1
@@ -74,7 +74,7 @@ class LaunchUnityWithFakeSensors(fixtures.Fixture):
7474 def _get_lightdm_mock_path(self):
7575 lib_path = get_mocks_library_path()
7676 lightdm_mock_path = os.path.abspath(
77− os.path.join(lib_path, "IntegratedLightDM", "liblightdm")
77+ os.path.join(lib_path, "LightDM" ,"IntegratedLightDM", "liblightdm")
7878 )
7979
8080 if not os.path.exists(lightdm_mock_path):
tests/autopilot/unity8/greeter/tests/test_args.py−5
@@ -35,11 +35,6 @@ class GreeterArgsTest(GreeterTestCase):
3535 shell = self.get_shell(unity_proxy)
3636 self.assertTrue(shell.mode == 'full-shell')
3737
38− def test_greeter_mode(self):
39− unity_proxy = self.launch_unity(mode='greeter')
40− shell = self.get_shell(unity_proxy)
41− self.assertTrue(shell.mode == 'greeter')
42−
4338 def test_nonexistent_mode(self):
4439 unity_proxy = self.launch_unity(mode=self.NONEXISTENT_MODE)
4540 shell = self.get_shell(unity_proxy)
tests/autopilot/unity8/shell/tests/__init__.py+1−1
@@ -261,7 +261,7 @@ class UnityTestCase(AutopilotTestCase):
261261 def _get_lightdm_mock_path(self):
262262 lib_path = get_mocks_library_path()
263263 lightdm_mock_path = os.path.abspath(
264− os.path.join(lib_path, "IntegratedLightDM", "liblightdm")
264+ os.path.join(lib_path, "LightDM" ,"IntegratedLightDM", "liblightdm")
265265 )
266266
267267 if not os.path.exists(lightdm_mock_path):
tests/mocks/CMakeLists.txt+1−1
@@ -34,7 +34,7 @@ add_subdirectory(Cursor)
3434add_subdirectory(GSettings.1.0)
3535add_subdirectory(indicator-service)
3636add_subdirectory(libusermetrics)
37−add_subdirectory(IntegratedLightDM)
37+add_subdirectory(LightDM)
3838add_subdirectory(Lights)
3939add_subdirectory(MeeGo)
4040add_subdirectory(Powerd)
tests/mocks/IntegratedLightDM/qmldirdeleted−3
@@ -1,3 +0,0 @@
1−module IntegratedLightDM
2−plugin MockLightDM-qml
3−typeinfo IntegratedLightDM.qmltypes
tests/mocks/LightDM/CMakeLists.txtnew file+1
@@ -0,0 +1 @@
1+add_subdirectory(IntegratedLightDM)
tests/mocks/IntegratedLightDM/CMakeLists.txt → tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txtrenamed+7−7
@@ -10,16 +10,16 @@ include_directories(
1010 ${CMAKE_CURRENT_SOURCE_DIR}
1111 ${CMAKE_CURRENT_BINARY_DIR}
1212 ${CMAKE_SOURCE_DIR}/plugins/Utils
13− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
13+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
1414 ${CMAKE_SOURCE_DIR}/tests/mocks/libusermetrics
1515 ${libunity8-private_SOURCE_DIR}
1616)
1717
1818set(QMLPLUGIN_SRC
19− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/DBusGreeter.cpp
20− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/DBusGreeterList.cpp
21− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/Greeter.cpp
22− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/UsersModel.cpp
19+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeter.cpp
20+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeterList.cpp
21+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
22+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
2323 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
2424 MockGreeter.cpp
2525 MockUsersModel.cpp
@@ -30,7 +30,7 @@ add_library(MockLightDM-qml MODULE
3030 ${QMLPLUGIN_SRC}
3131 )
3232
33−# We want to link to liblightdm-qt5-2, but we don't want to depend on it being
33+# We want to link to liblightdm-qt5-3, but we don't want to depend on it being
3434# installed on the system. So we make sure we link to our full fake version
3535# At run time, we can point to whichever version we happen to be using via
3636# LD_LIBRARY_PATH.
@@ -42,7 +42,7 @@ target_link_libraries(MockLightDM-qml
4242
4343qt5_use_modules(MockLightDM-qml DBus Gui Qml)
4444
45−add_unity8_mock(IntegratedLightDM 0.1 IntegratedLightDM
45+add_unity8_mock(LightDM.IntegratedLightDM 0.1 LightDM/IntegratedLightDM
4646 PREFIX mocks
4747 TARGETS MockLightDM-qml
4848 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/liblightdm"
tests/mocks/IntegratedLightDM/MockGreeter.cpp → tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpprenamed+16
@@ -33,3 +33,19 @@ void MockGreeter::setMockMode(QString mockMode)
3333 Q_EMIT mockModeChanged(mockMode);
3434 }
3535}
36+
37+QString MockGreeter::selectUserHint() const
38+{
39+ Q_D(const Greeter);
40+ return d->m_greeter->selectUserHint();
41+}
42+
43+void MockGreeter::setSelectUserHint(const QString &selectUserHint)
44+{
45+ Q_D(Greeter);
46+
47+ if (d->m_greeter->selectUserHint() != selectUserHint) {
48+ d->m_greeter->setSelectUserHint(selectUserHint);
49+ Q_EMIT selectUserHintChanged();
50+ }
51+}
tests/mocks/IntegratedLightDM/MockGreeter.h → tests/mocks/LightDM/IntegratedLightDM/MockGreeter.hrenamed+5
@@ -25,13 +25,18 @@ class MockGreeter : public Greeter {
2525 Q_OBJECT
2626
2727 Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
28+ Q_PROPERTY(QString selectUser READ selectUserHint WRITE setSelectUserHint NOTIFY selectUserHintChanged)
2829
2930public:
3031 QString mockMode() const;
3132 void setMockMode(QString mockMode);
3233
34+ QString selectUserHint() const;
35+ void setSelectUserHint(const QString &selectUserHint);
36+
3337Q_SIGNALS:
3438 void mockModeChanged(QString mode);
39+ void selectUserHintChanged();
3540};
3641
3742#endif // MOCK_UNITY_GREETER_H
tests/mocks/IntegratedLightDM/MockUsersModel.cpp → tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpprenamed

The content is the same.

tests/mocks/IntegratedLightDM/MockUsersModel.h → tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.hrenamed

The content is the same.

tests/mocks/IntegratedLightDM/QLightDM/Greeter → tests/mocks/LightDM/IntegratedLightDM/QLightDM/Greeterrenamed

The content is the same.

tests/mocks/IntegratedLightDM/QLightDM/UsersModel → tests/mocks/LightDM/IntegratedLightDM/QLightDM/UsersModelrenamed

The content is the same.

tests/mocks/IntegratedLightDM/liblightdm/CMakeLists.txt → tests/mocks/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txtrenamed+2−2
@@ -11,8 +11,8 @@ add_library(MockLightDM SHARED ${LibLightDM_SOURCES})
1111qt5_use_modules(MockLightDM Gui)
1212
1313set_target_properties(MockLightDM PROPERTIES
14− OUTPUT_NAME lightdm-qt5-2)
14+ OUTPUT_NAME lightdm-qt5-3)
1515
1616install(TARGETS MockLightDM
17− DESTINATION ${SHELL_INSTALL_QML}/mocks/IntegratedLightDM/liblightdm
17+ DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/liblightdm
1818 )
tests/mocks/IntegratedLightDM/liblightdm/Greeter.cpp → tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpprenamed+8−1
@@ -76,7 +76,14 @@ bool Greeter::lockHint () const
7676
7777QString Greeter::selectUserHint() const
7878{
79− return "";
79+ Q_D(const Greeter);
80+ return d->selectUserHint;
81+}
82+
83+void Greeter::setSelectUserHint(const QString &selectUserHint)
84+{
85+ Q_D(Greeter);
86+ d->selectUserHint = selectUserHint;
8087}
8188
8289bool Greeter::selectGuestHint() const
tests/mocks/IntegratedLightDM/liblightdm/Greeter.h → tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.hrenamed+1
@@ -70,6 +70,7 @@ public:
7070 bool lockHint () const;
7171 bool hasGuestAccountHint() const;
7272 QString selectUserHint() const;
73+ void setSelectUserHint(const QString &selectUserHint); // only in mock
7374 bool selectGuestHint() const;
7475 QString autologinUserHint() const;
7576 bool autologinGuestHint() const;
tests/mocks/IntegratedLightDM/liblightdm/GreeterPrivate.cpp → tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpprenamed

The content is the same.

tests/mocks/IntegratedLightDM/liblightdm/GreeterPrivate.h → tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.hrenamed+1
@@ -34,6 +34,7 @@ public:
3434 bool authenticated;
3535 QString authenticationUser;
3636 bool twoFactorDone;
37+ QString selectUserHint;
3738
3839 QString mockMode;
3940
tests/mocks/IntegratedLightDM/liblightdm/UsersModel.cpp → tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpprenamed

The content is the same.

tests/mocks/IntegratedLightDM/liblightdm/UsersModel.h → tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.hrenamed

The content is the same.

tests/mocks/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp → tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpprenamed

The content is the same.

tests/mocks/IntegratedLightDM/liblightdm/UsersModelPrivate.h → tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.hrenamed

The content is the same.

tests/mocks/IntegratedLightDM/plugin.cpp → tests/mocks/LightDM/IntegratedLightDM/plugin.cpprenamed+4−4
@@ -19,8 +19,8 @@
1919#include <DBusGreeterList.h>
2020#include "MockGreeter.h"
2121#include "MockUsersModel.h"
22−#include <libusermetricsoutput/ColorTheme.h>
23−#include <libusermetricsoutput/UserMetrics.h>
22+#include "ColorTheme.h"
23+#include "UserMetrics.h"
2424#include <QLightDM/UsersModel>
2525
2626#include <QAbstractItemModel>
@@ -53,12 +53,12 @@ static QObject *infographic_provider(QQmlEngine *engine, QJSEngine *scriptEngine
5353 return UserMetricsOutput::UserMetrics::getInstance();
5454}
5555
56−void IntegratedLightDMPlugin::registerTypes(const char *uri)
56+void LightDMPlugin::registerTypes(const char *uri)
5757{
5858 qmlRegisterType<QAbstractItemModel>();
5959 qmlRegisterType<UserMetricsOutput::ColorTheme>();
6060
61− Q_ASSERT(uri == QLatin1String("IntegratedLightDM"));
61+ Q_ASSERT(uri == QLatin1String("LightDM.IntegratedLightDM"));
6262 qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
6363 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
6464 qmlRegisterSingletonType<MockGreeter>(uri, 0, 1, "Greeter", greeter_provider);
tests/mocks/IntegratedLightDM/plugin.h → tests/mocks/LightDM/IntegratedLightDM/plugin.hrenamed+1−1
@@ -20,7 +20,7 @@
2020#include <QtQml/QQmlEngine>
2121#include <QtQml/QQmlExtensionPlugin>
2222
23−class IntegratedLightDMPlugin : public QQmlExtensionPlugin
23+class LightDMPlugin : public QQmlExtensionPlugin
2424{
2525 Q_OBJECT
2626 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
tests/mocks/LightDM/IntegratedLightDM/qmldirnew file+2
@@ -0,0 +1,2 @@
1+module LightDM.IntegratedLightDM
2+plugin MockLightDM-qml
tests/mocks/libusermetrics/libusermetricsoutput/ColorTheme.hdeleted−1
@@ -1 +0,0 @@
1−../ColorTheme.h
tests/mocks/libusermetrics/libusermetricsoutput/UserMetrics.hdeleted−1
@@ -1 +0,0 @@
1−../UserMetrics.h
tests/plugins/CMakeLists.txt+1−1
@@ -3,7 +3,7 @@ add_subdirectory(Cursor)
33add_subdirectory(Dash)
44add_subdirectory(GlobalShortcut)
55add_subdirectory(Greeter)
6−add_subdirectory(IntegratedLightDM)
6+add_subdirectory(LightDM)
77add_subdirectory(Ubuntu)
88add_subdirectory(Unity)
99add_subdirectory(Utils)
tests/plugins/LightDM/CMakeLists.txtnew file+1
@@ -0,0 +1 @@
1+add_subdirectory(IntegratedLightDM)
tests/plugins/IntegratedLightDM/CMakeLists.txt → tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txtrenamed+13−13
@@ -8,19 +8,18 @@ include_directories(
88
99add_executable(GreeterDBusTestExec
1010 dbus.cpp
11− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/Greeter.cpp
11+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
1212 )
1313# This add_dependencies is needed since we're linking with with -L and -l below
1414# make seems to work but ninja breaks without it
1515add_dependencies(GreeterDBusTestExec MockLightDM)
1616qt5_use_modules(GreeterDBusTestExec Core DBus Quick Test)
1717target_link_libraries(GreeterDBusTestExec
18− -L${CMAKE_BINARY_DIR}/tests/mocks/IntegratedLightDM/liblightdm
19− -llightdm-qt5-2
18+ MockLightDM
2019 )
2120target_include_directories(GreeterDBusTestExec PUBLIC
22− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
23− ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
21+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
22+ ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
2423 )
2524add_unity8_uitest(GreeterDBus dbus-test-runner
2625 ARG_PREFIX "--parameter"
@@ -32,20 +31,22 @@ add_unity8_uitest(GreeterDBus dbus-test-runner
3231
3332add_executable(GreeterPamTestExec
3433 pam.cpp
35− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm/GreeterPrivate.cpp
34+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp
3635 )
3736qt5_use_modules(GreeterPamTestExec Concurrent Core Test)
3837target_link_libraries(GreeterPamTestExec
3938 integratedLightDM
4039 )
40+
4141target_include_directories(GreeterPamTestExec PUBLIC
42− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm
42+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM
43+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm
4344 )
4445add_qmltest_target(testGreeterPam GreeterPamTestExec COMMAND $<TARGET_FILE:GreeterPamTestExec>)
4546
4647add_executable(GreeterUsersModelTestExec
4748 usersmodel.cpp
48− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/UsersModel.cpp
49+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
4950 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
5051 )
5152# This add_dependencies is needed since we're linking with with -L and -l below
@@ -53,13 +54,12 @@ add_executable(GreeterUsersModelTestExec
5354add_dependencies(GreeterUsersModelTestExec MockLightDM)
5455qt5_use_modules(GreeterUsersModelTestExec Core Test)
5556target_link_libraries(GreeterUsersModelTestExec
56− -L${CMAKE_BINARY_DIR}/tests/mocks/IntegratedLightDM/liblightdm
57− -llightdm-qt5-2
57+ MockLightDM
5858 )
5959target_include_directories(GreeterUsersModelTestExec PUBLIC
60− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
60+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
6161 ${CMAKE_SOURCE_DIR}/plugins/Utils
62− ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
62+ ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
6363 )
6464add_unity8_uitest(GreeterUsers GreeterUsersModelTestExec
6565 ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
@@ -77,7 +77,7 @@ target_link_libraries(GreeterIntegratedTestExec
7777 )
7878target_include_directories(GreeterIntegratedTestExec PUBLIC
7979 ${GLIB_INCLUDE_DIRS}
80− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm
80+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm
8181 )
8282add_unity8_unittest(GreeterIntegrated dbus-test-runner
8383 ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/IntegratedLightDM/liblightdm/
tests/plugins/IntegratedLightDM/dbus.cpp → tests/plugins/LightDM/IntegratedLightDM/dbus.cpprenamed

The content is the same.

tests/plugins/IntegratedLightDM/greeter.qml → tests/plugins/LightDM/IntegratedLightDM/greeter.qmlrenamed+1−1
@@ -15,7 +15,7 @@
1515 */
1616
1717import QtQuick 2.4
18−import IntegratedLightDM 0.1 as LightDM
18+import LightDM.IntegratedLightDM 0.1 as LightDM
1919
2020Item {
2121 property var greeter: LightDM.Greeter
tests/plugins/IntegratedLightDM/integrated.cpp → tests/plugins/LightDM/IntegratedLightDM/integrated.cpprenamed

The content is the same.

tests/plugins/IntegratedLightDM/pam.cpp → tests/plugins/LightDM/IntegratedLightDM/pam.cpprenamed

The content is the same.

tests/plugins/IntegratedLightDM/usersmodel.cpp → tests/plugins/LightDM/IntegratedLightDM/usersmodel.cpprenamed

The content is the same.

tests/qmltests/Greeter/TestView.qml+1
@@ -43,6 +43,7 @@ Item {
4343 signal responded(string response)
4444 signal tease()
4545 signal emergencyCall()
46+ signal promptlessLogin()
4647
4748 signal _showMessageCalled(string html)
4849 signal _showPromptCalled(string text, bool isSecret, bool isDefaultPrompt)
tests/qmltests/Greeter/tst_Greeter.qml+28−10
@@ -22,7 +22,7 @@ import Ubuntu.Components 1.3
2222import AccountsService 0.1
2323import Biometryd 0.0
2424import GSettings 1.0
25−import IntegratedLightDM 0.1 as LightDM
25+import LightDM.IntegratedLightDM 0.1 as LightDM // This is the mock
2626import Unity.Test 0.1 as UT
2727
2828Item {
@@ -146,7 +146,9 @@ Item {
146146
147147 function init() {
148148 greeterSettings.lockedOutTime = 0;
149− resetLoader();
149+ LightDM.Greeter.selectUser = "";
150+ greeter.failedLoginsDelayAttempts = 7;
151+ greeter.failedLoginsDelayMinutes = 5;
150152 teaseSpy.clear();
151153 sessionStartedSpy.clear();
152154 activeChangedSpy.clear();
@@ -162,11 +164,7 @@ Item {
162164 viewShowErrorMessageSpy.clear();
163165 viewResetSpy.clear();
164166 viewTryToUnlockSpy.clear();
165− tryCompare(greeter, "waiting", false);
166− view = findChild(greeter, "testView");
167− verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
168− greeter.failedLoginsDelayAttempts = 7;
169− greeter.failedLoginsDelayMinutes = 5;
167+ resetLoader();
170168 }
171169
172170 function resetLoader() {
@@ -178,6 +176,8 @@ Item {
178176 loader.active = true;
179177 tryCompare(loader, "status", Loader.Ready);
180178 removeTimeConstraintsFromSwipeAreas(loader.item);
179+ tryCompare(greeter, "waiting", false);
180+ view = findChild(greeter, "testView");
181181 }
182182
183183 function getIndexOf(name) {
@@ -202,6 +202,7 @@ Item {
202202 compare(view.currentIndex, i);
203203 compare(AccountsService.user, name);
204204 compare(LightDM.Greeter.authenticationUser, name);
205+ return i;
205206 }
206207
207208 function verifyLoggedIn() {
@@ -248,11 +249,9 @@ Item {
248249
249250 function test_promptless() {
250251 selectUser("no-password");
251− tryCompare(viewAuthenticationSucceededSpy, "count", 1);
252− compare(sessionStartedSpy.count, 1);
252+ tryCompare(view, "locked", false);
253253 compare(viewShowPromptSpy.count, 0);
254254 compare(viewHideSpy.count, 0);
255− compare(view.locked, false);
256255 }
257256
258257 function test_twoFactorPass() {
@@ -573,6 +572,25 @@ Item {
573572 tryCompare(viewShowPromptSpy, "count", 1);
574573 }
575574
575+ function test_selectUserHint() {
576+ LightDM.Greeter.selectUser = "info-prompt";
577+ resetLoader();
578+ var i = verifySelected("info-prompt");
579+ verify(i != 0); // sanity-check that info-prompt isn't default 0 answer
580+ }
581+
582+ function test_selectUserHintUnset() {
583+ LightDM.Greeter.selectUser = "";
584+ resetLoader();
585+ verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
586+ }
587+
588+ function test_selectUserHintInvalid() {
589+ LightDM.Greeter.selectUser = "not-a-real-user";
590+ resetLoader();
591+ verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
592+ }
593+
576594 function test_fingerprintSuccess() {
577595 var index = selectUser("has-password");
578596 unlockAndShowGreeter(); // turn on lockscreen mode
tests/qmltests/Greeter/tst_Infographics.qml+1−1
@@ -20,7 +20,7 @@ import ".."
2020import "../../../qml/Greeter"
2121import Ubuntu.Components 1.3
2222import Unity.Test 0.1 as UT
23−import IntegratedLightDM 0.1 as LightDM
23+import LightDM.IntegratedLightDM 0.1 as LightDM
2424
2525Item {
2626 Binding {
tests/qmltests/Greeter/tst_NarrowView.qml+1−1
@@ -18,7 +18,7 @@ import QtQuick 2.4
1818import QtTest 1.0
1919import ".."
2020import "../../../qml/Greeter"
21−import IntegratedLightDM 0.1 as LightDM
21+import LightDM.IntegratedLightDM 0.1 as LightDM
2222import Ubuntu.Components 1.3
2323import Unity.Test 0.1 as UT
2424
tests/qmltests/Greeter/tst_WideView.qml+1−1
@@ -18,7 +18,7 @@ import QtQuick 2.4
1818import QtTest 1.0
1919import ".."
2020import "../../../qml/Greeter"
21−import IntegratedLightDM 0.1 as LightDM
21+import LightDM.IntegratedLightDM 0.1 as LightDM
2222import Ubuntu.Components 1.3
2323import Unity.Test 0.1 as UT
2424
tests/qmltests/Tutorial/tst_Tutorial.qml+1−1
@@ -17,7 +17,7 @@
1717import QtQuick 2.4
1818import QtTest 1.0
1919import AccountsService 0.1
20−import IntegratedLightDM 0.1 as LightDM
20+import LightDM.IntegratedLightDM 0.1 as LightDM
2121import Ubuntu.Components 1.3
2222import Ubuntu.Components.ListItems 1.3
2323import Ubuntu.Telephony 0.1 as Telephony
tests/qmltests/tst_OrientedShell.qml+1−1
@@ -22,7 +22,7 @@ import Ubuntu.Components 1.3
2222import Ubuntu.Components.ListItems 1.3 as ListItem
2323import Unity.Application 0.1
2424import Unity.Test 0.1
25−import IntegratedLightDM 0.1 as LightDM
25+import LightDM.IntegratedLightDM 0.1 as LightDM
2626import Powerd 0.1
2727import Unity.InputInfo 0.1
2828import Utils 0.1
tests/qmltests/tst_Shell.qml+5−13
@@ -18,7 +18,7 @@ import QtQuick 2.4
1818import QtTest 1.0
1919import AccountsService 0.1
2020import GSettings 1.0
21−import IntegratedLightDM 0.1 as LightDM
21+import LightDM.IntegratedLightDM 0.1 as LightDM
2222import Ubuntu.Components 1.3
2323import Ubuntu.Components.ListItems 1.3 as ListItem
2424import Ubuntu.Telephony 0.1 as Telephony
@@ -1176,16 +1176,13 @@ Rectangle {
11761176
11771177 function test_greeterLoginsAutomaticallyWhenNoPasswordSet() {
11781178 loadShell("phone");
1179− swipeAwayGreeter();
1180−
1181− sessionSpy.clear();
1182− verify(sessionSpy.valid);
1183−
1184− showGreeter();
11851179
11861180 var greeter = findChild(shell, "greeter");
11871181 verify(!greeter.locked);
1188− verify(sessionSpy.count > 0);
1182+ compare(sessionSpy.count, 0);
1183+
1184+ swipeAwayGreeter();
1185+ compare(sessionSpy.count, 1);
11891186 }
11901187
11911188 function test_fullscreen() {
@@ -2213,11 +2210,6 @@ Rectangle {
22132210 shell.usageScenario = "desktop";
22142211 GSettingsController.setAutohideLauncher(!data.launcherLocked);
22152212 waitForRendering(shell);
2216− // Not sure why 2 but it's the number of times
2217− // it triggers at this time and we need to wait
2218− // for them otherwise a sessionStarted signal will
2219− // hide the launcher and make the test fail
2220− tryCompare(sessionSpy, "count", 2);
22212213
22222214 var launcher = findChild(shell, "launcher");
22232215 var launcherPanel = findChild(launcher, "launcherPanel");
tests/qmltests/tst_ShellWithPin.qml+1−1
@@ -19,7 +19,7 @@ import Ubuntu.Components 1.3
1919import QtTest 1.0
2020import AccountsService 0.1
2121import GSettings 1.0
22−import IntegratedLightDM 0.1 as LightDM
22+import LightDM.IntegratedLightDM 0.1 as LightDM
2323import Ubuntu.SystemImage 0.1
2424import Ubuntu.Telephony 0.1 as Telephony
2525import Unity.Application 0.1