on xenial help sign in
Allow the session to bring up the greeter/lockscreen over DBus. The emergency dialer will need this support in order to cancel bringing it up.

Approved by: Michael Zanetti, PS Jenkins bot

commitf47831e2113071ecac2408efb72c066d86dc59c6 authorMichael Terry <michael.terry@canonical.com> dateThu 17 Jul 2014, 09:37 (12 years ago) parent507b643729d779
6 files changed+27
plugins/LightDM/DBusGreeter.cpp+5 plugins/LightDM/DBusGreeter.h+1 plugins/LightDM/Greeter.h+1 qml/Shell.qml+5 tests/plugins/LightDM/dbus.cpp+7 tests/qmltests/tst_Shell.qml+8
plugins/LightDM/DBusGreeter.cpp+5
@@ -34,6 +34,11 @@ bool DBusGreeter::isActive() const
3434 return m_greeter->isActive();
3535}
3636
37+void DBusGreeter::ShowGreeter()
38+{
39+ return Q_EMIT m_greeter->showGreeter();
40+}
41+
3742void DBusGreeter::isActiveChangedHandler()
3843{
3944 notifyPropertyChanged("IsActive", isActive());
plugins/LightDM/DBusGreeter.h+1
@@ -37,6 +37,7 @@ public:
3737 explicit DBusGreeter(Greeter *greeter, const QDBusConnection &connection, const QString &path);
3838
3939 bool isActive() const;
40+ Q_SCRIPTABLE void ShowGreeter(); // temporary, until we split the greeter again
4041
4142Q_SIGNALS:
4243 void isActiveChanged();
plugins/LightDM/Greeter.h+1
@@ -60,6 +60,7 @@ Q_SIGNALS:
6060 void authenticationUserChanged(const QString &user);
6161 void isActiveChanged();
6262 void promptlessChanged();
63+ void showGreeter();
6364
6465 // This signal is emitted by external agents like indicators, and the UI
6566 // should switch to this user if possible.
qml/Shell.qml+5
@@ -348,6 +348,8 @@ FocusScope {
348348 Connections {
349349 target: LightDM.Greeter
350350
351+ onShowGreeter: greeter.show()
352+
351353 onShowPrompt: {
352354 if (LightDM.Users.count == 1) {
353355 // TODO: There's no better way for now to determine if its a PIN or a passphrase.
@@ -418,6 +420,9 @@ FocusScope {
418420 onShownChanged: {
419421 if (shown) {
420422 lockscreen.reset();
423+ if (!LightDM.Greeter.promptless) {
424+ lockscreen.show();
425+ }
421426 // If there is only one user, we start authenticating with that one here.
422427 // If there are more users, the Greeter will handle that
423428 if (LightDM.Users.count == 1) {
tests/plugins/LightDM/dbus.cpp+7
@@ -187,6 +187,13 @@ private Q_SLOTS:
187187 QVERIFY(arguments.at(1).toMap()["IsActive"].toBool());
188188 }
189189
190+ void testShowGreeter()
191+ {
192+ // Just confirm the call exists and doesn't fail
193+ QDBusReply<void> reply = dbusMain->call("ShowGreeter");
194+ QVERIFY(reply.isValid());
195+ }
196+
190197private:
191198 QQuickView *view;
192199 Greeter *greeter;
tests/qmltests/tst_Shell.qml+8
@@ -20,6 +20,7 @@
2020import QtQuick 2.0
2121import QtTest 1.0
2222import GSettings 1.0
23+import LightDM 0.1 as LightDM
2324import Unity.Application 0.1
2425import Unity.Test 0.1 as UT
2526import Powerd 0.1
@@ -520,5 +521,12 @@ Item {
520521 tryCompare(greeter, "showProgress", 0)
521522 waitUntilApplicationWindowIsFullyVisible()
522523 }
524+
525+ function test_showGreeterDBusCall() {
526+ var greeter = findChild(shell, "greeter")
527+ tryCompare(greeter, "showProgress", 0)
528+ LightDM.Greeter.showGreeter()
529+ tryCompare(greeter, "showProgress", 1)
530+ }
523531 }
524532}