Compare commits
1 commit
master
...
work/pairS
Author | SHA1 | Date | |
---|---|---|---|
|
1e392220da |
5 changed files with 14 additions and 21 deletions
|
@ -224,7 +224,7 @@ void Device::requestPairing()
|
||||||
{
|
{
|
||||||
qCDebug(KDECONNECT_CORE) << "Request pairing";
|
qCDebug(KDECONNECT_CORE) << "Request pairing";
|
||||||
d->m_pairingHandler->requestPairing();
|
d->m_pairingHandler->requestPairing();
|
||||||
Q_EMIT pairStateChanged(pairStateAsInt());
|
Q_EMIT pairStateChanged(pairState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::unpair()
|
void Device::unpair()
|
||||||
|
@ -248,7 +248,7 @@ void Device::cancelPairing()
|
||||||
void Device::pairingHandler_incomingPairRequest()
|
void Device::pairingHandler_incomingPairRequest()
|
||||||
{
|
{
|
||||||
Q_ASSERT(d->m_pairingHandler->pairState() == PairState::RequestedByPeer);
|
Q_ASSERT(d->m_pairingHandler->pairState() == PairState::RequestedByPeer);
|
||||||
Q_EMIT pairStateChanged(pairStateAsInt());
|
Q_EMIT pairStateChanged(pairState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::pairingHandler_pairingSuccessful()
|
void Device::pairingHandler_pairingSuccessful()
|
||||||
|
@ -257,14 +257,14 @@ void Device::pairingHandler_pairingSuccessful()
|
||||||
KdeConnectConfig::instance().addTrustedDevice(id(), name(), type());
|
KdeConnectConfig::instance().addTrustedDevice(id(), name(), type());
|
||||||
KdeConnectConfig::instance().setDeviceProperty(d->m_deviceId, QStringLiteral("certificate"), QString::fromLatin1(certificate().toPem()));
|
KdeConnectConfig::instance().setDeviceProperty(d->m_deviceId, QStringLiteral("certificate"), QString::fromLatin1(certificate().toPem()));
|
||||||
reloadPlugins(); // Will load/unload plugins
|
reloadPlugins(); // Will load/unload plugins
|
||||||
Q_EMIT pairStateChanged(pairStateAsInt());
|
Q_EMIT pairStateChanged(pairState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::pairingHandler_pairingFailed(const QString &errorMessage)
|
void Device::pairingHandler_pairingFailed(const QString &errorMessage)
|
||||||
{
|
{
|
||||||
Q_ASSERT(d->m_pairingHandler->pairState() == PairState::NotPaired);
|
Q_ASSERT(d->m_pairingHandler->pairState() == PairState::NotPaired);
|
||||||
Q_EMIT pairingFailed(errorMessage);
|
Q_EMIT pairingFailed(errorMessage);
|
||||||
Q_EMIT pairStateChanged(pairStateAsInt());
|
Q_EMIT pairStateChanged(pairState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::pairingHandler_unpaired()
|
void Device::pairingHandler_unpaired()
|
||||||
|
@ -273,7 +273,7 @@ void Device::pairingHandler_unpaired()
|
||||||
qCDebug(KDECONNECT_CORE) << "Unpaired";
|
qCDebug(KDECONNECT_CORE) << "Unpaired";
|
||||||
KdeConnectConfig::instance().removeTrustedDevice(id());
|
KdeConnectConfig::instance().removeTrustedDevice(id());
|
||||||
reloadPlugins(); // Will load/unload plugins
|
reloadPlugins(); // Will load/unload plugins
|
||||||
Q_EMIT pairStateChanged(pairStateAsInt());
|
Q_EMIT pairStateChanged(pairState());
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool lessThan(DeviceLink *p1, DeviceLink *p2)
|
static bool lessThan(DeviceLink *p1, DeviceLink *p2)
|
||||||
|
@ -381,11 +381,6 @@ PairState Device::pairState() const
|
||||||
return d->m_pairingHandler->pairState();
|
return d->m_pairingHandler->pairState();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Device::pairStateAsInt() const
|
|
||||||
{
|
|
||||||
return (int)pairState();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Device::isPaired() const
|
bool Device::isPaired() const
|
||||||
{
|
{
|
||||||
return d->m_pairingHandler->pairState() == PairState::Paired;
|
return d->m_pairingHandler->pairState() == PairState::Paired;
|
||||||
|
|
|
@ -30,7 +30,7 @@ class KDECONNECTCORE_EXPORT Device : public QObject
|
||||||
Q_PROPERTY(bool isPaired READ isPaired NOTIFY pairStateChanged)
|
Q_PROPERTY(bool isPaired READ isPaired NOTIFY pairStateChanged)
|
||||||
Q_PROPERTY(bool isPairRequested READ isPairRequested NOTIFY pairStateChanged)
|
Q_PROPERTY(bool isPairRequested READ isPairRequested NOTIFY pairStateChanged)
|
||||||
Q_PROPERTY(bool isPairRequestedByPeer READ isPairRequestedByPeer NOTIFY pairStateChanged)
|
Q_PROPERTY(bool isPairRequestedByPeer READ isPairRequestedByPeer NOTIFY pairStateChanged)
|
||||||
Q_PROPERTY(int pairState READ pairStateAsInt NOTIFY pairStateChanged)
|
Q_PROPERTY(PairState pairState READ pairState NOTIFY pairStateChanged)
|
||||||
Q_PROPERTY(QStringList supportedPlugins READ supportedPlugins NOTIFY pluginsChanged)
|
Q_PROPERTY(QStringList supportedPlugins READ supportedPlugins NOTIFY pluginsChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -76,7 +76,6 @@ public:
|
||||||
void removeLink(DeviceLink *);
|
void removeLink(DeviceLink *);
|
||||||
|
|
||||||
PairState pairState() const;
|
PairState pairState() const;
|
||||||
Q_SCRIPTABLE int pairStateAsInt() const; // Hack because qdbus doesn't like enums
|
|
||||||
Q_SCRIPTABLE bool isPaired() const;
|
Q_SCRIPTABLE bool isPaired() const;
|
||||||
Q_SCRIPTABLE bool isPairRequested() const;
|
Q_SCRIPTABLE bool isPairRequested() const;
|
||||||
Q_SCRIPTABLE bool isPairRequestedByPeer() const;
|
Q_SCRIPTABLE bool isPairRequestedByPeer() const;
|
||||||
|
@ -125,7 +124,7 @@ private Q_SLOTS:
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
Q_SCRIPTABLE void pluginsChanged();
|
Q_SCRIPTABLE void pluginsChanged();
|
||||||
Q_SCRIPTABLE void reachableChanged(bool reachable);
|
Q_SCRIPTABLE void reachableChanged(bool reachable);
|
||||||
Q_SCRIPTABLE void pairStateChanged(int pairState); // Hack because qdbus doesn't like enums
|
Q_SCRIPTABLE void pairStateChanged(PairState pairState);
|
||||||
Q_SCRIPTABLE void pairingFailed(const QString &error);
|
Q_SCRIPTABLE void pairingFailed(const QString &error);
|
||||||
Q_SCRIPTABLE void nameChanged(const QString &name);
|
Q_SCRIPTABLE void nameChanged(const QString &name);
|
||||||
Q_SCRIPTABLE void typeChanged(const QString &type);
|
Q_SCRIPTABLE void typeChanged(const QString &type);
|
||||||
|
|
|
@ -59,7 +59,7 @@ class KDECONNECTINTERFACES_EXPORT DeviceDbusInterface : public OrgKdeKdeconnectD
|
||||||
Q_PROPERTY(bool isPaired READ isPaired NOTIFY pairStateChangedProxy)
|
Q_PROPERTY(bool isPaired READ isPaired NOTIFY pairStateChangedProxy)
|
||||||
Q_PROPERTY(bool isPairRequested READ isPairRequested NOTIFY pairStateChangedProxy)
|
Q_PROPERTY(bool isPairRequested READ isPairRequested NOTIFY pairStateChangedProxy)
|
||||||
Q_PROPERTY(bool isPairRequestedByPeer READ isPairRequestedByPeer NOTIFY pairStateChangedProxy)
|
Q_PROPERTY(bool isPairRequestedByPeer READ isPairRequestedByPeer NOTIFY pairStateChangedProxy)
|
||||||
Q_PROPERTY(int pairState READ pairState NOTIFY pairStateChangedProxy)
|
Q_PROPERTY(PairState pairState READ pairState NOTIFY pairStateChangedProxy)
|
||||||
Q_PROPERTY(QString name READ name NOTIFY nameChangedProxy)
|
Q_PROPERTY(QString name READ name NOTIFY nameChangedProxy)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -71,7 +71,7 @@ public:
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void nameChangedProxy(const QString &name);
|
void nameChangedProxy(const QString &name);
|
||||||
void pairStateChangedProxy(int pairState);
|
void pairStateChangedProxy(PairState pairState);
|
||||||
void reachableChangedProxy(bool reachable);
|
void reachableChangedProxy(bool reachable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -207,9 +207,9 @@ void KdeConnectKcm::resetDeviceView()
|
||||||
|
|
||||||
kcmUi->name_label->setText(currentDevice->name());
|
kcmUi->name_label->setText(currentDevice->name());
|
||||||
setWhenAvailable(
|
setWhenAvailable(
|
||||||
currentDevice->pairStateAsInt(),
|
currentDevice->pairState(),
|
||||||
[this](int pairStateAsInt) {
|
[this](PairState pairState) {
|
||||||
setCurrentDevicePairState(pairStateAsInt);
|
setCurrentDevicePairState(pairState);
|
||||||
},
|
},
|
||||||
this);
|
this);
|
||||||
|
|
||||||
|
@ -279,9 +279,8 @@ void KdeConnectKcm::pairingFailed(const QString &error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KdeConnectKcm::setCurrentDevicePairState(int pairStateAsInt)
|
void KdeConnectKcm::setCurrentDevicePairState(PairState pairState)
|
||||||
{
|
{
|
||||||
PairState state = (PairState)pairStateAsInt; // Hack because qdbus doesn't like enums
|
|
||||||
kcmUi->accept_button->setVisible(state == PairState::RequestedByPeer);
|
kcmUi->accept_button->setVisible(state == PairState::RequestedByPeer);
|
||||||
kcmUi->reject_button->setVisible(state == PairState::RequestedByPeer);
|
kcmUi->reject_button->setVisible(state == PairState::RequestedByPeer);
|
||||||
kcmUi->cancel_button->setVisible(state == PairState::Requested);
|
kcmUi->cancel_button->setVisible(state == PairState::Requested);
|
||||||
|
|
|
@ -47,7 +47,7 @@ private Q_SLOTS:
|
||||||
void renameDone();
|
void renameDone();
|
||||||
void setRenameMode(bool b);
|
void setRenameMode(bool b);
|
||||||
void resetCurrentDevice();
|
void resetCurrentDevice();
|
||||||
void setCurrentDevicePairState(int pairStateAsInt);
|
void setCurrentDevicePairState(PairState pairState);
|
||||||
void acceptPairing();
|
void acceptPairing();
|
||||||
void cancelPairing();
|
void cancelPairing();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue