on xenial help sign in
Merge in slim_greeter_real_lightdm
fc1b69dMichael Terry
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+24
@@ -0,0 +1,24 @@
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+foreach(source_file ${QMLPLUGIN_SRC})
10+ list(APPEND RELATIVE_QMLPLUGIN_SRC ../${source_file})
11+endforeach()
12+
13+add_library(FullLightDM-qml MODULE
14+ ${RELATIVE_QMLPLUGIN_SRC}
15+ )
16+
17+target_link_libraries(FullLightDM-qml
18+ unity8-private
19+ ${LIBLIGHTDM_LDFLAGS}
20+ ${LIBUSERMETRICSOUTPUT_LDFLAGS}
21+ )
22+
23+qt5_use_modules(FullLightDM-qml DBus Gui Qml)
24+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+31
@@ -0,0 +1,31 @@
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+)
13+
14+foreach(source_file ${QMLPLUGIN_SRC})
15+ list(APPEND RELATIVE_QMLPLUGIN_SRC ../${source_file})
16+endforeach()
17+
18+add_library(IntegratedLightDM-qml MODULE
19+ ${RELATIVE_QMLPLUGIN_SRC}
20+ )
21+
22+target_link_libraries(IntegratedLightDM-qml
23+ integratedLightDM
24+ unity8-private
25+ ${LIBUSERMETRICSOUTPUT_LDFLAGS}
26+ )
27+
28+qt5_use_modules(IntegratedLightDM-qml DBus Gui Qml)
29+add_unity8_plugin(IntegratedLightDM 0.1 LightDM/IntegratedLightDM TARGETS IntegratedLightDM-qml)
30+
31+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+42−33
@@ -21,6 +21,8 @@ import Ubuntu.Components 1.3
21import Ubuntu.SystemImage 0.1
21import Ubuntu.SystemImage 0.1
22import Unity.Launcher 0.1
22import Unity.Launcher 0.1
23import Unity.Session 0.1
23import Unity.Session 0.1
24+
25+import "." 0.1
24import "../Components"
26import "../Components"
25
27
26Showable {
28Showable {
@@ -44,7 +46,7 @@ Showable {
44 readonly property bool hasLockedApp: lockedApp !== ""
46 readonly property bool hasLockedApp: lockedApp !== ""
45
47
46 property bool forcedUnlock
48 property bool forcedUnlock
47− readonly property bool locked: lightDM.greeter.active && !lightDM.greeter.authenticated && !forcedUnlock
49+ readonly property bool locked: LightDMService.greeter.active && !LightDMService.greeter.authenticated && !forcedUnlock
48
50
49 property bool tabletMode
51 property bool tabletMode
50 property url viewSource // only used for testing
52 property url viewSource // only used for testing
@@ -112,12 +114,12 @@ Showable {
112 return d.startUnlock(true /* toTheRight */);
114 return d.startUnlock(true /* toTheRight */);
113 }
115 }
114
116
115− LightDM{id:lightDM} // Provide backend access
116 QtObject {
117 QtObject {
117 id: d
118 id: d
118
119
119− readonly property bool multiUser: lightDM.users.count > 1
120+ readonly property bool multiUser: LightDMService.users.count > 1
121+ readonly property int selectUserIndex: d.getUserIndex(LightDMService.greeter.selectUser)
120− property int currentIndex
122+ property int currentIndex: Math.max(selectUserIndex, 0)
121 property bool waiting
123 property bool waiting
122
124
123 // We want 'launcherOffset' to animate down to zero. But not to animate
125 // We want 'launcherOffset' to animate down to zero. But not to animate
@@ -134,21 +136,37 @@ Showable {
134 UbuntuNumberAnimation {}
136 UbuntuNumberAnimation {}
135 }
137 }
136
138
139+ function getUserIndex(username) {
140+ if (username === "")
141+ return -1;
142+
143+ // Find index for requested user, if it exists
144+ for (var i = 0; i < LightDMService.users.count; i++) {
145+ if (username === LightDMService.users.data(i, LightDMService.userRoles.NameRole)) {
146+ return i;
147+ }
148+ }
149+
150+ return -1;
151+ }
152+
137 function selectUser(uid, reset) {
153 function selectUser(uid, reset) {
154+ if (uid < 0)
155+ return;
138 d.waiting = true;
156 d.waiting = true;
139 if (reset) {
157 if (reset) {
140 loader.item.reset();
158 loader.item.reset();
141 }
159 }
142 currentIndex = uid;
160 currentIndex = uid;
143− var user = lightDM.users.data(uid, lightDM.userRoles.NameRole);
161+ var user = LightDMService.users.data(uid, LightDMService.userRoles.NameRole);
144 AccountsService.user = user;
162 AccountsService.user = user;
145 LauncherModel.setUser(user);
163 LauncherModel.setUser(user);
146− lightDM.greeter.authenticate(user); // always resets auth state
164+ LightDMService.greeter.authenticate(user); // always resets auth state
147 }
165 }
148
166
149 function login() {
167 function login() {
150 enabled = false;
168 enabled = false;
151− if (lightDM.greeter.startSessionSync()) {
169+ if (LightDMService.greeter.startSessionSync()) {
152 sessionStarted();
170 sessionStarted();
153 if (loader.item) {
171 if (loader.item) {
154 loader.item.notifyAuthenticationSucceeded();
172 loader.item.notifyAuthenticationSucceeded();
@@ -283,7 +301,7 @@ Showable {
283 root.lockedApp = "";
301 root.lockedApp = "";
284 root.forceActiveFocus();
302 root.forceActiveFocus();
285 d.selectUser(d.currentIndex, true);
303 d.selectUser(d.currentIndex, true);
286− lightDM.infographic.readyForDataChange();
304+ LightDMService.infographic.readyForDataChange();
287 }
305 }
288
306
289 Connections {
307 Connections {
@@ -291,13 +309,12 @@ Showable {
291 onSelected: {
309 onSelected: {
292 d.selectUser(index, true);
310 d.selectUser(index, true);
293 }
311 }
312+ onPromptlessLogin: d.login();
294 onResponded: {
313 onResponded: {
295 if (root.locked) {
314 if (root.locked) {
296− lightDM.greeter.respond(response);
315+ LightDMService.greeter.respond(response);
297 } else {
316 } else {
298− if (lightDM.greeter.active && !lightDM.greeter.authenticated) { // could happen if forcedUnlock
299− d.login();
317+ d.login();
300− }
301 loader.item.hide();
318 loader.item.hide();
302 }
319 }
303 }
320 }
@@ -361,18 +378,18 @@ Showable {
361 Binding {
378 Binding {
362 target: loader.item
379 target: loader.item
363 property: "userModel"
380 property: "userModel"
364− value: lightDM.users
381+ value: LightDMService.users
365 }
382 }
366
383
367 Binding {
384 Binding {
368 target: loader.item
385 target: loader.item
369 property: "infographicModel"
386 property: "infographicModel"
370− value: lightDM.infographic
387+ value: LightDMService.infographic
371 }
388 }
372 }
389 }
373
390
374 Connections {
391 Connections {
375− target: lightDM.greeter
392+ target: LightDMService.greeter
376
393
377 onShowGreeter: root.forceShow()
394 onShowGreeter: root.forceShow()
378
395
@@ -407,14 +424,14 @@ Showable {
407 onAuthenticationComplete: {
424 onAuthenticationComplete: {
408 d.waiting = false;
425 d.waiting = false;
409
426
410− if (lightDM.greeter.authenticated) {
427+ if (LightDMService.greeter.authenticated) {
411 AccountsService.failedLogins = 0;
428 AccountsService.failedLogins = 0;
412− d.login();
413− if (!lightDM.greeter.promptless) {
429+ if (!LightDMService.greeter.promptless) {
430+ d.login();
414 loader.item.hide();
431 loader.item.hide();
415 }
432 }
416 } else {
433 } else {
417− if (!lightDM.greeter.promptless) {
434+ if (!LightDMService.greeter.promptless) {
418 AccountsService.failedLogins++;
435 AccountsService.failedLogins++;
419 }
436 }
420
437
@@ -435,21 +452,13 @@ Showable {
435 }
452 }
436
453
437 loader.item.notifyAuthenticationFailed();
454 loader.item.notifyAuthenticationFailed();
438− if (!lightDM.greeter.promptless) {
455+ if (!LightDMService.greeter.promptless) {
439 d.selectUser(d.currentIndex, false);
456 d.selectUser(d.currentIndex, false);
440 }
457 }
441 }
458 }
442 }
459 }
443
460
444− onRequestAuthenticationUser: {
461+ onRequestAuthenticationUser: d.selectUser(d.getUserIndex(user), true)
445− // Find index for requested user, if it exists
446− for (var i = 0; i < lightDM.users.count; i++) {
447− if (user === lightDM.users.data(i, lightDM.userRoles.NameRole)) {
448− d.selectUser(i, true);
449− return;
450− }
451− }
452− }
453 }
462 }
454
463
455 Connections {
464 Connections {
@@ -459,19 +468,19 @@ Showable {
459 }
468 }
460
469
461 Binding {
470 Binding {
462− target: lightDM.greeter
471+ target: LightDMService.greeter
463 property: "active"
472 property: "active"
464 value: root.active
473 value: root.active
465 }
474 }
466
475
467 Binding {
476 Binding {
468− target: lightDM.infographic
477+ target: LightDMService.infographic
469 property: "username"
478 property: "username"
470− value: AccountsService.statsWelcomeScreen ? lightDM.users.data(d.currentIndex, lightDM.userRoles.NameRole) : ""
479+ value: AccountsService.statsWelcomeScreen ? LightDMService.users.data(d.currentIndex, LightDMService.userRoles.NameRole) : ""
471 }
480 }
472
481
473 Connections {
482 Connections {
474 target: i18n
483 target: i18n
475− onLanguageChanged: lightDM.infographic.readyForDataChange()
484+ onLanguageChanged: LightDMService.infographic.readyForDataChange()
476 }
485 }
477}
486}
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()
@@ -128,6 +129,7 @@ FocusScope {
128
129
129 locked: root.locked
130 locked: root.locked
130
131
132+ onPromptlessLogin: root.promptlessLogin()
131 onSelected: root.selected(index)
133 onSelected: root.selected(index)
132 onResponded: root.responded(response)
134 onResponded: root.responded(response)
133 }
135 }
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") {
@@ -494,7 +493,7 @@ StyledItem {
494 function showHome() {
493 function showHome() {
495 greeter.notifyUserRequestedApp("unity8-dash");
494 greeter.notifyUserRequestedApp("unity8-dash");
496
495
497− var animate = !lightDM.greeter.active && !stages.shown
496+ var animate = !LightDMService.greeter.active && !stages.shown
498 dash.setCurrentScope(0, animate, false)
497 dash.setCurrentScope(0, animate, false)
499 ApplicationManager.requestFocusApplication("unity8-dash")
498 ApplicationManager.requestFocusApplication("unity8-dash")
500 }
499 }
@@ -533,7 +532,12 @@ StyledItem {
533
532
534 indicatorsModel: Indicators.IndicatorsModel {
533 indicatorsModel: Indicators.IndicatorsModel {
535 // tablet and phone both use the same profile
534 // tablet and phone both use the same profile
535+ // FIXME: use just "phone" for greeter too, but first fix
536+ // greeter app launching to either load the app inside the
537+ // greeter or tell the session to load the app. This will
538+ // involve taking the url-dispatcher dbus name and using
539+ // SessionBroadcast to tell the session.
536− profile: "phone"
540+ profile: shell.mode === "greeter" ? "desktop_greeter" : "phone"
537 Component.onCompleted: load();
541 Component.onCompleted: load();
538 }
542 }
539 }
543 }
@@ -545,7 +549,7 @@ StyledItem {
545 readonly property bool focusedSurfaceIsFullscreen: MirFocusController.focusedSurface
549 readonly property bool focusedSurfaceIsFullscreen: MirFocusController.focusedSurface
546 ? MirFocusController.focusedSurface.state === Mir.FullscreenState
550 ? MirFocusController.focusedSurface.state === Mir.FullscreenState
547 : false
551 : false
548− fullscreenMode: (focusedSurfaceIsFullscreen && !lightDM.greeter.active && launcher.progress == 0)
552+ fullscreenMode: (focusedSurfaceIsFullscreen && !LightDMService.greeter.active && launcher.progress == 0)
549 || greeter.hasLockedApp
553 || greeter.hasLockedApp
550 locked: greeter && greeter.active
554 locked: greeter && greeter.active
551 }
555 }
@@ -663,6 +667,7 @@ StyledItem {
663 id: wizard
667 id: wizard
664 objectName: "wizard"
668 objectName: "wizard"
665 anchors.fill: parent
669 anchors.fill: parent
670+ deferred: shell.mode === "greeter"
666
671
667 function unlockWhenDoneWithWizard() {
672 function unlockWhenDoneWithWizard() {
668 if (!active) {
673 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
@@ -33,7 +33,7 @@ add_subdirectory(Cursor)
33add_subdirectory(GSettings.1.0)
33add_subdirectory(GSettings.1.0)
34add_subdirectory(indicator-service)
34add_subdirectory(indicator-service)
35add_subdirectory(libusermetrics)
35add_subdirectory(libusermetrics)
36−add_subdirectory(IntegratedLightDM)
36+add_subdirectory(LightDM)
37add_subdirectory(Lights)
37add_subdirectory(Lights)
38add_subdirectory(MeeGo)
38add_subdirectory(MeeGo)
39add_subdirectory(Powerd)
39add_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+2
@@ -33,6 +33,7 @@ Item {
33 property var infographicModel
33 property var infographicModel
34 readonly property bool fullyShown: _fullyShown
34 readonly property bool fullyShown: _fullyShown
35 readonly property bool required: _required
35 readonly property bool required: _required
36+ readonly property bool animating: false
36
37
37 property bool _fullyShown: true
38 property bool _fullyShown: true
38 property bool _required: true
39 property bool _required: true
@@ -41,6 +42,7 @@ Item {
41 signal responded(string response)
42 signal responded(string response)
42 signal tease()
43 signal tease()
43 signal emergencyCall()
44 signal emergencyCall()
45+ signal promptlessLogin()
44
46
45 signal _showMessageCalled(string html)
47 signal _showMessageCalled(string html)
46 signal _showPromptCalled(string text, bool isSecret, bool isDefaultPrompt)
48 signal _showPromptCalled(string text, bool isSecret, bool isDefaultPrompt)
tests/qmltests/Greeter/tst_Greeter.qml+28−10
@@ -21,7 +21,7 @@ import "../../../qml/Greeter"
21import Ubuntu.Components 1.3
21import Ubuntu.Components 1.3
22import AccountsService 0.1
22import AccountsService 0.1
23import GSettings 1.0
23import GSettings 1.0
24−import IntegratedLightDM 0.1 as LightDM
24+import LightDM.IntegratedLightDM 0.1 as LightDM // This is the mock
25import Unity.Test 0.1 as UT
25import Unity.Test 0.1 as UT
26
26
27Item {
27Item {
@@ -139,7 +139,9 @@ Item {
139
139
140 function init() {
140 function init() {
141 greeterSettings.lockedOutTime = 0;
141 greeterSettings.lockedOutTime = 0;
142− resetLoader();
142+ LightDM.Greeter.selectUser = "";
143+ greeter.failedLoginsDelayAttempts = 7;
144+ greeter.failedLoginsDelayMinutes = 5;
143 teaseSpy.clear();
145 teaseSpy.clear();
144 sessionStartedSpy.clear();
146 sessionStartedSpy.clear();
145 activeChangedSpy.clear();
147 activeChangedSpy.clear();
@@ -151,11 +153,7 @@ Item {
151 viewAuthenticationFailedSpy.clear();
153 viewAuthenticationFailedSpy.clear();
152 viewResetSpy.clear();
154 viewResetSpy.clear();
153 viewTryToUnlockSpy.clear();
155 viewTryToUnlockSpy.clear();
154− tryCompare(greeter, "waiting", false);
156+ resetLoader();
155− view = findChild(greeter, "testView");
156− verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
157− greeter.failedLoginsDelayAttempts = 7;
158− greeter.failedLoginsDelayMinutes = 5;
159 }
157 }
160
158
161 function resetLoader() {
159 function resetLoader() {
@@ -167,6 +165,8 @@ Item {
167 loader.active = true;
165 loader.active = true;
168 tryCompare(loader, "status", Loader.Ready);
166 tryCompare(loader, "status", Loader.Ready);
169 removeTimeConstraintsFromSwipeAreas(loader.item);
167 removeTimeConstraintsFromSwipeAreas(loader.item);
168+ tryCompare(greeter, "waiting", false);
169+ view = findChild(greeter, "testView");
170 }
170 }
171
171
172 function getIndexOf(name) {
172 function getIndexOf(name) {
@@ -191,6 +191,7 @@ Item {
191 compare(view.currentIndex, i);
191 compare(view.currentIndex, i);
192 compare(AccountsService.user, name);
192 compare(AccountsService.user, name);
193 compare(LightDM.Greeter.authenticationUser, name);
193 compare(LightDM.Greeter.authenticationUser, name);
194+ return i;
194 }
195 }
195
196
196 function verifyLoggedIn() {
197 function verifyLoggedIn() {
@@ -229,11 +230,9 @@ Item {
229
230
230 function test_promptless() {
231 function test_promptless() {
231 selectUser("no-password");
232 selectUser("no-password");
232− tryCompare(viewAuthenticationSucceededSpy, "count", 1);
233+ tryCompare(view, "locked", false);
233− compare(sessionStartedSpy.count, 1);
234 compare(viewShowPromptSpy.count, 0);
234 compare(viewShowPromptSpy.count, 0);
235 compare(viewHideSpy.count, 0);
235 compare(viewHideSpy.count, 0);
236− compare(view.locked, false);
237 }
236 }
238
237
239 function test_twoFactorPass() {
238 function test_twoFactorPass() {
@@ -553,5 +552,24 @@ Item {
553 compare(viewResetSpy.count, 1);
552 compare(viewResetSpy.count, 1);
554 tryCompare(viewShowPromptSpy, "count", 1);
553 tryCompare(viewShowPromptSpy, "count", 1);
555 }
554 }
555+
556+ function test_selectUserHint() {
557+ LightDM.Greeter.selectUser = "info-prompt";
558+ resetLoader();
559+ var i = verifySelected("info-prompt");
560+ verify(i != 0); // sanity-check that info-prompt isn't default 0 answer
561+ }
562+
563+ function test_selectUserHintUnset() {
564+ LightDM.Greeter.selectUser = "";
565+ resetLoader();
566+ verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
567+ }
568+
569+ function test_selectUserHintInvalid() {
570+ LightDM.Greeter.selectUser = "not-a-real-user";
571+ resetLoader();
572+ verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
573+ }
556 }
574 }
557}
575}
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
@@ -1149,16 +1149,13 @@ Rectangle {
1149
1149
1150 function test_greeterLoginsAutomaticallyWhenNoPasswordSet() {
1150 function test_greeterLoginsAutomaticallyWhenNoPasswordSet() {
1151 loadShell("phone");
1151 loadShell("phone");
1152− swipeAwayGreeter();
1153−
1154− sessionSpy.clear();
1155− verify(sessionSpy.valid);
1156−
1157− showGreeter();
1158
1152
1159 var greeter = findChild(shell, "greeter");
1153 var greeter = findChild(shell, "greeter");
1160 verify(!greeter.locked);
1154 verify(!greeter.locked);
1161− verify(sessionSpy.count > 0);
1155+ compare(sessionSpy.count, 0);
1156+
1157+ swipeAwayGreeter();
1158+ compare(sessionSpy.count, 1);
1162 }
1159 }
1163
1160
1164 function test_fullscreen() {
1161 function test_fullscreen() {
@@ -2186,11 +2183,6 @@ Rectangle {
2186 shell.usageScenario = "desktop";
2183 shell.usageScenario = "desktop";
2187 GSettingsController.setAutohideLauncher(!data.launcherLocked);
2184 GSettingsController.setAutohideLauncher(!data.launcherLocked);
2188 waitForRendering(shell);
2185 waitForRendering(shell);
2189− // Not sure why 2 but it's the number of times
2190− // it triggers at this time and we need to wait
2191− // for them otherwise a sessionStarted signal will
2192− // hide the launcher and make the test fail
2193− tryCompare(sessionSpy, "count", 2);
2194
2186
2195 var launcher = findChild(shell, "launcher");
2187 var launcher = findChild(shell, "launcher");
2196 var launcherPanel = findChild(launcher, "launcherPanel");
2188 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