[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/solid/solid/backends
From: Alex Merry <kde () randomguy3 ! me ! uk>
Date: 2010-12-14 15:59:47
Message-ID: 20101214155947.A1089AC8A7 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1206485 by alexmerry:
Use PowerDevil's method of dealing with activatable services.
This should prevent connect() warnings when UDisks/UPower is not installed, but also \
ensure the service is activated if it is.
CCMAIL: faure@kde.org
CCMAIL: lukas@kde.org
M +19 -0 udisks/udisksmanager.cpp
M +19 -0 upower/upowermanager.cpp
--- trunk/KDE/kdelibs/solid/solid/backends/udisks/udisksmanager.cpp #1206484:1206485
@@ -25,6 +25,7 @@
#include <QtDBus/QDBusReply>
#include <QtCore/QDebug>
#include <QtDBus/QDBusMetaType>
+#include <QtDBus/QDBusConnectionInterface>
#include "../shared/rootdevice.h"
@@ -50,6 +51,23 @@
qDBusRegisterMetaType<QList<QDBusObjectPath> >();
qDBusRegisterMetaType<QVariantMap>();
+ bool serviceFound = m_manager.isValid();
+ if (!serviceFound) {
+ // find out whether it will be activated automatically
+ QDBusMessage message = \
QDBusMessage::createMethodCall("org.freedesktop.DBus", + \
"/org/freedesktop/DBus", + \
"org.freedesktop.DBus", + \
"ListActivatableNames"); +
+ QDBusPendingReply< QStringList > reply = \
QDBusConnection::systemBus().asyncCall(message); + reply.waitForFinished();
+ if (reply.isValid() && reply.value().contains(UD_DBUS_SERVICE)) {
+ QDBusConnection::systemBus().interface()->startService(UD_DBUS_SERVICE);
+ serviceFound = true;
+ }
+ }
+
+ if (serviceFound) {
connect(&m_manager, SIGNAL(DeviceAdded(QDBusObjectPath)),
this, SLOT(slotDeviceAdded(QDBusObjectPath)));
connect(&m_manager, SIGNAL(DeviceRemoved(QDBusObjectPath)),
@@ -57,6 +75,7 @@
connect(&m_manager, SIGNAL(DeviceChanged(QDBusObjectPath)),
this, SLOT(slotDeviceChanged(QDBusObjectPath)));
}
+}
UDisksManager::~UDisksManager()
{
--- trunk/KDE/kdelibs/solid/solid/backends/upower/upowermanager.cpp #1206484:1206485
@@ -26,6 +26,7 @@
#include <QtDBus/QDBusReply>
#include <QtCore/QDebug>
#include <QtDBus/QDBusMetaType>
+#include <QtDBus/QDBusConnectionInterface>
#include "../shared/rootdevice.h"
@@ -46,11 +47,29 @@
qDBusRegisterMetaType<QList<QDBusObjectPath> >();
+ bool serviceFound = m_manager.isValid();
+ if (!serviceFound) {
+ // find out whether it will be activated automatically
+ QDBusMessage message = \
QDBusMessage::createMethodCall("org.freedesktop.DBus", + \
"/org/freedesktop/DBus", + \
"org.freedesktop.DBus", + \
"ListActivatableNames"); +
+ QDBusPendingReply< QStringList > reply = \
QDBusConnection::systemBus().asyncCall(message); + reply.waitForFinished();
+ if (reply.isValid() && reply.value().contains(UP_DBUS_SERVICE)) {
+ QDBusConnection::systemBus().interface()->startService(UP_DBUS_SERVICE);
+ serviceFound = true;
+ }
+ }
+
+ if (serviceFound) {
connect(&m_manager, SIGNAL(DeviceAdded(QString)),
this, SLOT(slotDeviceAdded(QString)));
connect(&m_manager, SIGNAL(DeviceRemoved(QString)),
this, SLOT(slotDeviceRemoved(QString)));
}
+}
UPowerManager::~UPowerManager()
{
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic