Commit a918ffc0 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Add and make use of ECM's clang-format integration

parent 0719e4eb
......@@ -36,6 +36,7 @@ include(ECMQtDeclareLoggingCategory)
include(FeatureSummary)
include(GenerateExportHeader)
include(ECMGenerateQmlTypes)
include(KDEClangFormat)
if (NOT SAILFISHOS)
include(ECMQMLModules)
endif()
......@@ -162,4 +163,7 @@ endif()
ecm_qt_install_logging_categories(EXPORT kdeconnect-kde FILE kdeconnect-kde.categories SORT DESTINATION "${KDE_INSTALL_LOGGINGCATEGORIESDIR}")
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
......@@ -5,20 +5,20 @@
*/
#include <QApplication>
#include <QCommandLineParser>
#include <QIcon>
#include <QProcess>
#include <QQmlApplicationEngine>
#include <QCommandLineParser>
#include <QQmlContext>
#include <QQuickStyle>
#include <QStandardPaths>
#include <QProcess>
#include <KAboutData>
#include <KLocalizedString>
#include <KLocalizedContext>
#include <KColorSchemeManager>
#include <KLocalizedContext>
#include <KLocalizedString>
int main(int argc, char* argv[])
int main(int argc, char *argv[])
{
QIcon::setFallbackThemeName(QStringLiteral("breeze"));
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
......@@ -26,7 +26,12 @@ int main(int argc, char* argv[])
QApplication app(argc, argv);
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("kdeconnect")));
KAboutData aboutData(QStringLiteral("kdeconnect.app"), i18n("KDE Connect"), QStringLiteral("1.0"), i18n("KDE Connect"), KAboutLicense::GPL, i18n("(c) 2015, Aleix Pol Gonzalez"));
KAboutData aboutData(QStringLiteral("kdeconnect.app"),
i18n("KDE Connect"),
QStringLiteral("1.0"),
i18n("KDE Connect"),
KAboutLicense::GPL,
i18n("(c) 2015, Aleix Pol Gonzalez"));
aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), i18n("Maintainer"), QStringLiteral("aleixpol@kde.org"));
KAboutData::setApplicationData(aboutData);
......@@ -49,9 +54,10 @@ int main(int argc, char* argv[])
aboutData.processCommandLine(&parser);
if (parser.positionalArguments().count() == 1) {
urlToShare = parser.positionalArguments().constFirst();
const QString kdeconnectHandlerExecutable = QStandardPaths::findExecutable(QStringLiteral("kdeconnect-handler"), { QCoreApplication::applicationDirPath() });
const QString kdeconnectHandlerExecutable =
QStandardPaths::findExecutable(QStringLiteral("kdeconnect-handler"), {QCoreApplication::applicationDirPath()});
if (!kdeconnectHandlerExecutable.isEmpty()) {
QProcess::startDetached(kdeconnectHandlerExecutable, { urlToShare });
QProcess::startDetached(kdeconnectHandlerExecutable, {urlToShare});
return 0; // exit the app once kdeconnect-handler is started
}
}
......
This diff is collapsed.
......@@ -7,14 +7,17 @@
#include "bluetoothdevicelink.h"
#include "../linkprovider.h"
#include "bluetoothdownloadjob.h"
#include "bluetoothlinkprovider.h"
#include "bluetoothuploadjob.h"
#include "bluetoothdownloadjob.h"
#include "core_debug.h"
#include "connectionmultiplexer.h"
#include "core_debug.h"
#include "multiplexchannel.h"
BluetoothDeviceLink::BluetoothDeviceLink(const QString& deviceId, LinkProvider* parent, ConnectionMultiplexer* connection, QSharedPointer<MultiplexChannel> socket)
BluetoothDeviceLink::BluetoothDeviceLink(const QString &deviceId,
LinkProvider *parent,
ConnectionMultiplexer *connection,
QSharedPointer<MultiplexChannel> socket)
: DeviceLink(deviceId, parent)
, mSocketReader(new DeviceLineReader(socket.data(), this))
, mConnection(connection)
......@@ -23,10 +26,10 @@ BluetoothDeviceLink::BluetoothDeviceLink(const QString& deviceId, LinkProvider*
{
connect(mSocketReader, &DeviceLineReader::readyRead, this, &BluetoothDeviceLink::dataReceived);
//We take ownership of the connection.
//When the link provider destroys us,
//the socket (and the reader) will be
//destroyed as well
// We take ownership of the connection.
// When the link provider destroys us,
// the socket (and the reader) will be
// destroyed as well
mConnection->setParent(this);
connect(socket.data(), &MultiplexChannel::aboutToClose, this, &QObject::deleteLater);
}
......@@ -36,49 +39,53 @@ QString BluetoothDeviceLink::name()
return QStringLiteral("BluetoothLink"); // Should be same in both android and kde version
}
bool BluetoothDeviceLink::sendPacket(NetworkPacket& np)
bool BluetoothDeviceLink::sendPacket(NetworkPacket &np)
{
if (np.hasPayload()) {
BluetoothUploadJob* uploadJob = new BluetoothUploadJob(np.payload(), mConnection, this);
BluetoothUploadJob *uploadJob = new BluetoothUploadJob(np.payload(), mConnection, this);
np.setPayloadTransferInfo(uploadJob->transferInfo());
uploadJob->start();
}
//TODO: handle too-big packets
// TODO: handle too-big packets
int written = mSocketReader->write(np.serialize());
return (written != -1);
}
void BluetoothDeviceLink::userRequestsPair() {
void BluetoothDeviceLink::userRequestsPair()
{
mPairingHandler->requestPairing();
}
void BluetoothDeviceLink::userRequestsUnpair() {
void BluetoothDeviceLink::userRequestsUnpair()
{
mPairingHandler->unpair();
}
bool BluetoothDeviceLink::linkShouldBeKeptAlive() {
bool BluetoothDeviceLink::linkShouldBeKeptAlive()
{
return pairStatus() == Paired;
}
void BluetoothDeviceLink::dataReceived()
{
if (mSocketReader->bytesAvailable() == 0) return;
if (mSocketReader->bytesAvailable() == 0)
return;
const QByteArray serializedPacket = mSocketReader->readLine();
//qCDebug(KDECONNECT_CORE) << "BluetoothDeviceLink dataReceived" << packet;
// qCDebug(KDECONNECT_CORE) << "BluetoothDeviceLink dataReceived" << packet;
NetworkPacket packet((QString()));
NetworkPacket::unserialize(serializedPacket, &packet);
if (packet.type() == PACKET_TYPE_PAIR) {
//TODO: Handle pair/unpair requests and forward them (to the pairing handler?)
// TODO: Handle pair/unpair requests and forward them (to the pairing handler?)
mPairingHandler->packetReceived(packet);
return;
}
if (packet.hasPayloadTransferInfo()) {
BluetoothDownloadJob* downloadJob = new BluetoothDownloadJob(mConnection, packet.payloadTransferInfo(), this);
BluetoothDownloadJob *downloadJob = new BluetoothDownloadJob(mConnection, packet.payloadTransferInfo(), this);
downloadJob->start();
packet.setPayload(downloadJob->payload(), packet.payloadSize());
}
......
......@@ -7,28 +7,27 @@
#ifndef BLUETOOTHDEVICELINK_H
#define BLUETOOTHDEVICELINK_H
#include <QObject>
#include <QString>
#include <QBluetoothSocket>
#include <QObject>
#include <QSslCertificate>
#include <QString>
#include "../devicelink.h"
#include "../devicelinereader.h"
#include "../devicelink.h"
#include "bluetoothpairinghandler.h"
class ConnectionMultiplexer;
class MultiplexChannel;
class KDECONNECTCORE_EXPORT BluetoothDeviceLink
: public DeviceLink
class KDECONNECTCORE_EXPORT BluetoothDeviceLink : public DeviceLink
{
Q_OBJECT
public:
BluetoothDeviceLink(const QString& deviceId, LinkProvider* parent, ConnectionMultiplexer* connection, QSharedPointer<MultiplexChannel> socket);
BluetoothDeviceLink(const QString &deviceId, LinkProvider *parent, ConnectionMultiplexer *connection, QSharedPointer<MultiplexChannel> socket);
virtual QString name() override;
bool sendPacket(NetworkPacket& np) override;
bool sendPacket(NetworkPacket &np) override;
virtual void userRequestsPair() override;
virtual void userRequestsUnpair() override;
......@@ -40,13 +39,12 @@ private Q_SLOTS:
void dataReceived();
private:
DeviceLineReader* mSocketReader;
ConnectionMultiplexer* mConnection;
DeviceLineReader *mSocketReader;
ConnectionMultiplexer *mConnection;
QSharedPointer<MultiplexChannel> mChannel;
BluetoothPairingHandler* mPairingHandler;
BluetoothPairingHandler *mPairingHandler;
void sendMessage(const QString mMessage);
};
#endif
......@@ -8,7 +8,7 @@
#include "connectionmultiplexer.h"
#include "multiplexchannel.h"
BluetoothDownloadJob::BluetoothDownloadJob(ConnectionMultiplexer *connection, const QVariantMap& transferInfo, QObject* parent)
BluetoothDownloadJob::BluetoothDownloadJob(ConnectionMultiplexer *connection, const QVariantMap &transferInfo, QObject *parent)
: QObject(parent)
{
QBluetoothUuid id{transferInfo.value(QStringLiteral("uuid")).toString()};
......
......@@ -7,26 +7,26 @@
#ifndef BLUETOOTHDOWNLOADJOB_H
#define BLUETOOTHDOWNLOADJOB_H
#include <QBluetoothAddress>
#include <QBluetoothSocket>
#include <QBluetoothUuid>
#include <QIODevice>
#include <QSharedPointer>
#include <QThread>
#include <QVariantMap>
#include <QSharedPointer>
#include <QBluetoothAddress>
#include <QBluetoothUuid>
#include <QBluetoothSocket>
class ConnectionMultiplexer;
class MultiplexChannel;
class BluetoothDownloadJob
: public QObject
class BluetoothDownloadJob : public QObject
{
Q_OBJECT
public:
explicit BluetoothDownloadJob(ConnectionMultiplexer *connection, const QVariantMap& transferInfo, QObject* parent = 0);
explicit BluetoothDownloadJob(ConnectionMultiplexer *connection, const QVariantMap &transferInfo, QObject *parent = 0);
QSharedPointer<QIODevice> payload() const;
void start();
private:
QSharedPointer<MultiplexChannel> mSocket;
};
......
......@@ -5,10 +5,10 @@
*/
#include "bluetoothlinkprovider.h"
#include "core_debug.h"
#include "bluetoothdevicelink.h"
#include "connectionmultiplexer.h"
#include "core_debug.h"
#include "multiplexchannel.h"
#include "bluetoothdevicelink.h"
#include <QBluetoothServiceInfo>
......@@ -60,15 +60,16 @@ void BluetoothLinkProvider::onStop()
mBluetoothServer->deleteLater();
}
//I'm in a new network, let's be polite and introduce myself
// I'm in a new network, let's be polite and introduce myself
void BluetoothLinkProvider::onNetworkChange()
{
}
void BluetoothLinkProvider::connectError()
{
QBluetoothSocket* socket = qobject_cast<QBluetoothSocket*>(sender());
if (!socket) return;
QBluetoothSocket *socket = qobject_cast<QBluetoothSocket *>(sender());
if (!socket)
return;
qCWarning(KDECONNECT_CORE) << "Couldn't connect to socket:" << socket->errorString();
......@@ -80,13 +81,12 @@ void BluetoothLinkProvider::connectError()
socket->deleteLater();
}
void BluetoothLinkProvider::addLink(BluetoothDeviceLink* deviceLink, const QString& deviceId)
void BluetoothLinkProvider::addLink(BluetoothDeviceLink *deviceLink, const QString &deviceId)
{
QMap< QString, DeviceLink* >::iterator oldLinkIterator = mLinks.find(deviceId);
QMap<QString, DeviceLink *>::iterator oldLinkIterator = mLinks.find(deviceId);
if (oldLinkIterator != mLinks.end()) {
DeviceLink* oldLink = oldLinkIterator.value();
disconnect(oldLink, SIGNAL(destroyed(QObject*)),
this, SLOT(deviceLinkDestroyed(QObject*)));
DeviceLink *oldLink = oldLinkIterator.value();
disconnect(oldLink, SIGNAL(destroyed(QObject *)), this, SLOT(deviceLinkDestroyed(QObject *)));
oldLink->deleteLater();
mLinks.erase(oldLinkIterator);
}
......@@ -94,19 +94,20 @@ void BluetoothLinkProvider::addLink(BluetoothDeviceLink* deviceLink, const QStri
mLinks[deviceId] = deviceLink;
}
void BluetoothLinkProvider::serviceDiscovered(const QBluetoothServiceInfo& old_info) {
void BluetoothLinkProvider::serviceDiscovered(const QBluetoothServiceInfo &old_info)
{
auto info = old_info;
info.setServiceUuid(mServiceUuid);
if (mSockets.contains(info.device().address())) {
return;
}
QBluetoothSocket* socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
QBluetoothSocket *socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
//Delay before sending data
// Delay before sending data
QPointer<QBluetoothSocket> deleteableSocket = socket;
connect(socket, &QBluetoothSocket::connected, this, [this,deleteableSocket]() {
QTimer::singleShot(500, this, [this,deleteableSocket]() {
connect(socket, &QBluetoothSocket::connected, this, [this, deleteableSocket]() {
QTimer::singleShot(500, this, [this, deleteableSocket]() {
clientConnected(deleteableSocket);
});
});
......@@ -121,10 +122,11 @@ void BluetoothLinkProvider::serviceDiscovered(const QBluetoothServiceInfo& old_i
}
}
//I'm the new device and I'm connected to the existing device. Time to get data.
// I'm the new device and I'm connected to the existing device. Time to get data.
void BluetoothLinkProvider::clientConnected(QPointer<QBluetoothSocket> socket)
{
if (!socket) return;
if (!socket)
return;
auto peer = socket->peerAddress();
......@@ -143,14 +145,20 @@ void BluetoothLinkProvider::clientConnected(QPointer<QBluetoothSocket> socket)
disconnect(socket, nullptr, this, nullptr);
auto channel = QSharedPointer<MultiplexChannel>{multiplexer->getDefaultChannel().release()};
connect(channel.data(), &MultiplexChannel::readyRead, this, [this,peer,channel] () { clientIdentityReceived(peer, channel); });
connect(channel.data(), &MultiplexChannel::aboutToClose, this, [this,peer,channel] () { socketDisconnected(peer, channel.data()); });
connect(channel.data(), &MultiplexChannel::readyRead, this, [this, peer, channel]() {
clientIdentityReceived(peer, channel);
});
connect(channel.data(), &MultiplexChannel::aboutToClose, this, [this, peer, channel]() {
socketDisconnected(peer, channel.data());
});
if (channel->bytesAvailable()) clientIdentityReceived(peer, channel);
if (!channel->isOpen()) socketDisconnected(peer, channel.data());
if (channel->bytesAvailable())
clientIdentityReceived(peer, channel);
if (!channel->isOpen())
socketDisconnected(peer, channel.data());
}
//I'm the new device and the existing device sent me data.
// I'm the new device and the existing device sent me data.
void BluetoothLinkProvider::clientIdentityReceived(const QBluetoothAddress &peer, QSharedPointer<MultiplexChannel> socket)
{
socket->startTransaction();
......@@ -177,26 +185,24 @@ void BluetoothLinkProvider::clientIdentityReceived(const QBluetoothAddress &peer
qCDebug(KDECONNECT_CORE()) << "Received identity packet from" << peer;
//TODO?
//disconnect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError()));
// TODO?
// disconnect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError()));
const QString& deviceId = receivedPacket.get<QString>(QStringLiteral("deviceId"));
BluetoothDeviceLink* deviceLink = new BluetoothDeviceLink(deviceId, this, mSockets[peer], socket);
const QString &deviceId = receivedPacket.get<QString>(QStringLiteral("deviceId"));
BluetoothDeviceLink *deviceLink = new BluetoothDeviceLink(deviceId, this, mSockets[peer], socket);
NetworkPacket np2;
NetworkPacket::createIdentityPacket(&np2);
success = deviceLink->sendPacket(np2);
if (success) {
qCDebug(KDECONNECT_CORE) << "Handshaking done (I'm the new device)";
connect(deviceLink, SIGNAL(destroyed(QObject*)),
this, SLOT(deviceLinkDestroyed(QObject*)));
connect(deviceLink, SIGNAL(destroyed(QObject *)), this, SLOT(deviceLinkDestroyed(QObject *)));
Q_EMIT onConnectionReceived(receivedPacket, deviceLink);
//We kill any possible link from this same device
// We kill any possible link from this same device
addLink(deviceLink, deviceId);
} else {
......@@ -204,13 +210,13 @@ void BluetoothLinkProvider::clientIdentityReceived(const QBluetoothAddress &peer
delete deviceLink;
}
//We don't delete the socket because now it's owned by the BluetoothDeviceLink
// We don't delete the socket because now it's owned by the BluetoothDeviceLink
}
//I'm the existing device, a new device is kindly introducing itself.
// I'm the existing device, a new device is kindly introducing itself.
void BluetoothLinkProvider::serverNewConnection()
{
QBluetoothSocket* socket = mBluetoothServer->nextPendingConnection();
QBluetoothSocket *socket = mBluetoothServer->nextPendingConnection();
qCDebug(KDECONNECT_CORE()) << "Received connection from" << socket->peerAddress();
......@@ -229,8 +235,12 @@ void BluetoothLinkProvider::serverNewConnection()
disconnect(socket, nullptr, this, nullptr);
auto channel = QSharedPointer<MultiplexChannel>{multiplexer->getDefaultChannel().release()};
connect(channel.data(), &MultiplexChannel::readyRead, this, [this,peer,channel] () { serverDataReceived(peer, channel); });
connect(channel.data(), &MultiplexChannel::aboutToClose, this, [this,peer,channel] () { socketDisconnected(peer, channel.data()); });
connect(channel.data(), &MultiplexChannel::readyRead, this, [this, peer, channel]() {
serverDataReceived(peer, channel);
});
connect(channel.data(), &MultiplexChannel::aboutToClose, this, [this, peer, channel]() {
socketDisconnected(peer, channel.data());
});
if (!channel->isOpen()) {
socketDisconnected(peer, channel.data());
......@@ -244,7 +254,7 @@ void BluetoothLinkProvider::serverNewConnection()
qCDebug(KDECONNECT_CORE()) << "Sent identity packet to" << socket->peerAddress();
}
//I'm the existing device and this is the answer to my identity packet (data received)
// I'm the existing device and this is the answer to my identity packet (data received)
void BluetoothLinkProvider::serverDataReceived(const QBluetoothAddress &peer, QSharedPointer<MultiplexChannel> socket)
{
QByteArray identityArray;
......@@ -272,22 +282,21 @@ void BluetoothLinkProvider::serverDataReceived(const QBluetoothAddress &peer, QS
qCDebug(KDECONNECT_CORE()) << "Received identity packet from" << peer;
const QString& deviceId = receivedPacket.get<QString>(QStringLiteral("deviceId"));
BluetoothDeviceLink* deviceLink = new BluetoothDeviceLink(deviceId, this, mSockets[peer], socket);
const QString &deviceId = receivedPacket.get<QString>(QStringLiteral("deviceId"));
BluetoothDeviceLink *deviceLink = new BluetoothDeviceLink(deviceId, this, mSockets[peer], socket);
connect(deviceLink, SIGNAL(destroyed(QObject*)),
this, SLOT(deviceLinkDestroyed(QObject*)));
connect(deviceLink, SIGNAL(destroyed(QObject *)), this, SLOT(deviceLinkDestroyed(QObject *)));
Q_EMIT onConnectionReceived(receivedPacket, deviceLink);
addLink(deviceLink, deviceId);
}
void BluetoothLinkProvider::deviceLinkDestroyed(QObject* destroyedDeviceLink)
void BluetoothLinkProvider::deviceLinkDestroyed(QObject *destroyedDeviceLink)
{
const QString id = destroyedDeviceLink->property("deviceId").toString();
qCDebug(KDECONNECT_CORE()) << "Device disconnected:" << id;
QMap< QString, DeviceLink* >::iterator oldLinkIterator = mLinks.find(id);
QMap<QString, DeviceLink *>::iterator oldLinkIterator = mLinks.find(id);
if (oldLinkIterator != mLinks.end() && oldLinkIterator.value() == destroyedDeviceLink) {
mLinks.erase(oldLinkIterator);
}
......@@ -303,5 +312,4 @@ void BluetoothLinkProvider::socketDisconnected(const QBluetoothAddress &peer, Mu
BluetoothLinkProvider::~BluetoothLinkProvider()
{
}
......@@ -7,16 +7,16 @@
#ifndef BLUETOOTHLINKPROVIDER_H
#define BLUETOOTHLINKPROVIDER_H
#include <QObject>
#include <QPointer>
#include <QTimer>
#include <QBluetoothAddress>
#include <QBluetoothDeviceDiscoveryAgent>
#include <QBluetoothLocalDevice>
#include <QBluetoothUuid>
#include <QBluetoothServer>
#include <QBluetoothDeviceDiscoveryAgent>
#include <QBluetoothServiceDiscoveryAgent>
#include <QBluetoothSocket>
#include <QBluetoothUuid>
#include <QObject>
#include <QPointer>
#include <QTimer>
#include "../linkprovider.h"
......@@ -24,8 +24,7 @@ class BluetoothDeviceLink;
class ConnectionMultiplexer;
class MultiplexChannel;
class KDECONNECTCORE_EXPORT BluetoothLinkProvider
: public LinkProvider
class KDECONNECTCORE_EXPORT BluetoothLinkProvider : public LinkProvider
{
Q_OBJECT
......@@ -33,8 +32,14 @@ public:
BluetoothLinkProvider();
virtual ~BluetoothLinkProvider();
QString name() override { return QStringLiteral("BluetoothLinkProvider"); }
int priority() override { return PRIORITY_MEDIUM; }
QString name() override
{
return QStringLiteral("BluetoothLinkProvider");
}
int priority() override
{
return PRIORITY_MEDIUM;
}
public Q_SLOTS:
virtual void onNetworkChange() override;
......@@ -43,7 +48,7 @@ public Q_SLOTS:
void connectError();
private Q_SLOTS:
void deviceLinkDestroyed(QObject* destroyedDeviceLink);
void deviceLinkDestroyed(QObject *destroyedDeviceLink);
void socketDisconnected(const QBluetoothAddress &peerAddress, MultiplexChannel *socket);
void serverNewConnection();
......@@ -54,19 +59,18 @@ private Q_SLOTS:
void serviceDiscovered(const QBluetoothServiceInfo &info);
private:
void addLink(BluetoothDeviceLink* deviceLink, const QString& deviceId);
void addLink(BluetoothDeviceLink *deviceLink, const QString &deviceId);
QList<QBluetoothAddress> getPairedDevices();
QBluetoothUuid mServiceUuid;
QPointer<QBluetoothServer> mBluetoothServer;
QBluetoothServiceInfo mKdeconnectService;
QBluetoothServiceDiscoveryAgent* mServiceDiscoveryAgent;
QTimer* connectTimer;
QMap<QString, DeviceLink*> mLinks;
QBluetoothServiceDiscoveryAgent *mServiceDiscoveryAgent;
QTimer *connectTimer;
QMap<QBluetoothAddress, ConnectionMultiplexer*> mSockets;
QMap<QString, DeviceLink *> mLinks;
QMap<QBluetoothAddress, ConnectionMultiplexer *> mSockets;
};
#endif
......@@ -13,7 +13,7 @@
#include "kdeconnectconfig.h"
#include "networkpackettypes.h"
BluetoothPairingHandler::BluetoothPairingHandler(DeviceLink* deviceLink)
BluetoothPairingHandler::BluetoothPairingHandler(DeviceLink *deviceLink)
: PairingHandler(deviceLink)
, m_status(NotPaired)
{
......@@ -22,7 +22,7 @@ BluetoothPairingHandler::BluetoothPairingHandler(DeviceLink* deviceLink)
connect(&m_pairingTimeout, &QTimer::timeout, this, &BluetoothPairingHandler::pairingTimeout);
}
void BluetoothPairingHandler::packetReceived(const NetworkPacket& np)
void BluetoothPairingHandler::packetReceived(const NetworkPacket &np)
{
qCDebug(KDECONNECT_CORE) << "Pairing packet received!" << np.serialize();
......@@ -31,16 +31,15 @@ void BluetoothPairingHandler::packetReceived(const NetworkPacket& np)
bool wantsPair = np.get<bool>(QStringLiteral("pair"));
if (wantsPair) {
if (isPairRequested()) { //We started pairing
if (isPairRequested()) { // We started pairing
qCDebug(KDECONNECT_CORE) << "Pair answer";
setInternalPairStatus(Paired);
} else {
qCDebug(KDECONNECT_CORE) << "Pair request";
if (isPaired()) { //I'm already paired, but they think I'm not