From 9f372807041ec73cfa69017edfdb739485867d26 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Fri, 14 Nov 2014 16:24:52 +0100 Subject: [PATCH 11/23] Fix warning: No such signal org::freedesktop::UPower::Device... Backport of commit d5f6f40eb8b6a420520cb7c726959048593d2cab in the frameworks repository of solid. The signature change can be detected at runtime using Qt's QMetaObject introspection mechanism. That prevents us from emitting the two pesky warnings at runtime, polluting our konsoles. Google is full of that warning, and there is also: https://bugzilla.redhat.com/show_bug.cgi?id=1056769 REVIEW: 121007 --- solid/solid/backends/upower/upowermanager.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/solid/solid/backends/upower/upowermanager.cpp b/solid/solid/backends/upower/upowermanager.cpp index 1bfd37a..5012f0b 100644 --- a/solid/solid/backends/upower/upowermanager.cpp +++ b/solid/solid/backends/upower/upowermanager.cpp @@ -64,16 +64,18 @@ UPowerManager::UPowerManager(QObject *parent) } if (serviceFound) { - connect(&m_manager, SIGNAL(DeviceAdded(QString)), - this, SIGNAL(deviceAdded(QString))); - connect(&m_manager, SIGNAL(DeviceRemoved(QString)), - this, SIGNAL(deviceRemoved(QString))); - - // for UPower >= 0.99.0, changed signature :o/ - connect(&m_manager, SIGNAL(DeviceAdded(QDBusObjectPath)), - this, SLOT(onDeviceAdded(QDBusObjectPath))); - connect(&m_manager, SIGNAL(DeviceRemoved(QDBusObjectPath)), - this, SLOT(onDeviceRemoved(QDBusObjectPath))); + if (m_manager.metaObject()->indexOfSignal("DeviceAdded(QDBusObjectPath)") != -1) { + // for UPower >= 0.99.0, changed signature :o/ + connect(&m_manager, SIGNAL(DeviceAdded(QDBusObjectPath)), + this, SLOT(onDeviceAdded(QDBusObjectPath))); + connect(&m_manager, SIGNAL(DeviceRemoved(QDBusObjectPath)), + this, SLOT(onDeviceRemoved(QDBusObjectPath))); + } else { + connect(&m_manager, SIGNAL(DeviceAdded(QString)), + this, SIGNAL(deviceAdded(QString))); + connect(&m_manager, SIGNAL(DeviceRemoved(QString)), + this, SIGNAL(deviceRemoved(QString))); + } } } -- 1.9.3