Commit 60331ccb authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Clazy says all this QStringLiteral and QLatin1String were missing/wrong

parent a1340c80
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
KAboutData aboutData("kdeconnect.app", i18n("Awesome App"), "1.0", i18n("KDE Connect App"), KAboutLicense::GPL, i18n("(c) 2015, Aleix Pol Gonzalez")); KAboutData aboutData(QStringLiteral("kdeconnect.app"), i18n("Awesome App"), QStringLiteral("1.0"), i18n("KDE Connect App"), KAboutLicense::GPL, i18n("(c) 2015, Aleix Pol Gonzalez"));
aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), i18n("Maintainer"), "aleixpol@kde.org"); aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), i18n("Maintainer"), QStringLiteral("aleixpol@kde.org"));
KAboutData::setApplicationData(aboutData); KAboutData::setApplicationData(aboutData);
{ {
...@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) ...@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
kdeclarative.setDeclarativeEngine(&engine); kdeclarative.setDeclarativeEngine(&engine);
kdeclarative.setupBindings(); kdeclarative.setupBindings();
engine.load(QUrl("qrc:/qml/main.qml")); engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
return app.exec(); return app.exec();
} }
This diff is collapsed.
...@@ -34,11 +34,11 @@ ...@@ -34,11 +34,11 @@
DownloadJob::DownloadJob(const QHostAddress &address, const QVariantMap &transferInfo) DownloadJob::DownloadJob(const QHostAddress &address, const QVariantMap &transferInfo)
: KJob() : KJob()
, mAddress(address) , mAddress(address)
, mPort(transferInfo["port"].toInt()) , mPort(transferInfo[QStringLiteral("port")].toInt())
, mSocket(new QSslSocket) , mSocket(new QSslSocket)
, mBuffer(new QBuffer) , mBuffer(new QBuffer)
{ {
LanLinkProvider::configureSslSocket(mSocket.data(), transferInfo.value("deviceId").toString(), true); LanLinkProvider::configureSslSocket(mSocket.data(), transferInfo.value(QStringLiteral("deviceId")).toString(), true);
connect(mSocket.data(), SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketFailed(QAbstractSocket::SocketError))); connect(mSocket.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; });
......
...@@ -56,13 +56,13 @@ void LanDeviceLink::reset(QSslSocket* socket, ConnectionStarted connectionSource ...@@ -56,13 +56,13 @@ void LanDeviceLink::reset(QSslSocket* socket, ConnectionStarted connectionSource
mConnectionSource = connectionSource; mConnectionSource = connectionSource;
QString certString = KdeConnectConfig::instance()->getDeviceProperty(deviceId(), "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);
} }
QString LanDeviceLink::name() QString LanDeviceLink::name()
{ {
return "LanLink"; // Should be same in both android and kde version return QStringLiteral("LanLink"); // Should be same in both android and kde version
} }
bool LanDeviceLink::sendPackage(NetworkPackage& np) bool LanDeviceLink::sendPackage(NetworkPackage& np)
...@@ -106,8 +106,8 @@ void LanDeviceLink::dataReceived() ...@@ -106,8 +106,8 @@ void LanDeviceLink::dataReceived()
//qCDebug(KDECONNECT_CORE) << "HasPayloadTransferInfo"; //qCDebug(KDECONNECT_CORE) << "HasPayloadTransferInfo";
QVariantMap transferInfo = package.payloadTransferInfo(); QVariantMap transferInfo = package.payloadTransferInfo();
//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("useSsl", true); transferInfo.insert(QStringLiteral("useSsl"), true);
transferInfo.insert("deviceId", deviceId()); transferInfo.insert(QStringLiteral("deviceId"), deviceId());
DownloadJob* job = new DownloadJob(mSocketLineReader->peerAddress(), transferInfo); DownloadJob* job = new DownloadJob(mSocketLineReader->peerAddress(), transferInfo);
job->start(); job->start();
package.setPayload(job->getPayload(), package.payloadSize()); package.setPayload(job->getPayload(), package.payloadSize());
...@@ -146,7 +146,7 @@ void LanDeviceLink::setPairStatus(PairStatus status) ...@@ -146,7 +146,7 @@ void LanDeviceLink::setPairStatus(PairStatus 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(!mSocketLineReader->peerCertificate().isNull());
KdeConnectConfig::instance()->setDeviceProperty(deviceId(), "certificate", mSocketLineReader->peerCertificate().toPem()); KdeConnectConfig::instance()->setDeviceProperty(deviceId(), QStringLiteral("certificate"), mSocketLineReader->peerCertificate().toPem());
} }
} }
......
...@@ -126,11 +126,11 @@ void LanLinkProvider::broadcastToNetwork() ...@@ -126,11 +126,11 @@ void LanLinkProvider::broadcastToNetwork()
qCDebug(KDECONNECT_CORE()) << "Broadcasting identity packet"; qCDebug(KDECONNECT_CORE()) << "Broadcasting identity packet";
QHostAddress destAddress = mTestMode? QHostAddress::LocalHost : QHostAddress("255.255.255.255"); QHostAddress destAddress = mTestMode? QHostAddress::LocalHost : QHostAddress(QStringLiteral("255.255.255.255"));
NetworkPackage np(""); NetworkPackage np(QLatin1String(""));
NetworkPackage::createIdentityPackage(&np); NetworkPackage::createIdentityPackage(&np);
np.set("tcpPort", mTcpPort); np.set(QStringLiteral("tcpPort"), mTcpPort);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
//On Windows we need to broadcast from every local IP address to reach all networks //On Windows we need to broadcast from every local IP address to reach all networks
...@@ -171,7 +171,7 @@ void LanLinkProvider::newUdpConnection() //udpBroadcastReceived ...@@ -171,7 +171,7 @@ void LanLinkProvider::newUdpConnection() //udpBroadcastReceived
if (sender.isLoopback() && !mTestMode) if (sender.isLoopback() && !mTestMode)
continue; continue;
NetworkPackage* receivedPackage = new NetworkPackage(""); NetworkPackage* receivedPackage = new NetworkPackage(QLatin1String(""));
bool success = NetworkPackage::unserialize(datagram, receivedPackage); bool success = NetworkPackage::unserialize(datagram, receivedPackage);
//qCDebug(KDECONNECT_CORE) << "udp connection from " << receivedPackage->; //qCDebug(KDECONNECT_CORE) << "udp connection from " << receivedPackage->;
...@@ -183,13 +183,13 @@ void LanLinkProvider::newUdpConnection() //udpBroadcastReceived ...@@ -183,13 +183,13 @@ void LanLinkProvider::newUdpConnection() //udpBroadcastReceived
continue; continue;
} }
if (receivedPackage->get<QString>("deviceId") == KdeConnectConfig::instance()->deviceId()) { if (receivedPackage->get<QString>(QStringLiteral("deviceId")) == KdeConnectConfig::instance()->deviceId()) {
//qCDebug(KDECONNECT_CORE) << "Ignoring my own broadcast"; //qCDebug(KDECONNECT_CORE) << "Ignoring my own broadcast";
delete receivedPackage; delete receivedPackage;
continue; continue;
} }
int tcpPort = receivedPackage->get<int>("tcpPort", PORT); int tcpPort = receivedPackage->get<int>(QStringLiteral("tcpPort"), PORT);
//qCDebug(KDECONNECT_CORE) << "Received Udp identity package from" << sender << " asking for a tcp connection on port " << tcpPort; //qCDebug(KDECONNECT_CORE) << "Received Udp identity package from" << sender << " asking for a tcp connection on port " << tcpPort;
...@@ -210,9 +210,9 @@ void LanLinkProvider::connectError() ...@@ -210,9 +210,9 @@ void LanLinkProvider::connectError()
disconnect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectError())); disconnect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectError()));
qCDebug(KDECONNECT_CORE) << "Fallback (1), try reverse connection (send udp packet)" << socket->errorString(); qCDebug(KDECONNECT_CORE) << "Fallback (1), try reverse connection (send udp packet)" << socket->errorString();
NetworkPackage np(""); NetworkPackage np(QLatin1String(""));
NetworkPackage::createIdentityPackage(&np); NetworkPackage::createIdentityPackage(&np);
np.set("tcpPort", mTcpPort); np.set(QStringLiteral("tcpPort"), mTcpPort);
mUdpSocket.writeDatagram(np.serialize(), receivedIdentityPackages[socket].sender, PORT); mUdpSocket.writeDatagram(np.serialize(), receivedIdentityPackages[socket].sender, PORT);
//The socket we created didn't work, and we didn't manage //The socket we created didn't work, and we didn't manage
...@@ -237,11 +237,11 @@ void LanLinkProvider::connected() ...@@ -237,11 +237,11 @@ void LanLinkProvider::connected()
connect(socket, &QAbstractSocket::disconnected, socket, &QObject::deleteLater); connect(socket, &QAbstractSocket::disconnected, socket, &QObject::deleteLater);
NetworkPackage* receivedPackage = receivedIdentityPackages[socket].np; NetworkPackage* receivedPackage = receivedIdentityPackages[socket].np;
const QString& deviceId = receivedPackage->get<QString>("deviceId"); const QString& deviceId = receivedPackage->get<QString>(QStringLiteral("deviceId"));
//qCDebug(KDECONNECT_CORE) << "Connected" << socket->isWritable(); //qCDebug(KDECONNECT_CORE) << "Connected" << socket->isWritable();
// If network is on ssl, do not believe when they are connected, believe when handshake is completed // If network is on ssl, do not believe when they are connected, believe when handshake is completed
NetworkPackage np2(""); NetworkPackage np2(QLatin1String(""));
NetworkPackage::createIdentityPackage(&np2); NetworkPackage::createIdentityPackage(&np2);
socket->write(np2.serialize()); socket->write(np2.serialize());
bool success = socket->waitForBytesWritten(); bool success = socket->waitForBytesWritten();
...@@ -251,7 +251,7 @@ void LanLinkProvider::connected() ...@@ -251,7 +251,7 @@ void LanLinkProvider::connected()
qCDebug(KDECONNECT_CORE) << "TCP connection done (i'm the existing device)"; qCDebug(KDECONNECT_CORE) << "TCP connection done (i'm the existing device)";
// if ssl supported // if ssl supported
if (receivedPackage->get<int>("protocolVersion") >= MIN_VERSION_WITH_SSL_SUPPORT) { if (receivedPackage->get<int>(QStringLiteral("protocolVersion")) >= MIN_VERSION_WITH_SSL_SUPPORT) {
bool isDeviceTrusted = KdeConnectConfig::instance()->trustedDevices().contains(deviceId); bool isDeviceTrusted = KdeConnectConfig::instance()->trustedDevices().contains(deviceId);
configureSslSocket(socket, deviceId, isDeviceTrusted); configureSslSocket(socket, deviceId, isDeviceTrusted);
...@@ -268,7 +268,7 @@ void LanLinkProvider::connected() ...@@ -268,7 +268,7 @@ void LanLinkProvider::connected()
return; // Return statement prevents from deleting received package, needed in slot "encrypted" return; // Return statement prevents from deleting received package, needed in slot "encrypted"
} else { } else {
qWarning() << receivedPackage->get<QString>("deviceName") << "uses an old protocol version, this won't work"; qWarning() << receivedPackage->get<QString>(QStringLiteral("deviceName")) << "uses an old protocol version, this won't work";
//addLink(deviceId, socket, receivedPackage, LanDeviceLink::Remotely); //addLink(deviceId, socket, receivedPackage, LanDeviceLink::Remotely);
} }
...@@ -296,7 +296,7 @@ void LanLinkProvider::encrypted() ...@@ -296,7 +296,7 @@ void LanLinkProvider::encrypted()
LanDeviceLink::ConnectionStarted connectionOrigin = (socket->mode() == QSslSocket::SslClientMode)? LanDeviceLink::Locally : LanDeviceLink::Remotely; LanDeviceLink::ConnectionStarted connectionOrigin = (socket->mode() == QSslSocket::SslClientMode)? LanDeviceLink::Locally : LanDeviceLink::Remotely;
NetworkPackage* receivedPackage = receivedIdentityPackages[socket].np; NetworkPackage* receivedPackage = receivedIdentityPackages[socket].np;
const QString& deviceId = receivedPackage->get<QString>("deviceId"); const QString& deviceId = receivedPackage->get<QString>(QStringLiteral("deviceId"));
addLink(deviceId, socket, receivedPackage, connectionOrigin); addLink(deviceId, socket, receivedPackage, connectionOrigin);
...@@ -364,7 +364,7 @@ void LanLinkProvider::dataReceived() ...@@ -364,7 +364,7 @@ void LanLinkProvider::dataReceived()
//qCDebug(KDECONNECT_CORE) << "LanLinkProvider received reply:" << data; //qCDebug(KDECONNECT_CORE) << "LanLinkProvider received reply:" << data;
NetworkPackage* np = new NetworkPackage(""); NetworkPackage* np = new NetworkPackage(QLatin1String(""));
bool success = NetworkPackage::unserialize(data, np); bool success = NetworkPackage::unserialize(data, np);
if (!success) { if (!success) {
...@@ -381,13 +381,13 @@ void LanLinkProvider::dataReceived() ...@@ -381,13 +381,13 @@ void LanLinkProvider::dataReceived()
// Needed in "encrypted" if ssl is used, similar to "connected" // Needed in "encrypted" if ssl is used, similar to "connected"
receivedIdentityPackages[socket].np = np; receivedIdentityPackages[socket].np = np;
const QString& deviceId = np->get<QString>("deviceId"); const QString& deviceId = np->get<QString>(QStringLiteral("deviceId"));
//qCDebug(KDECONNECT_CORE) << "Handshaking done (i'm the new device)"; //qCDebug(KDECONNECT_CORE) << "Handshaking done (i'm the new device)";
//This socket will now be owned by the LanDeviceLink or we don't want more data to be received, forget about it //This socket will now be owned by the LanDeviceLink or we don't want more data to be received, forget about it
disconnect(socket, &QIODevice::readyRead, this, &LanLinkProvider::dataReceived); disconnect(socket, &QIODevice::readyRead, this, &LanLinkProvider::dataReceived);
if (np->get<int>("protocolVersion") >= MIN_VERSION_WITH_SSL_SUPPORT) { if (np->get<int>(QStringLiteral("protocolVersion")) >= MIN_VERSION_WITH_SSL_SUPPORT) {
bool isDeviceTrusted = KdeConnectConfig::instance()->trustedDevices().contains(deviceId); bool isDeviceTrusted = KdeConnectConfig::instance()->trustedDevices().contains(deviceId);
configureSslSocket(socket, deviceId, isDeviceTrusted); configureSslSocket(socket, deviceId, isDeviceTrusted);
...@@ -403,7 +403,7 @@ void LanLinkProvider::dataReceived() ...@@ -403,7 +403,7 @@ void LanLinkProvider::dataReceived()
socket->startClientEncryption(); socket->startClientEncryption();
} else { } else {
qWarning() << np->get<QString>("deviceName") << "uses an old protocol version, this won't work"; qWarning() << np->get<QString>(QStringLiteral("deviceName")) << "uses an old protocol version, this won't work";
//addLink(deviceId, socket, np, LanDeviceLink::Locally); //addLink(deviceId, socket, np, LanDeviceLink::Locally);
delete receivedIdentityPackages.take(socket).np; delete receivedIdentityPackages.take(socket).np;
} }
...@@ -429,11 +429,11 @@ void LanLinkProvider::configureSslSocket(QSslSocket* socket, const QString& devi ...@@ -429,11 +429,11 @@ void LanLinkProvider::configureSslSocket(QSslSocket* socket, const QString& devi
// Top 3 ciphers are for new Android devices, botton two are for old Android devices // Top 3 ciphers are for new Android devices, botton two are for old Android devices
// FIXME : These cipher suites should be checked whether they are supported or not on device // FIXME : These cipher suites should be checked whether they are supported or not on device
QList<QSslCipher> socketCiphers; QList<QSslCipher> socketCiphers;
socketCiphers.append(QSslCipher("ECDHE-ECDSA-AES256-GCM-SHA384")); socketCiphers.append(QSslCipher(QStringLiteral("ECDHE-ECDSA-AES256-GCM-SHA384")));
socketCiphers.append(QSslCipher("ECDHE-ECDSA-AES128-GCM-SHA256")); socketCiphers.append(QSslCipher(QStringLiteral("ECDHE-ECDSA-AES128-GCM-SHA256")));
socketCiphers.append(QSslCipher("ECDHE-RSA-AES128-SHA")); socketCiphers.append(QSslCipher(QStringLiteral("ECDHE-RSA-AES128-SHA")));
socketCiphers.append(QSslCipher("RC4-SHA")); socketCiphers.append(QSslCipher(QStringLiteral("RC4-SHA")));
socketCiphers.append(QSslCipher("RC4-MD5")); socketCiphers.append(QSslCipher(QStringLiteral("RC4-MD5")));
// Configure for ssl // Configure for ssl
QSslConfiguration sslConfig; QSslConfiguration sslConfig;
...@@ -446,7 +446,7 @@ void LanLinkProvider::configureSslSocket(QSslSocket* socket, const QString& devi ...@@ -446,7 +446,7 @@ void LanLinkProvider::configureSslSocket(QSslSocket* socket, const QString& devi
socket->setPeerVerifyName(deviceId); socket->setPeerVerifyName(deviceId);
if (isDeviceTrusted) { if (isDeviceTrusted) {
QString certString = KdeConnectConfig::instance()->getDeviceProperty(deviceId, "certificate", QString()); QString certString = KdeConnectConfig::instance()->getDeviceProperty(deviceId, QStringLiteral("certificate"), QString());
socket->addCaCertificate(QSslCertificate(certString.toLatin1())); socket->addCaCertificate(QSslCertificate(certString.toLatin1()));
socket->setPeerVerifyMode(QSslSocket::VerifyPeer); socket->setPeerVerifyMode(QSslSocket::VerifyPeer);
} else { } else {
......
...@@ -44,7 +44,7 @@ public: ...@@ -44,7 +44,7 @@ public:
LanLinkProvider(bool testMode = false); LanLinkProvider(bool testMode = false);
~LanLinkProvider() override; ~LanLinkProvider() override;
QString name() override { return "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);
......
...@@ -40,7 +40,7 @@ void LanPairingHandler::packageReceived(const NetworkPackage& np) ...@@ -40,7 +40,7 @@ void LanPairingHandler::packageReceived(const NetworkPackage& np)
{ {
m_pairingTimeout.stop(); m_pairingTimeout.stop();
bool wantsPair = np.get<bool>("pair"); bool wantsPair = np.get<bool>(QStringLiteral("pair"));
if (wantsPair) { if (wantsPair) {
......
...@@ -30,7 +30,7 @@ LoopbackDeviceLink::LoopbackDeviceLink(const QString& deviceId, LoopbackLinkProv ...@@ -30,7 +30,7 @@ LoopbackDeviceLink::LoopbackDeviceLink(const QString& deviceId, LoopbackLinkProv
QString LoopbackDeviceLink::name() QString LoopbackDeviceLink::name()
{ {
return "LoopbackLink"; return QStringLiteral("LoopbackLink");
} }
bool LoopbackDeviceLink::sendPackage(NetworkPackage& input) bool LoopbackDeviceLink::sendPackage(NetworkPackage& input)
......
...@@ -35,7 +35,7 @@ LoopbackLinkProvider::~LoopbackLinkProvider() ...@@ -35,7 +35,7 @@ LoopbackLinkProvider::~LoopbackLinkProvider()
void LoopbackLinkProvider::onNetworkChange() void LoopbackLinkProvider::onNetworkChange()
{ {
LoopbackDeviceLink* newLoopbackDeviceLink = new LoopbackDeviceLink("loopback", this); LoopbackDeviceLink* newLoopbackDeviceLink = new LoopbackDeviceLink(QStringLiteral("loopback"), this);
Q_EMIT onConnectionReceived(identityPackage, newLoopbackDeviceLink); Q_EMIT onConnectionReceived(identityPackage, newLoopbackDeviceLink);
if (loopbackDeviceLink) { if (loopbackDeviceLink) {
......
...@@ -33,7 +33,7 @@ public: ...@@ -33,7 +33,7 @@ public:
LoopbackLinkProvider(); LoopbackLinkProvider();
~LoopbackLinkProvider() override; ~LoopbackLinkProvider() override;
QString name() override { return "LoopbackLinkProvider"; } QString name() override { return QStringLiteral("LoopbackLinkProvider"); }
int priority() override { return PRIORITY_LOW; } int priority() override { return PRIORITY_LOW; }
void onStart() override; void onStart() override;
......
...@@ -85,8 +85,8 @@ Daemon::Daemon(QObject *parent, bool testMode) ...@@ -85,8 +85,8 @@ Daemon::Daemon(QObject *parent, bool testMode)
} }
//Register on DBus //Register on DBus
QDBusConnection::sessionBus().registerService("org.kde.kdeconnect"); QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.kdeconnect"));
QDBusConnection::sessionBus().registerObject("/modules/kdeconnect", this, QDBusConnection::ExportScriptableContents); QDBusConnection::sessionBus().registerObject(QStringLiteral("/modules/kdeconnect"), this, QDBusConnection::ExportScriptableContents);
qCDebug(KDECONNECT_CORE) << "KdeConnect daemon started"; qCDebug(KDECONNECT_CORE) << "KdeConnect daemon started";
} }
...@@ -165,12 +165,12 @@ QStringList Daemon::devices(bool onlyReachable, bool onlyTrusted) const ...@@ -165,12 +165,12 @@ QStringList Daemon::devices(bool onlyReachable, bool onlyTrusted) const
void Daemon::onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink* dl) void Daemon::onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink* dl)
{ {
const QString& id = identityPackage.get<QString>("deviceId"); const QString& id = identityPackage.get<QString>(QStringLiteral("deviceId"));
//qCDebug(KDECONNECT_CORE) << "Device discovered" << id << "via" << dl->provider()->name(); //qCDebug(KDECONNECT_CORE) << "Device discovered" << id << "via" << dl->provider()->name();
if (d->mDevices.contains(id)) { if (d->mDevices.contains(id)) {
qCDebug(KDECONNECT_CORE) << "It is a known device" << identityPackage.get<QString>("deviceName"); qCDebug(KDECONNECT_CORE) << "It is a known device" << identityPackage.get<QString>(QStringLiteral("deviceName"));
Device* device = d->mDevices[id]; Device* device = d->mDevices[id];
bool wasReachable = device->isReachable(); bool wasReachable = device->isReachable();
device->addLink(identityPackage, dl); device->addLink(identityPackage, dl);
...@@ -178,7 +178,7 @@ void Daemon::onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink* ...@@ -178,7 +178,7 @@ void Daemon::onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink*
Q_EMIT deviceVisibilityChanged(id, true); Q_EMIT deviceVisibilityChanged(id, true);
} }
} else { } else {
qCDebug(KDECONNECT_CORE) << "It is a new device" << identityPackage.get<QString>("deviceName"); qCDebug(KDECONNECT_CORE) << "It is a new device" << identityPackage.get<QString>(QStringLiteral("deviceName"));
Device* device = new Device(this, identityPackage, dl); Device* device = new Device(this, identityPackage, dl);
//we discard the connections that we created but it's not paired. //we discard the connections that we created but it's not paired.
......
...@@ -27,7 +27,7 @@ namespace DbusHelper { ...@@ -27,7 +27,7 @@ namespace DbusHelper {
void filterNonExportableCharacters(QString& s) void filterNonExportableCharacters(QString& s)
{ {
static QRegExp regexp("[^A-Za-z0-9_]", Qt::CaseSensitive, QRegExp::Wildcard); static QRegExp regexp("[^A-Za-z0-9_]", Qt::CaseSensitive, QRegExp::Wildcard);
s.replace(regexp,"_"); s.replace(regexp,QLatin1String("_"));
} }
} }
...@@ -68,8 +68,8 @@ Device::Device(QObject* parent, const QString& id) ...@@ -68,8 +68,8 @@ Device::Device(QObject* parent, const QString& id)
Device::Device(QObject* parent, const NetworkPackage& identityPackage, DeviceLink* dl) Device::Device(QObject* parent, const NetworkPackage& identityPackage, DeviceLink* dl)
: QObject(parent) : QObject(parent)
, m_deviceId(identityPackage.get<QString>("deviceId")) , m_deviceId(identityPackage.get<QString>(QStringLiteral("deviceId")))
, m_deviceName(identityPackage.get<QString>("deviceName")) , m_deviceName(identityPackage.get<QString>(QStringLiteral("deviceName")))
{ {
addLink(identityPackage, dl); addLink(identityPackage, dl);
...@@ -108,7 +108,7 @@ void Device::reloadPlugins() ...@@ -108,7 +108,7 @@ void Device::reloadPlugins()
const KPluginMetaData service = loader->getPluginInfo(pluginName); const KPluginMetaData service = loader->getPluginInfo(pluginName);
const bool pluginEnabled = isPluginEnabled(pluginName); const bool pluginEnabled = isPluginEnabled(pluginName);
const QSet<QString> incomingCapabilities = KPluginMetaData::readStringList(service.rawData(), "X-KdeConnect-SupportedPackageType").toSet(); const QSet<QString> incomingCapabilities = KPluginMetaData::readStringList(service.rawData(), QStringLiteral("X-KdeConnect-SupportedPackageType")).toSet();
if (pluginEnabled) { if (pluginEnabled) {
KdeConnectPlugin* plugin = m_plugins.take(pluginName); KdeConnectPlugin* plugin = m_plugins.take(pluginName);
...@@ -146,7 +146,7 @@ void Device::reloadPlugins() ...@@ -146,7 +146,7 @@ void Device::reloadPlugins()
QString Device::pluginsConfigFile() const QString Device::pluginsConfigFile() const
{ {
return KdeConnectConfig::instance()->deviceConfigDir(id()).absoluteFilePath("config"); return KdeConnectConfig::instance()->deviceConfigDir(id()).absoluteFilePath(QStringLiteral("config"));
} }
void Device::requestPair() void Device::requestPair()
...@@ -206,7 +206,7 @@ void Device::addLink(const NetworkPackage& identityPackage, DeviceLink* link) ...@@ -206,7 +206,7 @@ void Device::addLink(const NetworkPackage& identityPackage, DeviceLink* link)
Q_ASSERT(!m_deviceLinks.contains(link)); Q_ASSERT(!m_deviceLinks.contains(link));
m_protocolVersion = identityPackage.get<int>("protocolVersion", -1); m_protocolVersion = identityPackage.get<int>(QStringLiteral("protocolVersion"), -1);
if (m_protocolVersion != NetworkPackage::ProtocolVersion) { if (m_protocolVersion != NetworkPackage::ProtocolVersion) {
qCWarning(KDECONNECT_CORE) << m_deviceName << "- warning, device uses a different protocol version" << m_protocolVersion << "expected" << NetworkPackage::ProtocolVersion; qCWarning(KDECONNECT_CORE) << m_deviceName << "- warning, device uses a different protocol version" << m_protocolVersion << "expected" << NetworkPackage::ProtocolVersion;
} }
...@@ -217,8 +217,8 @@ void Device::addLink(const NetworkPackage& identityPackage, DeviceLink* link) ...@@ -217,8 +217,8 @@ void Device::addLink(const NetworkPackage& identityPackage, DeviceLink* link)
m_deviceLinks.append(link); m_deviceLinks.append(link);
//re-read the device name from the identityPackage because it could have changed //re-read the device name from the identityPackage because it could have changed
setName(identityPackage.get<QString>("deviceName")); setName(identityPackage.get<QString>(QStringLiteral("deviceName")));
m_deviceType = str2type(identityPackage.get<QString>("deviceType")); m_deviceType = str2type(identityPackage.get<QString>(QStringLiteral("deviceType")));
//Theoretically we will never add two links from the same provider (the provider should destroy //Theoretically we will never add two links from the same provider (the provider should destroy
//the old one before this is called), so we do not have to worry about destroying old links. //the old one before this is called), so we do not have to worry about destroying old links.
...@@ -229,10 +229,10 @@ void Device::addLink(const NetworkPackage& identityPackage, DeviceLink* link) ...@@ -229,10 +229,10 @@ void Device::addLink(const NetworkPackage& identityPackage, DeviceLink* link)
qSort(m_deviceLinks.begin(), m_deviceLinks.end(), lessThan); qSort(m_deviceLinks.begin(), m_deviceLinks.end(), lessThan);
const bool capabilitiesSupported = identityPackage.has("incomingCapabilities") || identityPackage.has("outgoingCapabilities"); const bool capabilitiesSupported = identityPackage.has(QStringLiteral("incomingCapabilities")) || identityPackage.has(QStringLiteral("outgoingCapabilities"));
if (capabilitiesSupported) { if (capabilitiesSupported) {
const QSet<QString> outgoingCapabilities = identityPackage.get<QStringList>("outgoingCapabilities").toSet() const QSet<QString> outgoingCapabilities = identityPackage.get<QStringList>(QStringLiteral("outgoingCapabilities")).toSet()
, incomingCapabilities = identityPackage.get<QStringList>("incomingCapabilities").toSet(); , incomingCapabilities = identityPackage.get<QStringList>(QStringLiteral("incomingCapabilities")).toSet();
m_supportedPlugins = PluginLoader::instance()->pluginsForCapabilities(incomingCapabilities, outgoingCapabilities); m_supportedPlugins = PluginLoader::instance()->pluginsForCapabilities(incomingCapabilities, outgoingCapabilities);
//qDebug() << "new plugins for" << m_deviceName << m_supportedPlugins << incomingCapabilities << outgoingCapabilities; //qDebug() << "new plugins for" << m_deviceName << m_supportedPlugins << incomingCapabilities << outgoingCapabilities;
...@@ -328,19 +328,19 @@ void Device::cleanUnneededLinks() { ...@@ -328,19 +328,19 @@ void Device::cleanUnneededLinks() {
} }
Device::DeviceType Device::str2type(const QString &deviceType) { Device::DeviceType Device::str2type(const QString &deviceType) {
if (deviceType == "desktop") return Desktop; if (deviceType == QLatin1String("desktop")) return Desktop;
if (deviceType == "laptop") return Laptop; if (deviceType == QLatin1String("laptop")) return Laptop;
if (deviceType == "smartphone" || deviceType == "phone") return Phone; if (deviceType == QLatin1String("smartphone") || deviceType == QLatin1String("phone")) return Phone;
if (deviceType == "tablet") return Tablet; if (deviceType == QLatin1String("tablet")) return Tablet;
return Unknown; return Unknown;
} }
QString Device::type2str(Device::DeviceType deviceType) { QString Device::type2str(Device::DeviceType deviceType) {
if (deviceType == Desktop) return "desktop"; if (deviceType == Desktop) return QStringLiteral("desktop");
if (deviceType == Laptop) return "laptop"; if (deviceType == Laptop) return QStringLiteral("laptop");
if (deviceType == Phone) return "smartphone"; if (deviceType == Phone) return QStringLiteral("smartphone");
if (deviceType == Tablet) return "tablet"; if (deviceType == Tablet) return QStringLiteral("tablet");
return "unknown"; return QStringLiteral("unknown");
} }
QString Device::statusIconName() const QString Device::statusIconName() const
...@@ -411,7 +411,7 @@ QString Device::encryptionInfo() const ...@@ -411,7 +411,7 @@ QString Device::encryptionInfo() const
} }
result += i18n("SHA1 fingerprint of your device certificate is: %1\n", localSha1); result += i18n("SHA1 fingerprint of your device certificate is: %1\n", localSha1);
std::string remotePem = KdeConnectConfig::instance()->getDeviceProperty(id(), "certificate").toStdString(); std::string remotePem = KdeConnectConfig::instance()->getDeviceProperty(id(), QStringLiteral("certificate")).toStdString();
QSslCertificate remoteCertificate = QSslCertificate(QByteArray(remotePem.c_str(), (int)remotePem.size())); QSslCertificate remoteCertificate = QSslCertificate(QByteArray(remotePem.c_str(), (int)remotePem.size()));
QString remoteSha1 = QString::fromLatin1(remoteCertificate.digest(digestAlgorithm).toHex()); QString remoteSha1 = QString::fromLatin1(remoteCertificate.digest(digestAlgorithm).toHex());
for (int i = 2; i < remoteSha1.size(); i += 3) { for (int i = 2; i < remoteSha1.size(); i += 3) {
......
...@@ -33,7 +33,7 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64 ...@@ -33,7 +33,7 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64
: KJob() : KJob()
, mOrigin(origin) , mOrigin(origin)
, mReply(Q_NULLPTR) , mReply(Q_NULLPTR)
, mFrom("KDE Connect") , mFrom(QStringLiteral("KDE Connect"))
, mDestination(destination) , mDestination(destination)
, mSpeedBytes(0) , mSpeedBytes(0)
, mWritten(0) , mWritten(0)
...@@ -42,7 +42,7 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64 ...@@ -42,7 +42,7 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64
Q_ASSERT(mOrigin->isReadable()); Q_ASSERT(mOrigin->isReadable());
if (mDestination.scheme().isEmpty()) { if (mDestination.scheme().isEmpty()) {
qCWarning(KDECONNECT_CORE) << "Destination QUrl" << mDestination << "lacks a scheme. Setting its scheme to 'file'."; qCWarning(KDECONNECT_CORE) << "Destination QUrl" << mDestination << "lacks a scheme. Setting its scheme to 'file'.";
mDestination.setScheme("file"); mDestination.setScheme(QStringLiteral("file"));
} }
if (size >= 0) { if (size >= 0) {
......
...@@ -77,14 +77,14 @@ KdeConnectConfig::KdeConnectConfig() ...@@ -77,14 +77,14 @@ KdeConnectConfig::KdeConnectConfig()
QDir().mkpath(baseConfigDir().path()); QDir().mkpath(baseConfigDir().path());
//.config/kdeconnect/config //.config/kdeconnect/config
d->config = new QSettings(baseConfigDir().absoluteFilePath("config"), QSettings::IniFormat); d->config = new QSettings(baseConfigDir().absoluteFilePath(QStringLiteral("config")), QSettings::IniFormat);
d->trusted_devices = new QSettings(baseConfigDir().absoluteFilePath("trusted_devices"), QSettings::IniFormat); d->trusted_devices = new QSettings(baseConfigDir().absoluteFilePath(QStringLiteral("trusted_devices")), QSettings::IniFormat);
//Register my own id if not there yet //Register my own id if not there yet
if (!d->config->contains("id")) { if (!d->config->contains(QStringLiteral("id"))) {
QString uuid = QUuid::createUuid().toString(); QString uuid = QUuid::createUuid().toString();
DbusHelper::filterNonExportableCharacters(uuid); DbusHelper::filterNonExportableCharacters(uuid);
d->config->setValue("id", uuid); d->config->setValue(QStringLiteral("id"), uuid);
d->config->sync(); d->config->sync();
qCDebug(KDECONNECT_CORE) << "My id:" << uuid; qCDebug(KDECONNECT_CORE) << "My id:" << uuid;
} }
...@@ -102,7 +102,7 @@ KdeConnectConfig::KdeConnectConfig() ...@@ -102,7 +102,7 @@ KdeConnectConfig::KdeConnectConfig()
d->privateKey = QCA::KeyGenerator().createRSA(2048); d->privateKey = QCA::KeyGenerator().createRSA(2048);
if (!privKey.open(QIODevice::ReadWrite | QIODevice::Truncate)) { if (!privKey.open(QIODevice::ReadWrite | QIODevice::Truncate)) {
Daemon::instance()->reportError(QLatin1String("KDE Connect"), i18n("Could not store private key file: %1", keyPath)); Daemon::instance()->reportError(QStringLiteral("KDE Connect"), i18n("Could not store private key file: %1", keyPath));
} else { } else {
privKey.setPermissions(strict); privKey.setPermissions(strict);
privKey.write(d->privateKey.toPEM().toLatin1()); privKey.write(d->privateKey.toPEM().toLatin1());
...@@ -126,8 +126,8 @@ KdeConnectConfig::KdeConnectConfig() ...@@ -126,8 +126,8 @@ KdeConnectConfig::KdeConnectConfig()
QDateTime endTime = startTime.addYears(10); QDateTime endTime = startTime.addYears(10);