on xenial help sign in
remove integrated lightdm
commit3616f22d43c0d91b4a479c8bdf0acdce68130735 authorJosh Arenson <joshua.arenson@canonical.com> dateThu 10 Sep 2015, 15:52 (11 years ago) parent03d506c
28 files changed−2332
plugins/LightDM/CMakeLists.txt−27 plugins/LightDM/DBusGreeter.cpp−50 plugins/LightDM/DBusGreeter.h−52 plugins/LightDM/DBusGreeterList.cpp−56 plugins/LightDM/DBusGreeterList.h−57 plugins/LightDM/FullLightDM/CMakeLists.txt−28 plugins/LightDM/FullLightDM/FullLightDM.qmltypes−286 plugins/LightDM/FullLightDM/qmldir−3 plugins/LightDM/Greeter.cpp−139 plugins/LightDM/Greeter.h−82 plugins/LightDM/GreeterPrivate.h−39 plugins/LightDM/IntegratedLightDM/CMakeLists.txt−34 plugins/LightDM/IntegratedLightDM/IntegratedLightDM.qmltypes−271 plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt−37 plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp−184 plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.h−110 plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp−305 plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h−51 plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp−123 plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.h−66 plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp−41 plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h−59 plugins/LightDM/IntegratedLightDM/qmldir−3 plugins/LightDM/UsersModel.cpp−70 plugins/LightDM/UsersModel.h−37 plugins/LightDM/plugin.cpp−77 plugins/LightDM/plugin.h−42 plugins/LightDM/qmldir.in−3
plugins/LightDM/CMakeLists.txtdeleted−27
@@ -1,27 +0,0 @@
1−pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1)
2−
3−find_package(Qt5Core REQUIRED)
4−find_package(Qt5Quick REQUIRED)
5−
6−include_directories(
7− ${CMAKE_CURRENT_SOURCE_DIR}
8− ${CMAKE_CURRENT_BINARY_DIR}
9− ${CMAKE_SOURCE_DIR}/plugins/Utils
10− ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM
11− ${CMAKE_BINARY_DIR}/tests/mocks/LightDM
12− ${LIBLIGHTDM_INCLUDE_DIRS}
13− ${libunity8-private_SOURCE_DIR}
14− ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS}
15−)
16−
17−set(QMLPLUGIN_SRC
18− ../Utils/unitysortfilterproxymodelqml.cpp
19− DBusGreeter.cpp
20− DBusGreeterList.cpp
21− Greeter.cpp
22− plugin.cpp
23− UsersModel.cpp
24− )
25−
26−add_subdirectory(FullLightDM)
27−add_subdirectory(IntegratedLightDM)
plugins/LightDM/DBusGreeter.cppdeleted−50
@@ -1,50 +0,0 @@
1−/*
2− * Copyright (C) 2014, 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 "DBusGreeter.h"
18−#include "Greeter.h"
19−
20−#include <QDBusMessage>
21−#include <QStringList>
22−
23−DBusGreeter::DBusGreeter(Greeter *greeter, const QString &path)
24− : UnityDBusObject(path, "com.canonical.UnityGreeter", true, greeter),
25− m_greeter(greeter)
26−{
27− connect(m_greeter, &Greeter::isActiveChanged,
28− this, &DBusGreeter::isActiveChangedHandler);
29−}
30−
31−bool DBusGreeter::isActive() const
32−{
33− return m_greeter->isActive();
34−}
35−
36−void DBusGreeter::ShowGreeter()
37−{
38− Q_EMIT m_greeter->showGreeter();
39−}
40−
41−void DBusGreeter::HideGreeter()
42−{
43− Q_EMIT m_greeter->hideGreeter();
44−}
45−
46−void DBusGreeter::isActiveChangedHandler()
47−{
48− notifyPropertyChanged("IsActive", isActive());
49− Q_EMIT isActiveChanged();
50−}
plugins/LightDM/DBusGreeter.hdeleted−52
@@ -1,52 +0,0 @@
1−/*
2− * Copyright (C) 2014 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−#ifndef UNITY_DBUSGREETER_H
18−#define UNITY_DBUSGREETER_H
19−
20−#include "unitydbusobject.h"
21−#include <QDBusConnection>
22−
23−class Greeter;
24−
25−/** This is an internal class used to talk with the indicators.
26− */
27−
28−class DBusGreeter : public UnityDBusObject
29−{
30− Q_OBJECT
31− Q_CLASSINFO("D-Bus Interface", "com.canonical.UnityGreeter")
32−
33− Q_PROPERTY(bool IsActive READ isActive NOTIFY isActiveChanged) // since 14.10
34−
35−public:
36− explicit DBusGreeter(Greeter *greeter, const QString &path);
37−
38− bool isActive() const;
39− Q_SCRIPTABLE void ShowGreeter(); // temporary, until we split the greeter again
40− Q_SCRIPTABLE void HideGreeter(); // temporary, until we split the greeter again
41−
42−Q_SIGNALS:
43− void isActiveChanged();
44−
45−private Q_SLOTS:
46− void isActiveChangedHandler();
47−
48−private:
49− Greeter *m_greeter;
50−};
51−
52−#endif
plugins/LightDM/DBusGreeterList.cppdeleted−56
@@ -1,56 +0,0 @@
1−/*
2− * Copyright (C) 2013 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 "DBusGreeterList.h"
18−#include "Greeter.h"
19−
20−#include <QDBusMessage>
21−#include <QStringList>
22−
23−DBusGreeterList::DBusGreeterList(Greeter *greeter, const QString &path)
24− : UnityDBusObject(path, "com.canonical.UnityGreeter", true, greeter),
25− m_greeter(greeter)
26−{
27− connect(m_greeter, &Greeter::authenticationUserChanged, this, &DBusGreeterList::authenticationUserChangedHandler);
28− connect(m_greeter, &Greeter::promptlessChanged, this, &DBusGreeterList::promptlessChangedHandler);
29−}
30−
31−QString DBusGreeterList::GetActiveEntry() const
32−{
33− return m_greeter->authenticationUser();
34−}
35−
36−void DBusGreeterList::SetActiveEntry(const QString &entry)
37−{
38− Q_EMIT m_greeter->requestAuthenticationUser(entry);
39−}
40−
41−bool DBusGreeterList::entryIsLocked() const
42−{
43− return !m_greeter->promptless();
44−}
45−
46−void DBusGreeterList::authenticationUserChangedHandler(const QString &user)
47−{
48− notifyPropertyChanged("ActiveEntry", user);
49− Q_EMIT EntrySelected(user);
50−}
51−
52−void DBusGreeterList::promptlessChangedHandler()
53−{
54− notifyPropertyChanged("EntryIsLocked", entryIsLocked());
55− Q_EMIT entryIsLockedChanged();
56−}
plugins/LightDM/DBusGreeterList.hdeleted−57
@@ -1,57 +0,0 @@
1−/*
2− * Copyright (C) 2013 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−#ifndef UNITY_DBUSGREETERLIST_H
18−#define UNITY_DBUSGREETERLIST_H
19−
20−#include "unitydbusobject.h"
21−#include <QDBusConnection>
22−
23−class Greeter;
24−
25−/** This is an internal class used to talk with the indicators.
26− */
27−
28−class DBusGreeterList : public UnityDBusObject
29−{
30− Q_OBJECT
31− Q_CLASSINFO("D-Bus Interface", "com.canonical.UnityGreeter.List")
32−
33− Q_PROPERTY(QString ActiveEntry READ GetActiveEntry WRITE SetActiveEntry NOTIFY EntrySelected) // since 14.04
34− Q_PROPERTY(bool EntryIsLocked READ entryIsLocked NOTIFY entryIsLockedChanged) // since 14.04
35−
36−public:
37− explicit DBusGreeterList(Greeter *greeter, const QString &path);
38−
39− Q_SCRIPTABLE void SetActiveEntry(const QString &entry); // since 13.04
40− Q_SCRIPTABLE QString GetActiveEntry() const; // since 13.10
41−
42− bool entryIsLocked() const;
43−
44−Q_SIGNALS:
45− Q_SCRIPTABLE void EntrySelected(const QString &entry); // since 13.10
46−
47− void entryIsLockedChanged();
48−
49−private Q_SLOTS:
50− void authenticationUserChangedHandler(const QString &user);
51− void promptlessChangedHandler();
52−
53−private:
54− Greeter *m_greeter;
55−};
56−
57−#endif
plugins/LightDM/FullLightDM/CMakeLists.txtdeleted−28
@@ -1,28 +0,0 @@
1−pkg_check_modules(LIBLIGHTDM REQUIRED liblightdm-qt5-3)
2−
3−set(PLUGIN_CLASSNAME "FullLightDM")
4−
5−# Written to source dir as thats where add_unity8_plugin expects it
6−configure_file(../qmldir.in ${CMAKE_CURRENT_SOURCE_DIR}/qmldir)
7−
8−add_definitions(-DFULL_LIGHTDM)
9−
10−include_directories(../)
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− lightdm-qt5-3
23− ${LIBLIGHTDM_LDFLAGS}
24− ${LIBUSERMETRICSOUTPUT_LDFLAGS}
25− )
26−
27−qt5_use_modules(FullLightDM-qml DBus Gui Qml)
28−add_unity8_plugin(FullLightDM 0.1 LightDM/FullLightDM TARGETS FullLightDM-qml)
plugins/LightDM/FullLightDM/FullLightDM.qmltypesdeleted−286
@@ -1,286 +0,0 @@
1−import QtQuick.tooling 1.1
2−
3−// This file describes the plugin-supplied types contained in the library.
4−// It is used for QML tooling purposes only.
5−//
6−// This file was auto-generated by:
7−// 'qmlplugindump -notrelocatable FullLightDM 0.1 plugins'
8−
9−Module {
10− Component {
11− name: "QAbstractProxyModel"
12− prototype: "QAbstractItemModel"
13− Property { name: "sourceModel"; type: "QAbstractItemModel"; isPointer: true }
14− }
15− Component {
16− name: "QLightDM::Greeter"
17− prototype: "QObject"
18− exports: ["FullLightDM/Greeter 0.1"]
19− isCreatable: false
20− isSingleton: true
21− exportMetaObjectRevisions: [0]
22− Enum {
23− name: "PromptType"
24− values: {
25− "PromptTypeQuestion": 0,
26− "PromptTypeSecret": 1
27− }
28− }
29− Enum {
30− name: "MessageType"
31− values: {
32− "MessageTypeInfo": 0,
33− "MessageTypeError": 1
34− }
35− }
36− Property { name: "authenticated"; type: "bool"; isReadonly: true }
37− Property { name: "authenticationUser"; type: "string"; isReadonly: true }
38− Property { name: "defaultSession"; type: "string"; isReadonly: true }
39− Property { name: "selectUser"; type: "string"; isReadonly: true }
40− Property { name: "selectGuest"; type: "bool"; isReadonly: true }
41− Property { name: "hostname"; type: "string"; isReadonly: true }
42− Property { name: "hasGuestAccount"; type: "bool"; isReadonly: true }
43− Property { name: "locked"; type: "bool"; isReadonly: true }
44− Property { name: "hostname"; type: "string"; isReadonly: true }
45− Signal {
46− name: "showMessage"
47− Parameter { name: "text"; type: "string" }
48− Parameter { name: "type"; type: "QLightDM::Greeter::MessageType" }
49− }
50− Signal {
51− name: "showPrompt"
52− Parameter { name: "text"; type: "string" }
53− Parameter { name: "type"; type: "QLightDM::Greeter::PromptType" }
54− }
55− Signal { name: "authenticationComplete" }
56− Signal { name: "autologinTimerExpired" }
57− Signal { name: "idle" }
58− Signal { name: "reset" }
59− Method { name: "connectToDaemonSync"; type: "bool" }
60− Method { name: "connectSync"; type: "bool" }
61− Method {
62− name: "authenticate"
63− Parameter { name: "username"; type: "string" }
64− }
65− Method { name: "authenticate" }
66− Method { name: "authenticateAsGuest" }
67− Method { name: "authenticateAutologin" }
68− Method {
69− name: "authenticateRemote"
70− Parameter { name: "session"; type: "string" }
71− Parameter { name: "username"; type: "string" }
72− }
73− Method {
74− name: "authenticateRemote"
75− Parameter { name: "session"; type: "string" }
76− }
77− Method { name: "authenticateRemote" }
78− Method {
79− name: "respond"
80− Parameter { name: "response"; type: "string" }
81− }
82− Method { name: "cancelAuthentication" }
83− Method { name: "cancelAutologin" }
84− Method {
85− name: "setLanguage"
86− Parameter { name: "language"; type: "string" }
87− }
88− Method {
89− name: "setResettable"
90− Parameter { name: "resettable"; type: "bool" }
91− }
92− Method {
93− name: "startSessionSync"
94− type: "bool"
95− Parameter { name: "session"; type: "string" }
96− }
97− Method { name: "startSessionSync"; type: "bool" }
98− Method {
99− name: "ensureSharedDataDirSync"
100− type: "string"
101− Parameter { name: "username"; type: "string" }
102− }
103− }
104− Component {
105− name: "QLightDM::UsersModel"
106− prototype: "QAbstractListModel"
107− exports: ["FullLightDM/UserRoles 0.1"]
108− isCreatable: false
109− exportMetaObjectRevisions: [0]
110− Enum {
111− name: "UserModelRoles"
112− values: {
113− "NameRole": 256,
114− "RealNameRole": 257,
115− "LoggedInRole": 258,
116− "BackgroundRole": 259,
117− "SessionRole": 260,
118− "HasMessagesRole": 261,
119− "ImagePathRole": 262,
120− "BackgroundPathRole": 263,
121− "UidRole": 264
122− }
123− }
124− }
125− Component {
126− name: "QSortFilterProxyModel"
127− prototype: "QAbstractProxyModel"
128− Property { name: "filterRegExp"; type: "QRegExp" }
129− Property { name: "filterKeyColumn"; type: "int" }
130− Property { name: "dynamicSortFilter"; type: "bool" }
131− Property { name: "filterCaseSensitivity"; type: "Qt::CaseSensitivity" }
132− Property { name: "sortCaseSensitivity"; type: "Qt::CaseSensitivity" }
133− Property { name: "isSortLocaleAware"; type: "bool" }
134− Property { name: "sortRole"; type: "int" }
135− Property { name: "filterRole"; type: "int" }
136− Method {
137− name: "setFilterRegExp"
138− Parameter { name: "pattern"; type: "string" }
139− }
140− Method {
141− name: "setFilterWildcard"
142− Parameter { name: "pattern"; type: "string" }
143− }
144− Method {
145− name: "setFilterFixedString"
146− Parameter { name: "pattern"; type: "string" }
147− }
148− Method { name: "clear" }
149− Method { name: "invalidate" }
150− }
151− Component {
152− name: "UnitySortFilterProxyModelQML"
153− prototype: "QSortFilterProxyModel"
154− Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
155− Property { name: "totalCount"; type: "int"; isReadonly: true }
156− Property { name: "count"; type: "int"; isReadonly: true }
157− Property { name: "invertMatch"; type: "bool" }
158− Signal {
159− name: "invertMatchChanged"
160− Parameter { type: "bool" }
161− }
162− Method {
163− name: "get"
164− type: "QVariantMap"
165− Parameter { name: "row"; type: "int" }
166− }
167− Method {
168− name: "data"
169− type: "QVariant"
170− Parameter { name: "row"; type: "int" }
171− Parameter { name: "role"; type: "int" }
172− }
173− Method { name: "count"; type: "int" }
174− Method {
175− name: "findFirst"
176− type: "int"
177− Parameter { name: "role"; type: "int" }
178− Parameter { name: "value"; type: "QVariant" }
179− }
180− Method {
181− name: "mapRowToSource"
182− type: "int"
183− Parameter { name: "row"; type: "int" }
184− }
185− Method {
186− name: "mapFromSource"
187− type: "int"
188− Parameter { name: "row"; type: "int" }
189− }
190− Method {
191− name: "mapToSource"
192− type: "int"
193− Parameter { name: "row"; type: "int" }
194− }
195− }
196− Component {
197− name: "UserMetricsOutput::ColorTheme"
198− prototype: "QObject"
199− Property { name: "start"; type: "QColor"; isReadonly: true }
200− Property { name: "main"; type: "QColor"; isReadonly: true }
201− Property { name: "end"; type: "QColor"; isReadonly: true }
202− Signal {
203− name: "startChanged"
204− Parameter { name: "color"; type: "QColor" }
205− }
206− Signal {
207− name: "mainChanged"
208− Parameter { name: "color"; type: "QColor" }
209− }
210− Signal {
211− name: "endChanged"
212− Parameter { name: "color"; type: "QColor" }
213− }
214− }
215− Component {
216− name: "UserMetricsOutput::UserMetrics"
217− prototype: "QObject"
218− exports: ["FullLightDM/Infographic 0.1"]
219− isCreatable: false
220− isSingleton: true
221− exportMetaObjectRevisions: [0]
222− Property { name: "label"; type: "string"; isReadonly: true }
223− Property { name: "username"; type: "string" }
224− Property {
225− name: "firstColor"
226− type: "UserMetricsOutput::ColorTheme"
227− isReadonly: true
228− isPointer: true
229− }
230− Property {
231− name: "secondColor"
232− type: "UserMetricsOutput::ColorTheme"
233− isReadonly: true
234− isPointer: true
235− }
236− Property { name: "firstMonth"; type: "QAbstractItemModel"; isReadonly: true; isPointer: true }
237− Property { name: "secondMonth"; type: "QAbstractItemModel"; isReadonly: true; isPointer: true }
238− Property { name: "currentDay"; type: "int"; isReadonly: true }
239− Signal {
240− name: "labelChanged"
241− Parameter { name: "label"; type: "string" }
242− }
243− Signal {
244− name: "usernameChanged"
245− Parameter { name: "username"; type: "string" }
246− }
247− Signal {
248− name: "firstColorChanged"
249− Parameter { name: "color"; type: "ColorTheme"; isPointer: true }
250− }
251− Signal {
252− name: "firstMonthChanged"
253− Parameter { name: "firstMonth"; type: "QAbstractItemModel"; isPointer: true }
254− }
255− Signal {
256− name: "currentDayChanged"
257− Parameter { name: "currentDay"; type: "int" }
258− }
259− Signal {
260− name: "secondColorChanged"
261− Parameter { name: "color"; type: "ColorTheme"; isPointer: true }
262− }
263− Signal {
264− name: "secondMonthChanged"
265− Parameter { name: "secondMonth"; type: "QAbstractItemModel"; isPointer: true }
266− }
267− Signal { name: "nextDataSource" }
268− Signal { name: "readyForDataChange" }
269− Signal { name: "dataAboutToAppear" }
270− Signal { name: "dataAppeared" }
271− Signal { name: "dataAboutToChange" }
272− Signal { name: "dataChanged" }
273− Signal { name: "dataAboutToDisappear" }
274− Signal { name: "dataDisappeared" }
275− Method { name: "nextDataSourceSlot" }
276− Method { name: "readyForDataChangeSlot" }
277− }
278− Component {
279− name: "UsersModel"
280− prototype: "UnitySortFilterProxyModelQML"
281− exports: ["FullLightDM/Users 0.1"]
282− isCreatable: false
283− isSingleton: true
284− exportMetaObjectRevisions: [0]
285− }
286−}
plugins/LightDM/FullLightDM/qmldirdeleted−3
@@ -1,3 +0,0 @@
1−module LightDM.FullLightDM
2−plugin FullLightDM-qml
3−typeinfo FullLightDM.qmltypes
plugins/LightDM/Greeter.cppdeleted−139
@@ -1,139 +0,0 @@
1−/*
2− * Copyright (C) 2013 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− * Author: Michael Terry <michael.terry@canonical.com>
17− */
18−
19−#include "Greeter.h"
20−#include "GreeterPrivate.h"
21−#include <libintl.h>
22−#include <QDebug>
23−
24−GreeterPrivate::GreeterPrivate(Greeter* parent)
25− : m_greeter(new QLightDM::Greeter(parent)),
26− m_active(false),
27− wasPrompted(false),
28− promptless(false),
29− q_ptr(parent)
30−{
31−}
32−
33−Greeter::Greeter(QObject* parent)
34− : QObject(parent),
35− d_ptr(new GreeterPrivate(this))
36−{
37− Q_D(Greeter);
38−
39− connect(d->m_greeter, &QLightDM::Greeter::showMessage,
40− this, &Greeter::showMessageFilter);
41− connect(d->m_greeter, &QLightDM::Greeter::showPrompt,
42− this, &Greeter::showPromptFilter);
43− connect(d->m_greeter, &QLightDM::Greeter::authenticationComplete,
44− this, &Greeter::authenticationCompleteFilter);
45−
46− d->m_greeter->connectSync();
47−}
48−
49−bool Greeter::isActive() const
50−{
51− Q_D(const Greeter);
52− return d->m_active;
53−}
54−
55−void Greeter::setIsActive(bool active)
56−{
57− Q_D(Greeter);
58− if (d->m_active != active) {
59− d->m_active = active;
60− Q_EMIT isActiveChanged();
61− }
62−}
63−
64−bool Greeter::isAuthenticated() const
65−{
66− Q_D(const Greeter);
67− return d->m_greeter->isAuthenticated();
68−}
69−
70−QString Greeter::authenticationUser() const
71−{
72− Q_D(const Greeter);
73− return d->m_greeter->authenticationUser();
74−}
75−
76−bool Greeter::promptless() const
77−{
78− Q_D(const Greeter);
79− return d->promptless;
80−}
81−
82−void Greeter::authenticate(const QString &username)
83−{
84− Q_D(Greeter);
85− d->wasPrompted = false;
86− if (d->promptless) {
87− d->promptless = false;
88− Q_EMIT promptlessChanged();
89− }
90−
91− d->m_greeter->authenticate(username);
92− Q_EMIT isAuthenticatedChanged();
93− Q_EMIT authenticationUserChanged(username);
94−}
95−
96−void Greeter::respond(const QString &response)
97−{
98− Q_D(Greeter);
99− d->m_greeter->respond(response);
100−}
101−
102−bool Greeter::startSessionSync(const QString &session)
103−{
104− Q_D(Greeter);
105− return d->m_greeter->startSessionSync(session);
106−}
107−
108−void Greeter::showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type)
109−{
110− Q_D(Greeter);
111− d->wasPrompted = true;
112−
113− bool isDefaultPrompt = (text == dgettext("Linux-PAM", "Password: "));
114−
115− // Strip prompt of any colons at the end
116− QString trimmedText = text.trimmed();
117− if (trimmedText.endsWith(":") || trimmedText.endsWith(":")) {
118− trimmedText.chop(1);
119− }
120−
121− Q_EMIT showPrompt(trimmedText, type == QLightDM::Greeter::PromptTypeSecret, isDefaultPrompt);
122−}
123−
124−void Greeter::showMessageFilter(const QString &text, QLightDM::Greeter::MessageType type)
125−{
126− Q_EMIT showMessage(text, type == QLightDM::Greeter::MessageTypeError);
127−}
128−
129−void Greeter::authenticationCompleteFilter()
130−{
131− Q_D(Greeter);
132− if (!d->wasPrompted) {
133− d->promptless = true;
134− Q_EMIT promptlessChanged();
135− }
136−
137− Q_EMIT isAuthenticatedChanged();
138− Q_EMIT authenticationComplete();
139−}
plugins/LightDM/Greeter.hdeleted−82
@@ -1,82 +0,0 @@
1−/*
2− * Copyright (C) 2012,2013 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− * Authors: Michael Terry <michael.terry@canonical.com>
17− */
18−
19−/* This class is a really tiny filter around QLightDM::Greeter. There are some
20− operations that we want to edit a bit for the benefit of Qml. Specifically,
21− we want to chop colons off of any password prompts. But there may be more
22− such edits in the future, and by inserting ourselves here, we have more
23− control. */
24−
25−#ifndef UNITY_GREETER_H
26−#define UNITY_GREETER_H
27−
28−#include <QLightDM/Greeter>
29−#include <QtCore/QObject>
30−
31−class GreeterPrivate;
32−
33−class Greeter : public QObject
34−{
35− Q_OBJECT
36−
37− Q_PROPERTY(bool active READ isActive WRITE setIsActive NOTIFY isActiveChanged)
38− Q_PROPERTY(bool authenticated READ isAuthenticated NOTIFY isAuthenticatedChanged)
39− Q_PROPERTY(QString authenticationUser READ authenticationUser NOTIFY authenticationUserChanged)
40− Q_PROPERTY(bool promptless READ promptless NOTIFY promptlessChanged)
41−
42−public:
43− explicit Greeter(QObject* parent=0);
44−
45− bool isActive() const;
46− bool isAuthenticated() const;
47− QString authenticationUser() const;
48− bool promptless() const;
49−
50−public Q_SLOTS:
51− void authenticate(const QString &username=QString());
52− void respond(const QString &response);
53− bool startSessionSync(const QString &session=QString());
54− void setIsActive(bool isActive);
55−
56−Q_SIGNALS:
57− void showMessage(const QString &text, bool isError);
58− void showPrompt(const QString &text, bool isSecret, bool isDefaultPrompt);
59− void authenticationComplete();
60− void authenticationUserChanged(const QString &user);
61− void isActiveChanged();
62− void isAuthenticatedChanged();
63− void promptlessChanged();
64− void showGreeter();
65− void hideGreeter();
66−
67− // This signal is emitted by external agents like indicators, and the UI
68− // should switch to this user if possible.
69− void requestAuthenticationUser(const QString &user);
70−
71−protected:
72− GreeterPrivate * const d_ptr;
73−
74− Q_DECLARE_PRIVATE(Greeter)
75−
76−private Q_SLOTS:
77− void showMessageFilter(const QString &text, QLightDM::Greeter::MessageType type);
78− void showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type);
79− void authenticationCompleteFilter();
80−};
81−
82−#endif
plugins/LightDM/GreeterPrivate.hdeleted−39
@@ -1,39 +0,0 @@
1−/*
2− * Copyright (C) 2014 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−#ifndef UNITY_GREETER_PRIVATE_H
18−#define UNITY_GREETER_PRIVATE_H
19−
20−#include <QLightDM/Greeter>
21−
22−class GreeterPrivate
23−{
24−public:
25− explicit GreeterPrivate(Greeter *parent);
26−
27− QLightDM::Greeter *m_greeter;
28− bool m_active;
29− bool wasPrompted;
30− bool promptless;
31−
32−protected:
33− Greeter * const q_ptr;
34−
35−private:
36− Q_DECLARE_PUBLIC(Greeter)
37−};
38−
39−#endif // UNITY_GREETER_PRIVATE_H
plugins/LightDM/IntegratedLightDM/CMakeLists.txtdeleted−34
@@ -1,34 +0,0 @@
1−set(PLUGIN_CLASSNAME "IntegratedLightDM")
2−
3−# Written to source dir as thats where add_unity8_plugin expects it
4−configure_file(../qmldir.in ${CMAKE_CURRENT_SOURCE_DIR}/qmldir)
5−
6−add_definitions(-DINTEGRATED_LIGHTDM)
7−
8−foreach(include_directory ${QMLPLUGIN_INCLUDES})
9− list(APPEND RELATIVE_QMLPLUGIN_INCLUDES ../${include_directory})
10−endforeach()
11−
12−include_directories(
13− ${QMLPLUGIN_INCLUDES}
14− ${libunity8-private_SOURCE_DIR}
15−)
16−
17−foreach(source_file ${QMLPLUGIN_SRC})
18− list(APPEND RELATIVE_QMLPLUGIN_SRC ../${source_file})
19−endforeach()
20−
21−add_library(IntegratedLightDM-qml MODULE
22− ${RELATIVE_QMLPLUGIN_SRC}
23− )
24−
25−target_link_libraries(IntegratedLightDM-qml
26− integratedLightDM
27− unity8-private
28− ${LIBUSERMETRICSOUTPUT_LDFLAGS}
29− )
30−
31−qt5_use_modules(IntegratedLightDM-qml DBus Gui Qml)
32−add_unity8_plugin(IntegratedLightDM 0.1 LightDM/IntegratedLightDM TARGETS IntegratedLightDM-qml)
33−
34−add_subdirectory(liblightdm)
plugins/LightDM/IntegratedLightDM/IntegratedLightDM.qmltypesdeleted−271
@@ -1,271 +0,0 @@
1−import QtQuick.tooling 1.1
2−
3−// This file describes the plugin-supplied types contained in the library.
4−// It is used for QML tooling purposes only.
5−//
6−// This file was auto-generated by:
7−// 'qmlplugindump -notrelocatable IntegratedLightDM 0.1 plugins'
8−
9−Module {
10− Component {
11− name: "QAbstractProxyModel"
12− prototype: "QAbstractItemModel"
13− Property { name: "sourceModel"; type: "QAbstractItemModel"; isPointer: true }
14− }
15− Component {
16− name: "QLightDM::Greeter"
17− prototype: "QObject"
18− exports: ["IntegratedLightDM/Greeter 0.1"]
19− isCreatable: false
20− isSingleton: true
21− exportMetaObjectRevisions: [0]
22− Enum {
23− name: "PromptType"
24− values: {
25− "PromptTypeQuestion": 0,
26− "PromptTypeSecret": 1
27− }
28− }
29− Enum {
30− name: "MessageType"
31− values: {
32− "MessageTypeInfo": 0,
33− "MessageTypeError": 1
34− }
35− }
36− Property { name: "authenticated"; type: "bool"; isReadonly: true }
37− Property { name: "authenticationUser"; type: "string"; isReadonly: true }
38− Property { name: "defaultSession"; type: "string"; isReadonly: true }
39− Property { name: "selectUser"; type: "string"; isReadonly: true }
40− Property { name: "selectGuest"; type: "bool"; isReadonly: true }
41− Property { name: "hostname"; type: "string"; isReadonly: true }
42− Property { name: "hasGuestAccount"; type: "bool"; isReadonly: true }
43− Property { name: "locked"; type: "bool"; isReadonly: true }
44− Signal {
45− name: "showMessage"
46− Parameter { name: "text"; type: "string" }
47− Parameter { name: "type"; type: "QLightDM::Greeter::MessageType" }
48− }
49− Signal {
50− name: "showPrompt"
51− Parameter { name: "text"; type: "string" }
52− Parameter { name: "type"; type: "QLightDM::Greeter::PromptType" }
53− }
54− Signal { name: "authenticationComplete" }
55− Signal { name: "autologinTimerExpired" }
56− Method { name: "connectSync"; type: "bool" }
57− Method {
58− name: "authenticate"
59− Parameter { name: "username"; type: "string" }
60− }
61− Method { name: "authenticate" }
62− Method { name: "authenticateAsGuest" }
63− Method { name: "authenticateAutologin" }
64− Method {
65− name: "authenticateRemote"
66− Parameter { name: "session"; type: "string" }
67− Parameter { name: "username"; type: "string" }
68− }
69− Method {
70− name: "authenticateRemote"
71− Parameter { name: "session"; type: "string" }
72− }
73− Method { name: "authenticateRemote" }
74− Method {
75− name: "respond"
76− Parameter { name: "response"; type: "string" }
77− }
78− Method { name: "cancelAuthentication" }
79− Method {
80− name: "setLanguage"
81− Parameter { name: "language"; type: "string" }
82− }
83− Method {
84− name: "startSessionSync"
85− type: "bool"
86− Parameter { name: "session"; type: "string" }
87− }
88− Method { name: "startSessionSync"; type: "bool" }
89− }
90− Component {
91− name: "QLightDM::UsersModel"
92− prototype: "QAbstractListModel"
93− exports: ["IntegratedLightDM/UserRoles 0.1"]
94− isCreatable: false
95− exportMetaObjectRevisions: [0]
96− Enum {
97− name: "UserModelRoles"
98− values: {
99− "NameRole": 256,
100− "RealNameRole": 257,
101− "LoggedInRole": 258,
102− "BackgroundRole": 259,
103− "SessionRole": 260,
104− "HasMessagesRole": 261,
105− "ImagePathRole": 262,
106− "BackgroundPathRole": 263
107− }
108− }
109− }
110− Component {
111− name: "QSortFilterProxyModel"
112− prototype: "QAbstractProxyModel"
113− Property { name: "filterRegExp"; type: "QRegExp" }
114− Property { name: "filterKeyColumn"; type: "int" }
115− Property { name: "dynamicSortFilter"; type: "bool" }
116− Property { name: "filterCaseSensitivity"; type: "Qt::CaseSensitivity" }
117− Property { name: "sortCaseSensitivity"; type: "Qt::CaseSensitivity" }
118− Property { name: "isSortLocaleAware"; type: "bool" }
119− Property { name: "sortRole"; type: "int" }
120− Property { name: "filterRole"; type: "int" }
121− Method {
122− name: "setFilterRegExp"
123− Parameter { name: "pattern"; type: "string" }
124− }
125− Method {
126− name: "setFilterWildcard"
127− Parameter { name: "pattern"; type: "string" }
128− }
129− Method {
130− name: "setFilterFixedString"
131− Parameter { name: "pattern"; type: "string" }
132− }
133− Method { name: "clear" }
134− Method { name: "invalidate" }
135− }
136− Component {
137− name: "UnitySortFilterProxyModelQML"
138− prototype: "QSortFilterProxyModel"
139− Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
140− Property { name: "totalCount"; type: "int"; isReadonly: true }
141− Property { name: "count"; type: "int"; isReadonly: true }
142− Property { name: "invertMatch"; type: "bool" }
143− Signal {
144− name: "invertMatchChanged"
145− Parameter { type: "bool" }
146− }
147− Method {
148− name: "get"
149− type: "QVariantMap"
150− Parameter { name: "row"; type: "int" }
151− }
152− Method {
153− name: "data"
154− type: "QVariant"
155− Parameter { name: "row"; type: "int" }
156− Parameter { name: "role"; type: "int" }
157− }
158− Method { name: "count"; type: "int" }
159− Method {
160− name: "findFirst"
161− type: "int"
162− Parameter { name: "role"; type: "int" }
163− Parameter { name: "value"; type: "QVariant" }
164− }
165− Method {
166− name: "mapRowToSource"
167− type: "int"
168− Parameter { name: "row"; type: "int" }
169− }
170− Method {
171− name: "mapFromSource"
172− type: "int"
173− Parameter { name: "row"; type: "int" }
174− }
175− Method {
176− name: "mapToSource"
177− type: "int"
178− Parameter { name: "row"; type: "int" }
179− }
180− }
181− Component {
182− name: "UserMetricsOutput::ColorTheme"
183− prototype: "QObject"
184− Property { name: "start"; type: "QColor"; isReadonly: true }
185− Property { name: "main"; type: "QColor"; isReadonly: true }
186− Property { name: "end"; type: "QColor"; isReadonly: true }
187− Signal {
188− name: "startChanged"
189− Parameter { name: "color"; type: "QColor" }
190− }
191− Signal {
192− name: "mainChanged"
193− Parameter { name: "color"; type: "QColor" }
194− }
195− Signal {
196− name: "endChanged"
197− Parameter { name: "color"; type: "QColor" }
198− }
199− }
200− Component {
201− name: "UserMetricsOutput::UserMetrics"
202− prototype: "QObject"
203− exports: ["IntegratedLightDM/Infographic 0.1"]
204− isCreatable: false
205− isSingleton: true
206− exportMetaObjectRevisions: [0]
207− Property { name: "label"; type: "string"; isReadonly: true }
208− Property { name: "username"; type: "string" }
209− Property {
210− name: "firstColor"
211− type: "UserMetricsOutput::ColorTheme"
212− isReadonly: true
213− isPointer: true
214− }
215− Property {
216− name: "secondColor"
217− type: "UserMetricsOutput::ColorTheme"
218− isReadonly: true
219− isPointer: true
220− }
221− Property { name: "firstMonth"; type: "QAbstractItemModel"; isReadonly: true; isPointer: true }
222− Property { name: "secondMonth"; type: "QAbstractItemModel"; isReadonly: true; isPointer: true }
223− Property { name: "currentDay"; type: "int"; isReadonly: true }
224− Signal {
225− name: "labelChanged"
226− Parameter { name: "label"; type: "string" }
227− }
228− Signal {
229− name: "usernameChanged"
230− Parameter { name: "username"; type: "string" }
231− }
232− Signal {
233− name: "firstColorChanged"
234− Parameter { name: "color"; type: "ColorTheme"; isPointer: true }
235− }
236− Signal {
237− name: "firstMonthChanged"
238− Parameter { name: "firstMonth"; type: "QAbstractItemModel"; isPointer: true }
239− }
240− Signal {
241− name: "currentDayChanged"
242− Parameter { name: "currentDay"; type: "int" }
243− }
244− Signal {
245− name: "secondColorChanged"
246− Parameter { name: "color"; type: "ColorTheme"; isPointer: true }
247− }
248− Signal {
249− name: "secondMonthChanged"
250− Parameter { name: "secondMonth"; type: "QAbstractItemModel"; isPointer: true }
251− }
252− Signal { name: "nextDataSource" }
253− Signal { name: "readyForDataChange" }
254− Signal { name: "dataAboutToAppear" }
255− Signal { name: "dataAppeared" }
256− Signal { name: "dataAboutToChange" }
257− Signal { name: "dataChanged" }
258− Signal { name: "dataAboutToDisappear" }
259− Signal { name: "dataDisappeared" }
260− Method { name: "nextDataSourceSlot" }
261− Method { name: "readyForDataChangeSlot" }
262− }
263− Component {
264− name: "UsersModel"
265− prototype: "UnitySortFilterProxyModelQML"
266− exports: ["IntegratedLightDM/Users 0.1"]
267− isCreatable: false
268− isSingleton: true
269− exportMetaObjectRevisions: [0]
270− }
271−}
plugins/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txtdeleted−37
@@ -1,37 +0,0 @@
1−pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1)
2−
3−set(LibLightDM_SOURCES
4− Greeter.cpp
5− UsersModel.cpp
6− GreeterPrivate.cpp
7− UsersModelPrivate.cpp
8− ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
9− )
10−
11−add_library(integratedLightDM STATIC ${LibLightDM_SOURCES})
12−add_library(MockLightDM-demo-shared SHARED ${LibLightDM_SOURCES})
13−
14−include_directories(
15− ${CMAKE_CURRENT_BINARY_DIR}
16− ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS}
17−)
18−
19−target_link_libraries(integratedLightDM
20− ${LIBUSERMETRICSOUTPUT_LDFLAGS}
21− -lpam
22−)
23−target_link_libraries(MockLightDM-demo-shared
24− ${LIBUSERMETRICSOUTPUT_LDFLAGS}
25− -lpam
26−)
27−
28−qt5_use_modules(integratedLightDM Concurrent Gui)
29−qt5_use_modules(MockLightDM-demo-shared Concurrent Gui)
30−
31−set_target_properties(integratedLightDM PROPERTIES COMPILE_FLAGS -fPIC)
32−set_target_properties(MockLightDM-demo-shared PROPERTIES
33− OUTPUT_NAME lightdm-qt5-2)
34−
35−install(TARGETS MockLightDM-demo-shared
36− DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/demo
37− )
plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.cppdeleted−184
@@ -1,184 +0,0 @@
1−/*
2− * Copyright (C) 2013 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− * Author: Michael Terry <michael.terry@canonical.com>
17− */
18−
19−
20−/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
21− * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
22− * COUNTERPART IN tests/mocks/Lightdm/liblightdm
23− * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
24−
25−
26−#include "Greeter.h"
27−#include "GreeterPrivate.h"
28−#include <QtCore/QCoreApplication>
29−#include <QTimer>
30−
31−namespace QLightDM
32−{
33−
34−Greeter::Greeter(QObject *parent)
35− : QObject(parent),
36− d_ptr(new GreeterPrivate(this))
37−{
38−}
39−
40−Greeter::~Greeter()
41−{
42−}
43−
44−QString Greeter::authenticationUser() const
45−{
46− Q_D(const Greeter);
47− return d->authenticationUser;
48−}
49−
50−bool Greeter::hasGuestAccountHint() const
51−{
52− return true;
53−}
54−
55−QString Greeter::getHint(const QString &name) const
56−{
57− Q_UNUSED(name)
58− return QString();
59−}
60−
61−QString Greeter::defaultSessionHint() const
62−{
63− return QString("ubuntu");
64−}
65−
66−bool Greeter::hideUsersHint() const
67−{
68− return false;
69−}
70−
71−bool Greeter::showManualLoginHint() const
72−{
73− return true;
74−}
75−
76−bool Greeter::showRemoteLoginHint() const
77−{
78− return true;
79−}
80−
81−bool Greeter::lockHint () const
82−{
83− return false;
84−}
85−
86−QString Greeter::selectUserHint() const
87−{
88− return QString();
89−}
90−
91−bool Greeter::selectGuestHint() const
92−{
93− return false;
94−}
95−
96−QString Greeter::autologinUserHint() const
97−{
98− return QString();
99−}
100−
101−bool Greeter::autologinGuestHint() const
102−{
103− return false;
104−}
105−
106−int Greeter::autologinTimeoutHint() const
107−{
108− return 0;
109−}
110−
111−bool Greeter::inAuthentication() const
112−{
113− return false;
114−}
115−
116−QString Greeter::hostname() const
117−{
118− return QString("hostname1");
119−}
120−
121−bool Greeter::isAuthenticated() const
122−{
123− Q_D(const Greeter);
124− return d->authenticated;
125−}
126−
127−bool Greeter::connectSync()
128−{
129− return true;
130−}
131−
132−void Greeter::authenticate(const QString &username)
133−{
134− Q_D(Greeter);
135−
136− d->authenticated = false;
137− d->authenticationUser = username;
138− d->handleAuthenticate();
139−}
140−
141−void Greeter::authenticateAsGuest()
142−{}
143−
144−void Greeter::authenticateAutologin()
145−{}
146−
147−void Greeter::authenticateRemote(const QString &session, const QString &username)
148−{
149− Q_UNUSED(session)
150− Q_UNUSED(username)
151−}
152−
153−void Greeter::cancelAuthentication()
154−{}
155−
156−void Greeter::setLanguage (const QString &language)
157−{
158− Q_UNUSED(language)
159−}
160−
161−bool Greeter::startSessionSync(const QString &session)
162−{
163− Q_UNUSED(session)
164− return true;
165−}
166−
167−void Greeter::respond(const QString &response)
168−{
169− Q_D(Greeter);
170−
171− d->handleRespond(response);
172−}
173−
174−void Greeter::sendAuthenticationComplete()
175−{
176− if (qgetenv("UNITY_TESTING").isEmpty()) {
177− // simulate PAM's delay
178− QTimer::singleShot(1000, this, SIGNAL(authenticationComplete()));
179− } else {
180− Q_EMIT authenticationComplete();
181− }
182−}
183−
184−}
plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.hdeleted−110
@@ -1,110 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− * Copyright (C) 2010-2011 David Edmundson.
4− * Copyright (C) 2010-2011 Robert Ancell
5− *
6− * This program is free software; you can redistribute it and/or modify
7− * it under the terms of the GNU General Public License as published by
8− * the Free Software Foundation; version 3.
9− *
10− * This program is distributed in the hope that it will be useful,
11− * but WITHOUT ANY WARRANTY; without even the implied warranty of
12− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13− * GNU General Public License for more details.
14− *
15− * You should have received a copy of the GNU General Public License
16− * along with this program. If not, see <http://www.gnu.org/licenses/>.
17− *
18− * Author: David Edmundson <kde@davidedmundson.co.uk>
19− */
20−
21−#ifndef UNITY_MOCK_GREETER_H
22−#define UNITY_MOCK_GREETER_H
23−
24−#include <QtCore/QObject>
25−#include <QtCore/QVariant>
26−
27−/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28− * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
29− * COUNTERPART IN tests/mocks/Lightdm/liblightdm
30− * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
31−
32−namespace QLightDM
33−{
34− class GreeterPrivate;
35−
36−class Q_DECL_EXPORT Greeter : public QObject
37−{
38− Q_OBJECT
39−
40− Q_PROPERTY(bool authenticated READ isAuthenticated ) //NOTFIY authenticationComplete
41− Q_PROPERTY(QString authenticationUser READ authenticationUser )
42− Q_PROPERTY(QString defaultSession READ defaultSessionHint CONSTANT)
43− Q_PROPERTY(QString selectUser READ selectUserHint CONSTANT)
44− Q_PROPERTY(bool selectGuest READ selectGuestHint CONSTANT)
45−
46− Q_PROPERTY(QString hostname READ hostname CONSTANT)
47− Q_PROPERTY(bool hasGuestAccount READ hasGuestAccountHint CONSTANT)
48− Q_PROPERTY(bool locked READ lockHint CONSTANT)
49−
50− Q_ENUMS(PromptType MessageType)
51−
52−public:
53− enum PromptType {
54− PromptTypeQuestion,
55− PromptTypeSecret
56− };
57−
58− enum MessageType {
59− MessageTypeInfo,
60− MessageTypeError
61− };
62−
63− explicit Greeter(QObject* parent=0);
64− virtual ~Greeter();
65−
66− QString getHint(const QString &name) const;
67− QString defaultSessionHint() const;
68− bool hideUsersHint() const;
69− bool showManualLoginHint() const;
70− bool showRemoteLoginHint() const;
71− bool lockHint () const;
72− bool hasGuestAccountHint() const;
73− QString selectUserHint() const;
74− bool selectGuestHint() const;
75− QString autologinUserHint() const;
76− bool autologinGuestHint() const;
77− int autologinTimeoutHint() const;
78−
79− bool inAuthentication() const;
80− bool isAuthenticated() const;
81− QString authenticationUser() const;
82− QString hostname() const;
83−
84−public Q_SLOTS:
85− bool connectSync();
86− void authenticate(const QString &username=QString());
87− void authenticateAsGuest();
88− void authenticateAutologin();
89− void authenticateRemote(const QString &session=QString(), const QString &username=QString());
90− void respond(const QString &response);
91− void cancelAuthentication();
92− void setLanguage (const QString &language);
93− bool startSessionSync(const QString &session=QString());
94−
95−Q_SIGNALS:
96− void showMessage(QString text, QLightDM::Greeter::MessageType type);
97− void showPrompt(QString text, QLightDM::Greeter::PromptType type);
98− void authenticationComplete();
99− void autologinTimerExpired();
100−
101−protected:
102− void sendAuthenticationComplete();
103−
104−private:
105− GreeterPrivate *d_ptr;
106− Q_DECLARE_PRIVATE(Greeter)
107−};
108−}
109−
110−#endif // UNITY_MOCK_GREETER_H
plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cppdeleted−305
@@ -1,305 +0,0 @@
1−/*
2− * Copyright (C) 2013, 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− * Author: Michael Terry <michael.terry@canonical.com>
17− */
18−
19−#include "Greeter.h"
20−#include "GreeterPrivate.h"
21−#include <QFuture>
22−#include <QFutureInterface>
23−#include <QFutureWatcher>
24−#include <QQueue>
25−#include <QtConcurrent>
26−#include <QVector>
27−#include <security/pam_appl.h>
28−
29−namespace QLightDM
30−{
31−
32−class GreeterImpl : public QObject
33−{
34− Q_OBJECT
35−
36− struct AppData
37− {
38− GreeterImpl *impl;
39− pam_handle *handle;
40− };
41−
42− typedef QFutureInterface<QString> ResponseFuture;
43−
44−public:
45− explicit GreeterImpl(Greeter *parent, GreeterPrivate *greeterPrivate)
46− : QObject(parent),
47− greeter(parent),
48− greeterPrivate(greeterPrivate),
49− pamHandle(nullptr)
50− {
51− qRegisterMetaType<QLightDM::GreeterImpl::ResponseFuture>("QLightDM::GreeterImpl::ResponseFuture");
52−
53− connect(&futureWatcher, &QFutureWatcher<int>::finished,
54− this, &GreeterImpl::finishPam);
55− connect(this, SIGNAL(showMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)),
56− this, SLOT(handleMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)));
57− // This next connect is how we pass ResponseFutures between threads
58− connect(this, SIGNAL(showPrompt(pam_handle *, QString, QLightDM::Greeter::PromptType, QLightDM::GreeterImpl::ResponseFuture)),
59− this, SLOT(handlePrompt(pam_handle *, QString, QLightDM::Greeter::PromptType, QLightDM::GreeterImpl::ResponseFuture)),
60− Qt::BlockingQueuedConnection);
61− }
62−
63− ~GreeterImpl()
64− {
65− cancelPam();
66− }
67−
68− void start(const QString &username)
69− {
70− // Clear out any existing PAM interactions first
71− cancelPam();
72− if (pamHandle != nullptr) {
73− // While we were cancelling pam above, we processed Qt events.
74− // Which may have allowed someone to call start() on us again.
75− // In which case, we'll bail on our current start() call.
76− // This isn't racy because it's all in the same thread.
77− return;
78− }
79−
80− AppData *appData = new AppData();
81− appData->impl = this;
82−
83− // Now actually start a new conversation with PAM
84− pam_conv conversation;
85− conversation.conv = converseWithPam;
86− conversation.appdata_ptr = static_cast<void*>(appData);
87−
88− if (pam_start("lightdm", username.toUtf8(), &conversation, &pamHandle) == PAM_SUCCESS) {
89− appData->handle = pamHandle;
90− futureWatcher.setFuture(QtConcurrent::mapped(QList<pam_handle*>() << pamHandle, authenticateWithPam));
91− } else {
92− delete appData;
93− greeterPrivate->authenticated = false;
94− Q_EMIT greeter->showMessage("Internal error: could not start PAM authentication", QLightDM::Greeter::MessageTypeError);
95− Q_EMIT greeter->authenticationComplete();
96− }
97− }
98−
99− static int authenticateWithPam(pam_handle* const& pamHandle)
100− {
101− int pamStatus = pam_authenticate(pamHandle, 0);
102− if (pamStatus == PAM_SUCCESS) {
103− pamStatus = pam_acct_mgmt(pamHandle, 0);
104− }
105− if (pamStatus == PAM_NEW_AUTHTOK_REQD) {
106− pamStatus = pam_chauthtok(pamHandle, PAM_CHANGE_EXPIRED_AUTHTOK);
107− }
108− if (pamStatus == PAM_SUCCESS) {
109− pam_setcred(pamHandle, PAM_REINITIALIZE_CRED);
110− }
111− return pamStatus;
112− }
113−
114− static int converseWithPam(int num_msg, const pam_message** msg,
115− pam_response** resp, void* appdata_ptr)
116− {
117− if (num_msg <= 0)
118− return PAM_CONV_ERR;
119−
120− auto* tmp_response = static_cast<pam_response*>(calloc(num_msg, sizeof(pam_response)));
121− if (!tmp_response)
122− return PAM_CONV_ERR;
123−
124− AppData *appData = static_cast<AppData*>(appdata_ptr);
125− GreeterImpl *impl = appData->impl;
126− pam_handle *handle = appData->handle;
127−
128− int count;
129− QVector<ResponseFuture> responses;
130−
131− for (count = 0; count < num_msg; ++count)
132− {
133− switch (msg[count]->msg_style)
134− {
135− case PAM_PROMPT_ECHO_ON:
136− {
137− QString message(msg[count]->msg);
138− responses.append(ResponseFuture());
139− responses.last().reportStarted();
140− Q_EMIT impl->showPrompt(handle, message, Greeter::PromptTypeQuestion, responses.last());
141− break;
142− }
143− case PAM_PROMPT_ECHO_OFF:
144− {
145− QString message(msg[count]->msg);
146− responses.append(ResponseFuture());
147− responses.last().reportStarted();
148− Q_EMIT impl->showPrompt(handle, message, Greeter::PromptTypeSecret, responses.last());
149− break;
150− }
151− case PAM_TEXT_INFO:
152− {
153− QString message(msg[count]->msg);
154− Q_EMIT impl->showMessage(handle, message, Greeter::MessageTypeInfo);
155− break;
156− }
157− default:
158− {
159− QString message(msg[count]->msg);
160− Q_EMIT impl->showMessage(handle, message, Greeter::MessageTypeError);
161− break;
162− }
163− }
164− }
165−
166− int i = 0;
167− bool raise_error = false;
168−
169− for (auto &response : responses)
170− {
171− pam_response* resp_item = &tmp_response[i++];
172− resp_item->resp_retcode = 0;
173− resp_item->resp = strdup(response.future().result().toUtf8());
174−
175− if (!resp_item->resp)
176− {
177− raise_error = true;
178− break;
179− }
180− }
181−
182− delete appData;
183−
184− if (raise_error)
185− {
186− for (int i = 0; i < count; ++i)
187− free(tmp_response[i].resp);
188−
189− free(tmp_response);
190− return PAM_CONV_ERR;
191− }
192− else
193− {
194− *resp = tmp_response;
195− return PAM_SUCCESS;
196− }
197− }
198−
199−public Q_SLOTS:
200− bool respond(const QString &response)
201− {
202− if (!futures.isEmpty()) {
203− futures.dequeue().reportFinished(&response);
204− return true;
205− } else {
206− return false;
207− }
208− }
209−
210−Q_SIGNALS:
211− void showMessage(pam_handle *handle, QString text, QLightDM::Greeter::MessageType type);
212− void showPrompt(pam_handle *handle, QString text, QLightDM::Greeter::PromptType type, QLightDM::GreeterImpl::ResponseFuture response);
213−
214−private Q_SLOTS:
215− void finishPam()
216− {
217− if (pamHandle == nullptr) {
218− return;
219− }
220−
221− int pamStatus = futureWatcher.result();
222−
223− pam_end(pamHandle, pamStatus);
224− pamHandle = nullptr;
225−
226− greeterPrivate->authenticated = (pamStatus == PAM_SUCCESS);
227− Q_EMIT greeter->authenticationComplete();
228− }
229−
230− void handleMessage(pam_handle *handle, const QString &text, QLightDM::Greeter::MessageType type)
231− {
232− if (handle != pamHandle)
233− return;
234−
235− Q_EMIT greeter->showMessage(text, type);
236− }
237−
238− void handlePrompt(pam_handle *handle, const QString &text, QLightDM::Greeter::PromptType type, QLightDM::GreeterImpl::ResponseFuture future)
239− {
240− if (handle != pamHandle) {
241− future.reportResult(QString());
242− future.reportFinished();
243− return;
244− }
245−
246− futures.enqueue(future);
247− Q_EMIT greeter->showPrompt(text, type);
248− }
249−
250−private:
251− void cancelPam()
252− {
253− if (pamHandle != nullptr) {
254− QFuture<int> pamFuture = futureWatcher.future();
255− pam_handle *handle = pamHandle;
256− pamHandle = nullptr; // to disable normal finishPam() handling
257− pamFuture.cancel();
258−
259− // Note the empty loop, we just want to clear the futures queue.
260− // Any further prompts from the pam thread will be immediately
261− // responded to/dismissed in handlePrompt().
262− while (respond(QString()));
263−
264− // Now let signal/slot handling happen so the thread can finish
265− while (!pamFuture.isFinished()) {
266− QCoreApplication::processEvents();
267− }
268−
269− pam_end(handle, PAM_CONV_ERR);
270− }
271− }
272−
273− Greeter *greeter;
274− GreeterPrivate *greeterPrivate;
275− pam_handle* pamHandle;
276− QFutureWatcher<int> futureWatcher;
277− QQueue<ResponseFuture> futures;
278−};
279−
280−GreeterPrivate::GreeterPrivate(Greeter* parent)
281− : authenticated(false),
282− authenticationUser(),
283− m_impl(new GreeterImpl(parent, this)),
284− q_ptr(parent)
285−{
286−}
287−
288−GreeterPrivate::~GreeterPrivate()
289−{
290− delete m_impl;
291−}
292−
293−void GreeterPrivate::handleAuthenticate()
294−{
295− m_impl->start(authenticationUser);
296−}
297−
298−void GreeterPrivate::handleRespond(const QString &response)
299−{
300− m_impl->respond(response);
301−}
302−
303−}
304−
305−#include "GreeterPrivate.moc"
plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.hdeleted−51
@@ -1,51 +0,0 @@
1−/*
2− * Copyright (C) 2013 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− * Author: Michael Terry <michael.terry@canonical.com>
17− */
18−
19−#ifndef UNITY_MOCK_GREETER_PRIVATE_H
20−#define UNITY_MOCK_GREETER_PRIVATE_H
21−
22−#include <QtCore/QObject>
23−
24−namespace QLightDM
25−{
26−class Greeter;
27−class GreeterImpl;
28−
29−class GreeterPrivate
30−{
31−public:
32− explicit GreeterPrivate(Greeter* parent=0);
33− virtual ~GreeterPrivate();
34−
35− // These variables may not be used by all subclasses, that's no problem
36− bool authenticated;
37− QString authenticationUser;
38−
39− void handleAuthenticate();
40− void handleRespond(const QString &response);
41−
42−protected:
43− GreeterImpl *m_impl; // if the backend needs more private data
44− Greeter * const q_ptr;
45−
46−private:
47− Q_DECLARE_PUBLIC(Greeter)
48−};
49−}
50−
51−#endif // UNITY_MOCK_GREETER_PRIVATE_H
plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cppdeleted−123
@@ -1,123 +0,0 @@
1−/*
2− * Copyright (C) 2013 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− * Author: Michael Terry <michael.terry@canonical.com>
17− */
18−
19−
20−/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
21− * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
22− * COUNTERPART IN tests/mocks/Lightdm/liblightdm
23− * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
24−
25−// LightDM currently is Qt4 compatible, and so doesn't define setRoleNames.
26−// To use the same method of setting role name that it does, we
27−// set our compatibility to Qt4 here too.
28−#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0)
29−
30−#include "UsersModel.h"
31−#include "UsersModelPrivate.h"
32−#include <QtCore/QDir>
33−#include <QtCore/QString>
34−#include <QtGui/QIcon>
35−
36−namespace QLightDM
37−{
38−
39−UsersModel::UsersModel(QObject *parent) :
40− QAbstractListModel(parent),
41− d_ptr(new UsersModelPrivate(this))
42−{
43− Q_D(UsersModel);
44−
45− // Extend roleNames (we want to keep the "display" role)
46− QHash<int, QByteArray> roles = roleNames();
47− roles[NameRole] = "name";
48− roles[RealNameRole] = "realName";
49− roles[LoggedInRole] = "loggedIn";
50− roles[BackgroundRole] = "background";
51− roles[BackgroundPathRole] = "backgroundPath";
52− roles[SessionRole] = "session";
53− roles[HasMessagesRole] = "hasMessages";
54− roles[ImagePathRole] = "imagePath";
55− setRoleNames(roles);
56−
57− // Now modify our mock user backgrounds
58− QDir bgdir = QDir("/usr/share/demo-assets/shell/backgrounds/");
59− QStringList backgrounds = bgdir.entryList(QDir::Files | QDir::NoDotAndDotDot);
60−
61− for (int i = 0, j = 0; i < d->entries.size(); i++) {
62− Entry &entry = d->entries[i];
63− if (entry.background.isNull() && !backgrounds.isEmpty()) {
64− entry.background = bgdir.filePath(backgrounds[j++]);
65− if (j >= backgrounds.length()) {
66− j = 0;
67− }
68− }
69− }
70−}
71−
72−UsersModel::~UsersModel()
73−{
74− delete d_ptr;
75−}
76−
77−int UsersModel::rowCount(const QModelIndex &parent) const
78−{
79− Q_D(const UsersModel);
80−
81− if (parent.isValid()) {
82− return 0;
83− } else { // parent is root
84− return d->entries.size();
85− }
86−}
87−
88−QVariant UsersModel::data(const QModelIndex &index, int role) const
89−{
90− Q_D(const UsersModel);
91−
92− if (!index.isValid()) {
93− return QVariant();
94− }
95−
96− int row = index.row();
97− switch (role) {
98− case Qt::DisplayRole:
99− return d->entries[row].real_name;
100− case Qt::DecorationRole:
101− return QIcon();
102− case UsersModel::NameRole:
103− return d->entries[row].username;
104− case UsersModel::RealNameRole:
105− return d->entries[row].real_name;
106− case UsersModel::SessionRole:
107− return d->entries[row].session;
108− case UsersModel::LoggedInRole:
109− return d->entries[row].is_active;
110− case UsersModel::BackgroundRole:
111− return QPixmap(d->entries[row].background);
112− case UsersModel::BackgroundPathRole:
113− return d->entries[row].background;
114− case UsersModel::HasMessagesRole:
115− return d->entries[row].has_messages;
116− case UsersModel::ImagePathRole:
117− return "";
118− default:
119− return QVariant();
120− }
121−}
122−
123−}
plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.hdeleted−66
@@ -1,66 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− * Copyright (C) 2010-2011 David Edmundson.
4− *
5− * This program is free software; you can redistribute it and/or modify
6− * it under the terms of the GNU General Public License as published by
7− * the Free Software Foundation; version 3.
8− *
9− * This program is distributed in the hope that it will be useful,
10− * but WITHOUT ANY WARRANTY; without even the implied warranty of
11− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12− * GNU General Public License for more details.
13− *
14− * You should have received a copy of the GNU General Public License
15− * along with this program. If not, see <http://www.gnu.org/licenses/>.
16− *
17− * Author: David Edmundson <kde@davidedmundson.co.uk>
18− */
19−
20−#ifndef UNITY_MOCK_USERSMODEL_H
21−#define UNITY_MOCK_USERSMODEL_H
22−
23−#include <QtCore/QString>
24−#include <QtCore/QSharedDataPointer>
25−#include <QAbstractListModel>
26−
27−/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28− * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
29− * COUNTERPART IN tests/mocks/Lightdm/liblightdm
30− * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
31−
32−namespace QLightDM
33−{
34−class UsersModelPrivate;
35−
36−class Q_DECL_EXPORT UsersModel : public QAbstractListModel
37−{
38− Q_OBJECT
39−
40− Q_ENUMS(UserModelRoles)
41−
42−public:
43− explicit UsersModel(QObject *parent = 0);
44− virtual ~UsersModel();
45−
46− enum UserModelRoles {NameRole = Qt::UserRole,
47− RealNameRole,
48− LoggedInRole,
49− BackgroundRole,
50− SessionRole,
51− HasMessagesRole,
52− ImagePathRole,
53− BackgroundPathRole
54− };
55−
56− int rowCount(const QModelIndex &parent) const override;
57− QVariant data(const QModelIndex &index, int role) const override;
58−
59−private:
60− UsersModelPrivate * const d_ptr;
61− Q_DECLARE_PRIVATE(UsersModel)
62−};
63−
64−}
65−
66−#endif // UNITY_MOCK_USERSMODEL_H
plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cppdeleted−41
@@ -1,41 +0,0 @@
1−/*
2− * Copyright (C) 2013, 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− * Author: Michael Terry <michael.terry@canonical.com>
17− */
18−
19−#include "UsersModelPrivate.h"
20−
21−#include <QDir>
22−#include <QSettings>
23−#include <QStringList>
24−
25−namespace QLightDM
26−{
27−
28−UsersModelPrivate::UsersModelPrivate(UsersModel* parent)
29− : q_ptr(parent)
30−{
31− QSettings settings(QDir::homePath() + "/.unity8-greeter-demo", QSettings::NativeFormat);
32− const QStringList users = settings.value("users", QStringList() << qgetenv("USER")).toStringList();
33−
34− Q_FOREACH(const QString &user, users)
35− {
36− QString name = settings.value(user + "/name", user[0].toUpper() + user.mid(1)).toString();
37− entries.append({user, name, 0, 0, false, false, 0, 0});
38− }
39−}
40−
41−}
plugins/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.hdeleted−59
@@ -1,59 +0,0 @@
1−/*
2− * Copyright (C) 2013 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− * Author: Michael Terry <michael.terry@canonical.com>
17− */
18−
19−#ifndef UNITY_MOCK_USERSMODEL_PRIVATE_H
20−#define UNITY_MOCK_USERSMODEL_PRIVATE_H
21−
22−#include <QtCore/QList>
23−#include <QtCore/QString>
24−
25−namespace QLightDM
26−{
27−class UsersModel;
28−
29−class Entry
30−{
31−public:
32− QString username;
33− QString real_name;
34− QString background;
35− QString layouts;
36− bool is_active;
37− bool has_messages;
38− QString session;
39− QString infographic;
40−};
41−
42−class UsersModelPrivate
43−{
44−public:
45− explicit UsersModelPrivate(UsersModel *parent = 0);
46− virtual ~UsersModelPrivate() = default;
47−
48− QList<Entry> entries;
49−
50−protected:
51− UsersModel * const q_ptr;
52−
53−private:
54− Q_DECLARE_PUBLIC(UsersModel)
55−};
56−
57−}
58−
59−#endif // UNITY_MOCK_USERSMODEL_PRIVATE_H
plugins/LightDM/IntegratedLightDM/qmldirdeleted−3
@@ -1,3 +0,0 @@
1−module LightDM.IntegratedLightDM
2−plugin IntegratedLightDM-qml
3−typeinfo IntegratedLightDM.qmltypes
plugins/LightDM/UsersModel.cppdeleted−70
@@ -1,70 +0,0 @@
1−/*
2− * Copyright (C) 2013 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− * Author: Michael Terry <michael.terry@canonical.com>
17− */
18−
19−#include "UsersModel.h"
20−#include <QLightDM/UsersModel>
21−#include <QtCore/QSortFilterProxyModel>
22−
23−// First, we define an internal class that wraps LightDM's UsersModel. This
24−// class will modify some of the data coming from LightDM. For example, we
25−// modify any empty Real Names into just normal Names.
26−// (We can't modify the data directly in UsersModel below because it won't sort
27−// using the modified data.)
28−class MangleModel : public QSortFilterProxyModel
29−{
30− Q_OBJECT
31−
32−public:
33− explicit MangleModel(QObject* parent=0);
34−
35− QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
36−};
37−
38−MangleModel::MangleModel(QObject* parent)
39− : QSortFilterProxyModel(parent)
40−{
41− setSourceModel(new QLightDM::UsersModel(this));
42−}
43−
44−QVariant MangleModel::data(const QModelIndex &index, int role) const
45−{
46− QVariant data = QSortFilterProxyModel::data(index, role);
47−
48− // If user's real name is empty, switch to unix name
49− if (role == QLightDM::UsersModel::RealNameRole && data.toString().isEmpty()) {
50− data = QSortFilterProxyModel::data(index, QLightDM::UsersModel::NameRole);
51− } else if (role == QLightDM::UsersModel::BackgroundPathRole && data.toString().startsWith('#')) {
52− data = "data:image/svg+xml,<svg><rect width='100%' height='100%' fill='" + data.toString() + "'/></svg>";
53− }
54−
55− return data;
56−}
57−
58−// **** Now we continue with actual UsersModel class ****
59−
60−UsersModel::UsersModel(QObject* parent)
61− : UnitySortFilterProxyModelQML(parent)
62−{
63− setModel(new MangleModel(this));
64− setSortCaseSensitivity(Qt::CaseInsensitive);
65− setSortLocaleAware(true);
66− setSortRole(QLightDM::UsersModel::RealNameRole);
67− sort(0);
68−}
69−
70−#include "UsersModel.moc"
plugins/LightDM/UsersModel.hdeleted−37
@@ -1,37 +0,0 @@
1−/*
2− * Copyright (C) 2012,2013 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− * Authors: Michael Terry <michael.terry@canonical.com>
17− */
18−
19−/* This class is a really tiny filter around QLightDM::UsersModel. There are
20− some operations that we want to edit a bit for the benefit of Qml.
21− Specifically, we want to sort users according to realName. */
22−
23−#ifndef UNITY_USERSMODEL_H
24−#define UNITY_USERSMODEL_H
25−
26−#include <unitysortfilterproxymodelqml.h>
27−#include <QtCore/QObject>
28−
29−class UsersModel : public UnitySortFilterProxyModelQML
30−{
31− Q_OBJECT
32−
33−public:
34− explicit UsersModel(QObject* parent=0);
35−};
36−
37−#endif
plugins/LightDM/plugin.cppdeleted−77
@@ -1,77 +0,0 @@
1−/*
2− * Copyright (C) 2012,2013,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 "plugin.h"
19−#include "DBusGreeter.h"
20−#include "DBusGreeterList.h"
21−#include "Greeter.h"
22−#include "UsersModel.h"
23−#include <libusermetricsoutput/ColorTheme.h>
24−#include <libusermetricsoutput/UserMetrics.h>
25−#include <QLightDM/UsersModel>
26−
27−#include <QAbstractItemModel>
28−#include <QDBusConnection>
29−#include <QtQml/qqml.h>
30−
31−static QObject *greeter_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
32−{
33− Q_UNUSED(engine)
34− Q_UNUSED(scriptEngine)
35−
36− Greeter *greeter = new Greeter();
37− new DBusGreeter(greeter, "/");
38− new DBusGreeterList(greeter, "/list");
39−
40− return greeter;
41−}
42−
43−static QObject *users_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
44−{
45− Q_UNUSED(engine)
46− Q_UNUSED(scriptEngine)
47− return new UsersModel();
48−}
49−
50−static QObject *infographic_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
51−{
52− Q_UNUSED(engine)
53− Q_UNUSED(scriptEngine)
54− return UserMetricsOutput::UserMetrics::getInstance();
55−}
56−
57−void PLUGIN_CLASSNAME::registerTypes(const char *uri)
58−{
59− qmlRegisterType<QAbstractItemModel>();
60− qmlRegisterType<UserMetricsOutput::ColorTheme>();
61−
62− Q_ASSERT(uri == QLatin1String("PLUGIN_CLASSNAME"));
63− qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
64− qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
65−
66−#if defined INTEGRATED_LIGHTDM
67− qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider);
68−#elif defined FULL_LIGHTDM
69− qmlRegisterSingletonType<QLightDM::Greeter>(uri, 0, 1, "Greeter", greeter_provider);
70−#else
71− #error No library defined in LightDM plugin
72−#endif
73−
74− qmlRegisterSingletonType<UsersModel>(uri, 0, 1, "Users", users_provider);
75− qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", "Type is not instantiable");
76− qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider);
77−}
plugins/LightDM/plugin.hdeleted−42
@@ -1,42 +0,0 @@
1−/*
2− * Copyright (C) 2012,2013,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 LIGHTDM_PLUGIN_H
19−#define LIGHTDM_PLUGIN_H
20−
21−#include <QtQml/QQmlEngine>
22−#include <QtQml/QQmlExtensionPlugin>
23−
24−#if defined INTEGRATED_LIGHTDM
25− #define PLUGIN_CLASSNAME FullLightDMPlugin
26−#elif defined FULL_LIGHTDM
27− #define PLUGIN_CLASSNAME IntegratedLightDMPlugin
28−#else
29− #error No library defined in LightDM plugin
30−#endif
31−
32−
33−class PLUGIN_CLASSNAME : public QQmlExtensionPlugin
34−{
35− Q_OBJECT
36− Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
37−
38−public:
39− void registerTypes(const char *uri) override;
40−};
41−
42−#endif /* LIGHTDM_PLUGIN_H */
plugins/LightDM/qmldir.indeleted−3
@@ -1,3 +0,0 @@
1−module LightDM.@PLUGIN_CLASSNAME@
2−plugin @PLUGIN_CLASSNAME@-qml
3−typeinfo @PLUGIN_CLASSNAME@.qmltypes