Changed signal reachableStatusChanged() to reachableChanged(bool)

And proxied it on the C++ dbus interface.
This commit is contained in:
Albert Vaca 2016-11-23 17:24:03 +01:00
parent f845b33392
commit 3d0f7c3fcb
5 changed files with 11 additions and 8 deletions

View file

@ -71,8 +71,8 @@ Daemon::Daemon(QObject *parent, bool testMode)
const QStringList& list = KdeConnectConfig::instance()->trustedDevices();
Q_FOREACH (const QString& id, list) {
Device* device = new Device(this, id);
connect(device, SIGNAL(reachableStatusChanged()), this, SLOT(onDeviceStatusChanged()));
connect(device, SIGNAL(trustedChanged(bool)), this, SLOT(onDeviceStatusChanged()));
connect(device, &Device::reachableChanged, this, &Daemon::onDeviceStatusChanged);
connect(device, &Device::trustedChanged, this, &Daemon::onDeviceStatusChanged);
d->mDevices[id] = device;
Q_EMIT deviceAdded(id);
}
@ -185,8 +185,8 @@ void Daemon::onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink*
if (!isDiscoveringDevices() && !device->isTrusted() && !dl->linkShouldBeKeptAlive()) {
device->deleteLater();
} else {
connect(device, SIGNAL(reachableStatusChanged()), this, SLOT(onDeviceStatusChanged()));
connect(device, SIGNAL(trustedChanged(bool)), this, SLOT(onDeviceStatusChanged()));
connect(device, &Device::reachableChanged, this, &Daemon::onDeviceStatusChanged);
connect(device, &Device::trustedChanged, this, &Daemon::onDeviceStatusChanged);
d->mDevices[id] = device;
Q_EMIT deviceAdded(id);

View file

@ -243,7 +243,7 @@ void Device::addLink(const NetworkPackage& identityPackage, DeviceLink* link)
reloadPlugins();
if (m_deviceLinks.size() == 1) {
Q_EMIT reachableStatusChanged();
Q_EMIT reachableChanged(true);
}
connect(link, &DeviceLink::pairStatusChanged, this, &Device::pairStatusChanged);
@ -263,7 +263,7 @@ void Device::removeLink(DeviceLink* link)
if (m_deviceLinks.isEmpty()) {
reloadPlugins();
Q_EMIT reachableStatusChanged();
Q_EMIT reachableChanged(false);
}
}

View file

@ -41,7 +41,7 @@ class KDECONNECTCORE_EXPORT Device
Q_PROPERTY(QString name READ name NOTIFY nameChanged)
Q_PROPERTY(QString iconName READ iconName CONSTANT)
Q_PROPERTY(QString statusIconName READ statusIconName)
Q_PROPERTY(bool isReachable READ isReachable NOTIFY reachableStatusChanged)
Q_PROPERTY(bool isReachable READ isReachable NOTIFY reachableChanged)
Q_PROPERTY(bool isTrusted READ isTrusted NOTIFY trustedChanged)
Q_PROPERTY(QStringList supportedPlugins READ supportedPlugins NOTIFY pluginsChanged)
@ -125,7 +125,7 @@ private Q_SLOTS:
Q_SIGNALS:
Q_SCRIPTABLE void pluginsChanged();
Q_SCRIPTABLE void reachableStatusChanged();
Q_SCRIPTABLE void reachableChanged(bool reachable);
Q_SCRIPTABLE void trustedChanged(bool trusted);
Q_SCRIPTABLE void pairingError(const QString& error);
Q_SCRIPTABLE void nameChanged(const QString& name);

View file

@ -45,6 +45,7 @@ DeviceDbusInterface::DeviceDbusInterface(const QString& id, QObject* parent)
, m_id(id)
{
connect(this, &OrgKdeKdeconnectDeviceInterface::trustedChanged, this, &DeviceDbusInterface::trustedChangedProxy);
connect(this, &OrgKdeKdeconnectDeviceInterface::reachableChanged, this, &DeviceDbusInterface::reachableChangedProxy);
connect(this, &OrgKdeKdeconnectDeviceInterface::nameChanged, this, &DeviceDbusInterface::nameChangedProxy);
}

View file

@ -59,6 +59,7 @@ class KDECONNECTINTERFACES_EXPORT DeviceDbusInterface
Q_OBJECT
// TODO: Workaround because OrgKdeKdeconnectDeviceInterface is not generating
// the signals for the properties
Q_PROPERTY(bool isReachable READ isReachable NOTIFY reachableChangedProxy)
Q_PROPERTY(bool isTrusted READ isTrusted NOTIFY trustedChangedProxy)
Q_PROPERTY(QString name READ name NOTIFY nameChangedProxy)
@ -72,6 +73,7 @@ public:
Q_SIGNALS:
void nameChangedProxy(const QString &name);
void trustedChangedProxy(bool paired);
void reachableChangedProxy(bool reachable);
private:
const QString m_id;