on xenial help sign in
Add unity8-greeter package which contains a basic, but usable LightDM greeter. (LP: #1324602)
8e548f2Josh Arenson
CMakeLists.txt+1
@@ -128,6 +128,7 @@ set(SHELL_APP unity8)
128set(DASH_APP unity8-dash)
128set(DASH_APP unity8-dash)
129set(SCOPE_TOOL unity-scope-tool)
129set(SCOPE_TOOL unity-scope-tool)
130set(INDICATORS_CLIENT_APP indicators-client)
130set(INDICATORS_CLIENT_APP indicators-client)
131+set(GREETER_APP unity8-greeter)
131set(MOCK_INDICATOR_SERVICE_APP unity-mock-indicator-service)
132set(MOCK_INDICATOR_SERVICE_APP unity-mock-indicator-service)
132
133
133include_directories(
134include_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 @@
2configure_file(${SHELL_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${SHELL_APP}.desktop @ONLY)
2configure_file(${SHELL_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${SHELL_APP}.desktop @ONLY)
3configure_file(${DASH_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${DASH_APP}.desktop @ONLY)
3configure_file(${DASH_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${DASH_APP}.desktop @ONLY)
4configure_file(${INDICATORS_CLIENT_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${INDICATORS_CLIENT_APP}.desktop @ONLY)
4configure_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)
5
6
6# install desktop files
7# install desktop files
7install(FILES
8install(FILES
@@ -11,6 +12,16 @@ install(FILES
11 DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
12 DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
12 )
13 )
13
14
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+
14# install dash icon
25# install dash icon
15install(FILES
26install(FILES
16 ${CMAKE_CURRENT_SOURCE_DIR}/${DASH_APP}.png
27 ${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,
23 libglib2.0-dev,
23 libglib2.0-dev,
24 libgsettings-qt-dev,
24 libgsettings-qt-dev,
25 libhardware-dev,
25 libhardware-dev,
26+ liblightdm-qt5-3-dev,
26 libpam0g-dev,
27 libpam0g-dev,
27 libpay2-dev,
28 libpay2-dev,
28 libpulse-dev,
29 libpulse-dev,
@@ -82,6 +83,17 @@ Depends: qmenumodel-qml (>= 0.2.9),
82Description: Indicators client test application
83Description: Indicators client test application
83 This package contains the client application for indicators used by autopilot
84 This package contains the client application for indicators used by autopilot
84
85
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+
85Package: unity-scope-tool
97Package: unity-scope-tool
86Architecture: any
98Architecture: any
87Depends: unity8-common (= ${source:Version}),
99Depends: unity8-common (= ${source:Version}),
debian/rules+1−1
@@ -37,6 +37,6 @@ override_dh_installdeb:
37override_dh_makeshlibs:
37override_dh_makeshlibs:
38 dh_makeshlibs -Nunity8-private -Nunity8-fake-env
38 dh_makeshlibs -Nunity8-private -Nunity8-fake-env
39
39
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
41override_dh_shlibdeps:
41override_dh_shlibdeps:
42 dh_shlibdeps -XlibMockLightDM-qml.so
42 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
4usr/lib/*/unity8/qml/Dash
4usr/lib/*/unity8/qml/Dash
5usr/lib/*/unity8/qml/GlobalShortcut
5usr/lib/*/unity8/qml/GlobalShortcut
6usr/lib/*/unity8/qml/Greeter
6usr/lib/*/unity8/qml/Greeter
7−usr/lib/*/unity8/qml/IntegratedLightDM
7+usr/lib/*/unity8/qml/LightDM
8usr/lib/*/unity8/qml/Lights
8usr/lib/*/unity8/qml/Lights
9usr/lib/*/unity8/qml/Powerd
9usr/lib/*/unity8/qml/Powerd
10usr/lib/*/unity8/qml/ScreenshotDirectory
10usr/lib/*/unity8/qml/ScreenshotDirectory
plugins/CMakeLists.txt+1−1
@@ -15,7 +15,7 @@ add_subdirectory(AccountsService)
15add_subdirectory(Cursor)
15add_subdirectory(Cursor)
16add_subdirectory(GlobalShortcut)
16add_subdirectory(GlobalShortcut)
17add_subdirectory(Greeter)
17add_subdirectory(Greeter)
18−add_subdirectory(IntegratedLightDM)
18+add_subdirectory(LightDM)
19add_subdirectory(Lights)
19add_subdirectory(Lights)
20add_subdirectory(Dash)
20add_subdirectory(Dash)
21add_subdirectory(Powerd)
21add_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 @@
1/*
1/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014, 2015 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
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
5 * it under the terms of the GNU General Public License as published by
@@ -24,7 +24,8 @@ DBusGreeter::DBusGreeter(Greeter *greeter, const QString &path)
24 : UnityDBusObject(path, QStringLiteral("com.canonical.UnityGreeter"), true, greeter),
24 : UnityDBusObject(path, QStringLiteral("com.canonical.UnityGreeter"), true, greeter),
25 m_greeter(greeter)
25 m_greeter(greeter)
26{
26{
27− connect(m_greeter, &Greeter::isActiveChanged, this, &DBusGreeter::isActiveChangedHandler);
27+ connect(m_greeter, &Greeter::isActiveChanged,
28+ this, &DBusGreeter::isActiveChangedHandler);
28}
29}
29
30
30bool DBusGreeter::isActive() const
31bool DBusGreeter::isActive() const
@@ -34,12 +35,12 @@ bool DBusGreeter::isActive() const
34
35
35void DBusGreeter::ShowGreeter()
36void DBusGreeter::ShowGreeter()
36{
37{
37− return Q_EMIT m_greeter->showGreeter();
38+ Q_EMIT m_greeter->showGreeter();
38}
39}
39
40
40void DBusGreeter::HideGreeter()
41void DBusGreeter::HideGreeter()
41{
42{
42− return Q_EMIT m_greeter->hideGreeter();
43+ Q_EMIT m_greeter->hideGreeter();
43}
44}
44
45
45void DBusGreeter::isActiveChangedHandler()
46void 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
78 return d->promptless;
78 return d->promptless;
79}
79}
80
80
81+QString Greeter::selectUser() const
82+{
83+ Q_D(const Greeter);
84+ return d->m_greeter->selectUserHint();
85+}
86+
81void Greeter::authenticate(const QString &username)
87void Greeter::authenticate(const QString &username)
82{
88{
83 Q_D(Greeter);
89 Q_D(Greeter);
plugins/IntegratedLightDM/Greeter.h → plugins/LightDM/Greeter.hrenamed+2
@@ -38,6 +38,7 @@ class Greeter : public QObject
38 Q_PROPERTY(bool authenticated READ isAuthenticated NOTIFY isAuthenticatedChanged)
38 Q_PROPERTY(bool authenticated READ isAuthenticated NOTIFY isAuthenticatedChanged)
39 Q_PROPERTY(QString authenticationUser READ authenticationUser NOTIFY authenticationUserChanged)
39 Q_PROPERTY(QString authenticationUser READ authenticationUser NOTIFY authenticationUserChanged)
40 Q_PROPERTY(bool promptless READ promptless NOTIFY promptlessChanged)
40 Q_PROPERTY(bool promptless READ promptless NOTIFY promptlessChanged)
41+ Q_PROPERTY(QString selectUser READ selectUser CONSTANT)
41
42
42public:
43public:
43 explicit Greeter(QObject* parent=0);
44 explicit Greeter(QObject* parent=0);
@@ -46,6 +47,7 @@ public:
46 bool isAuthenticated() const;
47 bool isAuthenticated() const;
47 QString authenticationUser() const;
48 QString authenticationUser() const;
48 bool promptless() const;
49 bool promptless() const;
50+ QString selectUser() const;
49
51
50public Q_SLOTS:
52public Q_SLOTS:
51 void authenticate(const QString &username=QString());
53 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
46 COMPILE_FLAGS "-DSM_BUSNAME=sessionBus -fPIC")
46 COMPILE_FLAGS "-DSM_BUSNAME=sessionBus -fPIC")
47set_target_properties(MockLightDM-demo-shared PROPERTIES
47set_target_properties(MockLightDM-demo-shared PROPERTIES
48 COMPILE_FLAGS "-DSM_BUSNAME=systemBus"
48 COMPILE_FLAGS "-DSM_BUSNAME=systemBus"
49− OUTPUT_NAME lightdm-qt5-2)
49+ OUTPUT_NAME lightdm-qt5-3)
50
50
51install(TARGETS MockLightDM-demo-shared
51install(TARGETS MockLightDM-demo-shared
52− DESTINATION ${SHELL_INSTALL_QML}/mocks/IntegratedLightDM/demo
52+ DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/demo
53 )
53 )
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:
50 {
50 {
51 qRegisterMetaType<QLightDM::GreeterImpl::ResponseFuture>("QLightDM::GreeterImpl::ResponseFuture");
51 qRegisterMetaType<QLightDM::GreeterImpl::ResponseFuture>("QLightDM::GreeterImpl::ResponseFuture");
52
52
53− connect(&futureWatcher, &QFutureWatcher<int>::finished,
53+ connect(&futureWatcher, &QFutureWatcher<int>::finished, this, &GreeterImpl::finishPam);
54− this, &GreeterImpl::finishPam);
55 connect(this, SIGNAL(showMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)),
54 connect(this, SIGNAL(showMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)),
56 this, SLOT(handleMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)));
55 this, SLOT(handleMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)));
57 // This next connect is how we pass ResponseFutures between threads
56 // 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 @@
1/*
1/*
2− * Copyright (C) 2012,2013, 2015 Canonical, Ltd.
2+ * Copyright (C) 2012,2013,2015 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
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
5 * 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
54 return UserMetricsOutput::UserMetrics::getInstance();
54 return UserMetricsOutput::UserMetrics::getInstance();
55}
55}
56
56
57−void IntegratedLightDMPlugin::registerTypes(const char *uri)
57+void PLUGIN_CLASSNAME::registerTypes(const char *uri)
58{
58{
59 qmlRegisterType<QAbstractItemModel>();
59 qmlRegisterType<QAbstractItemModel>();
60 qmlRegisterType<UserMetricsOutput::ColorTheme>();
60 qmlRegisterType<UserMetricsOutput::ColorTheme>();
61
61
62+#if defined INTEGRATED_LIGHTDM
62− Q_ASSERT(uri == QLatin1String("IntegratedLightDM"));
63+ Q_ASSERT(uri == QLatin1String("LightDM.IntegratedLightDM"));
64+#elif defined FULL_LIGHTDM
65+ Q_ASSERT(uri == QLatin1String("LightDM.FullLightDM"));
66+#endif
63 qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
67 qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
64 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
68 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
69+
70+#if defined INTEGRATED_LIGHTDM
65 qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider);
71 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+
66 qmlRegisterSingletonType<UsersModel>(uri, 0, 1, "Users", users_provider);
78 qmlRegisterSingletonType<UsersModel>(uri, 0, 1, "Users", users_provider);
67 qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", QStringLiteral("Type is not instantiable"));
79 qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", QStringLiteral("Type is not instantiable"));
68 qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider);
80 qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider);
plugins/IntegratedLightDM/plugin.h → plugins/LightDM/plugin.hrenamed+5−5
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2012,2013, 2015 Canonical, Ltd.
2+ * Copyright (C) 2012,2013,2015 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
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
5 * it under the terms of the GNU General Public License as published by
@@ -15,13 +15,13 @@
15 *
15 *
16 */
16 */
17
17
18−#ifndef INTEGRATED_LIGHTDM_PLUGIN_H
18+#ifndef LIGHTDM_PLUGIN_H
19−#define INTEGRATED_LIGHTDM_PLUGIN_H
19+#define LIGHTDM_PLUGIN_H
20
20
21#include <QtQml/QQmlEngine>
21#include <QtQml/QQmlEngine>
22#include <QtQml/QQmlExtensionPlugin>
22#include <QtQml/QQmlExtensionPlugin>
23
23
24−class IntegratedLightDMPlugin : public QQmlExtensionPlugin
24+class PLUGIN_CLASSNAME : public QQmlExtensionPlugin
25{
25{
26 Q_OBJECT
26 Q_OBJECT
27 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
27 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
@@ -30,4 +30,4 @@ public:
30 void registerTypes(const char *uri) override;
30 void registerTypes(const char *uri) override;
31};
31};
32
32
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)
291 // The rest of the indicators respect their default profile (which is "phone", even on desktop PCs)
291 // The rest of the indicators respect their default profile (which is "phone", even on desktop PCs)
292 if ((new_indicator->identifier() == QStringLiteral("indicator-session"))
292 if ((new_indicator->identifier() == QStringLiteral("indicator-session"))
293 || (new_indicator->identifier() == QStringLiteral("indicator-power") && m_platform.isPC())) {
293 || (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")));
295 } else {
295 } else {
296 new_indicator->setProfile(m_profile);
296 new_indicator->setProfile(m_profile);
297 }
297 }
qml/Components/Dialogs.qml+3−5
@@ -107,12 +107,12 @@ Item {
107
107
108 GlobalShortcut { // lock screen
108 GlobalShortcut { // lock screen
109 shortcut: Qt.Key_ScreenSaver
109 shortcut: Qt.Key_ScreenSaver
110− onTriggered: lightDM.greeter.showGreeter()
110+ onTriggered: LightDMService.greeter.showGreeter()
111 }
111 }
112
112
113 GlobalShortcut { // lock screen
113 GlobalShortcut { // lock screen
114 shortcut: Qt.ControlModifier|Qt.AltModifier|Qt.Key_L
114 shortcut: Qt.ControlModifier|Qt.AltModifier|Qt.Key_L
115− onTriggered: lightDM.greeter.showGreeter()
115+ onTriggered: LightDMService.greeter.showGreeter()
116 }
116 }
117
117
118 QtObject {
118 QtObject {
@@ -137,8 +137,6 @@ Item {
137 active: false
137 active: false
138 }
138 }
139
139
140− LightDM {id: lightDM} // Provide backend access
141−
142 Component {
140 Component {
143 id: logoutDialogComponent
141 id: logoutDialogComponent
144 ShellDialog {
142 ShellDialog {
@@ -148,7 +146,7 @@ Item {
148 Button {
146 Button {
149 text: i18n.ctr("Button: Lock the system", "Lock")
147 text: i18n.ctr("Button: Lock the system", "Lock")
150 onClicked: {
148 onClicked: {
151− lightDM.greeter.showGreeter()
149+ LightDMService.greeter.showGreeter()
152 logoutDialog.hide();
150 logoutDialog.hide();
153 }
151 }
154 }
152 }
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
23import Ubuntu.SystemImage 0.1
23import Ubuntu.SystemImage 0.1
24import Unity.Launcher 0.1
24import Unity.Launcher 0.1
25import Unity.Session 0.1
25import Unity.Session 0.1
26+
27+import "." 0.1
26import "../Components"
28import "../Components"
27
29
28Showable {
30Showable {
@@ -48,7 +50,7 @@ Showable {
48 readonly property bool hasLockedApp: lockedApp !== ""
50 readonly property bool hasLockedApp: lockedApp !== ""
49
51
50 property bool forcedUnlock
52 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
52
54
53 property bool tabletMode
55 property bool tabletMode
54 property url viewSource // only used for testing
56 property url viewSource // only used for testing
@@ -120,12 +122,12 @@ Showable {
120 return d.startUnlock(true /* toTheRight */);
122 return d.startUnlock(true /* toTheRight */);
121 }
123 }
122
124
123− LightDM{id:lightDM} // Provide backend access
124 QtObject {
125 QtObject {
125 id: d
126 id: d
126
127
127− readonly property bool multiUser: lightDM.users.count > 1
128+ readonly property bool multiUser: LightDMService.users.count > 1
129+ readonly property int selectUserIndex: d.getUserIndex(LightDMService.greeter.selectUser)
128− property int currentIndex
130+ property int currentIndex: Math.max(selectUserIndex, 0)
129 property bool waiting
131 property bool waiting
130 property bool isLockscreen // true when we are locking an active session, rather than first user login
132 property bool isLockscreen // true when we are locking an active session, rather than first user login
131 readonly property bool secureFingerprint: isLockscreen &&
133 readonly property bool secureFingerprint: isLockscreen &&
@@ -147,21 +149,37 @@ Showable {
147 UbuntuNumberAnimation {}
149 UbuntuNumberAnimation {}
148 }
150 }
149
151
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+
150 function selectUser(uid, reset) {
166 function selectUser(uid, reset) {
167+ if (uid < 0)
168+ return;
151 d.waiting = true;
169 d.waiting = true;
152 if (reset) {
170 if (reset) {
153 loader.item.reset();
171 loader.item.reset();
154 }
172 }
155 currentIndex = uid;
173 currentIndex = uid;
156− var user = lightDM.users.data(uid, lightDM.userRoles.NameRole);
174+ var user = LightDMService.users.data(uid, LightDMService.userRoles.NameRole);
157 AccountsService.user = user;
175 AccountsService.user = user;
158 LauncherModel.setUser(user);
176 LauncherModel.setUser(user);
159− lightDM.greeter.authenticate(user); // always resets auth state
177+ LightDMService.greeter.authenticate(user); // always resets auth state
160 }
178 }
161
179
162 function login() {
180 function login() {
163 enabled = false;
181 enabled = false;
164− if (lightDM.greeter.startSessionSync()) {
182+ if (LightDMService.greeter.startSessionSync()) {
165 sessionStarted();
183 sessionStarted();
166 if (loader.item) {
184 if (loader.item) {
167 loader.item.notifyAuthenticationSucceeded(false /* showFakePassword */);
185 loader.item.notifyAuthenticationSucceeded(false /* showFakePassword */);
@@ -307,7 +325,7 @@ Showable {
307 root.lockedApp = "";
325 root.lockedApp = "";
308 root.forceActiveFocus();
326 root.forceActiveFocus();
309 d.selectUser(d.currentIndex, true);
327 d.selectUser(d.currentIndex, true);
310− lightDM.infographic.readyForDataChange();
328+ LightDMService.infographic.readyForDataChange();
311 }
329 }
312
330
313 Connections {
331 Connections {
@@ -315,13 +333,12 @@ Showable {
315 onSelected: {
333 onSelected: {
316 d.selectUser(index, true);
334 d.selectUser(index, true);
317 }
335 }
336+ onPromptlessLogin: d.login();
318 onResponded: {
337 onResponded: {
319 if (root.locked) {
338 if (root.locked) {
320− lightDM.greeter.respond(response);
339+ LightDMService.greeter.respond(response);
321 } else {
340 } else {
322− if (lightDM.greeter.active && !lightDM.greeter.authenticated) { // could happen if forcedUnlock
323− d.login();
341+ d.login();
324− }
325 loader.item.hide();
342 loader.item.hide();
326 }
343 }
327 }
344 }
@@ -385,18 +402,18 @@ Showable {
385 Binding {
402 Binding {
386 target: loader.item
403 target: loader.item
387 property: "userModel"
404 property: "userModel"
388− value: lightDM.users
405+ value: LightDMService.users
389 }
406 }
390
407
391 Binding {
408 Binding {
392 target: loader.item
409 target: loader.item
393 property: "infographicModel"
410 property: "infographicModel"
394− value: lightDM.infographic
411+ value: LightDMService.infographic
395 }
412 }
396 }
413 }
397
414
398 Connections {
415 Connections {
399− target: lightDM.greeter
416+ target: LightDMService.greeter
400
417
401 onShowGreeter: root.forceShow()
418 onShowGreeter: root.forceShow()
402
419
@@ -431,13 +448,13 @@ Showable {
431 onAuthenticationComplete: {
448 onAuthenticationComplete: {
432 d.waiting = false;
449 d.waiting = false;
433
450
434− if (lightDM.greeter.authenticated) {
451+ if (LightDMService.greeter.authenticated) {
452+ if (!LightDMService.greeter.promptless) {
435− d.login();
453+ d.login();
436− if (!lightDM.greeter.promptless) {
437 loader.item.hide();
454 loader.item.hide();
438 }
455 }
439 } else {
456 } else {
440− if (!lightDM.greeter.promptless) {
457+ if (!LightDMService.greeter.promptless) {
441 AccountsService.failedLogins++;
458 AccountsService.failedLogins++;
442 }
459 }
443
460
@@ -458,21 +475,13 @@ Showable {
458 }
475 }
459
476
460 loader.item.notifyAuthenticationFailed();
477 loader.item.notifyAuthenticationFailed();
461− if (!lightDM.greeter.promptless) {
478+ if (!LightDMService.greeter.promptless) {
462 d.selectUser(d.currentIndex, false);
479 d.selectUser(d.currentIndex, false);
463 }
480 }
464 }
481 }
465 }
482 }
466
483
467− onRequestAuthenticationUser: {
484+ onRequestAuthenticationUser: d.selectUser(d.getUserIndex(user), true)
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− }
476 }
485 }
477
486
478 Connections {
487 Connections {
@@ -485,20 +494,20 @@ Showable {
485 }
494 }
486
495
487 Binding {
496 Binding {
488− target: lightDM.greeter
497+ target: LightDMService.greeter
489 property: "active"
498 property: "active"
490 value: root.active
499 value: root.active
491 }
500 }
492
501
493 Binding {
502 Binding {
494− target: lightDM.infographic
503+ target: LightDMService.infographic
495 property: "username"
504 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) : ""
497 }
506 }
498
507
499 Connections {
508 Connections {
500 target: i18n
509 target: i18n
501− onLanguageChanged: lightDM.infographic.readyForDataChange()
510+ onLanguageChanged: LightDMService.infographic.readyForDataChange()
502 }
511 }
503
512
504 Observer {
513 Observer {
@@ -550,7 +559,7 @@ Showable {
550 failOperation("fingerprint reader is locked");
559 failOperation("fingerprint reader is locked");
551 return;
560 return;
552 }
561 }
553− if (result !== lightDM.users.data(d.currentIndex, lightDM.userRoles.UidRole)) {
562+ if (result !== LightDMService.users.data(d.currentIndex, LightDMService.userRoles.UidRole)) {
554 AccountsService.failedFingerprintLogins++;
563 AccountsService.failedFingerprintLogins++;
555 failOperation("not the selected user");
564 failOperation("not the selected user");
556 return;
565 return;
qml/Greeter/IntegratedLightDMImpl.qml+1−1
@@ -15,7 +15,7 @@
15 */
15 */
16
16
17import QtQuick 2.4
17import QtQuick 2.4
18−import IntegratedLightDM 0.1 as LightDM
18+import LightDM.IntegratedLightDM 0.1 as LightDM
19
19
20Item{
20Item{
21 id: implementation
21 id: implementation
qml/Greeter/LightDM.qml → qml/Greeter/LightDMService.qmlrenamed+14−3
@@ -19,6 +19,7 @@
19 * plugin
19 * plugin
20 */
20 */
21
21
22+pragma Singleton
22import QtQuick 2.4
23import QtQuick 2.4
23
24
24Loader {
25Loader {
@@ -29,13 +30,23 @@ Loader {
29 property var users: d.valid ? loader.item.users : null
30 property var users: d.valid ? loader.item.users : null
30 property var userRoles: d.valid ? loader.item.userRoles : null
31 property var userRoles: d.valid ? loader.item.userRoles : null
31
32
32− // TODO: Conditionally load RealLightDMImpl if shellMode dictates it
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 ?
33− source: "./IntegratedLightDMImpl.qml"
45+ "FullLightDMImpl.qml" : "IntegratedLightDMImpl.qml"
34
46
35 QtObject {
47 QtObject {
36 id: d
48 id: d
37
49
38 property bool valid: loader.item !== null
50 property bool valid: loader.item !== null
39 }
51 }
40−
41}
52}
qml/Greeter/LoginList.qml+2
@@ -36,6 +36,7 @@ StyledItem {
36
36
37 signal selected(int index)
37 signal selected(int index)
38 signal responded(string response)
38 signal responded(string response)
39+ signal promptlessLogin()
39
40
40 function tryToUnlock() {
41 function tryToUnlock() {
41 if (wasPrompted) {
42 if (wasPrompted) {
@@ -44,6 +45,7 @@ StyledItem {
44 if (root.locked) {
45 if (root.locked) {
45 root.selected(currentIndex);
46 root.selected(currentIndex);
46 } else {
47 } else {
48+ promptlessLogin();
47 root.responded("");
49 root.responded("");
48 }
50 }
49 }
51 }
qml/Greeter/WideView.qml+2
@@ -37,6 +37,7 @@ FocusScope {
37 // so that it can be replaced in tests with a mock object
37 // so that it can be replaced in tests with a mock object
38 property var inputMethod: Qt.inputMethod
38 property var inputMethod: Qt.inputMethod
39
39
40+ signal promptlessLogin()
40 signal selected(int index)
41 signal selected(int index)
41 signal responded(string response)
42 signal responded(string response)
42 signal tease()
43 signal tease()
@@ -132,6 +133,7 @@ FocusScope {
132
133
133 locked: root.locked
134 locked: root.locked
134
135
136+ onPromptlessLogin: root.promptlessLogin()
135 onSelected: root.selected(index)
137 onSelected: root.selected(index)
136 onResponded: root.responded(response)
138 onResponded: root.responded(response)
137 }
139 }
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 {
175 finishStartUpTimer.start();
175 finishStartUpTimer.start();
176 }
176 }
177
177
178− LightDM{id: lightDM} // Provide backend access
179 VolumeControl {
178 VolumeControl {
180 id: volumeControl
179 id: volumeControl
181 indicators: panel.indicators
180 indicators: panel.indicators
@@ -260,8 +259,8 @@ StyledItem {
260 ? "phone"
259 ? "phone"
261 : shell.usageScenario
260 : shell.usageScenario
262 readonly property string qmlComponent: {
261 readonly property string qmlComponent: {
263− if(shell.mode === "greeter") {
262+ if (shell.mode === "greeter") {
264− return "Stages/ShimStage.qml"
263+ return "Stages/AbstractStage.qml"
265 } else if (applicationsDisplayLoader.usageScenario === "phone") {
264 } else if (applicationsDisplayLoader.usageScenario === "phone") {
266 return "Stages/PhoneStage.qml";
265 return "Stages/PhoneStage.qml";
267 } else if (applicationsDisplayLoader.usageScenario === "tablet") {
266 } else if (applicationsDisplayLoader.usageScenario === "tablet") {
@@ -502,7 +501,7 @@ StyledItem {
502 function showHome() {
501 function showHome() {
503 greeter.notifyUserRequestedApp("unity8-dash");
502 greeter.notifyUserRequestedApp("unity8-dash");
504
503
505− var animate = !lightDM.greeter.active && !stages.shown
504+ var animate = !LightDMService.greeter.active && !stages.shown
506 dash.setCurrentScope(0, animate, false)
505 dash.setCurrentScope(0, animate, false)
507 ApplicationManager.requestFocusApplication("unity8-dash")
506 ApplicationManager.requestFocusApplication("unity8-dash")
508 }
507 }
@@ -541,7 +540,12 @@ StyledItem {
541
540
542 indicatorsModel: Indicators.IndicatorsModel {
541 indicatorsModel: Indicators.IndicatorsModel {
543 // tablet and phone both use the same profile
542 // tablet and phone both use the same profile
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.
544− profile: "phone"
548+ profile: shell.mode === "greeter" ? "desktop_greeter" : "phone"
545 Component.onCompleted: load();
549 Component.onCompleted: load();
546 }
550 }
547 }
551 }
@@ -553,7 +557,7 @@ StyledItem {
553 readonly property bool focusedSurfaceIsFullscreen: MirFocusController.focusedSurface
557 readonly property bool focusedSurfaceIsFullscreen: MirFocusController.focusedSurface
554 ? MirFocusController.focusedSurface.state === Mir.FullscreenState
558 ? MirFocusController.focusedSurface.state === Mir.FullscreenState
555 : false
559 : false
556− fullscreenMode: (focusedSurfaceIsFullscreen && !lightDM.greeter.active && launcher.progress == 0)
560+ fullscreenMode: (focusedSurfaceIsFullscreen && !LightDMService.greeter.active && launcher.progress == 0)
557 || greeter.hasLockedApp
561 || greeter.hasLockedApp
558 locked: greeter && greeter.active
562 locked: greeter && greeter.active
559 }
563 }
@@ -671,6 +675,7 @@ StyledItem {
671 id: wizard
675 id: wizard
672 objectName: "wizard"
676 objectName: "wizard"
673 anchors.fill: parent
677 anchors.fill: parent
678+ deferred: shell.mode === "greeter"
674
679
675 function unlockWhenDoneWithWizard() {
680 function unlockWhenDoneWithWizard() {
676 if (!active) {
681 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 @@
1/*
1/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2013, 2015 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
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
5 * it under the terms of the GNU General Public License as published by
@@ -29,6 +29,10 @@ Showable {
29 // expected behavior of no emission on startup.
29 // expected behavior of no emission on startup.
30 readonly property bool active: loader.active
30 readonly property bool active: loader.active
31
31
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+
32 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
36 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
33
37
34 onRequiredChanged: {
38 onRequiredChanged: {
@@ -40,7 +44,7 @@ Showable {
40 Loader {
44 Loader {
41 id: loader
45 id: loader
42 anchors.fill: parent
46 anchors.fill: parent
43− active: System.wizardEnabled
47+ active: System.wizardEnabled && !deferred
44 source: "Pages.qml"
48 source: "Pages.qml"
45
49
46 Connections {
50 Connections {
src/ShellApplication.cpp+11−1
@@ -18,6 +18,7 @@
18
18
19// Qt
19// Qt
20#include <QLibrary>
20#include <QLibrary>
21+#include <QProcess>
21#include <QScreen>
22#include <QScreen>
22
23
23#include <libintl.h>
24#include <libintl.h>
@@ -110,7 +111,16 @@ ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
110 m_secondaryWindow->setVisible(true);
111 m_secondaryWindow->setVisible(true);
111 }
112 }
112
113
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+ }
113− if (isMirServer || parser.hasFullscreen()) {
123+ } else if (isMirServer || parser.hasFullscreen()) {
114 m_shellView->showFullScreen();
124 m_shellView->showFullScreen();
115 } else {
125 } else {
116 m_shellView->show();
126 m_shellView->show();
tests/CMakeLists.txt+1−1
@@ -47,7 +47,7 @@ macro(unity8_parse_arguments)
47 if(U8TEST_LIGHTDM)
47 if(U8TEST_LIGHTDM)
48 list(APPEND ld_paths
48 list(APPEND ld_paths
49 ${UNITY_MOCKPATH}/libusermetrics
49 ${UNITY_MOCKPATH}/libusermetrics
50− ${UNITY_MOCKPATH}/IntegratedLightDM/liblightdm
50+ ${UNITY_MOCKPATH}/LightDM/IntegratedLightDM/liblightdm
51 )
51 )
52 endif()
52 endif()
53
53
tests/autopilot/unity8/fixture_setup.py+1−1
@@ -74,7 +74,7 @@ class LaunchUnityWithFakeSensors(fixtures.Fixture):
74 def _get_lightdm_mock_path(self):
74 def _get_lightdm_mock_path(self):
75 lib_path = get_mocks_library_path()
75 lib_path = get_mocks_library_path()
76 lightdm_mock_path = os.path.abspath(
76 lightdm_mock_path = os.path.abspath(
77− os.path.join(lib_path, "IntegratedLightDM", "liblightdm")
77+ os.path.join(lib_path, "LightDM" ,"IntegratedLightDM", "liblightdm")
78 )
78 )
79
79
80 if not os.path.exists(lightdm_mock_path):
80 if not os.path.exists(lightdm_mock_path):
tests/autopilot/unity8/greeter/tests/test_args.py−5
@@ -35,11 +35,6 @@ class GreeterArgsTest(GreeterTestCase):
35 shell = self.get_shell(unity_proxy)
35 shell = self.get_shell(unity_proxy)
36 self.assertTrue(shell.mode == 'full-shell')
36 self.assertTrue(shell.mode == 'full-shell')
37
37
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−
43 def test_nonexistent_mode(self):
38 def test_nonexistent_mode(self):
44 unity_proxy = self.launch_unity(mode=self.NONEXISTENT_MODE)
39 unity_proxy = self.launch_unity(mode=self.NONEXISTENT_MODE)
45 shell = self.get_shell(unity_proxy)
40 shell = self.get_shell(unity_proxy)
tests/autopilot/unity8/shell/tests/__init__.py+1−1
@@ -261,7 +261,7 @@ class UnityTestCase(AutopilotTestCase):
261 def _get_lightdm_mock_path(self):
261 def _get_lightdm_mock_path(self):
262 lib_path = get_mocks_library_path()
262 lib_path = get_mocks_library_path()
263 lightdm_mock_path = os.path.abspath(
263 lightdm_mock_path = os.path.abspath(
264− os.path.join(lib_path, "IntegratedLightDM", "liblightdm")
264+ os.path.join(lib_path, "LightDM" ,"IntegratedLightDM", "liblightdm")
265 )
265 )
266
266
267 if not os.path.exists(lightdm_mock_path):
267 if not os.path.exists(lightdm_mock_path):
tests/mocks/CMakeLists.txt+1−1
@@ -34,7 +34,7 @@ add_subdirectory(Cursor)
34add_subdirectory(GSettings.1.0)
34add_subdirectory(GSettings.1.0)
35add_subdirectory(indicator-service)
35add_subdirectory(indicator-service)
36add_subdirectory(libusermetrics)
36add_subdirectory(libusermetrics)
37−add_subdirectory(IntegratedLightDM)
37+add_subdirectory(LightDM)
38add_subdirectory(Lights)
38add_subdirectory(Lights)
39add_subdirectory(MeeGo)
39add_subdirectory(MeeGo)
40add_subdirectory(Powerd)
40add_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(
10 ${CMAKE_CURRENT_SOURCE_DIR}
10 ${CMAKE_CURRENT_SOURCE_DIR}
11 ${CMAKE_CURRENT_BINARY_DIR}
11 ${CMAKE_CURRENT_BINARY_DIR}
12 ${CMAKE_SOURCE_DIR}/plugins/Utils
12 ${CMAKE_SOURCE_DIR}/plugins/Utils
13− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
13+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
14 ${CMAKE_SOURCE_DIR}/tests/mocks/libusermetrics
14 ${CMAKE_SOURCE_DIR}/tests/mocks/libusermetrics
15 ${libunity8-private_SOURCE_DIR}
15 ${libunity8-private_SOURCE_DIR}
16)
16)
17
17
18set(QMLPLUGIN_SRC
18set(QMLPLUGIN_SRC
19− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/DBusGreeter.cpp
19+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeter.cpp
20− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/DBusGreeterList.cpp
20+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeterList.cpp
21− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/Greeter.cpp
21+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
22− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/UsersModel.cpp
22+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
23 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
23 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
24 MockGreeter.cpp
24 MockGreeter.cpp
25 MockUsersModel.cpp
25 MockUsersModel.cpp
@@ -30,7 +30,7 @@ add_library(MockLightDM-qml MODULE
30 ${QMLPLUGIN_SRC}
30 ${QMLPLUGIN_SRC}
31 )
31 )
32
32
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
34# installed on the system. So we make sure we link to our full fake version
34# installed on the system. So we make sure we link to our full fake version
35# At run time, we can point to whichever version we happen to be using via
35# At run time, we can point to whichever version we happen to be using via
36# LD_LIBRARY_PATH.
36# LD_LIBRARY_PATH.
@@ -42,7 +42,7 @@ target_link_libraries(MockLightDM-qml
42
42
43qt5_use_modules(MockLightDM-qml DBus Gui Qml)
43qt5_use_modules(MockLightDM-qml DBus Gui Qml)
44
44
45−add_unity8_mock(IntegratedLightDM 0.1 IntegratedLightDM
45+add_unity8_mock(LightDM.IntegratedLightDM 0.1 LightDM/IntegratedLightDM
46 PREFIX mocks
46 PREFIX mocks
47 TARGETS MockLightDM-qml
47 TARGETS MockLightDM-qml
48 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/liblightdm"
48 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)
33 Q_EMIT mockModeChanged(mockMode);
33 Q_EMIT mockModeChanged(mockMode);
34 }
34 }
35}
35}
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 {
25 Q_OBJECT
25 Q_OBJECT
26
26
27 Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
27 Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
28+ Q_PROPERTY(QString selectUser READ selectUserHint WRITE setSelectUserHint NOTIFY selectUserHintChanged)
28
29
29public:
30public:
30 QString mockMode() const;
31 QString mockMode() const;
31 void setMockMode(QString mockMode);
32 void setMockMode(QString mockMode);
32
33
34+ QString selectUserHint() const;
35+ void setSelectUserHint(const QString &selectUserHint);
36+
33Q_SIGNALS:
37Q_SIGNALS:
34 void mockModeChanged(QString mode);
38 void mockModeChanged(QString mode);
39+ void selectUserHintChanged();
35};
40};
36
41
37#endif // MOCK_UNITY_GREETER_H
42#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})
11qt5_use_modules(MockLightDM Gui)
11qt5_use_modules(MockLightDM Gui)
12
12
13set_target_properties(MockLightDM PROPERTIES
13set_target_properties(MockLightDM PROPERTIES
14− OUTPUT_NAME lightdm-qt5-2)
14+ OUTPUT_NAME lightdm-qt5-3)
15
15
16install(TARGETS MockLightDM
16install(TARGETS MockLightDM
17− DESTINATION ${SHELL_INSTALL_QML}/mocks/IntegratedLightDM/liblightdm
17+ DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/liblightdm
18 )
18 )
tests/mocks/IntegratedLightDM/liblightdm/Greeter.cpp → tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpprenamed+8−1
@@ -76,7 +76,14 @@ bool Greeter::lockHint () const
76
76
77QString Greeter::selectUserHint() const
77QString Greeter::selectUserHint() const
78{
78{
79+ Q_D(const Greeter);
79− return "";
80+ return d->selectUserHint;
81+}
82+
83+void Greeter::setSelectUserHint(const QString &selectUserHint)
84+{
85+ Q_D(Greeter);
86+ d->selectUserHint = selectUserHint;
80}
87}
81
88
82bool Greeter::selectGuestHint() const
89bool Greeter::selectGuestHint() const
tests/mocks/IntegratedLightDM/liblightdm/Greeter.h → tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.hrenamed+1
@@ -70,6 +70,7 @@ public:
70 bool lockHint () const;
70 bool lockHint () const;
71 bool hasGuestAccountHint() const;
71 bool hasGuestAccountHint() const;
72 QString selectUserHint() const;
72 QString selectUserHint() const;
73+ void setSelectUserHint(const QString &selectUserHint); // only in mock
73 bool selectGuestHint() const;
74 bool selectGuestHint() const;
74 QString autologinUserHint() const;
75 QString autologinUserHint() const;
75 bool autologinGuestHint() const;
76 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:
34 bool authenticated;
34 bool authenticated;
35 QString authenticationUser;
35 QString authenticationUser;
36 bool twoFactorDone;
36 bool twoFactorDone;
37+ QString selectUserHint;
37
38
38 QString mockMode;
39 QString mockMode;
39
40
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 @@
19#include <DBusGreeterList.h>
19#include <DBusGreeterList.h>
20#include "MockGreeter.h"
20#include "MockGreeter.h"
21#include "MockUsersModel.h"
21#include "MockUsersModel.h"
22−#include <libusermetricsoutput/ColorTheme.h>
22+#include "ColorTheme.h"
23−#include <libusermetricsoutput/UserMetrics.h>
23+#include "UserMetrics.h"
24#include <QLightDM/UsersModel>
24#include <QLightDM/UsersModel>
25
25
26#include <QAbstractItemModel>
26#include <QAbstractItemModel>
@@ -53,12 +53,12 @@ static QObject *infographic_provider(QQmlEngine *engine, QJSEngine *scriptEngine
53 return UserMetricsOutput::UserMetrics::getInstance();
53 return UserMetricsOutput::UserMetrics::getInstance();
54}
54}
55
55
56−void IntegratedLightDMPlugin::registerTypes(const char *uri)
56+void LightDMPlugin::registerTypes(const char *uri)
57{
57{
58 qmlRegisterType<QAbstractItemModel>();
58 qmlRegisterType<QAbstractItemModel>();
59 qmlRegisterType<UserMetricsOutput::ColorTheme>();
59 qmlRegisterType<UserMetricsOutput::ColorTheme>();
60
60
61− Q_ASSERT(uri == QLatin1String("IntegratedLightDM"));
61+ Q_ASSERT(uri == QLatin1String("LightDM.IntegratedLightDM"));
62 qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
62 qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
63 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
63 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
64 qmlRegisterSingletonType<MockGreeter>(uri, 0, 1, "Greeter", greeter_provider);
64 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 @@
20#include <QtQml/QQmlEngine>
20#include <QtQml/QQmlEngine>
21#include <QtQml/QQmlExtensionPlugin>
21#include <QtQml/QQmlExtensionPlugin>
22
22
23−class IntegratedLightDMPlugin : public QQmlExtensionPlugin
23+class LightDMPlugin : public QQmlExtensionPlugin
24{
24{
25 Q_OBJECT
25 Q_OBJECT
26 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
26 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)
3add_subdirectory(Dash)
3add_subdirectory(Dash)
4add_subdirectory(GlobalShortcut)
4add_subdirectory(GlobalShortcut)
5add_subdirectory(Greeter)
5add_subdirectory(Greeter)
6−add_subdirectory(IntegratedLightDM)
6+add_subdirectory(LightDM)
7add_subdirectory(Ubuntu)
7add_subdirectory(Ubuntu)
8add_subdirectory(Unity)
8add_subdirectory(Unity)
9add_subdirectory(Utils)
9add_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(
8
8
9add_executable(GreeterDBusTestExec
9add_executable(GreeterDBusTestExec
10 dbus.cpp
10 dbus.cpp
11− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/Greeter.cpp
11+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
12 )
12 )
13# This add_dependencies is needed since we're linking with with -L and -l below
13# This add_dependencies is needed since we're linking with with -L and -l below
14# make seems to work but ninja breaks without it
14# make seems to work but ninja breaks without it
15add_dependencies(GreeterDBusTestExec MockLightDM)
15add_dependencies(GreeterDBusTestExec MockLightDM)
16qt5_use_modules(GreeterDBusTestExec Core DBus Quick Test)
16qt5_use_modules(GreeterDBusTestExec Core DBus Quick Test)
17target_link_libraries(GreeterDBusTestExec
17target_link_libraries(GreeterDBusTestExec
18− -L${CMAKE_BINARY_DIR}/tests/mocks/IntegratedLightDM/liblightdm
18+ MockLightDM
19− -llightdm-qt5-2
20 )
19 )
21target_include_directories(GreeterDBusTestExec PUBLIC
20target_include_directories(GreeterDBusTestExec PUBLIC
22− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
21+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
23− ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
22+ ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
24 )
23 )
25add_unity8_uitest(GreeterDBus dbus-test-runner
24add_unity8_uitest(GreeterDBus dbus-test-runner
26 ARG_PREFIX "--parameter"
25 ARG_PREFIX "--parameter"
@@ -32,20 +31,22 @@ add_unity8_uitest(GreeterDBus dbus-test-runner
32
31
33add_executable(GreeterPamTestExec
32add_executable(GreeterPamTestExec
34 pam.cpp
33 pam.cpp
35− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm/GreeterPrivate.cpp
34+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp
36 )
35 )
37qt5_use_modules(GreeterPamTestExec Concurrent Core Test)
36qt5_use_modules(GreeterPamTestExec Concurrent Core Test)
38target_link_libraries(GreeterPamTestExec
37target_link_libraries(GreeterPamTestExec
39 integratedLightDM
38 integratedLightDM
40 )
39 )
40+
41target_include_directories(GreeterPamTestExec PUBLIC
41target_include_directories(GreeterPamTestExec PUBLIC
42+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM
42− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm
43+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm
43 )
44 )
44add_qmltest_target(testGreeterPam GreeterPamTestExec COMMAND $<TARGET_FILE:GreeterPamTestExec>)
45add_qmltest_target(testGreeterPam GreeterPamTestExec COMMAND $<TARGET_FILE:GreeterPamTestExec>)
45
46
46add_executable(GreeterUsersModelTestExec
47add_executable(GreeterUsersModelTestExec
47 usersmodel.cpp
48 usersmodel.cpp
48− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/UsersModel.cpp
49+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
49 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
50 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
50 )
51 )
51# This add_dependencies is needed since we're linking with with -L and -l below
52# This add_dependencies is needed since we're linking with with -L and -l below
@@ -53,13 +54,12 @@ add_executable(GreeterUsersModelTestExec
53add_dependencies(GreeterUsersModelTestExec MockLightDM)
54add_dependencies(GreeterUsersModelTestExec MockLightDM)
54qt5_use_modules(GreeterUsersModelTestExec Core Test)
55qt5_use_modules(GreeterUsersModelTestExec Core Test)
55target_link_libraries(GreeterUsersModelTestExec
56target_link_libraries(GreeterUsersModelTestExec
56− -L${CMAKE_BINARY_DIR}/tests/mocks/IntegratedLightDM/liblightdm
57+ MockLightDM
57− -llightdm-qt5-2
58 )
58 )
59target_include_directories(GreeterUsersModelTestExec PUBLIC
59target_include_directories(GreeterUsersModelTestExec PUBLIC
60− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
60+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
61 ${CMAKE_SOURCE_DIR}/plugins/Utils
61 ${CMAKE_SOURCE_DIR}/plugins/Utils
62− ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
62+ ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
63 )
63 )
64add_unity8_uitest(GreeterUsers GreeterUsersModelTestExec
64add_unity8_uitest(GreeterUsers GreeterUsersModelTestExec
65 ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
65 ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
@@ -77,7 +77,7 @@ target_link_libraries(GreeterIntegratedTestExec
77 )
77 )
78target_include_directories(GreeterIntegratedTestExec PUBLIC
78target_include_directories(GreeterIntegratedTestExec PUBLIC
79 ${GLIB_INCLUDE_DIRS}
79 ${GLIB_INCLUDE_DIRS}
80− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm
80+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm
81 )
81 )
82add_unity8_unittest(GreeterIntegrated dbus-test-runner
82add_unity8_unittest(GreeterIntegrated dbus-test-runner
83 ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/IntegratedLightDM/liblightdm/
83 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 @@
15 */
15 */
16
16
17import QtQuick 2.4
17import QtQuick 2.4
18−import IntegratedLightDM 0.1 as LightDM
18+import LightDM.IntegratedLightDM 0.1 as LightDM
19
19
20Item {
20Item {
21 property var greeter: LightDM.Greeter
21 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 {
43 signal responded(string response)
43 signal responded(string response)
44 signal tease()
44 signal tease()
45 signal emergencyCall()
45 signal emergencyCall()
46+ signal promptlessLogin()
46
47
47 signal _showMessageCalled(string html)
48 signal _showMessageCalled(string html)
48 signal _showPromptCalled(string text, bool isSecret, bool isDefaultPrompt)
49 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
22import AccountsService 0.1
22import AccountsService 0.1
23import Biometryd 0.0
23import Biometryd 0.0
24import GSettings 1.0
24import GSettings 1.0
25−import IntegratedLightDM 0.1 as LightDM
25+import LightDM.IntegratedLightDM 0.1 as LightDM // This is the mock
26import Unity.Test 0.1 as UT
26import Unity.Test 0.1 as UT
27
27
28Item {
28Item {
@@ -146,7 +146,9 @@ Item {
146
146
147 function init() {
147 function init() {
148 greeterSettings.lockedOutTime = 0;
148 greeterSettings.lockedOutTime = 0;
149− resetLoader();
149+ LightDM.Greeter.selectUser = "";
150+ greeter.failedLoginsDelayAttempts = 7;
151+ greeter.failedLoginsDelayMinutes = 5;
150 teaseSpy.clear();
152 teaseSpy.clear();
151 sessionStartedSpy.clear();
153 sessionStartedSpy.clear();
152 activeChangedSpy.clear();
154 activeChangedSpy.clear();
@@ -162,11 +164,7 @@ Item {
162 viewShowErrorMessageSpy.clear();
164 viewShowErrorMessageSpy.clear();
163 viewResetSpy.clear();
165 viewResetSpy.clear();
164 viewTryToUnlockSpy.clear();
166 viewTryToUnlockSpy.clear();
165− tryCompare(greeter, "waiting", false);
167+ resetLoader();
166− view = findChild(greeter, "testView");
167− verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
168− greeter.failedLoginsDelayAttempts = 7;
169− greeter.failedLoginsDelayMinutes = 5;
170 }
168 }
171
169
172 function resetLoader() {
170 function resetLoader() {
@@ -178,6 +176,8 @@ Item {
178 loader.active = true;
176 loader.active = true;
179 tryCompare(loader, "status", Loader.Ready);
177 tryCompare(loader, "status", Loader.Ready);
180 removeTimeConstraintsFromSwipeAreas(loader.item);
178 removeTimeConstraintsFromSwipeAreas(loader.item);
179+ tryCompare(greeter, "waiting", false);
180+ view = findChild(greeter, "testView");
181 }
181 }
182
182
183 function getIndexOf(name) {
183 function getIndexOf(name) {
@@ -202,6 +202,7 @@ Item {
202 compare(view.currentIndex, i);
202 compare(view.currentIndex, i);
203 compare(AccountsService.user, name);
203 compare(AccountsService.user, name);
204 compare(LightDM.Greeter.authenticationUser, name);
204 compare(LightDM.Greeter.authenticationUser, name);
205+ return i;
205 }
206 }
206
207
207 function verifyLoggedIn() {
208 function verifyLoggedIn() {
@@ -248,11 +249,9 @@ Item {
248
249
249 function test_promptless() {
250 function test_promptless() {
250 selectUser("no-password");
251 selectUser("no-password");
251− tryCompare(viewAuthenticationSucceededSpy, "count", 1);
252+ tryCompare(view, "locked", false);
252− compare(sessionStartedSpy.count, 1);
253 compare(viewShowPromptSpy.count, 0);
253 compare(viewShowPromptSpy.count, 0);
254 compare(viewHideSpy.count, 0);
254 compare(viewHideSpy.count, 0);
255− compare(view.locked, false);
256 }
255 }
257
256
258 function test_twoFactorPass() {
257 function test_twoFactorPass() {
@@ -573,6 +572,25 @@ Item {
573 tryCompare(viewShowPromptSpy, "count", 1);
572 tryCompare(viewShowPromptSpy, "count", 1);
574 }
573 }
575
574
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+
576 function test_fingerprintSuccess() {
594 function test_fingerprintSuccess() {
577 var index = selectUser("has-password");
595 var index = selectUser("has-password");
578 unlockAndShowGreeter(); // turn on lockscreen mode
596 unlockAndShowGreeter(); // turn on lockscreen mode
tests/qmltests/Greeter/tst_Infographics.qml+1−1
@@ -20,7 +20,7 @@ import ".."
20import "../../../qml/Greeter"
20import "../../../qml/Greeter"
21import Ubuntu.Components 1.3
21import Ubuntu.Components 1.3
22import Unity.Test 0.1 as UT
22import Unity.Test 0.1 as UT
23−import IntegratedLightDM 0.1 as LightDM
23+import LightDM.IntegratedLightDM 0.1 as LightDM
24
24
25Item {
25Item {
26 Binding {
26 Binding {
tests/qmltests/Greeter/tst_NarrowView.qml+1−1
@@ -18,7 +18,7 @@ import QtQuick 2.4
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20import "../../../qml/Greeter"
20import "../../../qml/Greeter"
21−import IntegratedLightDM 0.1 as LightDM
21+import LightDM.IntegratedLightDM 0.1 as LightDM
22import Ubuntu.Components 1.3
22import Ubuntu.Components 1.3
23import Unity.Test 0.1 as UT
23import Unity.Test 0.1 as UT
24
24
tests/qmltests/Greeter/tst_WideView.qml+1−1
@@ -18,7 +18,7 @@ import QtQuick 2.4
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20import "../../../qml/Greeter"
20import "../../../qml/Greeter"
21−import IntegratedLightDM 0.1 as LightDM
21+import LightDM.IntegratedLightDM 0.1 as LightDM
22import Ubuntu.Components 1.3
22import Ubuntu.Components 1.3
23import Unity.Test 0.1 as UT
23import Unity.Test 0.1 as UT
24
24
tests/qmltests/Tutorial/tst_Tutorial.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.4
17import QtQuick 2.4
18import QtTest 1.0
18import QtTest 1.0
19import AccountsService 0.1
19import AccountsService 0.1
20−import IntegratedLightDM 0.1 as LightDM
20+import LightDM.IntegratedLightDM 0.1 as LightDM
21import Ubuntu.Components 1.3
21import Ubuntu.Components 1.3
22import Ubuntu.Components.ListItems 1.3
22import Ubuntu.Components.ListItems 1.3
23import Ubuntu.Telephony 0.1 as Telephony
23import Ubuntu.Telephony 0.1 as Telephony
tests/qmltests/tst_OrientedShell.qml+1−1
@@ -22,7 +22,7 @@ import Ubuntu.Components 1.3
22import Ubuntu.Components.ListItems 1.3 as ListItem
22import Ubuntu.Components.ListItems 1.3 as ListItem
23import Unity.Application 0.1
23import Unity.Application 0.1
24import Unity.Test 0.1
24import Unity.Test 0.1
25−import IntegratedLightDM 0.1 as LightDM
25+import LightDM.IntegratedLightDM 0.1 as LightDM
26import Powerd 0.1
26import Powerd 0.1
27import Unity.InputInfo 0.1
27import Unity.InputInfo 0.1
28import Utils 0.1
28import Utils 0.1
tests/qmltests/tst_Shell.qml+5−13
@@ -18,7 +18,7 @@ import QtQuick 2.4
18import QtTest 1.0
18import QtTest 1.0
19import AccountsService 0.1
19import AccountsService 0.1
20import GSettings 1.0
20import GSettings 1.0
21−import IntegratedLightDM 0.1 as LightDM
21+import LightDM.IntegratedLightDM 0.1 as LightDM
22import Ubuntu.Components 1.3
22import Ubuntu.Components 1.3
23import Ubuntu.Components.ListItems 1.3 as ListItem
23import Ubuntu.Components.ListItems 1.3 as ListItem
24import Ubuntu.Telephony 0.1 as Telephony
24import Ubuntu.Telephony 0.1 as Telephony
@@ -1176,16 +1176,13 @@ Rectangle {
1176
1176
1177 function test_greeterLoginsAutomaticallyWhenNoPasswordSet() {
1177 function test_greeterLoginsAutomaticallyWhenNoPasswordSet() {
1178 loadShell("phone");
1178 loadShell("phone");
1179− swipeAwayGreeter();
1180−
1181− sessionSpy.clear();
1182− verify(sessionSpy.valid);
1183−
1184− showGreeter();
1185
1179
1186 var greeter = findChild(shell, "greeter");
1180 var greeter = findChild(shell, "greeter");
1187 verify(!greeter.locked);
1181 verify(!greeter.locked);
1188− verify(sessionSpy.count > 0);
1182+ compare(sessionSpy.count, 0);
1183+
1184+ swipeAwayGreeter();
1185+ compare(sessionSpy.count, 1);
1189 }
1186 }
1190
1187
1191 function test_fullscreen() {
1188 function test_fullscreen() {
@@ -2213,11 +2210,6 @@ Rectangle {
2213 shell.usageScenario = "desktop";
2210 shell.usageScenario = "desktop";
2214 GSettingsController.setAutohideLauncher(!data.launcherLocked);
2211 GSettingsController.setAutohideLauncher(!data.launcherLocked);
2215 waitForRendering(shell);
2212 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);
2221
2213
2222 var launcher = findChild(shell, "launcher");
2214 var launcher = findChild(shell, "launcher");
2223 var launcherPanel = findChild(launcher, "launcherPanel");
2215 var launcherPanel = findChild(launcher, "launcherPanel");
tests/qmltests/tst_ShellWithPin.qml+1−1
@@ -19,7 +19,7 @@ import Ubuntu.Components 1.3
19import QtTest 1.0
19import QtTest 1.0
20import AccountsService 0.1
20import AccountsService 0.1
21import GSettings 1.0
21import GSettings 1.0
22−import IntegratedLightDM 0.1 as LightDM
22+import LightDM.IntegratedLightDM 0.1 as LightDM
23import Ubuntu.SystemImage 0.1
23import Ubuntu.SystemImage 0.1
24import Ubuntu.Telephony 0.1 as Telephony
24import Ubuntu.Telephony 0.1 as Telephony
25import Unity.Application 0.1
25import Unity.Application 0.1