on xenial help sign in
Merge in lp:~josharenson/unity8/sessions-model to make it easier to stack greeter changes
039514cMichael 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+26
@@ -0,0 +1,26 @@
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_BINARY_DIR}/tests/mocks/LightDM/IntegratedLightDM
11+ ${libunity8-private_SOURCE_DIR}
12+ ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS}
13+)
14+
15+set(QMLPLUGIN_SRC
16+ ../Utils/unitysortfilterproxymodelqml.cpp
17+ DBusGreeter.cpp
18+ DBusGreeterList.cpp
19+ Greeter.cpp
20+ plugin.cpp
21+ SessionsModel.cpp
22+ UsersModel.cpp
23+ )
24+
25+add_subdirectory(FullLightDM)
26+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+ ${LIBLIGHTDM_INCLUDE_DIRS}
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+13−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
@@ -13,7 +13,6 @@
13 * You should have received a copy of the GNU General Public License
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/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
15 *
16− * Author: Michael Terry <michael.terry@canonical.com>
17 */
16 */
18
17
19#include "Greeter.h"
18#include "Greeter.h"
@@ -72,12 +71,24 @@ QString Greeter::authenticationUser() const
72 return d->m_greeter->authenticationUser();
71 return d->m_greeter->authenticationUser();
73}
72}
74
73
74+QString Greeter::defaultSessionHint() const
75+{
76+ Q_D(const Greeter);
77+ return d->m_greeter->defaultSessionHint();
78+}
79+
75bool Greeter::promptless() const
80bool Greeter::promptless() const
76{
81{
77 Q_D(const Greeter);
82 Q_D(const Greeter);
78 return d->promptless;
83 return d->promptless;
79}
84}
80
85
86+QString Greeter::selectUser() const
87+{
88+ Q_D(const Greeter);
89+ return d->m_greeter->selectUserHint();
90+}
91+
81void Greeter::authenticate(const QString &username)
92void Greeter::authenticate(const QString &username)
82{
93{
83 Q_D(Greeter);
94 Q_D(Greeter);
plugins/IntegratedLightDM/Greeter.h → plugins/LightDM/Greeter.hrenamed+5−2
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2012,2013 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
@@ -13,7 +13,6 @@
13 * You should have received a copy of the GNU General Public License
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/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
15 *
16− * Authors: Michael Terry <michael.terry@canonical.com>
17 */
16 */
18
17
19/* This class is a really tiny filter around QLightDM::Greeter. There are some
18/* This class is a really tiny filter around QLightDM::Greeter. There are some
@@ -37,7 +36,9 @@ class Greeter : public QObject
37 Q_PROPERTY(bool active READ isActive WRITE setIsActive NOTIFY isActiveChanged)
36 Q_PROPERTY(bool active READ isActive WRITE setIsActive NOTIFY isActiveChanged)
38 Q_PROPERTY(bool authenticated READ isAuthenticated NOTIFY isAuthenticatedChanged)
37 Q_PROPERTY(bool authenticated READ isAuthenticated NOTIFY isAuthenticatedChanged)
39 Q_PROPERTY(QString authenticationUser READ authenticationUser NOTIFY authenticationUserChanged)
38 Q_PROPERTY(QString authenticationUser READ authenticationUser NOTIFY authenticationUserChanged)
39+ Q_PROPERTY(QString defaultSession READ defaultSessionHint CONSTANT)
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);
@@ -45,7 +46,9 @@ public:
45 bool isActive() const;
46 bool isActive() const;
46 bool isAuthenticated() const;
47 bool isAuthenticated() const;
47 QString authenticationUser() const;
48 QString authenticationUser() const;
49+ QString defaultSessionHint() const;
48 bool promptless() const;
50 bool promptless() const;
51+ QString selectUser() const;
49
52
50public Q_SLOTS:
53public Q_SLOTS:
51 void authenticate(const QString &username=QString());
54 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+30
@@ -0,0 +1,30 @@
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+ . #QLightDM
11+ )
12+
13+foreach(source_file ${QMLPLUGIN_SRC})
14+ list(APPEND RELATIVE_QMLPLUGIN_SRC ../${source_file})
15+endforeach()
16+
17+add_library(IntegratedLightDM-qml MODULE
18+ ${RELATIVE_QMLPLUGIN_SRC}
19+ )
20+
21+target_link_libraries(IntegratedLightDM-qml
22+ integratedLightDM
23+ unity8-private
24+ ${LIBUSERMETRICSOUTPUT_LDFLAGS}
25+ )
26+
27+qt5_use_modules(IntegratedLightDM-qml DBus Gui Qml)
28+add_unity8_plugin(IntegratedLightDM 0.1 LightDM/IntegratedLightDM TARGETS IntegratedLightDM-qml)
29+
30+add_subdirectory(liblightdm)
plugins/LightDM/IntegratedLightDM/QLightDM/Greeternew file+17
@@ -0,0 +1,17 @@
1+/*
2+ * Copyright (C) 2016 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+#include "../liblightdm/Greeter.h"
plugins/LightDM/IntegratedLightDM/QLightDM/SessionsModelnew file+17
@@ -0,0 +1,17 @@
1+/*
2+ * Copyright (C) 2016 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+#include "../liblightdm/SessionsModel.h"
plugins/LightDM/IntegratedLightDM/QLightDM/UsersModelnew file+17
@@ -0,0 +1,17 @@
1+/*
2+ * Copyright (C) 2016 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+#include "../liblightdm/UsersModel.h"
plugins/IntegratedLightDM/liblightdm/CMakeLists.txt → plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txtrenamed+4−2
@@ -2,8 +2,10 @@ pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1)
2
2
3set(LibLightDM_SOURCES
3set(LibLightDM_SOURCES
4 Greeter.cpp
4 Greeter.cpp
5+ SessionsModel.cpp
5 UsersModel.cpp
6 UsersModel.cpp
6 GreeterPrivate.cpp
7 GreeterPrivate.cpp
8+ SessionsModelPrivate.cpp
7 UsersModelPrivate.cpp
9 UsersModelPrivate.cpp
8 ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsServiceDBusAdaptor.cpp
10 ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsServiceDBusAdaptor.cpp
9 ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
11 ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
@@ -46,8 +48,8 @@ set_target_properties(integratedLightDMSession PROPERTIES
46 COMPILE_FLAGS "-DSM_BUSNAME=sessionBus -fPIC")
48 COMPILE_FLAGS "-DSM_BUSNAME=sessionBus -fPIC")
47set_target_properties(MockLightDM-demo-shared PROPERTIES
49set_target_properties(MockLightDM-demo-shared PROPERTIES
48 COMPILE_FLAGS "-DSM_BUSNAME=systemBus"
50 COMPILE_FLAGS "-DSM_BUSNAME=systemBus"
49− OUTPUT_NAME lightdm-qt5-2)
51+ OUTPUT_NAME lightdm-qt5-3)
50
52
51install(TARGETS MockLightDM-demo-shared
53install(TARGETS MockLightDM-demo-shared
52− DESTINATION ${SHELL_INSTALL_QML}/mocks/IntegratedLightDM/demo
54+ DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/demo
53 )
55 )
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/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cppnew file+88
@@ -0,0 +1,88 @@
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+
18+
19+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
20+ * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
21+ * COUNTERPART IN tests/mocks/LightDM/IntegratedLightDM/liblightdm
22+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
23+
24+// LightDM currently is Qt4 compatible, and so doesn't define setRoleNames.
25+// To use the same method of setting role name that it does, we
26+// set our compatibility to Qt4 here too.
27+#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0)
28+
29+#include "SessionsModel.h"
30+#include "SessionsModelPrivate.h"
31+#include <QtCore/QDir>
32+#include <QtCore/QString>
33+
34+namespace QLightDM
35+{
36+
37+SessionsModel::SessionsModel(QObject* parent) :
38+ QAbstractListModel(parent),
39+ d_ptr(new SessionsModelPrivate(this))
40+{
41+ Q_D(SessionsModel);
42+ m_roleNames = QAbstractListModel::roleNames();
43+ m_roleNames[KeyRole] = "key";
44+ m_roleNames[TypeRole] = "type";
45+}
46+
47+SessionsModel::~SessionsModel()
48+{
49+ delete d_ptr;
50+}
51+
52+QVariant SessionsModel::data(const QModelIndex& index, int role) const
53+{
54+ Q_D(const SessionsModel);
55+
56+ if(!index.isValid()) {
57+ return QVariant();
58+ }
59+
60+ int row = index.row();
61+
62+ switch (role) {
63+ case QLightDM::SessionsModel::KeyRole:
64+ return d->sessionItems[row].key;
65+ case Qt::DisplayRole:
66+ return d->sessionItems[row].name;
67+ default:
68+ return QVariant();
69+ }
70+}
71+
72+QHash<int, QByteArray> SessionsModel::roleNames() const
73+{
74+ return m_roleNames;
75+}
76+
77+int SessionsModel::rowCount(const QModelIndex& parent) const
78+{
79+ Q_D(const SessionsModel);
80+
81+ if (parent.isValid()) {
82+ return 0;
83+ } else { // parent is root
84+ return d->sessionItems.size();
85+ }
86+}
87+
88+} // namespace QLightDM
plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.hnew file+72
@@ -0,0 +1,72 @@
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+
18+#ifndef UNITY_INTEGRATED_SESSIONSMODEL_H
19+#define UNITY_INTEGRATED_SESSIONSMODEL_H
20+
21+#include <QtCore/QAbstractListModel>
22+#include <QtCore/QString>
23+
24+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
25+ * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
26+ * COUNTERPART IN tests/mocks/LightDM/IntegratedLightDM/liblightdm
27+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
28+
29+// This is taken from liblightdm and modified to confirm to our syle conventions
30+namespace QLightDM
31+{
32+class SessionsModelPrivate;
33+
34+class Q_DECL_EXPORT SessionsModel : public QAbstractListModel
35+ {
36+ Q_OBJECT
37+
38+ Q_ENUMS(SessionModelRoles SessionType)
39+
40+ public:
41+
42+ enum SessionModelRoles {
43+ //name is exposed as Qt::DisplayRole
44+ //comment is exposed as Qt::TooltipRole
45+ KeyRole = Qt::UserRole,
46+ IdRole = KeyRole, /** Deprecated */
47+ TypeRole
48+ };
49+
50+ enum SessionType {
51+ LocalSessions,
52+ RemoteSessions
53+ };
54+
55+ explicit SessionsModel(QObject* parent=0); /** Deprecated. Loads local sessions*/
56+ explicit SessionsModel(SessionsModel::SessionType, QObject* parent=0);
57+ virtual ~SessionsModel();
58+
59+ QHash<int, QByteArray> roleNames() const override;
60+ int rowCount(const QModelIndex& parent) const override;
61+ QVariant data(const QModelIndex& index, int role) const override;
62+
63+ protected:
64+ SessionsModelPrivate* const d_ptr;
65+
66+ private:
67+ QHash<int, QByteArray> m_roleNames;
68+ Q_DECLARE_PRIVATE(SessionsModel)
69+ };
70+}
71+
72+#endif // UNITY_INTEGRATED_SESSIONSMODEL_H
plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cppnew file+36
@@ -0,0 +1,36 @@
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+
18+#include "SessionsModelPrivate.h"
19+
20+#include <QDir>
21+#include <QSettings>
22+#include <QStringList>
23+
24+namespace QLightDM
25+{
26+
27+SessionsModelPrivate::SessionsModelPrivate(SessionsModel* parent)
28+ : q_ptr(parent)
29+{
30+ // Since this model is never visible, as there is only 1 session,
31+ // just use the session name as the key
32+ QString sessionName = qgetenv("XDG_SESSION_DESKTOP");
33+ sessionItems.append({sessionName, "", sessionName, ""});
34+}
35+
36+} // namespace QLightDM
plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.hnew file+54
@@ -0,0 +1,54 @@
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+
18+#ifndef UNITY_INTEGRATED_SESSIONSMODEL_PRIVATE_H
19+#define UNITY_INTEGRATED_SESSIONSMODEL_PRIVATE_H
20+
21+#include <QtCore/QList>
22+#include <QtCore/QString>
23+
24+namespace QLightDM
25+{
26+class SessionsModel;
27+
28+class SessionItem
29+{
30+public:
31+ QString key;
32+ QString type; // unused
33+ QString name;
34+ QString comment; // unused
35+};
36+
37+class SessionsModelPrivate
38+{
39+public:
40+ explicit SessionsModelPrivate(SessionsModel* parent=0);
41+ virtual ~SessionsModelPrivate() = default;
42+
43+ QList<SessionItem> sessionItems;
44+
45+protected:
46+ SessionsModel* const q_ptr;
47+
48+private:
49+ Q_DECLARE_PUBLIC(SessionsModel)
50+};
51+
52+} // namespace QLightDM
53+
54+#endif // UNITY_INTEGRATED_SESSIONSMODEL_PRIVATE_H
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/LightDM/SessionsModel.cppnew file+122
@@ -0,0 +1,122 @@
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+
18+#include "SessionsModel.h"
19+#include <QtCore/QFile>
20+#include <QtCore/QSortFilterProxyModel>
21+
22+QHash<int, QByteArray> SessionsModel::roleNames() const
23+{
24+ return m_roleNames;
25+}
26+
27+int SessionsModel::rowCount(const QModelIndex& parent) const
28+{
29+ return m_model->rowCount(parent);
30+}
31+
32+QList<QUrl> SessionsModel::iconSearchDirectories() const
33+{
34+ return m_iconSearchDirectories;
35+}
36+
37+void SessionsModel::setIconSearchDirectories(const QList<QUrl> searchDirectories)
38+{
39+ // QML gives us a url with file:// prepended which breaks QFile::exists()
40+ // so convert the url to a local file
41+ QList<QUrl> localList = {};
42+ Q_FOREACH(const QUrl& searchDirectory, searchDirectories)
43+ {
44+ localList.append(searchDirectory.toLocalFile());
45+ }
46+ m_iconSearchDirectories = localList;
47+ Q_EMIT iconSearchDirectoriesChanged();
48+}
49+
50+QUrl SessionsModel::iconUrl(const QString sessionName) const
51+{
52+ Q_FOREACH(const QUrl& searchDirectory, m_iconSearchDirectories)
53+ {
54+ // This is an established icon naming convention
55+ QString customIconUrl = searchDirectory.toString(QUrl::StripTrailingSlash) +
56+ "/custom_" + sessionName + "_badge.png";
57+ QString iconUrl = searchDirectory.toString(QUrl::StripTrailingSlash) +
58+ "/" + sessionName + "_badge.png";
59+
60+ QFile customIconFile(customIconUrl);
61+ QFile iconFile(iconUrl);
62+ if (customIconFile.exists()) {
63+ return QUrl(customIconUrl);
64+ } else if (iconFile.exists()) {
65+ return QUrl(iconUrl);
66+ } else{
67+ // Search the legacy way
68+ QString path = searchDirectory.toString(QUrl::StripTrailingSlash) + "/";
69+ if (sessionName == "ubuntu" || sessionName == "ubuntu-2d") {
70+ path += "ubuntu_badge.png";
71+ } else if(
72+ sessionName == "gnome-classic" ||
73+ sessionName == "gnome-flashback-compiz" ||
74+ sessionName == "gnome-flashback-metacity" ||
75+ sessionName == "gnome-shell" ||
76+ sessionName == "gnome-wayland" ||
77+ sessionName == "gnome"
78+ ){
79+ path += "gnome_badge.png";
80+ } else if (sessionName == "plasma") {
81+ path += "kde_badge.png";
82+ } else if (sessionName == "xterm") {
83+ path += "recovery_console_badge.png";
84+ } else if (sessionName == "remote-login") {
85+ path += "remote_login_help.png";
86+ }
87+
88+ if (QFile(path).exists()) {
89+ return path;
90+ }
91+ }
92+ }
93+
94+ // FIXME make this smarter
95+ return QUrl("./graphics/session_icons/unknown_badge.png");
96+}
97+
98+QVariant SessionsModel::data(const QModelIndex& index, int role) const
99+{
100+ switch (role) {
101+ case SessionsModel::IconRole:
102+ return iconUrl(m_model->data(index, Qt::DisplayRole).toString());
103+ default:
104+ return m_model->data(index, role);
105+ }
106+}
107+
108+SessionsModel::SessionsModel(QObject* parent)
109+ : UnitySortFilterProxyModelQML(parent)
110+{
111+ // Add a custom IconRole that isn't in either of the lightdm implementations
112+ m_model = new QLightDM::SessionsModel(this);
113+ m_roleNames = m_model->roleNames();
114+ m_roleNames[IconRole] = "icon_url";
115+
116+ setModel(m_model);
117+ setSourceModel(m_model);
118+ setSortCaseSensitivity(Qt::CaseInsensitive);
119+ setSortLocaleAware(true);
120+ setSortRole(Qt::DisplayRole);
121+ sort(0);
122+}
plugins/LightDM/SessionsModel.hnew file+68
@@ -0,0 +1,68 @@
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+
18+#ifndef UNITY_SESSIONSMODEL_H
19+#define UNITY_SESSIONSMODEL_H
20+
21+#include <unitysortfilterproxymodelqml.h>
22+#include <QLightDM/SessionsModel>
23+#include <QtCore/QHash>
24+#include <QtCore/QObject>
25+#include <QtCore/QUrl>
26+
27+class SessionsModel : public UnitySortFilterProxyModelQML
28+{
29+ Q_OBJECT
30+
31+ Q_ENUMS(SessionModelRoles)
32+
33+ Q_PROPERTY(QList<QUrl> iconSearchDirectories READ iconSearchDirectories
34+ WRITE setIconSearchDirectories NOTIFY iconSearchDirectoriesChanged)
35+Q_SIGNALS:
36+ void iconSearchDirectoriesChanged();
37+
38+public:
39+ enum SessionModelRoles {
40+ /* This is tricky / ugly. Since we are ultimately chaining 3 enums together,
41+ * the _first_ value of this enum MUST be the _last_ value of
42+ * QLightDM::SessionsModel::SessionModelRoles and consquently, this must
43+ * also match the last value in the corresponding enum of the integrated lib
44+ */
45+ TypeRole = QLightDM::SessionsModel::SessionModelRoles::TypeRole,
46+ IconRole
47+ };
48+
49+ explicit SessionsModel(QObject* parent=nullptr);
50+
51+ QHash<int, QByteArray> roleNames() const override;
52+ int rowCount(const QModelIndex& parent) const override;
53+ QVariant data(const QModelIndex& index, int role) const override;
54+ QList<QUrl> iconSearchDirectories() const;
55+ Q_INVOKABLE QUrl iconUrl(const QString sessionName) const;
56+
57+ void setIconSearchDirectories(const QList<QUrl> searchDirectories);
58+private:
59+ QLightDM::SessionsModel* m_model;
60+ QHash<int, QByteArray> m_roleNames;
61+ QList<QUrl> m_iconSearchDirectories{
62+ QUrl("/usr/share/unity8/Greeter/graphics/session_icons"),
63+ QUrl("/usr/local/share/unity-greeter"),
64+ QUrl("/usr/share/unity-greeter/")};
65+
66+};
67+
68+#endif // UNITY_SESSIONSMODEL_H
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+26−4
@@ -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
@@ -19,9 +19,11 @@
19#include "DBusGreeter.h"
19#include "DBusGreeter.h"
20#include "DBusGreeterList.h"
20#include "DBusGreeterList.h"
21#include "Greeter.h"
21#include "Greeter.h"
22+#include "SessionsModel.h"
22#include "UsersModel.h"
23#include "UsersModel.h"
23#include <libusermetricsoutput/ColorTheme.h>
24#include <libusermetricsoutput/ColorTheme.h>
24#include <libusermetricsoutput/UserMetrics.h>
25#include <libusermetricsoutput/UserMetrics.h>
26+#include <QLightDM/SessionsModel>
25#include <QLightDM/UsersModel>
27#include <QLightDM/UsersModel>
26
28
27#include <QAbstractItemModel>
29#include <QAbstractItemModel>
@@ -40,6 +42,13 @@ static QObject *greeter_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
40 return greeter;
42 return greeter;
41}
43}
42
44
45+static QObject *sessions_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
46+{
47+ Q_UNUSED(engine)
48+ Q_UNUSED(scriptEngine)
49+ return new SessionsModel();
50+}
51+
43static QObject *users_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
52static QObject *users_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
44{
53{
45 Q_UNUSED(engine)
54 Q_UNUSED(engine)
@@ -54,16 +63,29 @@ static QObject *infographic_provider(QQmlEngine *engine, QJSEngine *scriptEngine
54 return UserMetricsOutput::UserMetrics::getInstance();
63 return UserMetricsOutput::UserMetrics::getInstance();
55}
64}
56
65
57−void IntegratedLightDMPlugin::registerTypes(const char *uri)
66+void PLUGIN_CLASSNAME::registerTypes(const char *uri)
58{
67{
59 qmlRegisterType<QAbstractItemModel>();
68 qmlRegisterType<QAbstractItemModel>();
60 qmlRegisterType<UserMetricsOutput::ColorTheme>();
69 qmlRegisterType<UserMetricsOutput::ColorTheme>();
61
70
71+#if defined INTEGRATED_LIGHTDM
62− Q_ASSERT(uri == QLatin1String("IntegratedLightDM"));
72+ Q_ASSERT(uri == QLatin1String("LightDM.IntegratedLightDM"));
73+ qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider);
74+#elif defined FULL_LIGHTDM
75+ Q_ASSERT(uri == QLatin1String("LightDM.FullLightDM"));
76+ qmlRegisterSingletonType<QLightDM::Greeter>(uri, 0, 1, "Greeter", greeter_provider);
77+#else
78+ #error No library defined in LightDM plugin
79+#endif
80+
63 qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
81 qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
64 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
82 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
65− qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider);
83+
84+ qmlRegisterSingletonType<SessionsModel>(uri, 0, 1, "Sessions", sessions_provider);
85+ qmlRegisterUncreatableType<SessionsModel>(uri, 0, 1, "SessionRoles", QStringLiteral("Type is not instantiable"));
86+
66 qmlRegisterSingletonType<UsersModel>(uri, 0, 1, "Users", users_provider);
87 qmlRegisterSingletonType<UsersModel>(uri, 0, 1, "Users", users_provider);
67 qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", QStringLiteral("Type is not instantiable"));
88 qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", QStringLiteral("Type is not instantiable"));
89+
68 qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider);
90 qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider);
69}
91}
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 }
po/am.po+6−6
@@ -8,14 +8,14 @@ msgstr ""
8"Project-Id-Version: unity8\n"
8"Project-Id-Version: unity8\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2016-06-27 18:49+0000\n"
10"POT-Creation-Date: 2016-06-27 18:49+0000\n"
11−"PO-Revision-Date: 2016-06-19 16:08+0000\n"
11+"PO-Revision-Date: 2016-07-05 02:15+0000\n"
12"Last-Translator: samson <Unknown>\n"
12"Last-Translator: samson <Unknown>\n"
13"Language-Team: Amharic <am@li.org>\n"
13"Language-Team: Amharic <am@li.org>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17"Plural-Forms: nplurals=2; plural=n > 1;\n"
17"Plural-Forms: nplurals=2; plural=n > 1;\n"
18−"X-Launchpad-Export-Date: 2016-06-30 05:51+0000\n"
18+"X-Launchpad-Export-Date: 2016-07-05 05:58+0000\n"
19"X-Generator: Launchpad (build 18115)\n"
19"X-Generator: Launchpad (build 18115)\n"
20
20
21#: plugins/IntegratedLightDM/Greeter.cpp:112
21#: plugins/IntegratedLightDM/Greeter.cpp:112
@@ -294,12 +294,12 @@ msgstr "እሺ"
294#: qml/Components/MediaServices/VideoPlayerControls.qml:44
294#: qml/Components/MediaServices/VideoPlayerControls.qml:44
295#, qt-format
295#, qt-format
296msgid "%1:%2:%3"
296msgid "%1:%2:%3"
297−msgstr ""
297+msgstr "%1:%2:%3"
298
298
299#: qml/Components/MediaServices/VideoPlayerControls.qml:49
299#: qml/Components/MediaServices/VideoPlayerControls.qml:49
300#, qt-format
300#, qt-format
301msgid "%1:%2"
301msgid "%1:%2"
302−msgstr ""
302+msgstr "%1:%2"
303
303
304#: qml/Components/ModeSwitchWarningDialog.qml:32
304#: qml/Components/ModeSwitchWarningDialog.qml:32
305msgid "Apps may have unsaved data:"
305msgid "Apps may have unsaved data:"
@@ -440,7 +440,7 @@ msgstr "መክፈቻ"
440
440
441#: qml/Greeter/Greeter.qml:539
441#: qml/Greeter/Greeter.qml:539
442msgid "Try again"
442msgid "Try again"
443−msgstr ""
443+msgstr "እንደገና ይሞክሩ"
444
444
445#: qml/Greeter/LoginList.qml:259
445#: qml/Greeter/LoginList.qml:259
446msgid "Retry"
446msgid "Retry"
@@ -871,7 +871,7 @@ msgstr "ያለ ሲም ለ መቀጠል መዝለያውን መታ ያድርጉ"
871
871
872#: qml/Wizard/PasswordMeter.qml:87
872#: qml/Wizard/PasswordMeter.qml:87
873msgid "Password too short"
873msgid "Password too short"
874−msgstr ""
874+msgstr "የ መግቢያ ቃል በጣም አጭር ነው"
875
875
876#: qml/Wizard/PasswordMeter.qml:89
876#: qml/Wizard/PasswordMeter.qml:89
877msgid "Passwords match"
877msgid "Passwords match"
po/en_GB.po+9−9
@@ -8,14 +8,14 @@ msgstr ""
8"Project-Id-Version: unity\n"
8"Project-Id-Version: unity\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2016-06-27 18:49+0000\n"
10"POT-Creation-Date: 2016-06-27 18:49+0000\n"
11−"PO-Revision-Date: 2016-05-10 10:10+0000\n"
11+"PO-Revision-Date: 2016-07-05 00:37+0000\n"
12"Last-Translator: Andi Chandler <Unknown>\n"
12"Last-Translator: Andi Chandler <Unknown>\n"
13"Language-Team: English (United Kingdom) <en_GB@li.org>\n"
13"Language-Team: English (United Kingdom) <en_GB@li.org>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17"Plural-Forms: nplurals=2; plural=n != 1;\n"
17"Plural-Forms: nplurals=2; plural=n != 1;\n"
18−"X-Launchpad-Export-Date: 2016-06-30 05:53+0000\n"
18+"X-Launchpad-Export-Date: 2016-07-05 05:58+0000\n"
19"X-Generator: Launchpad (build 18115)\n"
19"X-Generator: Launchpad (build 18115)\n"
20
20
21#: plugins/IntegratedLightDM/Greeter.cpp:112
21#: plugins/IntegratedLightDM/Greeter.cpp:112
@@ -121,31 +121,31 @@ msgstr "Restart"
121
121
122#: qml/Components/KeyboardShortcutsOverlay.qml:41
122#: qml/Components/KeyboardShortcutsOverlay.qml:41
123msgid "Keyboard Shortcuts"
123msgid "Keyboard Shortcuts"
124−msgstr ""
124+msgstr "Keyboard Shortcuts"
125
125
126#: qml/Components/KeyboardShortcutsOverlay.qml:55
126#: qml/Components/KeyboardShortcutsOverlay.qml:55
127msgid "Unity 8"
127msgid "Unity 8"
128−msgstr ""
128+msgstr "Unity 8"
129
129
130#: qml/Components/KeyboardShortcutsOverlay.qml:62
130#: qml/Components/KeyboardShortcutsOverlay.qml:62
131msgid "PrtScr"
131msgid "PrtScr"
132−msgstr ""
132+msgstr "PrtScr"
133
133
134#: qml/Components/KeyboardShortcutsOverlay.qml:67
134#: qml/Components/KeyboardShortcutsOverlay.qml:67
135msgid "Takes a screenshot."
135msgid "Takes a screenshot."
136−msgstr ""
136+msgstr "Takes a screenshot."
137
137
138#: qml/Components/KeyboardShortcutsOverlay.qml:75
138#: qml/Components/KeyboardShortcutsOverlay.qml:75
139msgid "Alt + PrtScr"
139msgid "Alt + PrtScr"
140−msgstr ""
140+msgstr "Alt + PrtScr"
141
141
142#: qml/Components/KeyboardShortcutsOverlay.qml:80
142#: qml/Components/KeyboardShortcutsOverlay.qml:80
143msgid "Takes a screenshot of a window."
143msgid "Takes a screenshot of a window."
144−msgstr ""
144+msgstr "Takes a screenshot of a window."
145
145
146#: qml/Components/KeyboardShortcutsOverlay.qml:88
146#: qml/Components/KeyboardShortcutsOverlay.qml:88
147msgid "Super + Space"
147msgid "Super + Space"
148−msgstr ""
148+msgstr "Super + Space"
149
149
150#: qml/Components/KeyboardShortcutsOverlay.qml:93
150#: qml/Components/KeyboardShortcutsOverlay.qml:93
151msgid "Switches to next keyboard layout."
151msgid "Switches to next keyboard layout."
po/ug.po+54−54
@@ -8,14 +8,14 @@ msgstr ""
8"Project-Id-Version: unity\n"
8"Project-Id-Version: unity\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2016-06-27 18:49+0000\n"
10"POT-Creation-Date: 2016-06-27 18:49+0000\n"
11−"PO-Revision-Date: 2015-12-01 07:37+0000\n"
11+"PO-Revision-Date: 2016-07-03 13:56+0000\n"
12"Last-Translator: Eltikin <eltikinuyghur@hotmail.com>\n"
12"Last-Translator: Eltikin <eltikinuyghur@hotmail.com>\n"
13"Language-Team: Uyghur Computer Science Association <UKIJ@yahoogroups.com>\n"
13"Language-Team: Uyghur Computer Science Association <UKIJ@yahoogroups.com>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17"Plural-Forms: nplurals=1; plural=0;\n"
17"Plural-Forms: nplurals=1; plural=0;\n"
18−"X-Launchpad-Export-Date: 2016-06-30 05:52+0000\n"
18+"X-Launchpad-Export-Date: 2016-07-04 06:10+0000\n"
19"X-Generator: Launchpad (build 18115)\n"
19"X-Generator: Launchpad (build 18115)\n"
20
20
21#: plugins/IntegratedLightDM/Greeter.cpp:112
21#: plugins/IntegratedLightDM/Greeter.cpp:112
@@ -120,15 +120,15 @@ msgstr "قايتا قوزغات"
120
120
121#: qml/Components/KeyboardShortcutsOverlay.qml:41
121#: qml/Components/KeyboardShortcutsOverlay.qml:41
122msgid "Keyboard Shortcuts"
122msgid "Keyboard Shortcuts"
123−msgstr ""
123+msgstr "تېزلەتمىلەر"
124
124
125#: qml/Components/KeyboardShortcutsOverlay.qml:55
125#: qml/Components/KeyboardShortcutsOverlay.qml:55
126msgid "Unity 8"
126msgid "Unity 8"
127−msgstr ""
127+msgstr "Unity 8"
128
128
129#: qml/Components/KeyboardShortcutsOverlay.qml:62
129#: qml/Components/KeyboardShortcutsOverlay.qml:62
130msgid "PrtScr"
130msgid "PrtScr"
131−msgstr ""
131+msgstr "PrtScr"
132
132
133#: qml/Components/KeyboardShortcutsOverlay.qml:67
133#: qml/Components/KeyboardShortcutsOverlay.qml:67
134msgid "Takes a screenshot."
134msgid "Takes a screenshot."
@@ -136,7 +136,7 @@ msgstr ""
136
136
137#: qml/Components/KeyboardShortcutsOverlay.qml:75
137#: qml/Components/KeyboardShortcutsOverlay.qml:75
138msgid "Alt + PrtScr"
138msgid "Alt + PrtScr"
139−msgstr ""
139+msgstr "Alt + PrtScr"
140
140
141#: qml/Components/KeyboardShortcutsOverlay.qml:80
141#: qml/Components/KeyboardShortcutsOverlay.qml:80
142msgid "Takes a screenshot of a window."
142msgid "Takes a screenshot of a window."
@@ -144,7 +144,7 @@ msgstr ""
144
144
145#: qml/Components/KeyboardShortcutsOverlay.qml:88
145#: qml/Components/KeyboardShortcutsOverlay.qml:88
146msgid "Super + Space"
146msgid "Super + Space"
147−msgstr ""
147+msgstr "Super + Space"
148
148
149#: qml/Components/KeyboardShortcutsOverlay.qml:93
149#: qml/Components/KeyboardShortcutsOverlay.qml:93
150msgid "Switches to next keyboard layout."
150msgid "Switches to next keyboard layout."
@@ -152,7 +152,7 @@ msgstr ""
152
152
153#: qml/Components/KeyboardShortcutsOverlay.qml:101
153#: qml/Components/KeyboardShortcutsOverlay.qml:101
154msgid "Super + Shift + Space"
154msgid "Super + Shift + Space"
155−msgstr ""
155+msgstr "Super + Shift + Space"
156
156
157#: qml/Components/KeyboardShortcutsOverlay.qml:106
157#: qml/Components/KeyboardShortcutsOverlay.qml:106
158msgid "Switches to previous keyboard layout."
158msgid "Switches to previous keyboard layout."
@@ -160,11 +160,11 @@ msgstr ""
160
160
161#: qml/Components/KeyboardShortcutsOverlay.qml:118
161#: qml/Components/KeyboardShortcutsOverlay.qml:118
162msgid "Launcher"
162msgid "Launcher"
163−msgstr ""
163+msgstr "ئىجراچى"
164
164
165#: qml/Components/KeyboardShortcutsOverlay.qml:125
165#: qml/Components/KeyboardShortcutsOverlay.qml:125
166msgid "Super (Hold)"
166msgid "Super (Hold)"
167−msgstr ""
167+msgstr "Super (Hold)"
168
168
169#: qml/Components/KeyboardShortcutsOverlay.qml:130
169#: qml/Components/KeyboardShortcutsOverlay.qml:130
170msgid "Opens the launcher, displays shortcuts."
170msgid "Opens the launcher, displays shortcuts."
@@ -172,7 +172,7 @@ msgstr ""
172
172
173#: qml/Components/KeyboardShortcutsOverlay.qml:138
173#: qml/Components/KeyboardShortcutsOverlay.qml:138
174msgid "Alt + F1"
174msgid "Alt + F1"
175−msgstr ""
175+msgstr "Alt + F1"
176
176
177#: qml/Components/KeyboardShortcutsOverlay.qml:143
177#: qml/Components/KeyboardShortcutsOverlay.qml:143
178msgid "Opens launcher keyboard navigation mode."
178msgid "Opens launcher keyboard navigation mode."
@@ -180,7 +180,7 @@ msgstr ""
180
180
181#: qml/Components/KeyboardShortcutsOverlay.qml:151
181#: qml/Components/KeyboardShortcutsOverlay.qml:151
182msgid "Super + Tab"
182msgid "Super + Tab"
183−msgstr ""
183+msgstr "Super + Tab"
184
184
185#: qml/Components/KeyboardShortcutsOverlay.qml:156
185#: qml/Components/KeyboardShortcutsOverlay.qml:156
186msgid "Switches applications via the launcher."
186msgid "Switches applications via the launcher."
@@ -188,7 +188,7 @@ msgstr ""
188
188
189#: qml/Components/KeyboardShortcutsOverlay.qml:164
189#: qml/Components/KeyboardShortcutsOverlay.qml:164
190msgid "Super + 0 to 9"
190msgid "Super + 0 to 9"
191−msgstr ""
191+msgstr "Super + 0 to 9"
192
192
193#: qml/Components/KeyboardShortcutsOverlay.qml:169
193#: qml/Components/KeyboardShortcutsOverlay.qml:169
194msgid "Same as clicking on a launcher icon."
194msgid "Same as clicking on a launcher icon."
@@ -196,11 +196,11 @@ msgstr ""
196
196
197#: qml/Components/KeyboardShortcutsOverlay.qml:181
197#: qml/Components/KeyboardShortcutsOverlay.qml:181
198msgid "Scopes"
198msgid "Scopes"
199−msgstr ""
199+msgstr "ئەپچەلەر"
200
200
201#: qml/Components/KeyboardShortcutsOverlay.qml:188
201#: qml/Components/KeyboardShortcutsOverlay.qml:188
202msgid "Super (Tap)"
202msgid "Super (Tap)"
203−msgstr ""
203+msgstr "Super (Tap)"
204
204
205#: qml/Components/KeyboardShortcutsOverlay.qml:193
205#: qml/Components/KeyboardShortcutsOverlay.qml:193
206msgid "Opens the Scopes home."
206msgid "Opens the Scopes home."
@@ -208,19 +208,19 @@ msgstr ""
208
208
209#: qml/Components/KeyboardShortcutsOverlay.qml:209
209#: qml/Components/KeyboardShortcutsOverlay.qml:209
210msgid "Switching"
210msgid "Switching"
211−msgstr ""
211+msgstr "ئالماشتۇرۇش"
212
212
213#: qml/Components/KeyboardShortcutsOverlay.qml:216
213#: qml/Components/KeyboardShortcutsOverlay.qml:216
214msgid "Alt + Tab"
214msgid "Alt + Tab"
215−msgstr ""
215+msgstr "Alt + Tab"
216
216
217#: qml/Components/KeyboardShortcutsOverlay.qml:221
217#: qml/Components/KeyboardShortcutsOverlay.qml:221
218msgid "Switches between applications."
218msgid "Switches between applications."
219−msgstr ""
219+msgstr "پروگراممىلارنى ئالماشتۇرىدۇ."
220
220
221#: qml/Components/KeyboardShortcutsOverlay.qml:229
221#: qml/Components/KeyboardShortcutsOverlay.qml:229
222msgid "Super + W"
222msgid "Super + W"
223−msgstr ""
223+msgstr "Super + W"
224
224
225#: qml/Components/KeyboardShortcutsOverlay.qml:234
225#: qml/Components/KeyboardShortcutsOverlay.qml:234
226msgid "Opens the desktop spread."
226msgid "Opens the desktop spread."
@@ -228,19 +228,19 @@ msgstr ""
228
228
229#: qml/Components/KeyboardShortcutsOverlay.qml:242
229#: qml/Components/KeyboardShortcutsOverlay.qml:242
230msgid "Cursor Left or Right"
230msgid "Cursor Left or Right"
231−msgstr ""
231+msgstr "سىنبەلگە سولدىن ئوڭغا"
232
232
233#: qml/Components/KeyboardShortcutsOverlay.qml:247
233#: qml/Components/KeyboardShortcutsOverlay.qml:247
234msgid "Moves the focus."
234msgid "Moves the focus."
235−msgstr ""
235+msgstr "فوكۇسنى يۆتكەيدۇ."
236
236
237#: qml/Components/KeyboardShortcutsOverlay.qml:259
237#: qml/Components/KeyboardShortcutsOverlay.qml:259
238msgid "Windows"
238msgid "Windows"
239−msgstr ""
239+msgstr "كۆزنەكلەر"
240
240
241#: qml/Components/KeyboardShortcutsOverlay.qml:266
241#: qml/Components/KeyboardShortcutsOverlay.qml:266
242msgid "Ctrl + Super + D"
242msgid "Ctrl + Super + D"
243−msgstr ""
243+msgstr "Ctrl + Super + D"
244
244
245#: qml/Components/KeyboardShortcutsOverlay.qml:271
245#: qml/Components/KeyboardShortcutsOverlay.qml:271
246msgid "Minimizes all windows."
246msgid "Minimizes all windows."
@@ -248,7 +248,7 @@ msgstr ""
248
248
249#: qml/Components/KeyboardShortcutsOverlay.qml:279
249#: qml/Components/KeyboardShortcutsOverlay.qml:279
250msgid "Ctrl + Super + Up"
250msgid "Ctrl + Super + Up"
251−msgstr ""
251+msgstr "Ctrl + Super + Up"
252
252
253#: qml/Components/KeyboardShortcutsOverlay.qml:284
253#: qml/Components/KeyboardShortcutsOverlay.qml:284
254msgid "Maximizes the current window."
254msgid "Maximizes the current window."
@@ -256,7 +256,7 @@ msgstr ""
256
256
257#: qml/Components/KeyboardShortcutsOverlay.qml:292
257#: qml/Components/KeyboardShortcutsOverlay.qml:292
258msgid "Ctrl + Super + Down"
258msgid "Ctrl + Super + Down"
259−msgstr ""
259+msgstr "Ctrl + Super + Down"
260
260
261#: qml/Components/KeyboardShortcutsOverlay.qml:297
261#: qml/Components/KeyboardShortcutsOverlay.qml:297
262msgid "Minimizes or restores the current window."
262msgid "Minimizes or restores the current window."
@@ -264,7 +264,7 @@ msgstr ""
264
264
265#: qml/Components/KeyboardShortcutsOverlay.qml:305
265#: qml/Components/KeyboardShortcutsOverlay.qml:305
266msgid "Ctrl + Super + Left or Right"
266msgid "Ctrl + Super + Left or Right"
267−msgstr ""
267+msgstr "Ctrl + Super + Left or Right"
268
268
269#: qml/Components/KeyboardShortcutsOverlay.qml:310
269#: qml/Components/KeyboardShortcutsOverlay.qml:310
270msgid "Semi-maximizes the current window."
270msgid "Semi-maximizes the current window."
@@ -272,11 +272,11 @@ msgstr ""
272
272
273#: qml/Components/KeyboardShortcutsOverlay.qml:318
273#: qml/Components/KeyboardShortcutsOverlay.qml:318
274msgid "Alt + F4"
274msgid "Alt + F4"
275−msgstr ""
275+msgstr "Alt + F4"
276
276
277#: qml/Components/KeyboardShortcutsOverlay.qml:323
277#: qml/Components/KeyboardShortcutsOverlay.qml:323
278msgid "Closes the current window."
278msgid "Closes the current window."
279−msgstr ""
279+msgstr "نۆۋەتتىكى كۆزنەكنى ياپىدۇ."
280
280
281#: qml/Components/Lockscreen.qml:239
281#: qml/Components/Lockscreen.qml:239
282msgid "Return to Call"
282msgid "Return to Call"
@@ -293,12 +293,12 @@ msgstr "تامام"
293#: qml/Components/MediaServices/VideoPlayerControls.qml:44
293#: qml/Components/MediaServices/VideoPlayerControls.qml:44
294#, qt-format
294#, qt-format
295msgid "%1:%2:%3"
295msgid "%1:%2:%3"
296−msgstr ""
296+msgstr "%1:%2:%3"
297
297
298#: qml/Components/MediaServices/VideoPlayerControls.qml:49
298#: qml/Components/MediaServices/VideoPlayerControls.qml:49
299#, qt-format
299#, qt-format
300msgid "%1:%2"
300msgid "%1:%2"
301−msgstr ""
301+msgstr "%1:%2"
302
302
303#: qml/Components/ModeSwitchWarningDialog.qml:32
303#: qml/Components/ModeSwitchWarningDialog.qml:32
304msgid "Apps may have unsaved data:"
304msgid "Apps may have unsaved data:"
@@ -316,15 +316,15 @@ msgstr ""
316
316
317#: qml/Components/ModeSwitchWarningDialog.qml:75
317#: qml/Components/ModeSwitchWarningDialog.qml:75
318msgid "OK, I will reconnect"
318msgid "OK, I will reconnect"
319−msgstr ""
319+msgstr "بولدىلا قايتىدىن ئۇلاي"
320
320
321#: qml/Components/ModeSwitchWarningDialog.qml:76
321#: qml/Components/ModeSwitchWarningDialog.qml:76
322msgid "Reconnect now!"
322msgid "Reconnect now!"
323−msgstr ""
323+msgstr "ھازىرلا يېڭدىن ئۇلاندى"
324
324
325#: qml/Components/ModeSwitchWarningDialog.qml:88
325#: qml/Components/ModeSwitchWarningDialog.qml:88
326msgid "Close all"
326msgid "Close all"
327−msgstr ""
327+msgstr "ھەممىنى ياپ"
328
328
329#: qml/Components/SharingPicker.qml:54
329#: qml/Components/SharingPicker.qml:54
330msgid "Preview Share Item"
330msgid "Preview Share Item"
@@ -359,7 +359,7 @@ msgstr ""
359
359
360#: qml/Dash/FiltersPopover.qml:69
360#: qml/Dash/FiltersPopover.qml:69
361msgid "Reset"
361msgid "Reset"
362−msgstr ""
362+msgstr "ئەسلىگە قايتۇر"
363
363
364#: qml/Dash/GenericScopeView.qml:580 qml/Dash/GenericScopeView.qml:775
364#: qml/Dash/GenericScopeView.qml:580 qml/Dash/GenericScopeView.qml:775
365msgid "Show less"
365msgid "Show less"
@@ -367,7 +367,7 @@ msgstr ""
367
367
368#: qml/Dash/GenericScopeView.qml:580
368#: qml/Dash/GenericScopeView.qml:580
369msgid "Show all"
369msgid "Show all"
370−msgstr ""
370+msgstr "ھەممىنى كۆرسەت"
371
371
372#: qml/Dash/GenericScopeView.qml:637
372#: qml/Dash/GenericScopeView.qml:637
373msgctxt "Label: Hint for dash search line edit"
373msgctxt "Label: Hint for dash search line edit"
@@ -376,11 +376,11 @@ msgstr "ئىزدە"
376
376
377#: qml/Dash/PageHeaderExtraPanel.qml:56
377#: qml/Dash/PageHeaderExtraPanel.qml:56
378msgid "Recent Searches"
378msgid "Recent Searches"
379−msgstr ""
379+msgstr "يېقىنقى ئىزدەشلەر"
380
380
381#: qml/Dash/PageHeaderExtraPanel.qml:67
381#: qml/Dash/PageHeaderExtraPanel.qml:67
382msgid "Clear All"
382msgid "Clear All"
383−msgstr ""
383+msgstr "ھەممىنى تازىلا"
384
384
385#: qml/Dash/Previews/PreviewActionCombo.qml:35
385#: qml/Dash/Previews/PreviewActionCombo.qml:35
386msgid "More..."
386msgid "More..."
@@ -439,7 +439,7 @@ msgstr "قۇلۇپسىزلا"
439
439
440#: qml/Greeter/Greeter.qml:539
440#: qml/Greeter/Greeter.qml:539
441msgid "Try again"
441msgid "Try again"
442−msgstr ""
442+msgstr "قايتا سىنا"
443
443
444#: qml/Greeter/LoginList.qml:259
444#: qml/Greeter/LoginList.qml:259
445msgid "Retry"
445msgid "Retry"
@@ -447,7 +447,7 @@ msgstr "قايتا سىنا"
447
447
448#: qml/Greeter/LoginList.qml:260
448#: qml/Greeter/LoginList.qml:260
449msgid "Log In"
449msgid "Log In"
450−msgstr ""
450+msgstr "تىزىمغا كىر"
451
451
452#: qml/Greeter/NarrowView.qml:54
452#: qml/Greeter/NarrowView.qml:54
453msgid "Sorry, incorrect passphrase."
453msgid "Sorry, incorrect passphrase."
@@ -623,7 +623,7 @@ msgstr "قايتىش"
623
623
624#: qml/Wizard/Pages/10-welcome.qml:27
624#: qml/Wizard/Pages/10-welcome.qml:27
625msgid "Language"
625msgid "Language"
626−msgstr ""
626+msgstr "تىل"
627
627
628#: qml/Wizard/Pages/10-welcome.qml:171 qml/Wizard/Pages/30-wifi.qml:206
628#: qml/Wizard/Pages/10-welcome.qml:171 qml/Wizard/Pages/30-wifi.qml:206
629#: qml/Wizard/Pages/40-location.qml:271 qml/Wizard/Pages/50-timezone.qml:270
629#: qml/Wizard/Pages/40-location.qml:271 qml/Wizard/Pages/50-timezone.qml:270
@@ -632,7 +632,7 @@ msgstr ""
632#: qml/Wizard/Pages/passcode-desktop.qml:141
632#: qml/Wizard/Pages/passcode-desktop.qml:141
633#: qml/Wizard/Pages/password-set.qml:141
633#: qml/Wizard/Pages/password-set.qml:141
634msgid "Next"
634msgid "Next"
635−msgstr ""
635+msgstr "كېيىنكى"
636
636
637#: qml/Wizard/Pages/30-wifi.qml:29
637#: qml/Wizard/Pages/30-wifi.qml:29
638msgid "Connect to Wi‑Fi"
638msgid "Connect to Wi‑Fi"
@@ -640,7 +640,7 @@ msgstr "سىمسىز تورغا(Wi-Fi) باغلان"
640
640
641#: qml/Wizard/Pages/30-wifi.qml:130
641#: qml/Wizard/Pages/30-wifi.qml:130
642msgid "Connected"
642msgid "Connected"
643−msgstr ""
643+msgstr "ئۇلاندى"
644
644
645#: qml/Wizard/Pages/30-wifi.qml:163
645#: qml/Wizard/Pages/30-wifi.qml:163
646msgid "Available Wi-Fi networks"
646msgid "Available Wi-Fi networks"
@@ -689,7 +689,7 @@ msgstr ""
689
689
690#: qml/Wizard/Pages/50-timezone.qml:29
690#: qml/Wizard/Pages/50-timezone.qml:29
691msgid "Time Zone"
691msgid "Time Zone"
692−msgstr ""
692+msgstr "ۋاقىت رايونى"
693
693
694#: qml/Wizard/Pages/50-timezone.qml:181
694#: qml/Wizard/Pages/50-timezone.qml:181
695msgid "Enter your city"
695msgid "Enter your city"
@@ -705,7 +705,7 @@ msgstr ""
705
705
706#: qml/Wizard/Pages/70-passwd-type.qml:39
706#: qml/Wizard/Pages/70-passwd-type.qml:39
707msgid "Lock Screen"
707msgid "Lock Screen"
708−msgstr ""
708+msgstr "ئېكراننى قۇلۇپلا"
709
709
710#: qml/Wizard/Pages/70-passwd-type.qml:101
710#: qml/Wizard/Pages/70-passwd-type.qml:101
711msgctxt "Label: Type of security method"
711msgctxt "Label: Type of security method"
@@ -724,7 +724,7 @@ msgstr ""
724
724
725#: qml/Wizard/Pages/75-report-check.qml:26 qml/Wizard/Pages/here-terms.qml:108
725#: qml/Wizard/Pages/75-report-check.qml:26 qml/Wizard/Pages/here-terms.qml:108
726msgid "Privacy Policy"
726msgid "Privacy Policy"
727−msgstr ""
727+msgstr "شەخسىيەت سىياسىتى"
728
728
729#: qml/Wizard/Pages/75-report-check.qml:26
729#: qml/Wizard/Pages/75-report-check.qml:26
730msgid "Help Us Improve"
730msgid "Help Us Improve"
@@ -736,11 +736,11 @@ msgstr ""
736
736
737#: qml/Wizard/Pages/75-report-check.qml:60
737#: qml/Wizard/Pages/75-report-check.qml:60
738msgid "Privacy policy"
738msgid "Privacy policy"
739−msgstr ""
739+msgstr "شەخسىيەت سىياسىتى"
740
740
741#: qml/Wizard/Pages/80-finished.qml:89
741#: qml/Wizard/Pages/80-finished.qml:89
742msgid "Welcome to Ubuntu"
742msgid "Welcome to Ubuntu"
743−msgstr ""
743+msgstr "ئۇبۇنتۇغا مەرھابا"
744
744
745#: qml/Wizard/Pages/80-finished.qml:104
745#: qml/Wizard/Pages/80-finished.qml:104
746msgid "You are ready to use your device now"
746msgid "You are ready to use your device now"
@@ -805,7 +805,7 @@ msgstr ""
805#: qml/Wizard/Pages/passcode-desktop.qml:76
805#: qml/Wizard/Pages/passcode-desktop.qml:76
806#: qml/Wizard/Pages/passcode-set.qml:54
806#: qml/Wizard/Pages/passcode-set.qml:54
807msgid "Choose passcode"
807msgid "Choose passcode"
808−msgstr ""
808+msgstr "ئىم تاللاڭ"
809
809
810#: qml/Wizard/Pages/passcode-desktop.qml:126
810#: qml/Wizard/Pages/passcode-desktop.qml:126
811msgid "Passcode too short"
811msgid "Passcode too short"
@@ -837,7 +837,7 @@ msgstr ""
837
837
838#: qml/Wizard/Pages/password-set.qml:103
838#: qml/Wizard/Pages/password-set.qml:103
839msgid "Confirm password"
839msgid "Confirm password"
840−msgstr ""
840+msgstr "ئىمنى جەزملەڭ"
841
841
842#: qml/Wizard/Pages/sim.qml:27
842#: qml/Wizard/Pages/sim.qml:27
843msgid "No SIM card installed"
843msgid "No SIM card installed"
@@ -869,23 +869,23 @@ msgstr ""
869
869
870#: qml/Wizard/PasswordMeter.qml:89
870#: qml/Wizard/PasswordMeter.qml:89
871msgid "Passwords match"
871msgid "Passwords match"
872−msgstr ""
872+msgstr "ئىم ماس كەلدى"
873
873
874#: qml/Wizard/PasswordMeter.qml:91
874#: qml/Wizard/PasswordMeter.qml:91
875msgid "Passwords do not match"
875msgid "Passwords do not match"
876−msgstr ""
876+msgstr "ئىم ماس كەلمىدى"
877
877
878#: qml/Wizard/PasswordMeter.qml:95
878#: qml/Wizard/PasswordMeter.qml:95
879msgid "Strong password"
879msgid "Strong password"
880−msgstr ""
880+msgstr "كۈچلۈك ئىم"
881
881
882#: qml/Wizard/PasswordMeter.qml:97
882#: qml/Wizard/PasswordMeter.qml:97
883msgid "Fair password"
883msgid "Fair password"
884−msgstr ""
884+msgstr "يامان ئەمەس ئىم"
885
885
886#: qml/Wizard/PasswordMeter.qml:99
886#: qml/Wizard/PasswordMeter.qml:99
887msgid "Weak password"
887msgid "Weak password"
888−msgstr ""
888+msgstr "ئاجىز ئىم"
889
889
890#: qml/Wizard/PasswordMeter.qml:101
890#: qml/Wizard/PasswordMeter.qml:101
891msgid "Very weak password"
891msgid "Very weak password"
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
@@ -123,12 +125,12 @@ Showable {
123 return d.startUnlock(true /* toTheRight */);
125 return d.startUnlock(true /* toTheRight */);
124 }
126 }
125
127
126− LightDM{id:lightDM} // Provide backend access
127 QtObject {
128 QtObject {
128 id: d
129 id: d
129
130
130− readonly property bool multiUser: lightDM.users.count > 1
131+ readonly property bool multiUser: LightDMService.users.count > 1
132+ readonly property int selectUserIndex: d.getUserIndex(LightDMService.greeter.selectUser)
131− property int currentIndex
133+ property int currentIndex: Math.max(selectUserIndex, 0)
132 property bool waiting
134 property bool waiting
133 property bool isLockscreen // true when we are locking an active session, rather than first user login
135 property bool isLockscreen // true when we are locking an active session, rather than first user login
134 readonly property bool secureFingerprint: isLockscreen &&
136 readonly property bool secureFingerprint: isLockscreen &&
@@ -150,21 +152,37 @@ Showable {
150 UbuntuNumberAnimation {}
152 UbuntuNumberAnimation {}
151 }
153 }
152
154
155+ function getUserIndex(username) {
156+ if (username === "")
157+ return -1;
158+
159+ // Find index for requested user, if it exists
160+ for (var i = 0; i < LightDMService.users.count; i++) {
161+ if (username === LightDMService.users.data(i, LightDMService.userRoles.NameRole)) {
162+ return i;
163+ }
164+ }
165+
166+ return -1;
167+ }
168+
153 function selectUser(uid, reset) {
169 function selectUser(uid, reset) {
170+ if (uid < 0)
171+ return;
154 d.waiting = true;
172 d.waiting = true;
155 if (reset) {
173 if (reset) {
156 loader.item.reset();
174 loader.item.reset();
157 }
175 }
158 currentIndex = uid;
176 currentIndex = uid;
159− var user = lightDM.users.data(uid, lightDM.userRoles.NameRole);
177+ var user = LightDMService.users.data(uid, LightDMService.userRoles.NameRole);
160 AccountsService.user = user;
178 AccountsService.user = user;
161 LauncherModel.setUser(user);
179 LauncherModel.setUser(user);
162− lightDM.greeter.authenticate(user); // always resets auth state
180+ LightDMService.greeter.authenticate(user); // always resets auth state
163 }
181 }
164
182
165 function login() {
183 function login() {
166 enabled = false;
184 enabled = false;
167− if (lightDM.greeter.startSessionSync()) {
185+ if (LightDMService.greeter.startSessionSync()) {
168 sessionStarted();
186 sessionStarted();
169 if (loader.item) {
187 if (loader.item) {
170 loader.item.notifyAuthenticationSucceeded(false /* showFakePassword */);
188 loader.item.notifyAuthenticationSucceeded(false /* showFakePassword */);
@@ -310,7 +328,7 @@ Showable {
310 root.lockedApp = "";
328 root.lockedApp = "";
311 root.forceActiveFocus();
329 root.forceActiveFocus();
312 d.selectUser(d.currentIndex, true);
330 d.selectUser(d.currentIndex, true);
313− lightDM.infographic.readyForDataChange();
331+ LightDMService.infographic.readyForDataChange();
314 }
332 }
315
333
316 Connections {
334 Connections {
@@ -318,13 +336,12 @@ Showable {
318 onSelected: {
336 onSelected: {
319 d.selectUser(index, true);
337 d.selectUser(index, true);
320 }
338 }
339+ onPromptlessLogin: d.login();
321 onResponded: {
340 onResponded: {
322 if (root.locked) {
341 if (root.locked) {
323− lightDM.greeter.respond(response);
342+ LightDMService.greeter.respond(response);
324 } else {
343 } else {
325− if (lightDM.greeter.active && !lightDM.greeter.authenticated) { // could happen if forcedUnlock
326− d.login();
344+ d.login();
327− }
328 loader.item.hide();
345 loader.item.hide();
329 }
346 }
330 }
347 }
@@ -388,18 +405,18 @@ Showable {
388 Binding {
405 Binding {
389 target: loader.item
406 target: loader.item
390 property: "userModel"
407 property: "userModel"
391− value: lightDM.users
408+ value: LightDMService.users
392 }
409 }
393
410
394 Binding {
411 Binding {
395 target: loader.item
412 target: loader.item
396 property: "infographicModel"
413 property: "infographicModel"
397− value: lightDM.infographic
414+ value: LightDMService.infographic
398 }
415 }
399 }
416 }
400
417
401 Connections {
418 Connections {
402− target: lightDM.greeter
419+ target: LightDMService.greeter
403
420
404 onShowGreeter: root.forceShow()
421 onShowGreeter: root.forceShow()
405
422
@@ -434,13 +451,13 @@ Showable {
434 onAuthenticationComplete: {
451 onAuthenticationComplete: {
435 d.waiting = false;
452 d.waiting = false;
436
453
437− if (lightDM.greeter.authenticated) {
454+ if (LightDMService.greeter.authenticated) {
455+ if (!LightDMService.greeter.promptless) {
438− d.login();
456+ d.login();
439− if (!lightDM.greeter.promptless) {
440 loader.item.hide();
457 loader.item.hide();
441 }
458 }
442 } else {
459 } else {
443− if (!lightDM.greeter.promptless) {
460+ if (!LightDMService.greeter.promptless) {
444 AccountsService.failedLogins++;
461 AccountsService.failedLogins++;
445 }
462 }
446
463
@@ -461,21 +478,13 @@ Showable {
461 }
478 }
462
479
463 loader.item.notifyAuthenticationFailed();
480 loader.item.notifyAuthenticationFailed();
464− if (!lightDM.greeter.promptless) {
481+ if (!LightDMService.greeter.promptless) {
465 d.selectUser(d.currentIndex, false);
482 d.selectUser(d.currentIndex, false);
466 }
483 }
467 }
484 }
468 }
485 }
469
486
470− onRequestAuthenticationUser: {
487+ onRequestAuthenticationUser: d.selectUser(d.getUserIndex(user), true)
471− // Find index for requested user, if it exists
472− for (var i = 0; i < lightDM.users.count; i++) {
473− if (user === lightDM.users.data(i, lightDM.userRoles.NameRole)) {
474− d.selectUser(i, true);
475− return;
476− }
477− }
478− }
479 }
488 }
480
489
481 Connections {
490 Connections {
@@ -488,20 +497,20 @@ Showable {
488 }
497 }
489
498
490 Binding {
499 Binding {
491− target: lightDM.greeter
500+ target: LightDMService.greeter
492 property: "active"
501 property: "active"
493 value: root.active
502 value: root.active
494 }
503 }
495
504
496 Binding {
505 Binding {
497− target: lightDM.infographic
506+ target: LightDMService.infographic
498 property: "username"
507 property: "username"
499− value: AccountsService.statsWelcomeScreen ? lightDM.users.data(d.currentIndex, lightDM.userRoles.NameRole) : ""
508+ value: AccountsService.statsWelcomeScreen ? LightDMService.users.data(d.currentIndex, LightDMService.userRoles.NameRole) : ""
500 }
509 }
501
510
502 Connections {
511 Connections {
503 target: i18n
512 target: i18n
504− onLanguageChanged: lightDM.infographic.readyForDataChange()
513+ onLanguageChanged: LightDMService.infographic.readyForDataChange()
505 }
514 }
506
515
507 Observer {
516 Observer {
@@ -553,7 +562,7 @@ Showable {
553 failOperation("fingerprint reader is locked");
562 failOperation("fingerprint reader is locked");
554 return;
563 return;
555 }
564 }
556− if (result !== lightDM.users.data(d.currentIndex, lightDM.userRoles.UidRole)) {
565+ if (result !== LightDMService.users.data(d.currentIndex, LightDMService.userRoles.UidRole)) {
557 AccountsService.failedFingerprintLogins++;
566 AccountsService.failedFingerprintLogins++;
558 failOperation("not the selected user");
567 failOperation("not the selected user");
559 return;
568 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") {
@@ -497,7 +496,7 @@ StyledItem {
497 function showHome() {
496 function showHome() {
498 greeter.notifyUserRequestedApp("unity8-dash");
497 greeter.notifyUserRequestedApp("unity8-dash");
499
498
500− var animate = !lightDM.greeter.active && !stages.shown
499+ var animate = !LightDMService.greeter.active && !stages.shown
501 dash.setCurrentScope(0, animate, false)
500 dash.setCurrentScope(0, animate, false)
502 ApplicationManager.requestFocusApplication("unity8-dash")
501 ApplicationManager.requestFocusApplication("unity8-dash")
503 }
502 }
@@ -536,7 +535,12 @@ StyledItem {
536
535
537 indicatorsModel: Indicators.IndicatorsModel {
536 indicatorsModel: Indicators.IndicatorsModel {
538 // tablet and phone both use the same profile
537 // tablet and phone both use the same profile
538+ // FIXME: use just "phone" for greeter too, but first fix
539+ // greeter app launching to either load the app inside the
540+ // greeter or tell the session to load the app. This will
541+ // involve taking the url-dispatcher dbus name and using
542+ // SessionBroadcast to tell the session.
539− profile: "phone"
543+ profile: shell.mode === "greeter" ? "desktop_greeter" : "phone"
540 Component.onCompleted: load();
544 Component.onCompleted: load();
541 }
545 }
542 }
546 }
@@ -548,7 +552,7 @@ StyledItem {
548 readonly property bool focusedSurfaceIsFullscreen: MirFocusController.focusedSurface
552 readonly property bool focusedSurfaceIsFullscreen: MirFocusController.focusedSurface
549 ? MirFocusController.focusedSurface.state === Mir.FullscreenState
553 ? MirFocusController.focusedSurface.state === Mir.FullscreenState
550 : false
554 : false
551− fullscreenMode: (focusedSurfaceIsFullscreen && !lightDM.greeter.active && launcher.progress == 0)
555+ fullscreenMode: (focusedSurfaceIsFullscreen && !LightDMService.greeter.active && launcher.progress == 0)
552 || greeter.hasLockedApp
556 || greeter.hasLockedApp
553 locked: greeter && greeter.active
557 locked: greeter && greeter.active
554 }
558 }
@@ -666,6 +670,7 @@ StyledItem {
666 id: wizard
670 id: wizard
667 objectName: "wizard"
671 objectName: "wizard"
668 anchors.fill: parent
672 anchors.fill: parent
673+ deferred: shell.mode === "greeter"
669
674
670 function unlockWhenDoneWithWizard() {
675 function unlockWhenDoneWithWizard() {
671 if (!active) {
676 if (!active) {
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+9−7
@@ -10,18 +10,20 @@ 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/SessionsModel.cpp
23+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
23 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
24 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
24 MockGreeter.cpp
25 MockGreeter.cpp
26+ MockSessionsModel.cpp
25 MockUsersModel.cpp
27 MockUsersModel.cpp
26 plugin.cpp
28 plugin.cpp
27 )
29 )
@@ -30,7 +32,7 @@ add_library(MockLightDM-qml MODULE
30 ${QMLPLUGIN_SRC}
32 ${QMLPLUGIN_SRC}
31 )
33 )
32
34
33−# We want to link to liblightdm-qt5-2, but we don't want to depend on it being
35+# 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
36# 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
37# At run time, we can point to whichever version we happen to be using via
36# LD_LIBRARY_PATH.
38# LD_LIBRARY_PATH.
@@ -42,7 +44,7 @@ target_link_libraries(MockLightDM-qml
42
44
43qt5_use_modules(MockLightDM-qml DBus Gui Qml)
45qt5_use_modules(MockLightDM-qml DBus Gui Qml)
44
46
45−add_unity8_mock(IntegratedLightDM 0.1 IntegratedLightDM
47+add_unity8_mock(LightDM.IntegratedLightDM 0.1 LightDM/IntegratedLightDM
46 PREFIX mocks
48 PREFIX mocks
47 TARGETS MockLightDM-qml
49 TARGETS MockLightDM-qml
48 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/liblightdm"
50 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
qml/Stages/ShimStage.qml → tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpprenamed+15−21
@@ -12,32 +12,26 @@
12 *
12 *
13 * You should have received a copy of the GNU General Public License
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/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
15 */
16 */
16
17
17−import QtQuick 2.4
18+#include "MockSessionsModel.h"
18−import Ubuntu.Components 1.3
19+#include <QLightDM/SessionsModel>
19−
20−AbstractStage {
21− id: shimStage
22
20
23− anchors.fill: parent
21+QString MockSessionsModel::testScenario() const
22+{
23+ QLightDM::SessionsModel* qSessionsModel =
24+ static_cast<QLightDM::SessionsModel*>(sourceModel());
24
25
25− Text {
26+ return qSessionsModel->testScenario();
26− id: greeterModeText
27+}
27
28
28− anchors.horizontalCenter: parent.horizontalCenter
29+void MockSessionsModel::setTestScenario(const QString testScenario)
29− anchors.top: parent.top
30+{
30− anchors.topMargin: units.gu(10)
31+ QLightDM::SessionsModel* qSessionsModel =
31− font.bold: true
32+ static_cast<QLightDM::SessionsModel*>(sourceModel());
32− horizontalAlignment: Text.AlignHCenter
33− text: "Shell is in \"greeter\" mode"
34− }
35
33
36− Text {
34+ if (qSessionsModel->testScenario() != testScenario) {
37− anchors.centerIn: parent
35+ qSessionsModel->setTestScenario(testScenario);
38− color: UbuntuColors.orange
39− font.pointSize: units.gu(8)
40− horizontalAlignment: Text.AlignHCenter
41− text: "Shim \nStage"
42 }
36 }
43}
37}
tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.hnew file+34
@@ -0,0 +1,34 @@
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+
18+#ifndef MOCK_UNITY_SESSIONSMODEL_H
19+#define MOCK_UNITY_SESSIONSMODEL_H
20+
21+#include <SessionsModel.h>
22+
23+class MockSessionsModel : public SessionsModel
24+{
25+ Q_OBJECT
26+
27+ Q_PROPERTY(QString testScenario READ testScenario WRITE setTestScenario)
28+
29+public:
30+ QString testScenario() const;
31+ void setTestScenario(QString testScenario);
32+};
33+
34+#endif // MOCK_UNITY_SESSIONSMODEL_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/LightDM/IntegratedLightDM/QLightDM/SessionsModelnew file+17
@@ -0,0 +1,17 @@
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+#include "../liblightdm/SessionsModel.h"
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+4−2
@@ -1,7 +1,9 @@
1set(LibLightDM_SOURCES
1set(LibLightDM_SOURCES
2 Greeter.cpp
2 Greeter.cpp
3+ SessionsModel.cpp
3 UsersModel.cpp
4 UsersModel.cpp
4 GreeterPrivate.cpp
5 GreeterPrivate.cpp
6+ SessionsModelPrivate.cpp
5 UsersModelPrivate.cpp
7 UsersModelPrivate.cpp
6 ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
8 ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
7 )
9 )
@@ -11,8 +13,8 @@ add_library(MockLightDM SHARED ${LibLightDM_SOURCES})
11qt5_use_modules(MockLightDM Gui)
13qt5_use_modules(MockLightDM Gui)
12
14
13set_target_properties(MockLightDM PROPERTIES
15set_target_properties(MockLightDM PROPERTIES
14− OUTPUT_NAME lightdm-qt5-2)
16+ OUTPUT_NAME lightdm-qt5-3)
15
17
16install(TARGETS MockLightDM
18install(TARGETS MockLightDM
17− DESTINATION ${SHELL_INSTALL_QML}/mocks/IntegratedLightDM/liblightdm
19+ DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/liblightdm
18 )
20 )
tests/mocks/IntegratedLightDM/liblightdm/Greeter.cpp → tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpprenamed+9−2
@@ -51,7 +51,7 @@ QString Greeter::getHint(const QString &name) const
51
51
52QString Greeter::defaultSessionHint() const
52QString Greeter::defaultSessionHint() const
53{
53{
54− return "ubuntu";
54+ return QStringLiteral("ubuntu");
55}
55}
56
56
57bool Greeter::hideUsersHint() const
57bool Greeter::hideUsersHint() const
@@ -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/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cppnew file+99
@@ -0,0 +1,99 @@
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+
18+
19+// LightDM currently is Qt4 compatible, and so doesn't define setRoleNames.
20+// To use the same method of setting role name that it does, we
21+// set our compatibility to Qt4 here too.
22+#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0)
23+
24+#include "SessionsModel.h"
25+#include "SessionsModelPrivate.h"
26+#include <QtCore/QDir>
27+#include <QtCore/QString>
28+
29+namespace QLightDM
30+{
31+
32+SessionsModel::SessionsModel(QObject* parent) :
33+ QAbstractListModel(parent),
34+ d_ptr(new SessionsModelPrivate(this))
35+{
36+ Q_D(SessionsModel);
37+ m_roleNames = QAbstractListModel::roleNames();
38+ m_roleNames[KeyRole] = "key";
39+ m_roleNames[TypeRole] = "type";
40+}
41+
42+SessionsModel::~SessionsModel()
43+{
44+ delete d_ptr;
45+}
46+
47+QVariant SessionsModel::data(const QModelIndex& index, int role) const
48+{
49+ Q_D(const SessionsModel);
50+
51+ if(!index.isValid()) {
52+ return QVariant();
53+ }
54+
55+ int row = index.row();
56+
57+ switch (role) {
58+ case QLightDM::SessionsModel::KeyRole:
59+ return d->sessionItems[row].key;
60+ case Qt::DisplayRole:
61+ return d->sessionItems[row].name;
62+ default:
63+ return QVariant();
64+ }
65+}
66+
67+QHash<int, QByteArray> SessionsModel::roleNames() const
68+{
69+ return m_roleNames;
70+}
71+
72+int SessionsModel::rowCount(const QModelIndex& parent) const
73+{
74+ Q_D(const SessionsModel);
75+
76+ if (parent.isValid()) {
77+ return 0;
78+ } else { // parent is root
79+ return d->sessionItems.size();
80+ }
81+}
82+
83+QString SessionsModel::testScenario() const
84+{
85+ Q_D(const SessionsModel);
86+ return d->testScenario;
87+}
88+
89+void SessionsModel::setTestScenario(QString testScenario)
90+{
91+ Q_D(SessionsModel);
92+
93+ if (d->testScenario != testScenario) {
94+ d->testScenario = testScenario;
95+ d->resetEntries();
96+ }
97+}
98+
99+} // namespace QLightDM
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.hnew file+72
@@ -0,0 +1,72 @@
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+
18+#ifndef UNITY_MOCK_SESSIONSMODEL_H
19+#define UNITY_MOCK_SESSIONSMODEL_H
20+
21+#include <QtCore/QAbstractListModel>
22+#include <QtCore/QString>
23+
24+namespace QLightDM
25+{
26+class SessionsModelPrivate;
27+
28+class Q_DECL_EXPORT SessionsModel : public QAbstractListModel
29+ {
30+ Q_OBJECT
31+
32+ Q_ENUMS(SessionModelRoles SessionType)
33+
34+ // Mock-only API for testing purposes
35+ Q_PROPERTY(QString testScenario READ testScenario WRITE setTestScenario)
36+
37+ public:
38+
39+ enum SessionModelRoles {
40+ //name is exposed as Qt::DisplayRole
41+ //comment is exposed as Qt::TooltipRole
42+ KeyRole = Qt::UserRole,
43+ IdRole = KeyRole, /** Deprecated */
44+ TypeRole
45+ };
46+
47+ enum SessionType {
48+ LocalSessions,
49+ RemoteSessions
50+ };
51+
52+ explicit SessionsModel(QObject* parent=nullptr); /** Deprecated. Loads local sessions*/
53+ explicit SessionsModel(SessionsModel::SessionType, QObject* parent=nullptr);
54+ virtual ~SessionsModel();
55+
56+ QHash<int, QByteArray> roleNames() const override;
57+ int rowCount(const QModelIndex& parent) const override;
58+ QVariant data(const QModelIndex& index, int role) const override;
59+
60+ QString testScenario() const;
61+ void setTestScenario(QString testScenario);
62+
63+ protected:
64+ SessionsModelPrivate* const d_ptr;
65+
66+ private:
67+ QHash<int, QByteArray> m_roleNames;
68+ Q_DECLARE_PRIVATE(SessionsModel)
69+ };
70+}
71+
72+#endif // UNITY_MOCK_SESSIONSMODEL_H
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cppnew file+73
@@ -0,0 +1,73 @@
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+#include "SessionsModel.h"
18+#include "SessionsModelPrivate.h"
19+
20+namespace QLightDM
21+{
22+
23+SessionsModelPrivate::SessionsModelPrivate(SessionsModel* parent)
24+ : testScenario("singleSession")
25+ , q_ptr(parent)
26+{
27+ resetEntries();
28+}
29+
30+void SessionsModelPrivate::resetEntries()
31+{
32+ Q_Q(SessionsModel);
33+
34+ q->beginResetModel();
35+ if (testScenario == "multipleSessions") {
36+ resetEntries_multipleSessions();
37+ } else if (testScenario == "noSessions") {
38+ resetEntries_noSessions();
39+ } else {
40+ resetEntries_singleSession();
41+ }
42+ q->endResetModel();
43+}
44+
45+void SessionsModelPrivate::resetEntries_multipleSessions()
46+{
47+ sessionItems =
48+ {
49+ {"ubuntu", "", "Ubuntu", ""},
50+ {"ubuntu-2d", "", "Ubuntu 2D", ""},
51+ {"gnome", "", "GNOME", ""},
52+ {"gnome-classic", "", "GNOME Classic", ""},
53+ {"gnome-flashback-compiz", "", "GNOME Flashback (Compiz)", ""},
54+ {"gnome-flashback-metacity", "", "GNOME Flashback (Metacity)", ""},
55+ {"gnome-wayland", "", "GNOME on Wayland", ""},
56+ {"plasma", "", "Plasma", ""},
57+ {"kde", "", "KDE" , ""},
58+ {"xterm", "", "Recovery Console", ""},
59+ {"", "", "Unknown?", ""}
60+ };
61+}
62+
63+void SessionsModelPrivate::resetEntries_noSessions()
64+{
65+ sessionItems = {};
66+}
67+
68+void SessionsModelPrivate::resetEntries_singleSession()
69+{
70+ sessionItems = {{"ubuntu", "", "Ubuntu", ""}};
71+}
72+
73+} // namespace QLightDM
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.hnew file+59
@@ -0,0 +1,59 @@
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+
18+#ifndef UNITY_MOCK_SESSIONSMODEL_PRIVATE_H
19+#define UNITY_MOCK_SESSIONSMODEL_PRIVATE_H
20+
21+#include <QtCore/QList>
22+#include <QtCore/QString>
23+
24+namespace QLightDM
25+{
26+class SessionsModel;
27+
28+class SessionItem
29+{
30+public:
31+ QString key;
32+ QString type; // unused
33+ QString name;
34+ QString comment; // unused
35+};
36+
37+class SessionsModelPrivate
38+{
39+public:
40+ explicit SessionsModelPrivate(SessionsModel* parent=0);
41+ virtual ~SessionsModelPrivate() = default;
42+
43+ QList<SessionItem> sessionItems;
44+ QString testScenario;
45+
46+ void resetEntries();
47+protected:
48+ SessionsModel* const q_ptr;
49+
50+private:
51+ void resetEntries_multipleSessions();
52+ void resetEntries_noSessions();
53+ void resetEntries_singleSession();
54+ Q_DECLARE_PUBLIC(SessionsModel)
55+};
56+
57+} // namespace QLightDM
58+
59+#endif // UNITY_MOCK_SESSIONSMODEL_PRIVATE_H
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+22−22
@@ -60,7 +60,7 @@ void UsersModelPrivate::resetEntries_single()
60{
60{
61 entries =
61 entries =
62 {
62 {
63− { "single", "Single User", 0, 0, false, false, 0, 0, 0 },
63+ { "single", "Single User", 0, 0, false, false, "ubuntu", 0 },
64 };
64 };
65}
65}
66
66
@@ -68,7 +68,7 @@ void UsersModelPrivate::resetEntries_singlePassphrase()
68{
68{
69 entries =
69 entries =
70 {
70 {
71− { "single", "Single User", 0, 0, false, false, 0, 0, 0 },
71+ { "single", "Single User", 0, 0, false, false, "ubuntu", 0 },
72 };
72 };
73}
73}
74
74
@@ -76,7 +76,7 @@ void UsersModelPrivate::resetEntries_singlePin()
76{
76{
77 entries =
77 entries =
78 {
78 {
79− { "has-pin", "Has PIN", 0, 0, false, false, 0, 0, 0 },
79+ { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
80 };
80 };
81}
81}
82
82
@@ -84,26 +84,26 @@ void UsersModelPrivate::resetEntries_full()
84{
84{
85 entries =
85 entries =
86 {
86 {
87− { "has-password", "Has Password", 0, 0, false, false, 0, 0, 0 },
87+ { "has-password", "Has Password", 0, 0, false, false, "ubuntu", 0 },
88− { "has-pin", "Has PIN", 0, 0, false, false, 0, 0, 0 },
88+ { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
89− { "different-prompt", "Different Prompt", 0, 0, false, false, 0, 0, 0 },
89+ { "different-prompt", "Different Prompt", 0, 0, false, false, "ubuntu", 0 },
90− { "no-password", "No Password", 0, 0, false, false, 0, 0, 0 },
90+ { "no-password", "No Password", 0, 0, false, false, "ubuntu", 0 },
91− { "auth-error", "Auth Error", 0, 0, false, false, 0, 0, 0 },
91+ { "auth-error", "Auth Error", 0, 0, false, false, "ubuntu", 0 },
92− { "two-factor", "Two Factor", 0, 0, false, false, 0, 0, 0 },
92+ { "two-factor", "Two Factor", 0, 0, false, false, "ubuntu", 0 },
93− { "info-prompt", "Info Prompt", 0, 0, false, false, 0, 0, 0 },
93+ { "info-prompt", "Info Prompt", 0, 0, false, false, "ubuntu", 0 },
94− { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, 0, 0, 0 },
94+ { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, "ubuntu", 0 },
95− { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, 0, 0, 0 },
95+ { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, "ubuntu", 0 },
96− { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, 0, 0, 0 },
96+ { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, "ubuntu", 0 },
97− { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, 0, 0, 0 },
97+ { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, "ubuntu", 0 },
98− { "long-name", "Long name (far far too long to fit, seriously this would never fit on the screen, you will never see this part of the name)", 0, 0, false, false, 0, 0, 0 },
98+ { "long-name", "Long name (far far too long to fit, seriously this would never fit on the screen, you will never see this part of the name)", 0, 0, false, false, "ubuntu", 0 },
99− { "color-background", "Color Background", "#dd4814", 0, false, false, 0, 0, 0 },
99+ { "color-background", "Color Background", "#dd4814", 0, false, false, "ubuntu", 0 },
100 // white and black are a bit redundant, but useful for manually testing if UI is still readable
100 // white and black are a bit redundant, but useful for manually testing if UI is still readable
101− { "white-background", "White Background", "#ffffff", 0, false, false, 0, 0, 0 },
101+ { "white-background", "White Background", "#ffffff", 0, false, false, "ubuntu", 0 },
102− { "black-background", "Black Background", "#000000", 0, false, false, 0, 0, 0 },
102+ { "black-background", "Black Background", "#000000", 0, false, false, "ubuntu", 0 },
103− { "no-background", "No Background", "", 0, false, false, 0, 0, 0 },
103+ { "no-background", "No Background", "", 0, false, false, "ubuntu", 0 },
104− { "unicode", "가나다라마", 0, 0, false, false, 0, 0, 0 },
104+ { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 },
105− { "no-response", "No Response", 0, 0, false, false, 0, 0, 0 },
105+ { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 },
106− { "empty-name", "", 0, 0, false, false, 0, 0, 0 },
106+ { "empty-name", "", 0, 0, false, false, "ubuntu", 0 },
107 };
107 };
108}
108}
109
109
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+15−4
@@ -18,9 +18,11 @@
18#include <DBusGreeter.h>
18#include <DBusGreeter.h>
19#include <DBusGreeterList.h>
19#include <DBusGreeterList.h>
20#include "MockGreeter.h"
20#include "MockGreeter.h"
21+#include "MockSessionsModel.h"
21#include "MockUsersModel.h"
22#include "MockUsersModel.h"
22−#include <libusermetricsoutput/ColorTheme.h>
23+#include <QLightDM/SessionsModel>
24+#include "ColorTheme.h"
23−#include <libusermetricsoutput/UserMetrics.h>
25+#include "UserMetrics.h"
24#include <QLightDM/UsersModel>
26#include <QLightDM/UsersModel>
25
27
26#include <QAbstractItemModel>
28#include <QAbstractItemModel>
@@ -39,6 +41,13 @@ static QObject *greeter_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
39 return greeter;
41 return greeter;
40}
42}
41
43
44+static QObject *sessions_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
45+{
46+ Q_UNUSED(engine)
47+ Q_UNUSED(scriptEngine)
48+ return new MockSessionsModel;
49+}
50+
42static QObject *users_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
51static QObject *users_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
43{
52{
44 Q_UNUSED(engine)
53 Q_UNUSED(engine)
@@ -53,15 +62,17 @@ static QObject *infographic_provider(QQmlEngine *engine, QJSEngine *scriptEngine
53 return UserMetricsOutput::UserMetrics::getInstance();
62 return UserMetricsOutput::UserMetrics::getInstance();
54}
63}
55
64
56−void IntegratedLightDMPlugin::registerTypes(const char *uri)
65+void LightDMPlugin::registerTypes(const char *uri)
57{
66{
58 qmlRegisterType<QAbstractItemModel>();
67 qmlRegisterType<QAbstractItemModel>();
59 qmlRegisterType<UserMetricsOutput::ColorTheme>();
68 qmlRegisterType<UserMetricsOutput::ColorTheme>();
60
69
61− Q_ASSERT(uri == QLatin1String("IntegratedLightDM"));
70+ Q_ASSERT(uri == QLatin1String("LightDM.IntegratedLightDM"));
62 qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
71 qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
63 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
72 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
64 qmlRegisterSingletonType<MockGreeter>(uri, 0, 1, "Greeter", greeter_provider);
73 qmlRegisterSingletonType<MockGreeter>(uri, 0, 1, "Greeter", greeter_provider);
74+ qmlRegisterSingletonType<MockSessionsModel>(uri, 0, 1, "Sessions", sessions_provider);
75+ qmlRegisterUncreatableType<SessionsModel>(uri, 0, 1, "SessionRoles", "Type is not instantiable");
65 qmlRegisterSingletonType<MockUsersModel>(uri, 0, 1, "Users", users_provider);
76 qmlRegisterSingletonType<MockUsersModel>(uri, 0, 1, "Users", users_provider);
66 qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", "Type is not instantiable");
77 qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", "Type is not instantiable");
67 qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider);
78 qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_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+36−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,45 @@ 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
47+# SessionsModelTest
48+add_executable(GreeterSessionsModelTestExec
49+ sessionsmodel.cpp
50+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/SessionsModel.cpp
51+ ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
52+ )
53+add_dependencies(GreeterSessionsModelTestExec MockLightDM)
54+qt5_use_modules(GreeterSessionsModelTestExec Core Test)
55+target_link_libraries(GreeterSessionsModelTestExec
56+ MockLightDM
57+ )
58+target_include_directories(GreeterSessionsModelTestExec PUBLIC
59+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
60+ ${CMAKE_SOURCE_DIR}/plugins/Utils
61+ ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
62+ )
63+add_unity8_uitest(GreeterSessions GreeterSessionsModelTestExec
64+ ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
65+ DEPENDS MockLightDM
66+ LIGHTDM
67+ )
68+
69+# UsersModelTest
46add_executable(GreeterUsersModelTestExec
70add_executable(GreeterUsersModelTestExec
47 usersmodel.cpp
71 usersmodel.cpp
48− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/UsersModel.cpp
72+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
49 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
73 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
50 )
74 )
51# This add_dependencies is needed since we're linking with with -L and -l below
75# This add_dependencies is needed since we're linking with with -L and -l below
@@ -53,13 +77,12 @@ add_executable(GreeterUsersModelTestExec
53add_dependencies(GreeterUsersModelTestExec MockLightDM)
77add_dependencies(GreeterUsersModelTestExec MockLightDM)
54qt5_use_modules(GreeterUsersModelTestExec Core Test)
78qt5_use_modules(GreeterUsersModelTestExec Core Test)
55target_link_libraries(GreeterUsersModelTestExec
79target_link_libraries(GreeterUsersModelTestExec
56− -L${CMAKE_BINARY_DIR}/tests/mocks/IntegratedLightDM/liblightdm
80+ MockLightDM
57− -llightdm-qt5-2
58 )
81 )
59target_include_directories(GreeterUsersModelTestExec PUBLIC
82target_include_directories(GreeterUsersModelTestExec PUBLIC
60− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
83+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
61 ${CMAKE_SOURCE_DIR}/plugins/Utils
84 ${CMAKE_SOURCE_DIR}/plugins/Utils
62− ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
85+ ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
63 )
86 )
64add_unity8_uitest(GreeterUsers GreeterUsersModelTestExec
87add_unity8_uitest(GreeterUsers GreeterUsersModelTestExec
65 ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
88 ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
@@ -77,7 +100,7 @@ target_link_libraries(GreeterIntegratedTestExec
77 )
100 )
78target_include_directories(GreeterIntegratedTestExec PUBLIC
101target_include_directories(GreeterIntegratedTestExec PUBLIC
79 ${GLIB_INCLUDE_DIRS}
102 ${GLIB_INCLUDE_DIRS}
80− ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm
103+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm
81 )
104 )
82add_unity8_unittest(GreeterIntegrated dbus-test-runner
105add_unity8_unittest(GreeterIntegrated dbus-test-runner
83 ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/IntegratedLightDM/liblightdm/
106 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/LightDM/IntegratedLightDM/sessionsmodel.cppnew file+96
@@ -0,0 +1,96 @@
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+#include "SessionsModel.h"
18+
19+#include <QLightDM/SessionsModel>
20+#include <QtCore/QModelIndex>
21+#include <QtTest>
22+#include <QString>
23+
24+class GreeterSessionsModelTest : public QObject
25+{
26+ Q_OBJECT
27+
28+private Q_SLOTS:
29+
30+ void init()
31+ {
32+ model = new SessionsModel();
33+ QVERIFY(model);
34+ sourceModel = new QLightDM::SessionsModel();
35+ QVERIFY(sourceModel);
36+ }
37+
38+ void cleanup()
39+ {
40+ delete model;
41+ delete sourceModel;
42+ }
43+
44+ static QModelIndex findByKey(QAbstractItemModel *model, const QString& key)
45+ {
46+ for (int i = 0; i < model->rowCount(QModelIndex()); i++) {
47+ if (model->data(model->index(i, 0), QLightDM::SessionsModel::KeyRole).toString() == key)
48+ return model->index(i, 0);
49+ }
50+
51+ return QModelIndex();
52+ }
53+
54+ void testIconDirectoriesAreValid()
55+ {
56+ Q_FOREACH(const QUrl& searchDirectory, model->iconSearchDirectories())
57+ {
58+ QVERIFY(searchDirectory.isValid());
59+ }
60+ }
61+
62+ void testMultipleSessionsCountIsCorrect()
63+ {
64+ sourceModel->setTestScenario("multipleSessions");
65+ QVERIFY(sourceModel->rowCount(QModelIndex()) > 1);
66+ }
67+
68+ void testNoSessionsCountIsCorrect()
69+ {
70+ sourceModel->setTestScenario("noSessions");
71+ QVERIFY(sourceModel->rowCount(QModelIndex()) == 0);
72+ }
73+
74+ void testSingleSessionCountIsCorrect()
75+ {
76+ sourceModel->setTestScenario("singleSession");
77+ QVERIFY(sourceModel->rowCount(QModelIndex()) == 1);
78+ }
79+
80+ void testSessionNameIsCorrect()
81+ {
82+ // This is testing the lookup, not the correctness of the strings,
83+ // so one test should be sufficient
84+ sourceModel->setTestScenario("multipleSessions");
85+ QVERIFY(model->data(findByKey(sourceModel, "ubuntu"),
86+ Qt::DisplayRole).toString() == "Ubuntu");
87+ }
88+
89+private:
90+ SessionsModel *model;
91+ QLightDM::SessionsModel *sourceModel;
92+};
93+
94+QTEST_MAIN(GreeterSessionsModelTest)
95+
96+#include "sessionsmodel.moc"
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
@@ -1187,16 +1187,13 @@ Rectangle {
1187
1187
1188 function test_greeterLoginsAutomaticallyWhenNoPasswordSet() {
1188 function test_greeterLoginsAutomaticallyWhenNoPasswordSet() {
1189 loadShell("phone");
1189 loadShell("phone");
1190− swipeAwayGreeter();
1191−
1192− sessionSpy.clear();
1193− verify(sessionSpy.valid);
1194−
1195− showGreeter();
1196
1190
1197 var greeter = findChild(shell, "greeter");
1191 var greeter = findChild(shell, "greeter");
1198 verify(!greeter.locked);
1192 verify(!greeter.locked);
1199− verify(sessionSpy.count > 0);
1193+ compare(sessionSpy.count, 0);
1194+
1195+ swipeAwayGreeter();
1196+ compare(sessionSpy.count, 1);
1200 }
1197 }
1201
1198
1202 function test_fullscreen() {
1199 function test_fullscreen() {
@@ -2224,11 +2221,6 @@ Rectangle {
2224 shell.usageScenario = "desktop";
2221 shell.usageScenario = "desktop";
2225 GSettingsController.setAutohideLauncher(!data.launcherLocked);
2222 GSettingsController.setAutohideLauncher(!data.launcherLocked);
2226 waitForRendering(shell);
2223 waitForRendering(shell);
2227− // Not sure why 2 but it's the number of times
2228− // it triggers at this time and we need to wait
2229− // for them otherwise a sessionStarted signal will
2230− // hide the launcher and make the test fail
2231− tryCompare(sessionSpy, "count", 2);
2232
2224
2233 var launcher = findChild(shell, "launcher");
2225 var launcher = findChild(shell, "launcher");
2234 var launcherPanel = findChild(launcher, "launcherPanel");
2226 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