Propagate pairing errors

This commit is contained in:
Aleix Pol 2015-12-06 01:51:53 +01:00
parent 90c8f588bc
commit e10b2e80c9
3 changed files with 6 additions and 4 deletions

View file

@ -63,6 +63,7 @@ public:
Q_SIGNALS: Q_SIGNALS:
void receivedPackage(const NetworkPackage& np); void receivedPackage(const NetworkPackage& np);
void pairStatusChanged(DeviceLink::PairStatus status); void pairStatusChanged(DeviceLink::PairStatus status);
void pairingError(const QString &error);
protected: protected:
QCA::PrivateKey mPrivateKey; QCA::PrivateKey mPrivateKey;

View file

@ -471,7 +471,8 @@ void LanLinkProvider::userRequestsPair(const QString& deviceId)
void LanLinkProvider::refreshPairingHandler(const QString& deviceId) { void LanLinkProvider::refreshPairingHandler(const QString& deviceId) {
LanPairingHandler* ph = mPairingHandlers.value(deviceId); LanPairingHandler* ph = mPairingHandlers.value(deviceId);
if (ph) { if (ph) {
ph->setDeviceLink(mLinks[deviceId]); DeviceLink* link = mLinks[deviceId];
ph->setDeviceLink(link);
connect(ph, &LanPairingHandler::pairingError, link, &DeviceLink::pairingError);
} }
} }

View file

@ -271,8 +271,8 @@ void Device::addLink(const NetworkPackage& identityPackage, DeviceLink* link)
} }
} }
connect(link, SIGNAL(pairStatusChanged(PairStatus)), this, SLOT(pairStatusChanged(PairStatus, PairStatus))); connect(link, &DeviceLink::pairStatusChanged, this, &Device::pairStatusChanged);
connect(link, SIGNAL(pairingFailed(const QString&)), this, SIGNAL(pairingFailed(const QString&))); connect(link, &DeviceLink::pairingError, this, &Device::pairingError);
} }
void Device::linkDestroyed(QObject* o) void Device::linkDestroyed(QObject* o)