on xenial help sign in
Refactor the greeter to enable dynamic loading of backend plugins.

Approved by: Michael Zanetti

commit2a1ddfe95a914883b3969e7e97fea1037fc84996 authorJosh Arenson <josh@blackbox> dateMon 31 Aug 2015, 10:25 (11 years ago) parent1a073a02332c2a
67 files changed+163−96
debian/unity8-private.install+1−1 plugins/CMakeLists.txt+1−1 plugins/LightDM/CMakeLists.txt → plugins/IntegratedLightDM/CMakeLists.txt+5−5 plugins/LightDM/DBusGreeter.cpp → plugins/IntegratedLightDM/DBusGreeter.cpp plugins/LightDM/DBusGreeter.h → plugins/IntegratedLightDM/DBusGreeter.h plugins/LightDM/DBusGreeterList.cpp → plugins/IntegratedLightDM/DBusGreeterList.cpp plugins/LightDM/DBusGreeterList.h → plugins/IntegratedLightDM/DBusGreeterList.h plugins/LightDM/Greeter.cpp → plugins/IntegratedLightDM/Greeter.cpp plugins/LightDM/Greeter.h → plugins/IntegratedLightDM/Greeter.h plugins/LightDM/GreeterPrivate.h → plugins/IntegratedLightDM/GreeterPrivate.h plugins/LightDM/LightDM.qmltypes → plugins/IntegratedLightDM/IntegratedLightDM.qmltypes plugins/LightDM/UsersModel.cpp → plugins/IntegratedLightDM/UsersModel.cpp plugins/LightDM/UsersModel.h → plugins/IntegratedLightDM/UsersModel.h plugins/LightDM/liblightdm/CMakeLists.txt → plugins/IntegratedLightDM/liblightdm/CMakeLists.txt plugins/LightDM/liblightdm/Greeter.cpp → plugins/IntegratedLightDM/liblightdm/Greeter.cpp plugins/LightDM/liblightdm/Greeter.h → plugins/IntegratedLightDM/liblightdm/Greeter.h plugins/LightDM/liblightdm/GreeterPrivate.cpp → plugins/IntegratedLightDM/liblightdm/GreeterPrivate.cpp plugins/LightDM/liblightdm/GreeterPrivate.h → plugins/IntegratedLightDM/liblightdm/GreeterPrivate.h plugins/LightDM/liblightdm/UsersModel.cpp → plugins/IntegratedLightDM/liblightdm/UsersModel.cpp plugins/LightDM/liblightdm/UsersModel.h → plugins/IntegratedLightDM/liblightdm/UsersModel.h plugins/LightDM/liblightdm/UsersModelPrivate.cpp → plugins/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp plugins/LightDM/liblightdm/UsersModelPrivate.h → plugins/IntegratedLightDM/liblightdm/UsersModelPrivate.h plugins/LightDM/plugin.cpp → plugins/IntegratedLightDM/plugin.cpp+3−5 plugins/LightDM/plugin.h → plugins/IntegratedLightDM/plugin.h+5−7 plugins/IntegratedLightDM/qmldir+3 plugins/LightDM/qmldir−3 qml/Components/Dialogs.qml+3−2 qml/Greeter/Greeter.qml+24−24 qml/Greeter/IntegratedLightDMImpl.qml+28 qml/Greeter/LightDM.qml+41 qml/Shell.qml+7−4 tests/mocks/CMakeLists.txt+1−1 tests/mocks/LightDM/CMakeLists.txt → tests/mocks/IntegratedLightDM/CMakeLists.txt+6−6 tests/mocks/LightDM/LightDM.qmltypes → tests/mocks/IntegratedLightDM/IntegratedLightDM.qmltypes+6−8 tests/mocks/LightDM/MockGreeter.cpp → tests/mocks/IntegratedLightDM/MockGreeter.cpp tests/mocks/LightDM/MockGreeter.h → tests/mocks/IntegratedLightDM/MockGreeter.h tests/mocks/LightDM/MockUsersModel.cpp → tests/mocks/IntegratedLightDM/MockUsersModel.cpp tests/mocks/LightDM/MockUsersModel.h → tests/mocks/IntegratedLightDM/MockUsersModel.h tests/mocks/LightDM/QLightDM/Greeter → tests/mocks/IntegratedLightDM/QLightDM/Greeter tests/mocks/LightDM/QLightDM/UsersModel → tests/mocks/IntegratedLightDM/QLightDM/UsersModel tests/mocks/LightDM/liblightdm/CMakeLists.txt → tests/mocks/IntegratedLightDM/liblightdm/CMakeLists.txt tests/mocks/LightDM/liblightdm/Greeter.cpp → tests/mocks/IntegratedLightDM/liblightdm/Greeter.cpp tests/mocks/LightDM/liblightdm/Greeter.h → tests/mocks/IntegratedLightDM/liblightdm/Greeter.h tests/mocks/LightDM/liblightdm/GreeterPrivate.cpp → tests/mocks/IntegratedLightDM/liblightdm/GreeterPrivate.cpp tests/mocks/LightDM/liblightdm/GreeterPrivate.h → tests/mocks/IntegratedLightDM/liblightdm/GreeterPrivate.h tests/mocks/LightDM/liblightdm/UsersModel.cpp → tests/mocks/IntegratedLightDM/liblightdm/UsersModel.cpp tests/mocks/LightDM/liblightdm/UsersModel.h → tests/mocks/IntegratedLightDM/liblightdm/UsersModel.h tests/mocks/LightDM/liblightdm/UsersModelPrivate.cpp → tests/mocks/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp tests/mocks/LightDM/liblightdm/UsersModelPrivate.h → tests/mocks/IntegratedLightDM/liblightdm/UsersModelPrivate.h tests/mocks/LightDM/plugin.cpp → tests/mocks/IntegratedLightDM/plugin.cpp+3−3 tests/mocks/LightDM/plugin.h → tests/mocks/IntegratedLightDM/plugin.h+2−2 tests/mocks/IntegratedLightDM/qmldir+3 tests/mocks/LightDM/qmldir−3 tests/plugins/CMakeLists.txt+1−1 tests/plugins/LightDM/CMakeLists.txt → tests/plugins/IntegratedLightDM/CMakeLists.txt+11−11 tests/plugins/LightDM/dbus.cpp → tests/plugins/IntegratedLightDM/dbus.cpp tests/plugins/LightDM/greeter.qml → tests/plugins/IntegratedLightDM/greeter.qml+1−1 tests/plugins/LightDM/pam.cpp → tests/plugins/IntegratedLightDM/pam.cpp tests/plugins/LightDM/usersmodel.cpp → tests/plugins/IntegratedLightDM/usersmodel.cpp tests/qmltests/Greeter/tst_Greeter.qml+1−1 tests/qmltests/Greeter/tst_Infographics.qml+1−1 tests/qmltests/Greeter/tst_NarrowView.qml+1−1 tests/qmltests/Greeter/tst_WideView.qml+1−1 tests/qmltests/Tutorial/tst_Tutorial.qml+1−1 tests/qmltests/tst_OrientedShell.qml+1−1 tests/qmltests/tst_Shell.qml+1−1 tests/qmltests/tst_ShellWithPin.qml+1−1
debian/unity8-private.install+1−1
@@ -3,7 +3,7 @@ usr/lib/*/unity8/libUbuntuGestures*
33usr/lib/*/unity8/qml/AccountsService
44usr/lib/*/unity8/qml/Dash
55usr/lib/*/unity8/qml/Greeter
6−usr/lib/*/unity8/qml/LightDM
6+usr/lib/*/unity8/qml/IntegratedLightDM
77usr/lib/*/unity8/qml/Lights
88usr/lib/*/unity8/qml/Powerd
99usr/lib/*/unity8/qml/ScreenGrabber
plugins/CMakeLists.txt+1−1
@@ -13,7 +13,7 @@ endmacro()
1313
1414add_subdirectory(AccountsService)
1515add_subdirectory(Greeter)
16−add_subdirectory(LightDM)
16+add_subdirectory(IntegratedLightDM)
1717add_subdirectory(Lights)
1818add_subdirectory(Dash)
1919add_subdirectory(Powerd)
plugins/LightDM/CMakeLists.txt → plugins/IntegratedLightDM/CMakeLists.txtrenamed+5−5
@@ -8,7 +8,7 @@ include_directories(
88 ${CMAKE_CURRENT_SOURCE_DIR}
99 ${CMAKE_CURRENT_BINARY_DIR}
1010 ${CMAKE_SOURCE_DIR}/plugins/Utils
11− ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM
11+ ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
1212 #${LIBLIGHTDM_INCLUDE_DIRS}
1313 ${libunity8-private_SOURCE_DIR}
1414 ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS}
@@ -23,11 +23,11 @@ set(QMLPLUGIN_SRC
2323 UsersModel.cpp
2424 )
2525
26−add_library(LightDM-qml MODULE
26+add_library(IntegratedLightDM-qml MODULE
2727 ${QMLPLUGIN_SRC}
2828 )
2929
30−target_link_libraries(LightDM-qml
30+target_link_libraries(IntegratedLightDM-qml
3131 integratedLightDM
3232 unity8-private
3333# TODO: Once we split out a separate greeter process, uncomment these lines
@@ -35,6 +35,6 @@ target_link_libraries(LightDM-qml
3535 ${LIBUSERMETRICSOUTPUT_LDFLAGS}
3636 )
3737
38−qt5_use_modules(LightDM-qml DBus Gui Qml)
38+qt5_use_modules(IntegratedLightDM-qml DBus Gui Qml)
3939
40−add_unity8_plugin(LightDM 0.1 LightDM TARGETS LightDM-qml)
40+add_unity8_plugin(IntegratedLightDM 0.1 IntegratedLightDM TARGETS IntegratedLightDM-qml)
plugins/LightDM/DBusGreeter.cpp → plugins/IntegratedLightDM/DBusGreeter.cpprenamed

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

plugins/LightDM/LightDM.qmltypes → plugins/IntegratedLightDM/IntegratedLightDM.qmltypesrenamed

The content is the same.

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

The content is the same.

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

The content is the same.

plugins/LightDM/liblightdm/CMakeLists.txt → plugins/IntegratedLightDM/liblightdm/CMakeLists.txtrenamed

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

plugins/LightDM/plugin.cpp → plugins/IntegratedLightDM/plugin.cpprenamed+3−5
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2012,2013 Canonical, Ltd.
2+ * Copyright (C) 2012,2013, 2015 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -13,8 +13,6 @@
1313 * You should have received a copy of the GNU General Public License
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 *
16− * Authors: Gerry Boland <gerry.boland@canonical.com>
17− * Michael Terry <michael.terry@canonical.com>
1816 */
1917
2018#include "plugin.h"
@@ -56,12 +54,12 @@ static QObject *infographic_provider(QQmlEngine *engine, QJSEngine *scriptEngine
5654 return UserMetricsOutput::UserMetrics::getInstance();
5755}
5856
59−void LightDMPlugin::registerTypes(const char *uri)
57+void IntegratedLightDMPlugin::registerTypes(const char *uri)
6058{
6159 qmlRegisterType<QAbstractItemModel>();
6260 qmlRegisterType<UserMetricsOutput::ColorTheme>();
6361
64− Q_ASSERT(uri == QLatin1String("LightDM"));
62+ Q_ASSERT(uri == QLatin1String("IntegratedLightDM"));
6563 qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
6664 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
6765 qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider);
plugins/LightDM/plugin.h → plugins/IntegratedLightDM/plugin.hrenamed+5−7
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2012,2013 Canonical, Ltd.
2+ * Copyright (C) 2012,2013, 2015 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -13,17 +13,15 @@
1313 * You should have received a copy of the GNU General Public License
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 *
16− * Authors: Gerry Boland <gerry.boland@canonical.com>
17− * Michael Terry <michael.terry@canonical.com>
1816 */
1917
20−#ifndef LIGHTDM_PLUGIN_H
21−#define LIGHTDM_PLUGIN_H
18+#ifndef INTEGRATED_LIGHTDM_PLUGIN_H
19+#define INTEGRATED_LIGHTDM_PLUGIN_H
2220
2321#include <QtQml/QQmlEngine>
2422#include <QtQml/QQmlExtensionPlugin>
2523
26−class LightDMPlugin : public QQmlExtensionPlugin
24+class IntegratedLightDMPlugin : public QQmlExtensionPlugin
2725{
2826 Q_OBJECT
2927 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
@@ -32,4 +30,4 @@ public:
3230 void registerTypes(const char *uri) override;
3331};
3432
35−#endif
33+#endif /* INTEGRATED_LIGHTDM_PLUGIN_H */
plugins/IntegratedLightDM/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module IntegratedLightDM
2+plugin IntegratedLightDM-qml
3+typeinfo IntegratedLightDM.qmltypes
plugins/LightDM/qmldirdeleted−3
@@ -1,3 +0,0 @@
1−module LightDM
2−plugin LightDM-qml
3−typeinfo LightDM.qmltypes
qml/Components/Dialogs.qml+3−2
@@ -19,7 +19,7 @@ import QtQuick 2.0
1919import Unity.Application 0.1
2020import Unity.Session 0.1
2121import Ubuntu.Components 1.1
22−import LightDM 0.1 as LightDM
22+import "../Greeter"
2323
2424Item {
2525 id: root
@@ -62,6 +62,7 @@ Item {
6262 active: false
6363 }
6464
65+ LightDM{id: lightDM} // Provide backend access
6566 Component {
6667 id: logoutDialogComponent
6768 ShellDialog {
@@ -71,7 +72,7 @@ Item {
7172 Button {
7273 text: i18n.ctr("Button: Lock the system", "Lock")
7374 onClicked: {
74− LightDM.Greeter.showGreeter()
75+ lightDM.greeter.showGreeter()
7576 logoutDialog.hide();
7677 }
7778 }
qml/Greeter/Greeter.qml+24−24
@@ -16,7 +16,6 @@
1616
1717import QtQuick 2.3
1818import AccountsService 0.1
19−import LightDM 0.1 as LightDM
2019import Ubuntu.Components 1.1
2120import Ubuntu.SystemImage 0.1
2221import Unity.Launcher 0.1
@@ -43,7 +42,7 @@ Showable {
4342 readonly property bool hasLockedApp: lockedApp !== ""
4443
4544 property bool forcedUnlock
46− readonly property bool locked: LightDM.Greeter.active && !LightDM.Greeter.authenticated && !forcedUnlock
45+ readonly property bool locked: lightDM.greeter.active && !lightDM.greeter.authenticated && !forcedUnlock
4746
4847 property bool tabletMode
4948 property url viewSource // only used for testing
@@ -106,10 +105,11 @@ Showable {
106105 return d.startUnlock(true /* toTheRight */);
107106 }
108107
108+ LightDM{id:lightDM} // Provide backend access
109109 QtObject {
110110 id: d
111111
112− readonly property bool multiUser: LightDM.Users.count > 1
112+ readonly property bool multiUser: lightDM.users.count > 1
113113 property int currentIndex
114114 property bool waiting
115115
@@ -133,15 +133,15 @@ Showable {
133133 loader.item.reset();
134134 }
135135 currentIndex = uid;
136− var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
136+ var user = lightDM.users.data(uid, lightDM.userRoles.NameRole);
137137 AccountsService.user = user;
138138 LauncherModel.setUser(user);
139− LightDM.Greeter.authenticate(user); // always resets auth state
139+ lightDM.greeter.authenticate(user); // always resets auth state
140140 }
141141
142142 function login() {
143143 enabled = false;
144− if (LightDM.Greeter.startSessionSync()) {
144+ if (lightDM.greeter.startSessionSync()) {
145145 sessionStarted();
146146 if (loader.item) {
147147 loader.item.notifyAuthenticationSucceeded();
@@ -228,7 +228,7 @@ Showable {
228228 root.lockedApp = "";
229229 root.forceActiveFocus();
230230 d.selectUser(d.currentIndex, true);
231− LightDM.Infographic.readyForDataChange();
231+ lightDM.infographic.readyForDataChange();
232232 }
233233
234234 Connections {
@@ -238,9 +238,9 @@ Showable {
238238 }
239239 onResponded: {
240240 if (root.locked) {
241− LightDM.Greeter.respond(response);
241+ lightDM.greeter.respond(response);
242242 } else {
243− if (LightDM.Greeter.active && !LightDM.Greeter.authenticated) { // could happen if forcedUnlock
243+ if (lightDM.greeter.active && !lightDM.greeter.authenticated) { // could happen if forcedUnlock
244244 d.login();
245245 }
246246 loader.item.hide();
@@ -306,18 +306,18 @@ Showable {
306306 Binding {
307307 target: loader.item
308308 property: "userModel"
309− value: LightDM.Users
309+ value: lightDM.users
310310 }
311311
312312 Binding {
313313 target: loader.item
314314 property: "infographicModel"
315− value: LightDM.Infographic
315+ value: lightDM.infographic
316316 }
317317 }
318318
319319 Connections {
320− target: LightDM.Greeter
320+ target: lightDM.greeter
321321
322322 onShowGreeter: root.forceShow()
323323
@@ -327,7 +327,7 @@ Showable {
327327 }
328328
329329 onShowMessage: {
330− if (!LightDM.Greeter.active) {
330+ if (!lightDM.greeter.active) {
331331 return; // could happen if hideGreeter() comes in before we prompt
332332 }
333333
@@ -346,7 +346,7 @@ Showable {
346346 onShowPrompt: {
347347 d.waiting = false;
348348
349− if (!LightDM.Greeter.active) {
349+ if (!lightDM.greeter.active) {
350350 return; // could happen if hideGreeter() comes in before we prompt
351351 }
352352
@@ -356,14 +356,14 @@ Showable {
356356 onAuthenticationComplete: {
357357 d.waiting = false;
358358
359− if (LightDM.Greeter.authenticated) {
359+ if (lightDM.greeter.authenticated) {
360360 AccountsService.failedLogins = 0;
361361 d.login();
362− if (!LightDM.Greeter.promptless) {
362+ if (!lightDM.greeter.promptless) {
363363 loader.item.hide();
364364 }
365365 } else {
366− if (!LightDM.Greeter.promptless) {
366+ if (!lightDM.greeter.promptless) {
367367 AccountsService.failedLogins++;
368368 }
369369
@@ -384,7 +384,7 @@ Showable {
384384 }
385385
386386 loader.item.notifyAuthenticationFailed();
387− if (!LightDM.Greeter.promptless) {
387+ if (!lightDM.greeter.promptless) {
388388 d.selectUser(d.currentIndex, false);
389389 }
390390 }
@@ -392,8 +392,8 @@ Showable {
392392
393393 onRequestAuthenticationUser: {
394394 // Find index for requested user, if it exists
395− for (var i = 0; i < LightDM.Users.count; i++) {
396− if (user === LightDM.Users.data(i, LightDM.UserRoles.NameRole)) {
395+ for (var i = 0; i < lightDM.users.count; i++) {
396+ if (user === lightDM.users.data(i, lightDM.userRoles.NameRole)) {
397397 d.selectUser(i, true);
398398 return;
399399 }
@@ -402,19 +402,19 @@ Showable {
402402 }
403403
404404 Binding {
405− target: LightDM.Greeter
405+ target: lightDM.greeter
406406 property: "active"
407407 value: root.active
408408 }
409409
410410 Binding {
411− target: LightDM.Infographic
411+ target: lightDM.infographic
412412 property: "username"
413− value: AccountsService.statsWelcomeScreen ? LightDM.Users.data(d.currentIndex, LightDM.UserRoles.NameRole) : ""
413+ value: AccountsService.statsWelcomeScreen ? lightDM.users.data(d.currentIndex, lightDM.userRoles.NameRole) : ""
414414 }
415415
416416 Connections {
417417 target: i18n
418− onLanguageChanged: LightDM.Infographic.readyForDataChange()
418+ onLanguageChanged: lightDM.infographic.readyForDataChange()
419419 }
420420}
qml/Greeter/IntegratedLightDMImpl.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.3
18+import IntegratedLightDM 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/LightDM.qmlnew file+41
@@ -0,0 +1,41 @@
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+ * Lightweight wrapper that allows for loading integrated/real LightDM
19+ * plugin
20+ */
21+
22+import QtQuick 2.3
23+
24+Loader {
25+ id: loader
26+
27+ property var greeter: d.valid ? loader.item.greeter : null
28+ property var infographic: d.valid ? loader.item.infographic : null
29+ property var users: d.valid ? loader.item.users : null
30+ property var userRoles: d.valid ? loader.item.userRoles : null
31+
32+ // TODO: Conditionally load RealLightDMImpl if shellMode dictates it
33+ source: "./IntegratedLightDMImpl.qml"
34+
35+ QtObject {
36+ id: d
37+
38+ property bool valid: loader.item !== null
39+ }
40+
41+}
qml/Shell.qml+7−4
@@ -26,7 +26,6 @@ import Ubuntu.Telephony 0.1 as Telephony
2626import Unity.Connectivity 0.1
2727import Unity.Launcher 0.1
2828import Utils 0.1
29−import LightDM 0.1 as LightDM
3029import Powerd 0.1
3130import SessionBroadcast 0.1
3231import "Greeter"
@@ -167,6 +166,7 @@ Item {
167166 finishStartUpTimer.start();
168167 }
169168
169+ LightDM{id: lightDM} // Provide backend access
170170 VolumeControl {
171171 id: volumeControl
172172 indicators: panel.indicators
@@ -503,7 +503,7 @@ Item {
503503
504504 greeter.notifyAboutToFocusApp("unity8-dash");
505505
506− var animate = !LightDM.Greeter.active && !stages.shown
506+ var animate = !lightDM.greeter.active && !stages.shown
507507 dash.setCurrentScope(0, animate, false)
508508 ApplicationManager.requestFocusApplication("unity8-dash")
509509 }
@@ -551,8 +551,11 @@ Item {
551551 greeterShown: greeter.shown
552552 }
553553
554− property bool mainAppIsFullscreen: shell.mainApp && shell.mainApp.fullscreen
555− fullscreenMode: (mainAppIsFullscreen && !LightDM.Greeter.active && launcher.progress == 0)
554+ property bool topmostApplicationIsFullscreen:
555+ ApplicationManager.focusedApplicationId &&
556+ ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
557+
558+ fullscreenMode: (topmostApplicationIsFullscreen && !lightDM.greeter.active && launcher.progress == 0)
556559 || greeter.hasLockedApp
557560 }
558561
tests/mocks/CMakeLists.txt+1−1
@@ -32,7 +32,7 @@ add_subdirectory(AccountsService)
3232add_subdirectory(GSettings.1.0)
3333add_subdirectory(indicator-service)
3434add_subdirectory(libusermetrics)
35−add_subdirectory(LightDM)
35+add_subdirectory(IntegratedLightDM)
3636add_subdirectory(Lights)
3737add_subdirectory(MeeGo)
3838add_subdirectory(Powerd)
tests/mocks/LightDM/CMakeLists.txt → tests/mocks/IntegratedLightDM/CMakeLists.txtrenamed+6−6
@@ -10,16 +10,16 @@ include_directories(
1010 ${CMAKE_CURRENT_SOURCE_DIR}
1111 ${CMAKE_CURRENT_BINARY_DIR}
1212 ${CMAKE_SOURCE_DIR}/plugins/Utils
13− ${CMAKE_SOURCE_DIR}/plugins/LightDM
13+ ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
1414 ${CMAKE_SOURCE_DIR}/tests/mocks/libusermetrics
1515 ${libunity8-private_SOURCE_DIR}
1616)
1717
1818set(QMLPLUGIN_SRC
19− ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeter.cpp
20− ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeterList.cpp
21− ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
22− ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
19+ ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/DBusGreeter.cpp
20+ ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/DBusGreeterList.cpp
21+ ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/Greeter.cpp
22+ ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/UsersModel.cpp
2323 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
2424 MockGreeter.cpp
2525 MockUsersModel.cpp
@@ -42,7 +42,7 @@ target_link_libraries(MockLightDM-qml
4242
4343qt5_use_modules(MockLightDM-qml DBus Gui Qml)
4444
45−add_unity8_mock(LightDM 0.1 LightDM
45+add_unity8_mock(IntegratedLightDM 0.1 IntegratedLightDM
4646 PREFIX mocks
4747 TARGETS MockLightDM-qml
4848 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/liblightdm"
tests/mocks/LightDM/LightDM.qmltypes → tests/mocks/IntegratedLightDM/IntegratedLightDM.qmltypesrenamed+6−8
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.1
44// It is used for QML tooling purposes only.
55//
66// This file was auto-generated by:
7−// 'qmlplugindump -notrelocatable LightDM 0.1 tests/mocks'
7+// 'qmlplugindump -notrelocatable IntegratedLightDM 0.1 tests/mocks'
88
99Module {
1010 Component {
@@ -61,7 +61,7 @@ Module {
6161 Component {
6262 name: "MockGreeter"
6363 prototype: "Greeter"
64− exports: ["LightDM/Greeter 0.1"]
64+ exports: ["IntegratedLightDM/Greeter 0.1"]
6565 isCreatable: false
6666 isSingleton: true
6767 exportMetaObjectRevisions: [0]
@@ -74,7 +74,7 @@ Module {
7474 Component {
7575 name: "MockUsersModel"
7676 prototype: "UsersModel"
77− exports: ["LightDM/Users 0.1"]
77+ exports: ["IntegratedLightDM/Users 0.1"]
7878 isCreatable: false
7979 isSingleton: true
8080 exportMetaObjectRevisions: [0]
@@ -92,7 +92,7 @@ Module {
9292 Component {
9393 name: "QLightDM::UsersModel"
9494 prototype: "QAbstractListModel"
95− exports: ["LightDM/UserRoles 0.1"]
95+ exports: ["IntegratedLightDM/UserRoles 0.1"]
9696 isCreatable: false
9797 exportMetaObjectRevisions: [0]
9898 Enum {
@@ -207,7 +207,7 @@ Module {
207207 Component {
208208 name: "UserMetricsOutput::UserMetrics"
209209 prototype: "QObject"
210− exports: ["LightDM/Infographic 0.1"]
210+ exports: ["IntegratedLightDM/Infographic 0.1"]
211211 isCreatable: false
212212 isSingleton: true
213213 exportMetaObjectRevisions: [0]
@@ -246,7 +246,7 @@ Module {
246246 }
247247 Signal {
248248 name: "currentDayChanged"
249− Parameter { name: "currentDay"; type: "int" }
249+ Parameter { name: "length"; type: "int" }
250250 }
251251 Signal {
252252 name: "secondColorChanged"
@@ -264,8 +264,6 @@ Module {
264264 Signal { name: "dataChanged" }
265265 Signal { name: "dataAboutToDisappear" }
266266 Signal { name: "dataDisappeared" }
267− Method { name: "nextDataSourceSlot" }
268− Method { name: "readyForDataChangeSlot" }
269267 }
270268 Component { name: "UsersModel"; prototype: "UnitySortFilterProxyModelQML" }
271269}
tests/mocks/LightDM/MockGreeter.cpp → tests/mocks/IntegratedLightDM/MockGreeter.cpprenamed

The content is the same.

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

The content is the same.

tests/mocks/LightDM/MockUsersModel.cpp → tests/mocks/IntegratedLightDM/MockUsersModel.cpprenamed

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

tests/mocks/LightDM/liblightdm/CMakeLists.txt → tests/mocks/IntegratedLightDM/liblightdm/CMakeLists.txtrenamed

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

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

The content is the same.

tests/mocks/LightDM/plugin.cpp → tests/mocks/IntegratedLightDM/plugin.cpprenamed+3−3
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014, 2015 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -53,12 +53,12 @@ static QObject *infographic_provider(QQmlEngine *engine, QJSEngine *scriptEngine
5353 return UserMetricsOutput::UserMetrics::getInstance();
5454}
5555
56−void LightDMPlugin::registerTypes(const char *uri)
56+void IntegratedLightDMPlugin::registerTypes(const char *uri)
5757{
5858 qmlRegisterType<QAbstractItemModel>();
5959 qmlRegisterType<UserMetricsOutput::ColorTheme>();
6060
61− Q_ASSERT(uri == QLatin1String("LightDM"));
61+ Q_ASSERT(uri == QLatin1String("IntegratedLightDM"));
6262 qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
6363 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
6464 qmlRegisterSingletonType<MockGreeter>(uri, 0, 1, "Greeter", greeter_provider);
tests/mocks/LightDM/plugin.h → tests/mocks/IntegratedLightDM/plugin.hrenamed+2−2
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014, 2015 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
2020#include <QtQml/QQmlEngine>
2121#include <QtQml/QQmlExtensionPlugin>
2222
23−class LightDMPlugin : public QQmlExtensionPlugin
23+class IntegratedLightDMPlugin : public QQmlExtensionPlugin
2424{
2525 Q_OBJECT
2626 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
tests/mocks/IntegratedLightDM/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module IntegratedLightDM
2+plugin MockLightDM-qml
3+typeinfo IntegratedLightDM.qmltypes
tests/mocks/LightDM/qmldirdeleted−3
@@ -1,3 +0,0 @@
1−module LightDM
2−plugin MockLightDM-qml
3−typeinfo LightDM.qmltypes
tests/plugins/CMakeLists.txt+1−1
@@ -1,6 +1,6 @@
11add_subdirectory(AccountsService)
22add_subdirectory(Greeter)
3−add_subdirectory(LightDM)
3+add_subdirectory(IntegratedLightDM)
44add_subdirectory(Dash)
55add_subdirectory(ScreenGrabber)
66add_subdirectory(Ubuntu)
tests/plugins/LightDM/CMakeLists.txt → tests/plugins/IntegratedLightDM/CMakeLists.txtrenamed+11−11
@@ -7,19 +7,19 @@ include_directories(
77
88add_executable(GreeterDBusTestExec
99 dbus.cpp
10− ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
10+ ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/Greeter.cpp
1111 )
1212# This add_dependencies is needed since we're linking with with -L and -l below
1313# make seems to work but ninja breaks without it
1414add_dependencies(GreeterDBusTestExec MockLightDM)
1515qt5_use_modules(GreeterDBusTestExec Core DBus Quick Test)
1616target_link_libraries(GreeterDBusTestExec
17− -L${CMAKE_BINARY_DIR}/tests/mocks/LightDM/liblightdm
17+ -L${CMAKE_BINARY_DIR}/tests/mocks/IntegratedLightDM/liblightdm
1818 -llightdm-qt5-2
1919 )
2020target_include_directories(GreeterDBusTestExec PUBLIC
21− ${CMAKE_SOURCE_DIR}/plugins/LightDM
22− ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM
21+ ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
22+ ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
2323 )
2424add_unity8_uitest(GreeterDBus dbus-test-runner
2525 ARG_PREFIX "--parameter"
@@ -31,20 +31,20 @@ add_unity8_uitest(GreeterDBus dbus-test-runner
3131
3232add_executable(GreeterPamTestExec
3333 pam.cpp
34− ${CMAKE_SOURCE_DIR}/plugins/LightDM/liblightdm/GreeterPrivate.cpp
34+ ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm/GreeterPrivate.cpp
3535 )
3636qt5_use_modules(GreeterPamTestExec Concurrent Core Test)
3737target_link_libraries(GreeterPamTestExec
3838 integratedLightDM
3939 )
4040target_include_directories(GreeterPamTestExec PUBLIC
41− ${CMAKE_SOURCE_DIR}/plugins/LightDM/liblightdm
41+ ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm
4242 )
4343add_qmltest_target(testGreeterPam GreeterPamTestExec COMMAND $<TARGET_FILE:GreeterPamTestExec>)
4444
4545add_executable(GreeterUsersModelTestExec
4646 usersmodel.cpp
47− ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
47+ ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/UsersModel.cpp
4848 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
4949 )
5050# This add_dependencies is needed since we're linking with with -L and -l below
@@ -52,16 +52,16 @@ add_executable(GreeterUsersModelTestExec
5252add_dependencies(GreeterUsersModelTestExec MockLightDM)
5353qt5_use_modules(GreeterUsersModelTestExec Core Test)
5454target_link_libraries(GreeterUsersModelTestExec
55− -L${CMAKE_BINARY_DIR}/tests/mocks/LightDM/liblightdm
55+ -L${CMAKE_BINARY_DIR}/tests/mocks/IntegratedLightDM/liblightdm
5656 -llightdm-qt5-2
5757 )
5858target_include_directories(GreeterUsersModelTestExec PUBLIC
59− ${CMAKE_SOURCE_DIR}/plugins/LightDM
59+ ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
6060 ${CMAKE_SOURCE_DIR}/plugins/Utils
61− ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM
61+ ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
6262 )
6363add_unity8_uitest(GreeterUsers GreeterUsersModelTestExec
6464 ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
6565 DEPENDS MockLightDM
6666 LIGHTDM
67− )
67+ )
tests/plugins/LightDM/dbus.cpp → tests/plugins/IntegratedLightDM/dbus.cpprenamed

The content is the same.

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

The content is the same.

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

The content is the same.

tests/qmltests/Greeter/tst_Greeter.qml+1−1
@@ -20,7 +20,7 @@ import ".."
2020import "../../../qml/Greeter"
2121import Ubuntu.Components 0.1
2222import AccountsService 0.1
23−import LightDM 0.1 as LightDM
23+import IntegratedLightDM 0.1 as LightDM
2424import Unity.Test 0.1 as UT
2525
2626Item {
tests/qmltests/Greeter/tst_Infographics.qml+1−1
@@ -20,7 +20,7 @@ import ".."
2020import "../../../qml/Greeter"
2121import Ubuntu.Components 0.1
2222import Unity.Test 0.1 as UT
23−import LightDM 0.1 as LightDM
23+import IntegratedLightDM 0.1 as LightDM
2424
2525Item {
2626 Binding {
tests/qmltests/Greeter/tst_NarrowView.qml+1−1
@@ -18,7 +18,7 @@ import QtQuick 2.0
1818import QtTest 1.0
1919import ".."
2020import "../../../qml/Greeter"
21−import LightDM 0.1 as LightDM
21+import IntegratedLightDM 0.1 as LightDM
2222import Ubuntu.Components 0.1
2323import Unity.Test 0.1 as UT
2424
tests/qmltests/Greeter/tst_WideView.qml+1−1
@@ -18,7 +18,7 @@ import QtQuick 2.0
1818import QtTest 1.0
1919import ".."
2020import "../../../qml/Greeter"
21−import LightDM 0.1 as LightDM
21+import IntegratedLightDM 0.1 as LightDM
2222import Ubuntu.Components 0.1
2323import Unity.Test 0.1 as UT
2424
tests/qmltests/Tutorial/tst_Tutorial.qml+1−1
@@ -17,7 +17,7 @@
1717import QtQuick 2.0
1818import QtTest 1.0
1919import AccountsService 0.1
20−import LightDM 0.1 as LightDM
20+import IntegratedLightDM 0.1 as LightDM
2121import Ubuntu.Components 1.1
2222import Unity.Application 0.1
2323import Unity.Test 0.1 as UT
tests/qmltests/tst_OrientedShell.qml+1−1
@@ -21,7 +21,7 @@ import Ubuntu.Components 1.1
2121import Ubuntu.Components.ListItems 1.0 as ListItem
2222import Unity.Application 0.1
2323import Unity.Test 0.1
24−import LightDM 0.1 as LightDM
24+import IntegratedLightDM 0.1 as LightDM
2525import Powerd 0.1
2626import Unity.InputInfo 0.1
2727
tests/qmltests/tst_Shell.qml+1−1
@@ -18,7 +18,7 @@ import QtQuick 2.0
1818import QtTest 1.0
1919import AccountsService 0.1
2020import GSettings 1.0
21−import LightDM 0.1 as LightDM
21+import IntegratedLightDM 0.1 as LightDM
2222import Ubuntu.Components 1.1
2323import Ubuntu.Components.ListItems 1.0 as ListItem
2424import Ubuntu.Telephony 0.1 as Telephony
tests/qmltests/tst_ShellWithPin.qml+1−1
@@ -19,7 +19,7 @@ import Ubuntu.Components 1.0
1919import QtTest 1.0
2020import AccountsService 0.1
2121import GSettings 1.0
22−import LightDM 0.1 as LightDM
22+import IntegratedLightDM 0.1 as LightDM
2323import Ubuntu.SystemImage 0.1
2424import Ubuntu.Telephony 0.1 as Telephony
2525import Unity.Application 0.1