@@ -72,18 +72,9 @@
void QUPowerInterface::connectNotify(const QMetaMethod &signal)
{
- static const QMetaMethod changedSignal = QMetaMethod::fromSignal(&QUPowerInterface::changed);
static const QMetaMethod addedSignal = QMetaMethod::fromSignal(&QUPowerInterface::deviceAdded);
static const QMetaMethod removedSignal = QMetaMethod::fromSignal(&QUPowerInterface::deviceRemoved);
- if (signal == changedSignal) {
- if (!connection().connect(QStringLiteral(UPOWER_SERVICE),
- QStringLiteral(UPOWER_PATH),
- QStringLiteral(UPOWER_SERVICE),
- QStringLiteral("Changed"),
- this, SIGNAL(changed()))) {
- qDebug() << "Error"<<connection().lastError().message();
- }
- }
+
if (signal == addedSignal) {
if (!connection().connect(QStringLiteral(UPOWER_SERVICE),
QStringLiteral(UPOWER_PATH),
@@ -107,18 +98,9 @@
void QUPowerInterface::disconnectNotify(const QMetaMethod &signal)
{
- static const QMetaMethod changedSignal = QMetaMethod::fromSignal(&QUPowerInterface::changed);
static const QMetaMethod addedSignal = QMetaMethod::fromSignal(&QUPowerInterface::deviceAdded);
static const QMetaMethod removedSignal = QMetaMethod::fromSignal(&QUPowerInterface::deviceRemoved);
- if (signal == changedSignal) {
- if (!connection().disconnect(QStringLiteral(UPOWER_SERVICE),
- QStringLiteral(UPOWER_PATH),
- QStringLiteral(UPOWER_SERVICE),
- QStringLiteral("Changed"),
- this, SIGNAL(changed()))) {
- qDebug() << "Error"<<connection().lastError().message();
- }
- }
+
if (signal == addedSignal) {
if (!connection().disconnect(QStringLiteral(UPOWER_SERVICE),
QStringLiteral(UPOWER_PATH),
@@ -229,8 +211,18 @@
void QUPowerDeviceInterface::connectNotify(const QMetaMethod &signal)
{
+ static const QMetaMethod changedSignal = QMetaMethod::fromSignal(&QUPowerDeviceInterface::changed);
static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QUPowerDeviceInterface::propertyChanged);
+ if (signal == changedSignal) {
+ if (!connection().connect(QLatin1String(UPOWER_SERVICE),
+ path(),
+ QLatin1String(UPOWER_DEVICE_SERVICE),
+ QLatin1String("Changed"),
+ this, SIGNAL(changed()))) {
+ qDebug() << "Error" << connection().lastError().message();
+ }
+ }
if (signal == propertyChangedSignal) {
if (!connection().connect(QLatin1String(UPOWER_SERVICE),
path(),
@@ -244,7 +236,15 @@
void QUPowerDeviceInterface::disconnectNotify(const QMetaMethod &signal)
{
+ static const QMetaMethod changedSignal = QMetaMethod::fromSignal(&QUPowerDeviceInterface::changed);
static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QUPowerDeviceInterface::propertyChanged);
+ if (signal == changedSignal) {
+ connection().disconnect(QLatin1String(UPOWER_SERVICE),
+ path(),
+ QLatin1String(UPOWER_DEVICE_SERVICE),
+ QLatin1String("Changed"),
+ this, SIGNAL(changed()));
+ }
if (signal == propertyChangedSignal) {
connection().disconnect(QLatin1String(UPOWER_SERVICE),
path(),
|