Commit 1c97e1d9 authored by David Edmundson's avatar David Edmundson

Don't block starting notification service

We don't need to manually start the DBus service.
It blocks the calling app, and dbusServiceExists means that we will
always end up going the DBus route over a popup anyway, so it won't
do anything useful.

The service (in the plasma case plasma-wait-for-name) will be started
automatically when we actually send the notification.

Also fix d-dbusServiceExists being cleared to false when the first
service owner exits.

BUG: 382444

Subscribers: #frameworks

Tags: #frameworks

Differential Revision:
parent 2a8445e1
......@@ -109,6 +109,9 @@ public:
* Specifies if DBus Notifications interface exists on session bus
bool dbusServiceExists;
bool dbusServiceActivatable;
* DBus notification daemon capabilities cache.
* Do not use this variable. Use #popupServerCapabilities() instead.
......@@ -161,6 +164,7 @@ NotifyByPopup::NotifyByPopup(QObject *parent)
d->animationTimer = 0;
d->dbusServiceExists = false;
d->dbusServiceActivatable = false;
d->dbusServiceCapCacheDirty = true;
d->nextPosition = -1;
......@@ -180,32 +184,20 @@ NotifyByPopup::NotifyByPopup(QObject *parent)
connect(watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
#ifndef Q_WS_WIN
if (!d->dbusServiceExists) {
bool startfdo = false;
#ifdef Q_WS_WIN
startfdo = true;
QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.DBus"),
// FIXME - this should be async
QDBusReply<QStringList> reply = QDBusConnection::sessionBus().call(message);
if (reply.isValid() && reply.value().contains(dbusServiceName)) {
startfdo = true;
// We need to set d->dbusServiceExists to true because dbus might be too slow
// starting the service and the first call to NotifyByPopup::notify
// might not have had the service up, by setting this to true we
// guarantee it will still go through dbus and dbus will do the correct
// thing and wait for the service to go up
d->dbusServiceActivatable = true;
//if the service is activatable, we can assume it exists even if it is not currently running
d->dbusServiceExists = true;
if (startfdo) {
......@@ -439,7 +431,9 @@ void NotifyByPopup::onServiceOwnerChanged(const QString &serviceName, const QStr
if (newOwner.isEmpty()) {
d->dbusServiceExists = false;
if (!d->dbusServiceActivatable) {
d->dbusServiceExists = false;
} else if (oldOwner.isEmpty()) {
d->dbusServiceExists = true;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment