Commit 72535ecf authored by Jean Vincent's avatar Jean Vincent Committed by Albert Vaca Cintora

Make member variable names, & placement and * placement more coherent

Summary:
Change all member variables to the form m_fooBar because it is the preferred form in Qt (it was half and half between this and mFooBar, and a minority didn't have anything).
Place all references and pointers on the side of the type since it is the majority.

Basically:
 - mFoo -> m_foo
 - foo -> m_foo (if it is a member variable)
 - Type &ref -> Type& ref
 - Type *ptr -> Type* ptr

Reviewers: #kde_connect, nicolasfella, albertvaka

Reviewed By: #kde_connect, nicolasfella, albertvaka

Subscribers: albertvaka, #kde_connect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D7312
parent 5d4821fb
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <KAboutData> #include <KAboutData>
#include <KLocalizedString> #include <KLocalizedString>
int main(int argc, char *argv[]) int main(int argc, char* argv[])
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
KAboutData aboutData(QStringLiteral("kdeconnect.app"), i18n("KDE Connect App"), QStringLiteral("1.0"), i18n("KDE Connect App"), KAboutLicense::GPL, i18n("(c) 2015, Aleix Pol Gonzalez")); KAboutData aboutData(QStringLiteral("kdeconnect.app"), i18n("KDE Connect App"), QStringLiteral("1.0"), i18n("KDE Connect App"), KAboutLicense::GPL, i18n("(c) 2015, Aleix Pol Gonzalez"));
......
...@@ -11,7 +11,6 @@ Name[el]=Εφαρμογή KDE Connect ...@@ -11,7 +11,6 @@ Name[el]=Εφαρμογή KDE Connect
Name[en_GB]=KDE Connect Application Name[en_GB]=KDE Connect Application
Name[es]=Aplicación KDE Connect Name[es]=Aplicación KDE Connect
Name[et]=KDE Connecti rakendus Name[et]=KDE Connecti rakendus
Name[eu]=KDE Connect aplikazioa
Name[fi]=KDE Connect -sovellus Name[fi]=KDE Connect -sovellus
Name[fr]=Application KDE Connect Name[fr]=Application KDE Connect
Name[gl]=Aplicativo de KDE Connect Name[gl]=Aplicativo de KDE Connect
...@@ -48,7 +47,6 @@ GenericName[el]=Συγχρονισμός συσκευών ...@@ -48,7 +47,6 @@ GenericName[el]=Συγχρονισμός συσκευών
GenericName[en_GB]=Device Synchronisation GenericName[en_GB]=Device Synchronisation
GenericName[es]=Sincronización de dispositivos GenericName[es]=Sincronización de dispositivos
GenericName[et]=Seadmete sünkroonimine GenericName[et]=Seadmete sünkroonimine
GenericName[eu]=Galuak sinkronizatzea
GenericName[fi]=Laitteiden synkronointi GenericName[fi]=Laitteiden synkronointi
GenericName[fr]=Synchronisation de périphériques GenericName[fr]=Synchronisation de périphériques
GenericName[gl]=Sincronización de dispositivos GenericName[gl]=Sincronización de dispositivos
...@@ -86,7 +84,6 @@ Comment[el]=Όλες οι συσκευές σας σε μία ...@@ -86,7 +84,6 @@ Comment[el]=Όλες οι συσκευές σας σε μία
Comment[en_GB]=Make all your devices one Comment[en_GB]=Make all your devices one
Comment[es]=Convertir todos sus dispositivos en uno Comment[es]=Convertir todos sus dispositivos en uno
Comment[et]=Kõigi seadmete ühendamine Comment[et]=Kõigi seadmete ühendamine
Comment[eu]=Bat egin zure gailu guztiak
Comment[fi]=Yhdistä kaikki laitteesi toisiinsa Comment[fi]=Yhdistä kaikki laitteesi toisiinsa
Comment[fr]=Unifiez vos périphériques Comment[fr]=Unifiez vos périphériques
Comment[gl]=Unifique os seus dispositivos. Comment[gl]=Unifique os seus dispositivos.
......
...@@ -152,7 +152,7 @@ int main(int argc, char** argv) ...@@ -152,7 +152,7 @@ int main(int argc, char** argv)
QTextStream(stderr) << i18n("waiting for device...") << endl; QTextStream(stderr) << i18n("waiting for device...") << endl;
blockOnReply(iface.acquireDiscoveryMode(id)); blockOnReply(iface.acquireDiscoveryMode(id));
QObject::connect(&iface, &DaemonDbusInterface::deviceAdded, [&](const QString &deviceAddedId) { QObject::connect(&iface, &DaemonDbusInterface::deviceAdded, [&](const QString& deviceAddedId) {
if (device == deviceAddedId) { if (device == deviceAddedId) {
wait.quit(); wait.quit();
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "bluetoothdownloadjob.h" #include "bluetoothdownloadjob.h"
BluetoothDownloadJob::BluetoothDownloadJob(const QBluetoothAddress &remoteAddress, const QVariantMap &transferInfo, QObject *parent) BluetoothDownloadJob::BluetoothDownloadJob(const QBluetoothAddress& remoteAddress, const QVariantMap& transferInfo, QObject* parent)
: QObject(parent) : QObject(parent)
, mRemoteAddress(remoteAddress) , mRemoteAddress(remoteAddress)
, mTransferUuid(QBluetoothUuid(transferInfo.value("uuid").toString())) , mTransferUuid(QBluetoothUuid(transferInfo.value("uuid").toString()))
......
...@@ -34,7 +34,7 @@ class BluetoothDownloadJob ...@@ -34,7 +34,7 @@ class BluetoothDownloadJob
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit BluetoothDownloadJob(const QBluetoothAddress &remoteAddress, const QVariantMap &transferInfo, QObject* parent = 0); explicit BluetoothDownloadJob(const QBluetoothAddress& remoteAddress, const QVariantMap& transferInfo, QObject* parent = 0);
QSharedPointer<QIODevice> payload() const; QSharedPointer<QIODevice> payload() const;
void start(); void start();
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "core_debug.h" #include "core_debug.h"
#include <QCoreApplication> #include <QCoreApplication>
BluetoothUploadJob::BluetoothUploadJob(const QSharedPointer<QIODevice> &data, const QBluetoothAddress &remoteAddress, QObject *parent) BluetoothUploadJob::BluetoothUploadJob(const QSharedPointer<QIODevice>& data, const QBluetoothAddress& remoteAddress, QObject* parent)
: QObject(parent) : QObject(parent)
, mData(data) , mData(data)
, mRemoteAddress(remoteAddress) , mRemoteAddress(remoteAddress)
......
...@@ -34,7 +34,7 @@ class BluetoothUploadJob ...@@ -34,7 +34,7 @@ class BluetoothUploadJob
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit BluetoothUploadJob(const QSharedPointer<QIODevice> &data, const QBluetoothAddress &remoteAddress, QObject* parent = 0); explicit BluetoothUploadJob(const QSharedPointer<QIODevice>& data, const QBluetoothAddress& remoteAddress, QObject* parent = 0);
QVariantMap transferInfo() const; QVariantMap transferInfo() const;
void start(); void start();
......
...@@ -23,33 +23,33 @@ ...@@ -23,33 +23,33 @@
DeviceLineReader::DeviceLineReader(QIODevice* device, QObject* parent) DeviceLineReader::DeviceLineReader(QIODevice* device, QObject* parent)
: QObject(parent) : QObject(parent)
, mDevice(device) , m_device(device)
{ {
connect(mDevice, SIGNAL(readyRead()), connect(m_device, SIGNAL(readyRead()),
this, SLOT(dataReceived())); this, SLOT(dataReceived()));
connect(mDevice, SIGNAL(disconnected()), connect(m_device, SIGNAL(disconnected()),
this, SIGNAL(disconnected())); this, SIGNAL(disconnected()));
} }
void DeviceLineReader::dataReceived() void DeviceLineReader::dataReceived()
{ {
while(mDevice->canReadLine()) { while(m_device->canReadLine()) {
const QByteArray line = mDevice->readLine(); const QByteArray line = m_device->readLine();
if (line.length() > 1) { if (line.length() > 1) {
mPackages.enqueue(line);//we don't want single \n m_packages.enqueue(line);//we don't want single \n
} }
} }
//If we still have things to read from the device, call dataReceived again //If we still have things to read from the device, call dataReceived again
//We do this manually because we do not trust readyRead to be emitted again //We do this manually because we do not trust readyRead to be emitted again
//So we call this method again just in case. //So we call this method again just in case.
if (mDevice->bytesAvailable() > 0) { if (m_device->bytesAvailable() > 0) {
QMetaObject::invokeMethod(this, "dataReceived", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "dataReceived", Qt::QueuedConnection);
return; return;
} }
//If we have any packages, tell it to the world. //If we have any packages, tell it to the world.
if (!mPackages.isEmpty()) { if (!m_packages.isEmpty()) {
Q_EMIT readyRead(); Q_EMIT readyRead();
} }
} }
...@@ -39,9 +39,9 @@ class DeviceLineReader ...@@ -39,9 +39,9 @@ class DeviceLineReader
public: public:
DeviceLineReader(QIODevice* device, QObject* parent = 0); DeviceLineReader(QIODevice* device, QObject* parent = 0);
QByteArray readLine() { return mPackages.dequeue(); } QByteArray readLine() { return m_packages.dequeue(); }
qint64 write(const QByteArray& data) { return mDevice->write(data); } qint64 write(const QByteArray& data) { return m_device->write(data); }
qint64 bytesAvailable() const { return mPackages.size(); } qint64 bytesAvailable() const { return m_packages.size(); }
Q_SIGNALS: Q_SIGNALS:
void readyRead(); void readyRead();
...@@ -51,9 +51,9 @@ private Q_SLOTS: ...@@ -51,9 +51,9 @@ private Q_SLOTS:
void dataReceived(); void dataReceived();
private: private:
QByteArray lastChunk; QByteArray m_lastChunk;
QIODevice* mDevice; QIODevice* m_device;
QQueue<QByteArray> mPackages; QQueue<QByteArray> m_packages;
}; };
......
...@@ -24,10 +24,10 @@ ...@@ -24,10 +24,10 @@
DeviceLink::DeviceLink(const QString& deviceId, LinkProvider* parent) DeviceLink::DeviceLink(const QString& deviceId, LinkProvider* parent)
: QObject(parent) : QObject(parent)
, mPrivateKey(KdeConnectConfig::instance()->privateKey()) , m_privateKey(KdeConnectConfig::instance()->privateKey())
, mDeviceId(deviceId) , m_deviceId(deviceId)
, mLinkProvider(parent) , m_linkProvider(parent)
, mPairStatus(NotPaired) , m_pairStatus(NotPaired)
{ {
Q_ASSERT(!deviceId.isEmpty()); Q_ASSERT(!deviceId.isEmpty());
...@@ -36,8 +36,8 @@ DeviceLink::DeviceLink(const QString& deviceId, LinkProvider* parent) ...@@ -36,8 +36,8 @@ DeviceLink::DeviceLink(const QString& deviceId, LinkProvider* parent)
void DeviceLink::setPairStatus(DeviceLink::PairStatus status) void DeviceLink::setPairStatus(DeviceLink::PairStatus status)
{ {
if (mPairStatus != status) { if (m_pairStatus != status) {
mPairStatus = status; m_pairStatus = status;
Q_EMIT pairStatusChanged(status); Q_EMIT pairStatusChanged(status);
} }
} }
......
...@@ -44,8 +44,8 @@ public: ...@@ -44,8 +44,8 @@ public:
virtual QString name() = 0; virtual QString name() = 0;
const QString& deviceId() const { return mDeviceId; } const QString& deviceId() const { return m_deviceId; }
LinkProvider* provider() { return mLinkProvider; } LinkProvider* provider() { return m_linkProvider; }
virtual bool sendPackage(NetworkPackage& np) = 0; virtual bool sendPackage(NetworkPackage& np) = 0;
...@@ -53,7 +53,7 @@ public: ...@@ -53,7 +53,7 @@ public:
virtual void userRequestsPair() = 0; virtual void userRequestsPair() = 0;
virtual void userRequestsUnpair() = 0; virtual void userRequestsUnpair() = 0;
PairStatus pairStatus() const { return mPairStatus; } PairStatus pairStatus() const { return m_pairStatus; }
virtual void setPairStatus(PairStatus status); virtual void setPairStatus(PairStatus status);
//The daemon will periodically destroy unpaired links if this returns false //The daemon will periodically destroy unpaired links if this returns false
...@@ -63,16 +63,16 @@ Q_SIGNALS: ...@@ -63,16 +63,16 @@ Q_SIGNALS:
void pairingRequest(PairingHandler* handler); void pairingRequest(PairingHandler* handler);
void pairingRequestExpired(PairingHandler* handler); void pairingRequestExpired(PairingHandler* handler);
void pairStatusChanged(DeviceLink::PairStatus status); void pairStatusChanged(DeviceLink::PairStatus status);
void pairingError(const QString &error); void pairingError(const QString& error);
void receivedPackage(const NetworkPackage& np); void receivedPackage(const NetworkPackage& np);
protected: protected:
QCA::PrivateKey mPrivateKey; QCA::PrivateKey m_privateKey;
private: private:
const QString mDeviceId; const QString m_deviceId;
LinkProvider* mLinkProvider; LinkProvider* m_linkProvider;
PairStatus mPairStatus; PairStatus m_pairStatus;
}; };
......
...@@ -31,16 +31,16 @@ ...@@ -31,16 +31,16 @@
#include "lanlinkprovider.h" #include "lanlinkprovider.h"
#include "core/core_debug.h" #include "core/core_debug.h"
DownloadJob::DownloadJob(const QHostAddress &address, const QVariantMap &transferInfo) DownloadJob::DownloadJob(const QHostAddress& address, const QVariantMap& transferInfo)
: KJob() : KJob()
, mAddress(address) , m_address(address)
, mPort(transferInfo[QStringLiteral("port")].toInt()) , m_port(transferInfo[QStringLiteral("port")].toInt())
, mSocket(new QSslSocket) , m_socket(new QSslSocket)
, mBuffer(new QBuffer) , m_buffer(new QBuffer)
{ {
LanLinkProvider::configureSslSocket(mSocket.data(), transferInfo.value(QStringLiteral("deviceId")).toString(), true); LanLinkProvider::configureSslSocket(m_socket.data(), transferInfo.value(QStringLiteral("deviceId")).toString(), true);
connect(mSocket.data(), SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketFailed(QAbstractSocket::SocketError))); connect(m_socket.data(), SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketFailed(QAbstractSocket::SocketError)));
// connect(mSocket.data(), &QAbstractSocket::stateChanged, [](QAbstractSocket::SocketState state){ qDebug() << "statechange" << state; }); // connect(mSocket.data(), &QAbstractSocket::stateChanged, [](QAbstractSocket::SocketState state){ qDebug() << "statechange" << state; });
} }
...@@ -53,27 +53,27 @@ void DownloadJob::start() ...@@ -53,27 +53,27 @@ void DownloadJob::start()
{ {
//TODO: Timeout? //TODO: Timeout?
// Cannot use read only, might be due to ssl handshake, getting QIODevice::ReadOnly error and no connection // Cannot use read only, might be due to ssl handshake, getting QIODevice::ReadOnly error and no connection
mSocket->connectToHostEncrypted(mAddress.toString(), mPort, QIODevice::ReadWrite); m_socket->connectToHostEncrypted(m_address.toString(), m_port, QIODevice::ReadWrite);
bool b = mBuffer->open(QBuffer::ReadWrite); bool b = m_buffer->open(QBuffer::ReadWrite);
Q_ASSERT(b); Q_ASSERT(b);
} }
void DownloadJob::socketFailed(QAbstractSocket::SocketError error) void DownloadJob::socketFailed(QAbstractSocket::SocketError error)
{ {
if (error != QAbstractSocket::RemoteHostClosedError) { //remote host closes when finishes if (error != QAbstractSocket::RemoteHostClosedError) { //remote host closes when finishes
qWarning(KDECONNECT_CORE) << "error..." << mSocket->errorString(); qWarning(KDECONNECT_CORE) << "error..." << m_socket->errorString();
setError(error + 1); setError(error + 1);
setErrorText(mSocket->errorString()); setErrorText(m_socket->errorString());
} else { } else {
auto ba = mSocket->readAll(); auto ba = m_socket->readAll();
mBuffer->write(ba); m_buffer->write(ba);
mBuffer->seek(0); m_buffer->seek(0);
} }
emitResult(); emitResult();
} }
QSharedPointer<QIODevice> DownloadJob::getPayload() QSharedPointer<QIODevice> DownloadJob::getPayload()
{ {
return mBuffer.staticCast<QIODevice>(); return m_buffer.staticCast<QIODevice>();
} }
...@@ -38,16 +38,16 @@ class KDECONNECTCORE_EXPORT DownloadJob ...@@ -38,16 +38,16 @@ class KDECONNECTCORE_EXPORT DownloadJob
{ {
Q_OBJECT Q_OBJECT
public: public:
DownloadJob(const QHostAddress &address, const QVariantMap &transferInfo); DownloadJob(const QHostAddress& address, const QVariantMap& transferInfo);
~DownloadJob() override; ~DownloadJob() override;
void start() override; void start() override;
QSharedPointer<QIODevice> getPayload(); QSharedPointer<QIODevice> getPayload();
private: private:
QHostAddress mAddress; QHostAddress m_address;
qint16 mPort; qint16 m_port;
QSharedPointer<QSslSocket> mSocket; QSharedPointer<QSslSocket> m_socket;
QSharedPointer<QBuffer> mBuffer; QSharedPointer<QBuffer> m_buffer;
private Q_SLOTS: private Q_SLOTS:
void socketFailed(QAbstractSocket::SocketError error); void socketFailed(QAbstractSocket::SocketError error);
......
...@@ -31,30 +31,30 @@ ...@@ -31,30 +31,30 @@
LanDeviceLink::LanDeviceLink(const QString& deviceId, LinkProvider* parent, QSslSocket* socket, ConnectionStarted connectionSource) LanDeviceLink::LanDeviceLink(const QString& deviceId, LinkProvider* parent, QSslSocket* socket, ConnectionStarted connectionSource)
: DeviceLink(deviceId, parent) : DeviceLink(deviceId, parent)
, mSocketLineReader(nullptr) , m_socketLineReader(nullptr)
{ {
reset(socket, connectionSource); reset(socket, connectionSource);
} }
void LanDeviceLink::reset(QSslSocket* socket, ConnectionStarted connectionSource) void LanDeviceLink::reset(QSslSocket* socket, ConnectionStarted connectionSource)
{ {
if (mSocketLineReader) { if (m_socketLineReader) {
disconnect(mSocketLineReader->mSocket, &QAbstractSocket::disconnected, this, &QObject::deleteLater); disconnect(m_socketLineReader->m_socket, &QAbstractSocket::disconnected, this, &QObject::deleteLater);
delete mSocketLineReader; delete m_socketLineReader;
} }
mSocketLineReader = new SocketLineReader(socket, this); m_socketLineReader = new SocketLineReader(socket, this);
connect(socket, &QAbstractSocket::disconnected, this, &QObject::deleteLater); connect(socket, &QAbstractSocket::disconnected, this, &QObject::deleteLater);
connect(mSocketLineReader, &SocketLineReader::readyRead, this, &LanDeviceLink::dataReceived); connect(m_socketLineReader, &SocketLineReader::readyRead, this, &LanDeviceLink::dataReceived);
//We take ownership of the socket. //We take ownership of the socket.
//When the link provider destroys us, //When the link provider destroys us,
//the socket (and the reader) will be //the socket (and the reader) will be
//destroyed as well //destroyed as well
socket->setParent(mSocketLineReader); socket->setParent(m_socketLineReader);
mConnectionSource = connectionSource; m_connectionSource = connectionSource;
QString certString = KdeConnectConfig::instance()->getDeviceProperty(deviceId(), QStringLiteral("certificate")); QString certString = KdeConnectConfig::instance()->getDeviceProperty(deviceId(), QStringLiteral("certificate"));
DeviceLink::setPairStatus(certString.isEmpty()? PairStatus::NotPaired : PairStatus::Paired); DeviceLink::setPairStatus(certString.isEmpty()? PairStatus::NotPaired : PairStatus::Paired);
...@@ -62,10 +62,10 @@ void LanDeviceLink::reset(QSslSocket* socket, ConnectionStarted connectionSource ...@@ -62,10 +62,10 @@ void LanDeviceLink::reset(QSslSocket* socket, ConnectionStarted connectionSource
QHostAddress LanDeviceLink::hostAddress() const QHostAddress LanDeviceLink::hostAddress() const
{ {
if (!mSocketLineReader) { if (!m_socketLineReader) {
return QHostAddress::Null; return QHostAddress::Null;
} }
QHostAddress addr = mSocketLineReader->mSocket->peerAddress(); QHostAddress addr = m_socketLineReader->m_socket->peerAddress();
if (addr.protocol() == QAbstractSocket::IPv6Protocol) { if (addr.protocol() == QAbstractSocket::IPv6Protocol) {
bool success; bool success;
QHostAddress convertedAddr = QHostAddress(addr.toIPv4Address(&success)); QHostAddress convertedAddr = QHostAddress(addr.toIPv4Address(&success));
...@@ -88,7 +88,7 @@ bool LanDeviceLink::sendPackage(NetworkPackage& np) ...@@ -88,7 +88,7 @@ bool LanDeviceLink::sendPackage(NetworkPackage& np)
np.setPayloadTransferInfo(sendPayload(np)->transferInfo()); np.setPayloadTransferInfo(sendPayload(np)->transferInfo());
} }
int written = mSocketLineReader->write(np.serialize()); int written = m_socketLineReader->write(np.serialize());
//Actually we can't detect if a package is received or not. We keep TCP //Actually we can't detect if a package is received or not. We keep TCP
//"ESTABLISHED" connections that look legit (return true when we use them), //"ESTABLISHED" connections that look legit (return true when we use them),
...@@ -105,9 +105,9 @@ UploadJob* LanDeviceLink::sendPayload(const NetworkPackage& np) ...@@ -105,9 +105,9 @@ UploadJob* LanDeviceLink::sendPayload(const NetworkPackage& np)
void LanDeviceLink::dataReceived() void LanDeviceLink::dataReceived()
{ {
if (mSocketLineReader->bytesAvailable() == 0) return; if (m_socketLineReader->bytesAvailable() == 0) return;
const QByteArray serializedPackage = mSocketLineReader->readLine(); const QByteArray serializedPackage = m_socketLineReader->readLine();
NetworkPackage package(QString::null); NetworkPackage package(QString::null);
NetworkPackage::unserialize(serializedPackage, &package); NetworkPackage::unserialize(serializedPackage, &package);
...@@ -125,14 +125,14 @@ void LanDeviceLink::dataReceived() ...@@ -125,14 +125,14 @@ void LanDeviceLink::dataReceived()
//FIXME: The next two lines shouldn't be needed! Why are they here? //FIXME: The next two lines shouldn't be needed! Why are they here?
transferInfo.insert(QStringLiteral("useSsl"), true); transferInfo.insert(QStringLiteral("useSsl"), true);
transferInfo.insert(QStringLiteral("deviceId"), deviceId()); transferInfo.insert(QStringLiteral("deviceId"), deviceId());
DownloadJob* job = new DownloadJob(mSocketLineReader->peerAddress(), transferInfo); DownloadJob* job = new DownloadJob(m_socketLineReader->peerAddress(), transferInfo);
job->start(); job->start();
package.setPayload(job->getPayload(), package.payloadSize()); package.setPayload(job->getPayload(), package.payloadSize());
} }
Q_EMIT receivedPackage(package); Q_EMIT receivedPackage(package);
if (mSocketLineReader->bytesAvailable() > 0) { if (m_socketLineReader->bytesAvailable() > 0) {
QMetaObject::invokeMethod(this, "dataReceived", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "dataReceived", Qt::QueuedConnection);
} }
...@@ -140,7 +140,7 @@ void LanDeviceLink::dataReceived() ...@@ -140,7 +140,7 @@ void LanDeviceLink::dataReceived()
void LanDeviceLink::userRequestsPair() void LanDeviceLink::userRequestsPair()
{ {
if (mSocketLineReader->peerCertificate().isNull()) { if (m_socketLineReader->peerCertificate().isNull()) {
Q_EMIT pairingError(i18n("This device cannot be paired because it is running an old version of KDE Connect.")); Q_EMIT pairingError(i18n("This device cannot be paired because it is running an old version of KDE Connect."));
} else { } else {
qobject_cast<LanLinkProvider*>(provider())->userRequestsPair(deviceId()); qobject_cast<LanLinkProvider*>(provider())->userRequestsPair(deviceId());
...@@ -154,7 +154,7 @@ void LanDeviceLink::userRequestsUnpair() ...@@ -154,7 +154,7 @@ void LanDeviceLink::userRequestsUnpair()
void LanDeviceLink::setPairStatus(PairStatus status) void LanDeviceLink::setPairStatus(PairStatus status)
{ {
if (status == Paired && mSocketLineReader->peerCertificate().isNull()) { if (status == Paired && m_socketLineReader->peerCertificate().isNull()) {
Q_EMIT pairingError(i18n("This device cannot be paired because it is running an old version of KDE Connect.")); Q_EMIT pairingError(i18n("This device cannot be paired because it is running an old version of KDE Connect."));
return; return;
} }
...@@ -162,8 +162,8 @@ void LanDeviceLink::setPairStatus(PairStatus status) ...@@ -162,8 +162,8 @@ void LanDeviceLink::setPairStatus(PairStatus status)
DeviceLink::setPairStatus(status); DeviceLink::setPairStatus(status);
if (status == Paired) { if (status == Paired) {
Q_ASSERT(KdeConnectConfig::instance()->trustedDevices().contains(deviceId())); Q_ASSERT(KdeConnectConfig::instance()->trustedDevices().contains(deviceId()));
Q_ASSERT(!mSocketLineReader->peerCertificate().isNull()); Q_ASSERT(!m_socketLineReader->peerCertificate().isNull());
KdeConnectConfig::instance()->setDeviceProperty(deviceId(), QStringLiteral("certificate"), mSocketLineReader->peerCertificate().toPem()); KdeConnectConfig::instance()->setDeviceProperty(deviceId(), QStringLiteral("certificate"), m_socketLineReader->peerCertificate().toPem());
} }
} }
......
...@@ -60,9 +60,9 @@ private Q_SLOTS: ...@@ -60,9 +60,9 @@ private Q_SLOTS:
void dataReceived(); void dataReceived();
private: private:
SocketLineReader* mSocketLineReader; SocketLineReader* m_socketLineReader;
ConnectionStarted mConnectionSource; ConnectionStarted m_connectionSource;
QHostAddress mHostAddress; QHostAddress m_hostAddress;
}; };
#endif #endif
This diff is collapsed.
...@@ -47,8 +47,8 @@ public: ...@@ -47,8 +47,8 @@ public:
QString name() override { return QStringLiteral("LanLinkProvider"); } QString name() override { return QStringLiteral("LanLinkProvider"); }
int priority() override { return PRIORITY_HIGH; } int priority() override { return PRIORITY_HIGH; }
void userRequestsPair(const QString &deviceId); void userRequestsPair(const QString& deviceId);
void userRequestsUnpair(const QString &deviceId); void userRequestsUnpair(const QString& deviceId);
void incomingPairPackage(DeviceLink* device, const NetworkPackage& np); void incomingPairPackage(DeviceLink* device, const NetworkPackage& np);
static void configureSslSocket(QSslSocket* socket, const QString& deviceId, bool isDeviceTrusted); static void configureSslSocket(QSslSocket* socket, const QString& deviceId, bool isDeviceTrusted);
...@@ -77,24 +77,24 @@ private Q_SLOTS: ...@@ -77,24 +77,24 @@ private Q_SLOTS:
private: private:
LanPairingHandler* createPairingHandler(DeviceLink* link); LanPairingHandler* createPairingHandler(DeviceLink* link);
void onNetworkConfigurationChanged(const QNetworkConfiguration &config); void onNetworkConfigurationChanged(const QNetworkConfiguration& config);
void addLink(const QString& deviceId, QSslSocket* socket, NetworkPackage* receivedPackage, LanDeviceLink::ConnectionStarted connectionOrigin); void addLink(const QString& deviceId, QSslSocket* socket, NetworkPackage* receivedPackage, LanDeviceLink::ConnectionStarted connectionOrigin);
Server* mServer; Server* m_server;
QUdpSocket mUdpSocket; QUdpSocket m_udpSocket;