Devices where not removed if they were unpaired after going offline

This commit is contained in:
Albert Vaca 2015-06-21 19:40:05 -07:00
parent 08938689c5
commit 77256e1932
2 changed files with 6 additions and 5 deletions

View file

@ -69,8 +69,8 @@ Daemon::Daemon(QObject *parent)
const QStringList& list = KdeConnectConfig::instance()->trustedDevices(); const QStringList& list = KdeConnectConfig::instance()->trustedDevices();
Q_FOREACH(const QString& id, list) { Q_FOREACH(const QString& id, list) {
Device* device = new Device(this, id); Device* device = new Device(this, id);
connect(device, SIGNAL(reachableStatusChanged()), connect(device, SIGNAL(reachableStatusChanged()), this, SLOT(onDeviceStatusChanged()));
this, SLOT(onDeviceReachableStatusChanged())); connect(device, SIGNAL(pairingChanged(bool)), this, SLOT(onDeviceStatusChanged()));
d->mDevices[id] = device; d->mDevices[id] = device;
Q_EMIT deviceAdded(id); Q_EMIT deviceAdded(id);
} }
@ -136,14 +136,15 @@ void Daemon::onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink*
//qCDebug(KDECONNECT_CORE) << "It is a new device"; //qCDebug(KDECONNECT_CORE) << "It is a new device";
Device* device = new Device(this, identityPackage, dl); Device* device = new Device(this, identityPackage, dl);
connect(device, SIGNAL(reachableStatusChanged()), this, SLOT(onDeviceReachableStatusChanged())); connect(device, SIGNAL(reachableStatusChanged()), this, SLOT(onDeviceStatusChanged()));
connect(device, SIGNAL(pairingChanged(bool)), this, SLOT(onDeviceStatusChanged()));
d->mDevices[id] = device; d->mDevices[id] = device;
Q_EMIT deviceAdded(id); Q_EMIT deviceAdded(id);
} }
} }
void Daemon::onDeviceReachableStatusChanged() void Daemon::onDeviceStatusChanged()
{ {
Device* device = (Device*)sender(); Device* device = (Device*)sender();
QString id = device->id(); QString id = device->id();

View file

@ -72,7 +72,7 @@ Q_SIGNALS:
private Q_SLOTS: private Q_SLOTS:
void onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink* dl); void onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink* dl);
void onDeviceReachableStatusChanged(); void onDeviceStatusChanged();
private: private:
QScopedPointer<struct DaemonPrivate> d; QScopedPointer<struct DaemonPrivate> d;