From e601755644467b151fed5f05ef8aa662542459fe Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Mon, 10 Jun 2019 14:40:28 +0000 Subject: [PATCH] Force usage of QStringLiteral and port remaining offenders --- CMakeLists.txt | 2 +- cli/kdeconnect-cli.cpp | 44 ++++++++-------- .../bluetooth/bluetoothdevicelink.cpp | 2 +- .../bluetooth/bluetoothdownloadjob.cpp | 2 +- .../bluetooth/bluetoothlinkprovider.cpp | 16 +++--- .../bluetooth/bluetoothlinkprovider.h | 2 +- .../bluetooth/bluetoothpairinghandler.cpp | 12 ++--- .../backends/bluetooth/bluetoothuploadjob.cpp | 4 +- core/backends/lan/compositeuploadjob.cpp | 4 +- core/backends/lan/landevicelink.cpp | 2 +- core/backends/lan/lanlinkprovider.cpp | 2 +- core/backends/lan/lanpairinghandler.cpp | 10 ++-- core/backends/lan/server.cpp | 2 +- core/dbushelper.cpp | 2 +- core/device.cpp | 4 +- core/device.h | 2 +- core/kdeconnectconfig.cpp | 8 +-- core/kdeconnectpluginconfig.cpp | 4 +- declarativeplugin/responsewaiter.cpp | 2 +- fileitemactionplugin/sendfileitemaction.cpp | 2 +- indicator/deviceindicator.cpp | 12 ++--- indicator/main.cpp | 8 +-- interfaces/conversationmessage.cpp | 32 ++++++------ interfaces/dbusinterfaces.cpp | 32 ++++++------ kcm/main.cpp | 4 +- kio/kiokdeconnect.cpp | 2 +- plugins/battery/batteryplugin.cpp | 2 +- plugins/clipboard/clipboardplugin.cpp | 2 +- plugins/contacts/contactsplugin.cpp | 18 +++---- plugins/contacts/contactsplugin.h | 2 +- plugins/findmyphone/findmyphoneplugin.cpp | 2 +- .../findthisdevice/findthisdeviceplugin.cpp | 2 +- plugins/lockdevice/lockdeviceplugin.cpp | 8 +-- plugins/mpriscontrol/mpriscontrolplugin-win.h | 2 +- plugins/mpriscontrol/mpriscontrolplugin.cpp | 8 +-- plugins/mprisremote/mprisremoteplugin.cpp | 26 +++++----- plugins/notifications/notification.cpp | 6 +-- .../notificationsdbusinterface.cpp | 6 +-- plugins/notifications/notificationsplugin.cpp | 2 +- plugins/notifications/sendreplydialog.cpp | 2 +- plugins/photo/photoplugin.cpp | 2 +- plugins/ping/pingplugin.cpp | 2 +- .../remotecommands/remotecommandsplugin.cpp | 8 +-- plugins/remotecontrol/remotecontrolplugin.cpp | 6 +-- .../remotekeyboard/remotekeyboardplugin.cpp | 38 +++++++------- .../remotesystemvolumeplugin.cpp | 2 +- plugins/runcommand/runcommandplugin.cpp | 4 +- .../screensaverinhibitplugin.cpp | 2 +- .../notificationslistener.cpp | 14 ++--- plugins/sftp/mounter.cpp | 10 ++-- plugins/sftp/sftpplugin.cpp | 10 ++-- plugins/sftp/sftpplugin.h | 2 +- plugins/share/shareplugin.cpp | 10 ++-- plugins/sms/smsplugin.cpp | 12 ++--- .../systemvolume/systemvolumeplugin-pulse.cpp | 10 ++-- .../systemvolume/systemvolumeplugin-win.cpp | 10 ++-- plugins/telephony/telephonyplugin.cpp | 4 +- .../remotecommands/remotecommandsrunner.cpp | 10 ++-- smsapp/main.cpp | 10 ++-- smsapp/smshelper.cpp | 18 +++---- tests/kdeconnectconfigtest.cpp | 8 +-- tests/lanlinkprovidertest.cpp | 12 ++--- tests/networkpackettests.cpp | 22 ++++---- tests/pluginloadtest.cpp | 8 +-- tests/sendfiletest.cpp | 2 +- tests/testnotificationlistener.cpp | 52 +++++++++---------- urlhandler/kdeconnect-handler.cpp | 2 +- 67 files changed, 298 insertions(+), 298 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d89581d7c..b82da6d64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ else() if(NOT WIN32 AND NOT APPLE) find_package(KF5PulseAudioQt REQUIRED) endif() - add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS) + add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII) endif() find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp index 7c44ca496..5cfa88c4b 100644 --- a/cli/kdeconnect-cli.cpp +++ b/cli/kdeconnect-cli.cpp @@ -78,8 +78,8 @@ int main(int argc, char** argv) //Hidden because it's an implementation detail QCommandLineOption deviceAutocomplete(QStringLiteral("shell-device-autocompletion")); deviceAutocomplete.setHidden(true); - deviceAutocomplete.setDescription("Outputs all available devices id's with their name and paired status"); //Not visible, so no translation needed - deviceAutocomplete.setValueName("shell"); + deviceAutocomplete.setDescription(QStringLiteral("Outputs all available devices id's with their name and paired status")); //Not visible, so no translation needed + deviceAutocomplete.setValueName(QStringLiteral("shell")); parser.addOption(deviceAutocomplete); about.setupCommandLine(&parser); @@ -87,7 +87,7 @@ int main(int argc, char** argv) parser.process(app); about.processCommandLine(&parser); - const QString id = "kdeconnect-cli-"+QString::number(QCoreApplication::applicationPid()); + const QString id = QStringLiteral("kdeconnect-cli-") + QString::number(QCoreApplication::applicationPid()); DaemonDbusInterface iface; if (parser.isSet(QStringLiteral("my-id"))) { @@ -152,15 +152,15 @@ int main(int argc, char** argv) } //Description: "device name (paired/unpaired)" - QString description = deviceIface.name() + " " + statusInfo; + QString description = deviceIface.name() + QLatin1Char(' ') + statusInfo; //Replace characters - description.replace(QChar('\\'), QStringLiteral("\\\\")); - description.replace(QChar('['), QStringLiteral("\\[")); - description.replace(QChar(']'), QStringLiteral("\\]")); - description.replace(QChar('\''), QStringLiteral("\\'")); - description.replace(QChar('\"'), QStringLiteral("\\\"")); - description.replace(QChar('\n'), QChar(' ')); - description.remove(QChar('\0')); + description.replace(QLatin1Char('\\'), QStringLiteral("\\\\")); + description.replace(QLatin1Char('['), QStringLiteral("\\[")); + description.replace(QLatin1Char(']'), QStringLiteral("\\]")); + description.replace(QLatin1Char('\''), QStringLiteral("\\'")); + description.replace(QLatin1Char('\"'), QStringLiteral("\\\"")); + description.replace(QLatin1Char('\n'), QLatin1Char(' ')); + description.remove(QLatin1Char('\0')); //Output id and description QTextStream(stdout) << id << '[' << description << ']' << endl; @@ -196,7 +196,7 @@ int main(int argc, char** argv) urls.append(url.toString()); } - QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device+"/share", + QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrls")); msg.setArguments(QVariantList() << QVariant(urls)); @@ -206,7 +206,7 @@ int main(int argc, char** argv) QTextStream(stdout) << i18n("Shared %1", url) << endl; } } else if (parser.isSet(QStringLiteral("share-text"))) { - QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device+"/share", QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareText")); + QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareText")); msg.setArguments(QVariantList() << parser.value(QStringLiteral("share-text"))); blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); QTextStream(stdout) << i18n("Shared text: %1", parser.value(QStringLiteral("share-text"))) << endl; @@ -246,7 +246,7 @@ int main(int argc, char** argv) blockOnReply(dev.unpair()); } } else if(parser.isSet(QStringLiteral("ping")) || parser.isSet(QStringLiteral("ping-msg"))) { - QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device+"/ping", QStringLiteral("org.kde.kdeconnect.device.ping"), QStringLiteral("sendPing")); + QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/ping"), QStringLiteral("org.kde.kdeconnect.device.ping"), QStringLiteral("sendPing")); if (parser.isSet(QStringLiteral("ping-msg"))) { QString message = parser.value(QStringLiteral("ping-msg")); msg.setArguments(QVariantList() << message); @@ -254,29 +254,29 @@ int main(int argc, char** argv) blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); } else if(parser.isSet(QStringLiteral("send-sms"))) { if (parser.isSet(QStringLiteral("destination"))) { - QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device+"/sms", QStringLiteral("org.kde.kdeconnect.device.sms"), QStringLiteral("sendSms")); - msg.setArguments({ parser.value("destination"), parser.value("send-sms") }); + QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/sms"), QStringLiteral("org.kde.kdeconnect.device.sms"), QStringLiteral("sendSms")); + msg.setArguments({ parser.value(QStringLiteral("destination")), parser.value(QStringLiteral("send-sms"))}); blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); } else { QTextStream(stderr) << i18n("error: should specify the SMS's recipient by passing --destination "); return 1; } } else if(parser.isSet(QStringLiteral("ring"))) { - QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device+"/findmyphone", QStringLiteral("org.kde.kdeconnect.device.findmyphone"), QStringLiteral("ring")); + QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/findmyphone"), QStringLiteral("org.kde.kdeconnect.device.findmyphone"), QStringLiteral("ring")); blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); } else if(parser.isSet(QStringLiteral("photo"))) { - QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device+"/photo", QStringLiteral("org.kde.kdeconnect.device.photo"), QStringLiteral("requestPhoto")); + QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/photo"), QStringLiteral("org.kde.kdeconnect.device.photo"), QStringLiteral("requestPhoto")); blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); - } else if(parser.isSet("send-keys")) { - QString seq = parser.value("send-keys"); - QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect/devices/"+device+"/remotekeyboard", "org.kde.kdeconnect.device.remotekeyboard", "sendKeyPress"); + } else if(parser.isSet(QStringLiteral("send-keys"))) { + QString seq = parser.value(QStringLiteral("send-keys")); + QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/remotekeyboard"), QStringLiteral("org.kde.kdeconnect.device.remotekeyboard"), QStringLiteral("sendKeyPress")); if (seq.trimmed() == QLatin1String("-")) { // from stdin QFile in; if(in.open(stdin,QIODevice::ReadOnly | QIODevice::Unbuffered)) { while (!in.atEnd()) { QByteArray line = in.readLine(); // sanitize to ASCII-codes > 31? - msg.setArguments({QString(line), -1, false, false, false}); + msg.setArguments({QString::fromLatin1(line), -1, false, false, false}); blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); } in.close(); diff --git a/core/backends/bluetooth/bluetoothdevicelink.cpp b/core/backends/bluetooth/bluetoothdevicelink.cpp index dbcb3a889..740a288f2 100644 --- a/core/backends/bluetooth/bluetoothdevicelink.cpp +++ b/core/backends/bluetooth/bluetoothdevicelink.cpp @@ -45,7 +45,7 @@ BluetoothDeviceLink::BluetoothDeviceLink(const QString& deviceId, LinkProvider* QString BluetoothDeviceLink::name() { - return "BluetoothLink"; // Should be same in both android and kde version + return QStringLiteral("BluetoothLink"); // Should be same in both android and kde version } bool BluetoothDeviceLink::sendPacket(NetworkPacket& np) diff --git a/core/backends/bluetooth/bluetoothdownloadjob.cpp b/core/backends/bluetooth/bluetoothdownloadjob.cpp index f7cffc974..39e3c2b6e 100644 --- a/core/backends/bluetooth/bluetoothdownloadjob.cpp +++ b/core/backends/bluetooth/bluetoothdownloadjob.cpp @@ -23,7 +23,7 @@ BluetoothDownloadJob::BluetoothDownloadJob(const QBluetoothAddress& remoteAddress, const QVariantMap& transferInfo, QObject* parent) : QObject(parent) , mRemoteAddress(remoteAddress) - , mTransferUuid(QBluetoothUuid(transferInfo.value("uuid").toString())) + , mTransferUuid(QBluetoothUuid(transferInfo.value(QStringLiteral("uuid")).toString())) , mSocket(new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol)) { } diff --git a/core/backends/bluetooth/bluetoothlinkprovider.cpp b/core/backends/bluetooth/bluetoothlinkprovider.cpp index d20a5c4fd..e69ae0a39 100644 --- a/core/backends/bluetooth/bluetoothlinkprovider.cpp +++ b/core/backends/bluetooth/bluetoothlinkprovider.cpp @@ -34,7 +34,7 @@ BluetoothLinkProvider::BluetoothLinkProvider() { - mServiceUuid = QBluetoothUuid(QString("185f3df4-3268-4e3f-9fca-d4d5059915bd")); + mServiceUuid = QBluetoothUuid(QStringLiteral("185f3df4-3268-4e3f-9fca-d4d5059915bd")); connectTimer = new QTimer(this); connectTimer->setInterval(30000); @@ -61,7 +61,7 @@ void BluetoothLinkProvider::onStart() mServiceDiscoveryAgent->start(); connectTimer->start(); - mKdeconnectService = mBluetoothServer->listen(mServiceUuid, "KDE Connect"); + mKdeconnectService = mBluetoothServer->listen(mServiceUuid, QStringLiteral("KDE Connect")); } void BluetoothLinkProvider::onStop() @@ -183,7 +183,7 @@ void BluetoothLinkProvider::clientIdentityReceived() disconnect(socket, SIGNAL(readyRead()), this, SLOT(clientIdentityReceived())); - NetworkPacket receivedPacket(""); + NetworkPacket receivedPacket; bool success = NetworkPacket::unserialize(identityArray, &receivedPacket); if (!success || receivedPacket.type() != PACKET_TYPE_IDENTITY) { @@ -198,10 +198,10 @@ void BluetoothLinkProvider::clientIdentityReceived() disconnect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError())); - const QString& deviceId = receivedPacket.get("deviceId"); + const QString& deviceId = receivedPacket.get(QStringLiteral("deviceId")); BluetoothDeviceLink* deviceLink = new BluetoothDeviceLink(deviceId, this, socket); - NetworkPacket np2(""); + NetworkPacket np2; NetworkPacket::createIdentityPacket(&np2); success = deviceLink->sendPacket(np2); @@ -243,7 +243,7 @@ void BluetoothLinkProvider::serverNewConnection() connect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError())); connect(socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected())); - NetworkPacket np2(""); + NetworkPacket np2; NetworkPacket::createIdentityPacket(&np2); socket->write(np2.serialize()); @@ -276,7 +276,7 @@ void BluetoothLinkProvider::serverDataReceived() disconnect(socket, SIGNAL(readyRead()), this, SLOT(serverDataReceived())); disconnect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError())); - NetworkPacket receivedPacket(""); + NetworkPacket receivedPacket; bool success = NetworkPacket::unserialize(identityArray, &receivedPacket); if (!success || receivedPacket.type() != PACKET_TYPE_IDENTITY) { @@ -289,7 +289,7 @@ void BluetoothLinkProvider::serverDataReceived() qCDebug(KDECONNECT_CORE()) << "Received identity packet from" << socket->peerAddress(); - const QString& deviceId = receivedPacket.get("deviceId"); + const QString& deviceId = receivedPacket.get(QStringLiteral("deviceId")); BluetoothDeviceLink* deviceLink = new BluetoothDeviceLink(deviceId, this, socket); connect(deviceLink, SIGNAL(destroyed(QObject*)), diff --git a/core/backends/bluetooth/bluetoothlinkprovider.h b/core/backends/bluetooth/bluetoothlinkprovider.h index d7815914e..744ce573d 100644 --- a/core/backends/bluetooth/bluetoothlinkprovider.h +++ b/core/backends/bluetooth/bluetoothlinkprovider.h @@ -45,7 +45,7 @@ public: BluetoothLinkProvider(); virtual ~BluetoothLinkProvider(); - QString name() override { return "BluetoothLinkProvider"; } + QString name() override { return QStringLiteral("BluetoothLinkProvider"); } int priority() override { return PRIORITY_MEDIUM; } public Q_SLOTS: diff --git a/core/backends/bluetooth/bluetoothpairinghandler.cpp b/core/backends/bluetooth/bluetoothpairinghandler.cpp index 3eb2d452a..8889cd2e8 100644 --- a/core/backends/bluetooth/bluetoothpairinghandler.cpp +++ b/core/backends/bluetooth/bluetoothpairinghandler.cpp @@ -42,7 +42,7 @@ void BluetoothPairingHandler::packetReceived(const NetworkPacket& np) m_pairingTimeout.stop(); - bool wantsPair = np.get("pair"); + bool wantsPair = np.get(QStringLiteral("pair")); if (wantsPair) { @@ -91,7 +91,7 @@ bool BluetoothPairingHandler::requestPairing() } NetworkPacket np(PACKET_TYPE_PAIR); - np.set("pair", true); + np.set(QStringLiteral("pair"), true); bool success; success = deviceLink()->sendPacket(np); if (success) { @@ -106,7 +106,7 @@ bool BluetoothPairingHandler::acceptPairing() qCDebug(KDECONNECT_CORE) << "User accepts pairing"; m_pairingTimeout.stop(); // Just in case it is started NetworkPacket np(PACKET_TYPE_PAIR); - np.set("pair", true); + np.set(QStringLiteral("pair"), true); bool success = deviceLink()->sendPacket(np); if (success) { setInternalPairStatus(Paired); @@ -118,14 +118,14 @@ void BluetoothPairingHandler::rejectPairing() { qCDebug(KDECONNECT_CORE) << "User rejects pairing"; NetworkPacket np(PACKET_TYPE_PAIR); - np.set("pair", false); + np.set(QStringLiteral("pair"), false); deviceLink()->sendPacket(np); setInternalPairStatus(NotPaired); } void BluetoothPairingHandler::unpair() { NetworkPacket np(PACKET_TYPE_PAIR); - np.set("pair", false); + np.set(QStringLiteral("pair"), false); deviceLink()->sendPacket(np); setInternalPairStatus(NotPaired); } @@ -133,7 +133,7 @@ void BluetoothPairingHandler::unpair() { void BluetoothPairingHandler::pairingTimeout() { NetworkPacket np(PACKET_TYPE_PAIR); - np.set("pair", false); + np.set(QStringLiteral("pair"), false); deviceLink()->sendPacket(np); setInternalPairStatus(NotPaired); //Will emit the change as well Q_EMIT pairingError(i18n("Timed out")); diff --git a/core/backends/bluetooth/bluetoothuploadjob.cpp b/core/backends/bluetooth/bluetoothuploadjob.cpp index d7b564784..f8cfaec1d 100644 --- a/core/backends/bluetooth/bluetoothuploadjob.cpp +++ b/core/backends/bluetooth/bluetoothuploadjob.cpp @@ -38,14 +38,14 @@ BluetoothUploadJob::BluetoothUploadJob(const QSharedPointer& data, co QVariantMap BluetoothUploadJob::transferInfo() const { QVariantMap ret; - ret["uuid"] = mTransferUuid.toString().mid(1, 36); + ret[QStringLiteral("uuid")] = mTransferUuid.toString().mid(1, 36); return ret; } void BluetoothUploadJob::start() { connect(mServer, &QBluetoothServer::newConnection, this, &BluetoothUploadJob::newConnection); - mServiceInfo = mServer->listen(mTransferUuid, "KDE Connect Transfer Job"); + mServiceInfo = mServer->listen(mTransferUuid, QStringLiteral("KDE Connect Transfer Job")); Q_ASSERT(mServiceInfo.isValid()); } diff --git a/core/backends/lan/compositeuploadjob.cpp b/core/backends/lan/compositeuploadjob.cpp index 614d3e355..a0e61bf3d 100644 --- a/core/backends/lan/compositeuploadjob.cpp +++ b/core/backends/lan/compositeuploadjob.cpp @@ -111,7 +111,7 @@ void CompositeUploadJob::startNextSubJob() //TODO: Create a copy of the networkpacket that can be re-injected if sending via lan fails? NetworkPacket np = m_currentJob->getNetworkPacket(); np.setPayload(nullptr, np.payloadSize()); - np.setPayloadTransferInfo({{"port", m_port}}); + np.setPayloadTransferInfo({{QStringLiteral("port"), m_port}}); np.set(QStringLiteral("numberOfFiles"), m_totalJobs); np.set(QStringLiteral("totalPayloadSize"), m_totalPayloadSize); @@ -272,7 +272,7 @@ void CompositeUploadJob::slotResult(KJob *job) { startNextSubJob(); } else { QPair field2; - field2.first = QString("Files"); + field2.first = QStringLiteral("Files"); field2.second = i18np("Sent 1 file", "Sent %1 files", m_totalJobs); Q_EMIT description(this, i18n("Sending to %1", Daemon::instance()->getDevice(this->m_deviceId)->name()), { QString(), QString() }, field2 diff --git a/core/backends/lan/landevicelink.cpp b/core/backends/lan/landevicelink.cpp index c1e67437d..3b157e47d 100644 --- a/core/backends/lan/landevicelink.cpp +++ b/core/backends/lan/landevicelink.cpp @@ -179,7 +179,7 @@ void LanDeviceLink::setPairStatus(PairStatus status) if (status == Paired) { Q_ASSERT(KdeConnectConfig::instance()->trustedDevices().contains(deviceId())); Q_ASSERT(!m_socketLineReader->peerCertificate().isNull()); - KdeConnectConfig::instance()->setDeviceProperty(deviceId(), QStringLiteral("certificate"), m_socketLineReader->peerCertificate().toPem()); + KdeConnectConfig::instance()->setDeviceProperty(deviceId(), QStringLiteral("certificate"), QString::fromLatin1(m_socketLineReader->peerCertificate().toPem().data())); } } diff --git a/core/backends/lan/lanlinkprovider.cpp b/core/backends/lan/lanlinkprovider.cpp index 572ac3f8a..1893ccff5 100644 --- a/core/backends/lan/lanlinkprovider.cpp +++ b/core/backends/lan/lanlinkprovider.cpp @@ -96,7 +96,7 @@ void LanLinkProvider::onStart() if (!success) { QAbstractSocket::SocketError sockErr = m_udpSocket.error(); // Refer to https://doc.qt.io/qt-5/qabstractsocket.html#SocketError-enum to decode socket error number - QString errorMessage = QMetaEnum::fromType().valueToKey(sockErr); + QString errorMessage = QString::fromLatin1(QMetaEnum::fromType().valueToKey(sockErr)); qCritical(KDECONNECT_CORE) << QLatin1String("Failed to bind UDP socket on port") << m_udpListenPort diff --git a/core/backends/lan/lanpairinghandler.cpp b/core/backends/lan/lanpairinghandler.cpp index bac740e7e..a008196a8 100644 --- a/core/backends/lan/lanpairinghandler.cpp +++ b/core/backends/lan/lanpairinghandler.cpp @@ -81,7 +81,7 @@ bool LanPairingHandler::requestPairing() return acceptPairing(); } - NetworkPacket np(PACKET_TYPE_PAIR, {{"pair", true}}); + NetworkPacket np(PACKET_TYPE_PAIR, {{QStringLiteral("pair"), true}}); const bool success = deviceLink()->sendPacket(np); if (success) { setInternalPairStatus(Requested); @@ -91,7 +91,7 @@ bool LanPairingHandler::requestPairing() bool LanPairingHandler::acceptPairing() { - NetworkPacket np(PACKET_TYPE_PAIR, {{"pair", true}}); + NetworkPacket np(PACKET_TYPE_PAIR, {{QStringLiteral("pair"), true}}); bool success = deviceLink()->sendPacket(np); if (success) { setInternalPairStatus(Paired); @@ -101,20 +101,20 @@ bool LanPairingHandler::acceptPairing() void LanPairingHandler::rejectPairing() { - NetworkPacket np(PACKET_TYPE_PAIR, {{"pair", false}}); + NetworkPacket np(PACKET_TYPE_PAIR, {{QStringLiteral("pair"), false}}); deviceLink()->sendPacket(np); setInternalPairStatus(NotPaired); } void LanPairingHandler::unpair() { - NetworkPacket np(PACKET_TYPE_PAIR, {{"pair", false}}); + NetworkPacket np(PACKET_TYPE_PAIR, {{QStringLiteral("pair"), false}}); deviceLink()->sendPacket(np); setInternalPairStatus(NotPaired); } void LanPairingHandler::pairingTimeout() { - NetworkPacket np(PACKET_TYPE_PAIR, {{"pair", false}}); + NetworkPacket np(PACKET_TYPE_PAIR, {{QStringLiteral("pair"), false}}); deviceLink()->sendPacket(np); setInternalPairStatus(NotPaired); //Will emit the change as well Q_EMIT pairingError(i18n("Timed out")); diff --git a/core/backends/lan/server.cpp b/core/backends/lan/server.cpp index 7787b4e5c..04340955a 100644 --- a/core/backends/lan/server.cpp +++ b/core/backends/lan/server.cpp @@ -38,7 +38,7 @@ void Server::incomingConnection(qintptr socketDescriptor) { if (serverSocket->setSocketDescriptor(socketDescriptor)) { addPendingConnection(serverSocket); } else { - qWarning() << "setSocketDescriptor failed " + serverSocket->errorString(); + qWarning() << "setSocketDescriptor failed" << serverSocket->errorString(); delete serverSocket; } } diff --git a/core/dbushelper.cpp b/core/dbushelper.cpp index c319eb92e..20383deec 100644 --- a/core/dbushelper.cpp +++ b/core/dbushelper.cpp @@ -24,7 +24,7 @@ namespace DbusHelper { void filterNonExportableCharacters(QString& s) { - static QRegExp regexp("[^A-Za-z0-9_]", Qt::CaseSensitive, QRegExp::Wildcard); + static QRegExp regexp(QStringLiteral("[^A-Za-z0-9_]"), Qt::CaseSensitive, QRegExp::Wildcard); s.replace(regexp,QLatin1String("_")); } diff --git a/core/device.cpp b/core/device.cpp index c745d0c7d..32e23a899 100644 --- a/core/device.cpp +++ b/core/device.cpp @@ -540,7 +540,7 @@ QString Device::encryptionInfo() const QString localSha1 = QString::fromLatin1(KdeConnectConfig::instance()->certificate().digest(digestAlgorithm).toHex()); for (int i = 2; im_config->value(QStringLiteral("name"), defaultName).toString(); return name; } @@ -212,7 +212,7 @@ void KdeConnectConfig::loadPrivateKey() bool needsToGenerateKey = false; if (privKey.exists() && privKey.open(QIODevice::ReadOnly)) { QCA::ConvertResult result; - d->m_privateKey = QCA::PrivateKey::fromPEM(privKey.readAll(), QCA::SecureArray(), &result); + d->m_privateKey = QCA::PrivateKey::fromPEM(QString::fromLatin1(privKey.readAll()), QCA::SecureArray(), &result); if (result != QCA::ConvertResult::ConvertGood) { qCWarning(KDECONNECT_CORE) << "Private key from" << keyPath << "is not valid"; needsToGenerateKey = true; diff --git a/core/kdeconnectpluginconfig.cpp b/core/kdeconnectpluginconfig.cpp index 271925306..a59975e59 100644 --- a/core/kdeconnectpluginconfig.cpp +++ b/core/kdeconnectpluginconfig.cpp @@ -42,8 +42,8 @@ KdeConnectPluginConfig::KdeConnectPluginConfig(const QString& deviceId, const QS d->m_config = new QSettings(d->m_configDir.absoluteFilePath(QStringLiteral("config")), QSettings::IniFormat); - d->m_signal = QDBusMessage::createSignal("/kdeconnect/"+deviceId+"/"+pluginName, QStringLiteral("org.kde.kdeconnect.config"), QStringLiteral("configChanged")); - DbusHelper::sessionBus().connect(QLatin1String(""), "/kdeconnect/"+deviceId+"/"+pluginName, QStringLiteral("org.kde.kdeconnect.config"), QStringLiteral("configChanged"), this, SLOT(slotConfigChanged())); + d->m_signal = QDBusMessage::createSignal(QStringLiteral("/kdeconnect/") + deviceId + QStringLiteral("/") + pluginName, QStringLiteral("org.kde.kdeconnect.config"), QStringLiteral("configChanged")); + DbusHelper::sessionBus().connect(QLatin1String(""), QStringLiteral("/kdeconnect/") + deviceId + QStringLiteral("/") + pluginName, QStringLiteral("org.kde.kdeconnect.config"), QStringLiteral("configChanged"), this, SLOT(slotConfigChanged())); } KdeConnectPluginConfig::~KdeConnectPluginConfig() diff --git a/declarativeplugin/responsewaiter.cpp b/declarativeplugin/responsewaiter.cpp index dca838dc9..b575d6485 100644 --- a/declarativeplugin/responsewaiter.cpp +++ b/declarativeplugin/responsewaiter.cpp @@ -46,7 +46,7 @@ QVariant DBusResponseWaiter::waitForReply(QVariant variant) const if (call->isError()) { qWarning() << "error:" << call->error(); - return QVariant("error"); + return QVariant(QStringLiteral("error")); } QDBusMessage reply = call->reply(); diff --git a/fileitemactionplugin/sendfileitemaction.cpp b/fileitemactionplugin/sendfileitemaction.cpp index 68c176109..619475972 100644 --- a/fileitemactionplugin/sendfileitemaction.cpp +++ b/fileitemactionplugin/sendfileitemaction.cpp @@ -92,7 +92,7 @@ void SendFileItemAction::sendFile() const QList urls = sender()->property("urls").value>(); QString id = sender()->property("id").toString(); for (const QUrl& url : urls) { - QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+id+"/share", QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrl")); + QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrl")); msg.setArguments(QVariantList() << url.toString()); DbusHelper::sessionBus().call(msg); } diff --git a/indicator/deviceindicator.cpp b/indicator/deviceindicator.cpp index d2463d9b7..53ff32be1 100644 --- a/indicator/deviceindicator.cpp +++ b/indicator/deviceindicator.cpp @@ -70,7 +70,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device) , m_device(device) { #ifdef Q_OS_WIN - setIcon(QIcon(QStandardPaths::locate(QStandardPaths::AppDataLocation, "icons/hicolor/scalable/status/"+device->iconName()+".svg"))); + setIcon(QIcon(QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("icons/hicolor/scalable/status/") + device->iconName() + QStringLiteral(".svg")))); #else setIcon(QIcon::fromTheme(device->iconName())); #endif @@ -79,7 +79,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device) auto battery = new BatteryAction(device); addAction(battery); - setWhenAvailable(device->hasPlugin("kdeconnect_battery"), + setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_battery")), [battery](bool available) { battery->setVisible(available); } , this); @@ -89,7 +89,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device) sftpIface->startBrowsing(); sftpIface->deleteLater(); }); - setWhenAvailable(device->hasPlugin("kdeconnect_sftp"), [browse](bool available) { browse->setVisible(available); }, this); + setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_sftp")), [browse](bool available) { browse->setVisible(available); }, this); auto findDevice = addAction(QIcon::fromTheme(QStringLiteral("irc-voice")), i18n("Ring device")); connect(findDevice, &QAction::triggered, device, [device](){ @@ -97,7 +97,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device) iface->ring(); iface->deleteLater(); }); - setWhenAvailable(device->hasPlugin("kdeconnect_findmyphone"), [findDevice](bool available) { findDevice->setVisible(available); }, this); + setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_findmyphone")), [findDevice](bool available) { findDevice->setVisible(available); }, this); auto sendFile = addAction(QIcon::fromTheme(QStringLiteral("document-share")), i18n("Send file")); connect(sendFile, &QAction::triggered, device, [device, this](){ @@ -105,11 +105,11 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device) if (url.isEmpty()) return; - QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device->id()+"/share", QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrl")); + QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device->id() + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrl")); msg.setArguments(QVariantList() << url.toString()); DbusHelper::sessionBus().call(msg); }); - setWhenAvailable(device->hasPlugin("kdeconnect_share"), [sendFile](bool available) { sendFile->setVisible(available); }, this); + setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_share")), [sendFile](bool available) { sendFile->setVisible(available); }, this); } #include "deviceindicator.moc" diff --git a/indicator/main.cpp b/indicator/main.cpp index 27cb8a249..b95f15d0d 100644 --- a/indicator/main.cpp +++ b/indicator/main.cpp @@ -46,7 +46,7 @@ int main(int argc, char** argv) { QApplication app(argc, argv); - KAboutData about("kdeconnect-indicator", + KAboutData about(QStringLiteral("kdeconnect-indicator"), i18n("KDE Connect Indicator"), QStringLiteral(KDECONNECT_VERSION_STRING), i18n("KDE Connect Indicator tool"), @@ -55,7 +55,7 @@ int main(int argc, char** argv) KAboutData::setApplicationData(about); #ifdef Q_OS_WIN - QProcess::startDetached("kdeconnectd.exe"); + QProcess::startDetached(QStringLiteral("kdeconnectd.exe")); #endif #ifdef Q_OS_MAC @@ -81,7 +81,7 @@ int main(int argc, char** argv) auto configure = menu->addAction(QIcon::fromTheme(QStringLiteral("configure")), i18n("Configure...")); QObject::connect(configure, &QAction::triggered, configure, [](){ KCMultiDialog* dialog = new KCMultiDialog; - dialog->addModule("kcm_kdeconnect"); + dialog->addModule(QStringLiteral("kcm_kdeconnect")); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->show(); }); @@ -129,7 +129,7 @@ int main(int argc, char** argv) #else KStatusNotifierItem systray; systray.setIconByName(QStringLiteral("kdeconnectindicatordark")); - systray.setToolTip(QStringLiteral("kdeconnect"), "KDE Connect", "KDE Connect"); + systray.setToolTip(QStringLiteral("kdeconnect"), QStringLiteral("KDE Connect"), QStringLiteral("KDE Connect")); systray.setCategory(KStatusNotifierItem::Communications); systray.setStatus(KStatusNotifierItem::Passive); systray.setStandardActionsEnabled(false); diff --git a/interfaces/conversationmessage.cpp b/interfaces/conversationmessage.cpp index 6d8e4884b..b37bce1ae 100644 --- a/interfaces/conversationmessage.cpp +++ b/interfaces/conversationmessage.cpp @@ -24,14 +24,14 @@ ConversationMessage::ConversationMessage(const QVariantMap& args) - : m_eventField(args["event"].toInt()), - m_body(args["body"].toString()), - m_address(args["address"].toString()), - m_date(args["date"].toLongLong()), - m_type(args["type"].toInt()), - m_read(args["read"].toInt()), - m_threadID(args["thread_id"].toLongLong()), - m_uID(args["_id"].toInt()) + : m_eventField(args[QStringLiteral("event")].toInt()), + m_body(args[QStringLiteral("body")].toString()), + m_address(args[QStringLiteral("address")].toString()), + m_date(args[QStringLiteral("date")].toLongLong()), + m_type(args[QStringLiteral("type")].toInt()), + m_read(args[QStringLiteral("read")].toInt()), + m_threadID(args[QStringLiteral("thread_id")].toLongLong()), + m_uID(args[QStringLiteral("_id")].toInt()) { } @@ -81,14 +81,14 @@ ConversationMessage& ConversationMessage::operator=(const ConversationMessage& o QVariantMap ConversationMessage::toVariant() const { return { - {"event", m_eventField}, - {"body", m_body}, - {"address", m_address}, - {"date", m_date}, - {"type", m_type}, - {"read", m_read}, - {"thread_id", m_threadID}, - {"_id", m_uID}, + {QStringLiteral("event"), m_eventField}, + {QStringLiteral("body"), m_body}, + {QStringLiteral("address"), m_address}, + {QStringLiteral("date"), m_date}, + {QStringLiteral("type"), m_type}, + {QStringLiteral("read"), m_read}, + {QStringLiteral("thread_id"), m_threadID}, + {QStringLiteral("_id"), m_uID}, }; } diff --git a/interfaces/dbusinterfaces.cpp b/interfaces/dbusinterfaces.cpp index 31e9c21c9..02f2c22e8 100644 --- a/interfaces/dbusinterfaces.cpp +++ b/interfaces/dbusinterfaces.cpp @@ -42,7 +42,7 @@ DaemonDbusInterface::~DaemonDbusInterface() } DeviceDbusInterface::DeviceDbusInterface(const QString& id, QObject* parent) - : OrgKdeKdeconnectDeviceInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+id, DbusHelper::sessionBus(), parent) + : OrgKdeKdeconnectDeviceInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") +id, DbusHelper::sessionBus(), parent) , m_id(id) { connect(this, &OrgKdeKdeconnectDeviceInterface::trustedChanged, this, &DeviceDbusInterface::trustedChangedProxy); @@ -63,12 +63,12 @@ QString DeviceDbusInterface::id() const void DeviceDbusInterface::pluginCall(const QString& plugin, const QString& method) { - QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+id()+'/'+plugin, "org.kde.kdeconnect.device."+plugin, method); + QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") +id() + QStringLiteral("/") + plugin, QStringLiteral("org.kde.kdeconnect.device.") + plugin, method); DbusHelper::sessionBus().asyncCall(msg); } DeviceBatteryDbusInterface::DeviceBatteryDbusInterface(const QString& id, QObject* parent) - : OrgKdeKdeconnectDeviceBatteryInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+id, DbusHelper::sessionBus(), parent) + : OrgKdeKdeconnectDeviceBatteryInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") +id, DbusHelper::sessionBus(), parent) { } @@ -79,7 +79,7 @@ DeviceBatteryDbusInterface::~DeviceBatteryDbusInterface() } DeviceNotificationsDbusInterface::DeviceNotificationsDbusInterface(const QString& id, QObject* parent) - : OrgKdeKdeconnectDeviceNotificationsInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+id, DbusHelper::sessionBus(), parent) + : OrgKdeKdeconnectDeviceNotificationsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") +id, DbusHelper::sessionBus(), parent) { } @@ -90,7 +90,7 @@ DeviceNotificationsDbusInterface::~DeviceNotificationsDbusInterface() } NotificationDbusInterface::NotificationDbusInterface(const QString& deviceId, const QString& notificationId, QObject* parent) - : OrgKdeKdeconnectDeviceNotificationsNotificationInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+deviceId+"/notifications/"+notificationId, DbusHelper::sessionBus(), parent) + : OrgKdeKdeconnectDeviceNotificationsNotificationInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/notifications/") + notificationId, DbusHelper::sessionBus(), parent) , id(notificationId) { @@ -102,7 +102,7 @@ NotificationDbusInterface::~NotificationDbusInterface() } DeviceConversationsDbusInterface::DeviceConversationsDbusInterface(const QString& deviceId, QObject* parent) - : OrgKdeKdeconnectDeviceConversationsInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+deviceId, DbusHelper::sessionBus(), parent) + : OrgKdeKdeconnectDeviceConversationsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId, DbusHelper::sessionBus(), parent) { } @@ -113,7 +113,7 @@ DeviceConversationsDbusInterface::~DeviceConversationsDbusInterface() } SftpDbusInterface::SftpDbusInterface(const QString& id, QObject* parent) - : OrgKdeKdeconnectDeviceSftpInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/sftp", DbusHelper::sessionBus(), parent) + : OrgKdeKdeconnectDeviceSftpInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/sftp"), DbusHelper::sessionBus(), parent) { } @@ -124,7 +124,7 @@ SftpDbusInterface::~SftpDbusInterface() } MprisDbusInterface::MprisDbusInterface(const QString& id, QObject* parent) - : OrgKdeKdeconnectDeviceMprisremoteInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/mprisremote", DbusHelper::sessionBus(), parent) + : OrgKdeKdeconnectDeviceMprisremoteInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/mprisremote"), DbusHelper::sessionBus(), parent) { connect(this, &OrgKdeKdeconnectDeviceMprisremoteInterface::propertiesChanged, this, &MprisDbusInterface::propertiesChangedProxy); } @@ -134,7 +134,7 @@ MprisDbusInterface::~MprisDbusInterface() } RemoteControlDbusInterface::RemoteControlDbusInterface(const QString& id, QObject* parent) - : OrgKdeKdeconnectDeviceRemotecontrolInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/remotecontrol", DbusHelper::sessionBus(), parent) + : OrgKdeKdeconnectDeviceRemotecontrolInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/remotecontrol"), DbusHelper::sessionBus(), parent) { } @@ -143,7 +143,7 @@ RemoteControlDbusInterface::~RemoteControlDbusInterface() } LockDeviceDbusInterface::LockDeviceDbusInterface(const QString& id, QObject* parent) - : OrgKdeKdeconnectDeviceLockdeviceInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/lockdevice", DbusHelper::sessionBus(), parent) + : OrgKdeKdeconnectDeviceLockdeviceInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/lockdevice"), DbusHelper::sessionBus(), parent) { connect(this, &OrgKdeKdeconnectDeviceLockdeviceInterface::lockedChanged, this, &LockDeviceDbusInterface::lockedChangedProxy); Q_ASSERT(isValid()); @@ -154,7 +154,7 @@ LockDeviceDbusInterface::~LockDeviceDbusInterface() } FindMyPhoneDeviceDbusInterface::FindMyPhoneDeviceDbusInterface(const QString& deviceId, QObject* parent): - OrgKdeKdeconnectDeviceFindmyphoneInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/findmyphone", DbusHelper::sessionBus(), parent) + OrgKdeKdeconnectDeviceFindmyphoneInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/findmyphone"), DbusHelper::sessionBus(), parent) { } @@ -163,14 +163,14 @@ FindMyPhoneDeviceDbusInterface::~FindMyPhoneDeviceDbusInterface() } RemoteCommandsDbusInterface::RemoteCommandsDbusInterface(const QString& deviceId, QObject* parent): - OrgKdeKdeconnectDeviceRemotecommandsInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/remotecommands", DbusHelper::sessionBus(), parent) + OrgKdeKdeconnectDeviceRemotecommandsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotecommands"), DbusHelper::sessionBus(), parent) { } RemoteCommandsDbusInterface::~RemoteCommandsDbusInterface() = default; RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString& deviceId, QObject* parent): - OrgKdeKdeconnectDeviceRemotekeyboardInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/remotekeyboard", DbusHelper::sessionBus(), parent) + OrgKdeKdeconnectDeviceRemotekeyboardInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotekeyboard"), DbusHelper::sessionBus(), parent) { connect(this, &OrgKdeKdeconnectDeviceRemotekeyboardInterface::remoteStateChanged, this, &RemoteKeyboardDbusInterface::remoteStateChanged); } @@ -178,20 +178,20 @@ RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString& deviceId RemoteKeyboardDbusInterface::~RemoteKeyboardDbusInterface() = default; SmsDbusInterface::SmsDbusInterface(const QString& deviceId, QObject* parent): - OrgKdeKdeconnectDeviceSmsInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/sms", DbusHelper::sessionBus(), parent) + OrgKdeKdeconnectDeviceSmsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/sms"), DbusHelper::sessionBus(), parent) { } SmsDbusInterface::~SmsDbusInterface() = default; ShareDbusInterface::ShareDbusInterface(const QString& deviceId, QObject* parent): - OrgKdeKdeconnectDeviceShareInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/share", DbusHelper::sessionBus(), parent) + OrgKdeKdeconnectDeviceShareInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/share"), DbusHelper::sessionBus(), parent) { } ShareDbusInterface::~ShareDbusInterface() = default; RemoteSystemVolumeDbusInterface::RemoteSystemVolumeDbusInterface(const QString& deviceId, QObject* parent): - OrgKdeKdeconnectDeviceRemotesystemvolumeInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/remotesystemvolume", DbusHelper::sessionBus(), parent) + OrgKdeKdeconnectDeviceRemotesystemvolumeInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotesystemvolume"), DbusHelper::sessionBus(), parent) { } diff --git a/kcm/main.cpp b/kcm/main.cpp index 87b6d341e..4c487ebd3 100644 --- a/kcm/main.cpp +++ b/kcm/main.cpp @@ -28,7 +28,7 @@ int main(int argc, char** argv) { QApplication app(argc, argv); - KAboutData about("kdeconnect-settings", + KAboutData about(QStringLiteral("kdeconnect-settings"), i18n("KDE Connect Settings"), QStringLiteral(KDECONNECT_VERSION_STRING), i18n("KDE Connect Settings"), @@ -37,7 +37,7 @@ int main(int argc, char** argv) KAboutData::setApplicationData(about); KCMultiDialog* dialog = new KCMultiDialog; - dialog->addModule("kcm_kdeconnect"); + dialog->addModule(QStringLiteral("kcm_kdeconnect")); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->show(); diff --git a/kio/kiokdeconnect.cpp b/kio/kiokdeconnect.cpp index c381d69e7..5be080ebb 100644 --- a/kio/kiokdeconnect.cpp +++ b/kio/kiokdeconnect.cpp @@ -102,7 +102,7 @@ void KioKdeconnect::listAllDevices() if (!interface.hasPlugin(QStringLiteral("kdeconnect_sftp"))) continue; - const QString path = QStringLiteral("kdeconnect://").append(deviceId).append("/"); + const QString path = QStringLiteral("kdeconnect://").append(deviceId).append(QStringLiteral("/")); const QString name = interface.name(); const QString icon = QStringLiteral("kdeconnect"); diff --git a/plugins/battery/batteryplugin.cpp b/plugins/battery/batteryplugin.cpp index 5d46db854..fa214e436 100644 --- a/plugins/battery/batteryplugin.cpp +++ b/plugins/battery/batteryplugin.cpp @@ -43,7 +43,7 @@ BatteryPlugin::BatteryPlugin(QObject* parent, const QVariantList& args) void BatteryPlugin::connected() { - NetworkPacket np(PACKET_TYPE_BATTERY_REQUEST, {{"request",true}}); + NetworkPacket np(PACKET_TYPE_BATTERY_REQUEST, {{QStringLiteral("request"),true}}); sendPacket(np); } diff --git a/plugins/clipboard/clipboardplugin.cpp b/plugins/clipboard/clipboardplugin.cpp index 764143204..edb379550 100644 --- a/plugins/clipboard/clipboardplugin.cpp +++ b/plugins/clipboard/clipboardplugin.cpp @@ -37,7 +37,7 @@ ClipboardPlugin::ClipboardPlugin(QObject* parent, const QVariantList& args) void ClipboardPlugin::propagateClipboard(const QString& content) { - NetworkPacket np(PACKET_TYPE_CLIPBOARD, {{"content", content}}); + NetworkPacket np(PACKET_TYPE_CLIPBOARD, {{QStringLiteral("content"), content}}); sendPacket(np); } diff --git a/plugins/contacts/contactsplugin.cpp b/plugins/contacts/contactsplugin.cpp index d0778c94a..dfe2788af 100644 --- a/plugins/contacts/contactsplugin.cpp +++ b/plugins/contacts/contactsplugin.cpp @@ -39,7 +39,7 @@ Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_CONTACTS, "kdeconnect.plugin.contacts") ContactsPlugin::ContactsPlugin(QObject* parent, const QVariantList& args) : KdeConnectPlugin(parent, args) { - vcardsPath = QString(*vcardsLocation).append("/kdeconnect-").append(device()->id()); + vcardsPath = QString(*vcardsLocation).append(QStringLiteral("/kdeconnect-").append(device()->id())); // Register custom types with dbus qRegisterMetaType("uID"); @@ -85,7 +85,7 @@ void ContactsPlugin::synchronizeRemoteWithLocal() bool ContactsPlugin::handleResponseUIDsTimestamps(const NetworkPacket& np) { - if (!np.has("uids")) { + if (!np.has(QStringLiteral("uids"))) { qCDebug(KDECONNECT_PLUGIN_CONTACTS) << "handleResponseUIDsTimestamps:" << "Malformed packet does not have uids key"; return false; @@ -95,9 +95,9 @@ bool ContactsPlugin::handleResponseUIDsTimestamps(const NetworkPacket& np) // Get a list of all file info in this directory // Clean out IDs returned from the remote. Anything leftover should be deleted - QFileInfoList localVCards = vcardsDir.entryInfoList( { "*.vcard", "*.vcf" }); + QFileInfoList localVCards = vcardsDir.entryInfoList({QStringLiteral("*.vcard"), QStringLiteral("*.vcf")}); - const QStringList& uIDs = np.get("uids"); + const QStringList& uIDs = np.get(QStringLiteral("uids")); // Check local storage for the contacts: // If the contact is not found in local storage, request its vcard be sent @@ -130,7 +130,7 @@ bool ContactsPlugin::handleResponseUIDsTimestamps(const NetworkPacket& np) while (!fileReadStream.atEnd()) { fileReadStream >> line; // TODO: Check that the saved ID is the same as the one we were expecting. This requires parsing the VCard - if (!line.startsWith("X-KDECONNECT-TIMESTAMP:")) { + if (!line.startsWith(QStringLiteral("X-KDECONNECT-TIMESTAMP:"))) { continue; } QStringList parts = line.split(QLatin1Char(':')); @@ -158,14 +158,14 @@ bool ContactsPlugin::handleResponseUIDsTimestamps(const NetworkPacket& np) bool ContactsPlugin::handleResponseVCards(const NetworkPacket& np) { - if (!np.has("uids")) { + if (!np.has(QStringLiteral("uids"))) { qCDebug(KDECONNECT_PLUGIN_CONTACTS) << "handleResponseVCards:" << "Malformed packet does not have uids key"; return false; } QDir vcardsDir(vcardsPath); - const QStringList& uIDs = np.get("uids"); + const QStringList& uIDs = np.get(QStringLiteral("uids")); // Loop over all IDs, extract the VCard from the packet and write the file for (const auto& ID : uIDs) { @@ -200,14 +200,14 @@ bool ContactsPlugin::sendRequestWithIDs(const QString& packetType, const uIDList { NetworkPacket np(packetType); - np.set("uids", uIDs); + np.set(QStringLiteral("uids"), uIDs); bool success = sendPacket(np); return success; } QString ContactsPlugin::dbusPath() const { - return "/modules/kdeconnect/devices/" + device()->id() + "/contacts"; + return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/contacts"); } #include "contactsplugin.moc" diff --git a/plugins/contacts/contactsplugin.h b/plugins/contacts/contactsplugin.h index 56a6c9783..580079fce 100644 --- a/plugins/contacts/contactsplugin.h +++ b/plugins/contacts/contactsplugin.h @@ -74,7 +74,7 @@ class QObject; */ Q_GLOBAL_STATIC_WITH_ARGS( QString, vcardsLocation, - (QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + ("/kpeoplevcard"))) + (QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QString::fromLatin1("/kpeoplevcard"))) #define VCARD_EXTENSION QStringLiteral(".vcf") #define METADATA_EXTENSION QStringLiteral(".meta") diff --git a/plugins/findmyphone/findmyphoneplugin.cpp b/plugins/findmyphone/findmyphoneplugin.cpp index 835231ad9..3fb8f252d 100644 --- a/plugins/findmyphone/findmyphoneplugin.cpp +++ b/plugins/findmyphone/findmyphoneplugin.cpp @@ -50,7 +50,7 @@ void FindMyPhonePlugin::ring() QString FindMyPhonePlugin::dbusPath() const { - return "/modules/kdeconnect/devices/" + device()->id() + "/findmyphone"; + return QString::fromLatin1("/modules/kdeconnect/devices/") + device()->id() + QString::fromLatin1("/findmyphone"); } #include "findmyphoneplugin.moc" diff --git a/plugins/findthisdevice/findthisdeviceplugin.cpp b/plugins/findthisdevice/findthisdeviceplugin.cpp index e10185185..824c1d6d7 100644 --- a/plugins/findthisdevice/findthisdeviceplugin.cpp +++ b/plugins/findthisdevice/findthisdeviceplugin.cpp @@ -123,7 +123,7 @@ bool FindThisDevicePlugin::receivePacket(const NetworkPacket& np) QString FindThisDevicePlugin::dbusPath() const { - return "/modules/kdeconnect/devices/" + device()->id() + "/findthisdevice"; + return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/findthisdevice"); } #include "findthisdeviceplugin.moc" diff --git a/plugins/lockdevice/lockdeviceplugin.cpp b/plugins/lockdevice/lockdeviceplugin.cpp index efafb151e..b53273416 100644 --- a/plugins/lockdevice/lockdeviceplugin.cpp +++ b/plugins/lockdevice/lockdeviceplugin.cpp @@ -52,7 +52,7 @@ bool LockDevicePlugin::isLocked() const } void LockDevicePlugin::setLocked(bool locked) { - NetworkPacket np(PACKET_TYPE_LOCK_REQUEST, {{"setLocked", locked}}); + NetworkPacket np(PACKET_TYPE_LOCK_REQUEST, {{QStringLiteral("setLocked"), locked}}); sendPacket(np); } @@ -72,7 +72,7 @@ bool LockDevicePlugin::receivePacket(const NetworkPacket & np) sendState = true; } if (sendState) { - NetworkPacket np(PACKET_TYPE_LOCK, QVariantMap {{"isLocked", QVariant::fromValue(iface()->GetActive())}}); + NetworkPacket np(PACKET_TYPE_LOCK, QVariantMap {{QStringLiteral("isLocked"), QVariant::fromValue(iface()->GetActive())}}); sendPacket(np); } @@ -91,13 +91,13 @@ OrgFreedesktopScreenSaverInterface* LockDevicePlugin::iface() void LockDevicePlugin::connected() { - NetworkPacket np(PACKET_TYPE_LOCK_REQUEST, {{"requestLocked", QVariant()}}); + NetworkPacket np(PACKET_TYPE_LOCK_REQUEST, {{QStringLiteral("requestLocked"), QVariant()}}); sendPacket(np); } QString LockDevicePlugin::dbusPath() const { - return "/modules/kdeconnect/devices/" + device()->id() + "/lockdevice"; + return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/lockdevice"); } #include "lockdeviceplugin.moc" diff --git a/plugins/mpriscontrol/mpriscontrolplugin-win.h b/plugins/mpriscontrol/mpriscontrolplugin-win.h index db47f1bdc..600f531cb 100644 --- a/plugins/mpriscontrol/mpriscontrolplugin-win.h +++ b/plugins/mpriscontrol/mpriscontrolplugin-win.h @@ -24,6 +24,6 @@ class MprisControlPlugin void connected() override {} private: - const QString playername = "Media Player"; + const QString playername = PLAYERNAME; }; #endif //MPRISCONTROLPLUGINWIN_H \ No newline at end of file diff --git a/plugins/mpriscontrol/mpriscontrolplugin.cpp b/plugins/mpriscontrol/mpriscontrolplugin.cpp index c8603f908..6d59eb6a1 100644 --- a/plugins/mpriscontrol/mpriscontrolplugin.cpp +++ b/plugins/mpriscontrol/mpriscontrolplugin.cpp @@ -128,8 +128,8 @@ void MprisControlPlugin::seeked(qlonglong position){ const QString& playerName = it.key(); NetworkPacket np(PACKET_TYPE_MPRIS, { - {"pos", position/1000}, //Send milis instead of nanos - {"player", playerName} + {QStringLiteral("pos"), position/1000}, //Send milis instead of nanos + {QStringLiteral("player"), playerName} }); sendPacket(np); } @@ -246,7 +246,7 @@ bool MprisControlPlugin::sendAlbumArt(const NetworkPacket& np) } //Only support sending local files - if (playerAlbumArtUrl.scheme() != "file") { + if (playerAlbumArtUrl.scheme() != QStringLiteral("file")) { return false; } @@ -363,7 +363,7 @@ void MprisControlPlugin::mprisPlayerMetadataToNetworkPacket(NetworkPacket& np, c QString albumArtUrl = nowPlayingMap[QStringLiteral("mpris:artUrl")].toString(); QString nowPlaying = title; if (!artist.isEmpty()) { - nowPlaying = artist + " - " + title; + nowPlaying = artist + QStringLiteral(" - ") + title; } np.set(QStringLiteral("title"), title); np.set(QStringLiteral("artist"), artist); diff --git a/plugins/mprisremote/mprisremoteplugin.cpp b/plugins/mprisremote/mprisremoteplugin.cpp index 2e9f24096..be89115ef 100644 --- a/plugins/mprisremote/mprisremoteplugin.cpp +++ b/plugins/mprisremote/mprisremoteplugin.cpp @@ -84,30 +84,30 @@ long MprisRemotePlugin::position() const QString MprisRemotePlugin::dbusPath() const { - return "/modules/kdeconnect/devices/" + device()->id() + "/mprisremote"; + return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/mprisremote"); } void MprisRemotePlugin::requestPlayerStatus(const QString& player) { NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, { - {"player", player}, - {"requestNowPlaying", true}, - {"requestVolume", true}} + {QStringLiteral("player"), player}, + {QStringLiteral("requestNowPlaying"), true}, + {QStringLiteral("requestVolume"), true}} ); sendPacket(np); } void MprisRemotePlugin::requestPlayerList() { - NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {{"requestPlayerList", true}}); + NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {{QStringLiteral("requestPlayerList"), true}}); sendPacket(np); } void MprisRemotePlugin::sendAction(const QString& action) { NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, { - {"player", m_currentPlayer}, - {"action", action} + {QStringLiteral("player"), m_currentPlayer}, + {QStringLiteral("action"), action} }); sendPacket(np); } @@ -115,16 +115,16 @@ void MprisRemotePlugin::sendAction(const QString& action) void MprisRemotePlugin::seek(int offset) const { NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, { - {"player", m_currentPlayer}, - {"Seek", offset}}); + {QStringLiteral("player"), m_currentPlayer}, + {QStringLiteral("Seek"), offset}}); sendPacket(np); } void MprisRemotePlugin::setVolume(int volume) { NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, { - {"player", m_currentPlayer}, - {"setVolume",volume} + {QStringLiteral("player"), m_currentPlayer}, + {QStringLiteral("setVolume"), volume} }); sendPacket(np); } @@ -132,8 +132,8 @@ void MprisRemotePlugin::setVolume(int volume) void MprisRemotePlugin::setPosition(int position) { NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, { - {"player", m_currentPlayer}, - {"SetPosition", position} + {QStringLiteral("player"), m_currentPlayer}, + {QStringLiteral("SetPosition"), position} }); sendPacket(np); diff --git a/plugins/notifications/notification.cpp b/plugins/notifications/notification.cpp index 52dfa8284..845f04c2e 100644 --- a/plugins/notifications/notification.cpp +++ b/plugins/notifications/notification.cpp @@ -44,9 +44,9 @@ Notification::Notification(const NetworkPacket& np, const Device* device, QObjec //Make a own directory for each user so noone can see each others icons QString username; #ifdef Q_OS_WIN - username = qgetenv("USERNAME"); + username = QString::fromLatin1(qgetenv("USERNAME")); #else - username = qgetenv("USER"); + username = QString::fromLatin1(qgetenv("USER")); #endif m_imagesDir = QDir::temp().absoluteFilePath(QStringLiteral("kdeconnect_") + username); @@ -122,7 +122,7 @@ void Notification::createKNotification(const NetworkPacket& np) } else if (m_text.isEmpty()) { m_notification->setText(escapedTitle); } else { - m_notification->setText(escapedTitle + ": " + escapedText); + m_notification->setText(escapedTitle + QStringLiteral(": ") + escapedText); } #if KNOTIFICATIONS_VERSION >= QT_VERSION_CHECK(5, 57, 0) diff --git a/plugins/notifications/notificationsdbusinterface.cpp b/plugins/notifications/notificationsdbusinterface.cpp index f28d749f2..210a54760 100644 --- a/plugins/notifications/notificationsdbusinterface.cpp +++ b/plugins/notifications/notificationsdbusinterface.cpp @@ -118,7 +118,7 @@ void NotificationsDbusInterface::addNotification(Notification* noti) m_notifications[publicId] = noti; m_internalIdToPublicId[internalId] = publicId; - DbusHelper::sessionBus().registerObject(m_device->dbusPath()+"/notifications/"+publicId, noti, QDBusConnection::ExportScriptableContents); + DbusHelper::sessionBus().registerObject(m_device->dbusPath() + QStringLiteral("/notifications/") + publicId, noti, QDBusConnection::ExportScriptableContents); Q_EMIT notificationPosted(publicId); } @@ -181,8 +181,8 @@ void NotificationsDbusInterface::sendReply(const QString& replyId, const QString void NotificationsDbusInterface::sendAction(const QString& key, const QString& action) { NetworkPacket np(PACKET_TYPE_NOTIFICATION_ACTION); - np.set("key", key); - np.set("action", action); + np.set(QStringLiteral("key"), key); + np.set(QStringLiteral("action"), action); m_plugin->sendPacket(np); } diff --git a/plugins/notifications/notificationsplugin.cpp b/plugins/notifications/notificationsplugin.cpp index ca93863e0..3fb979b84 100644 --- a/plugins/notifications/notificationsplugin.cpp +++ b/plugins/notifications/notificationsplugin.cpp @@ -37,7 +37,7 @@ NotificationsPlugin::NotificationsPlugin(QObject* parent, const QVariantList& ar void NotificationsPlugin::connected() { - NetworkPacket np(PACKET_TYPE_NOTIFICATION_REQUEST, {{"request", true}}); + NetworkPacket np(PACKET_TYPE_NOTIFICATION_REQUEST, {{QStringLiteral("request"), true}}); sendPacket(np); } diff --git a/plugins/notifications/sendreplydialog.cpp b/plugins/notifications/sendreplydialog.cpp index e957ba8ed..4d960a4f2 100644 --- a/plugins/notifications/sendreplydialog.cpp +++ b/plugins/notifications/sendreplydialog.cpp @@ -35,7 +35,7 @@ SendReplyDialog::SendReplyDialog(const QString& originalMessage, const QString& , m_ui(new Ui::SendReplyDialog) { m_ui->setupUi(this); - m_ui->textView->setText(topicName + ": \n" + originalMessage); + m_ui->textView->setText(topicName + QStringLiteral(": \n") + originalMessage); auto button = m_ui->buttonBox->button(QDialogButtonBox::Ok); button->setText(i18n("Send")); diff --git a/plugins/photo/photoplugin.cpp b/plugins/photo/photoplugin.cpp index f31f03bc4..2260d77bf 100644 --- a/plugins/photo/photoplugin.cpp +++ b/plugins/photo/photoplugin.cpp @@ -65,7 +65,7 @@ void PhotoPlugin::requestPhoto(const QString& fileName) QString PhotoPlugin::dbusPath() const { - return "/modules/kdeconnect/devices/" + device()->id() + "/photo"; + return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/photo"); } #include "photoplugin.moc" diff --git a/plugins/ping/pingplugin.cpp b/plugins/ping/pingplugin.cpp index 4207cfec8..91e79c276 100644 --- a/plugins/ping/pingplugin.cpp +++ b/plugins/ping/pingplugin.cpp @@ -71,7 +71,7 @@ void PingPlugin::sendPing(const QString& customMessage) QString PingPlugin::dbusPath() const { - return "/modules/kdeconnect/devices/" + device()->id() + "/ping"; + return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/ping"); } #include "pingplugin.moc" diff --git a/plugins/remotecommands/remotecommandsplugin.cpp b/plugins/remotecommands/remotecommandsplugin.cpp index 163cd154e..4796b2f1a 100644 --- a/plugins/remotecommands/remotecommandsplugin.cpp +++ b/plugins/remotecommands/remotecommandsplugin.cpp @@ -55,13 +55,13 @@ bool RemoteCommandsPlugin::receivePacket(const NetworkPacket& np) void RemoteCommandsPlugin::connected() { - NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{"requestCommandList", true}}); + NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{QStringLiteral("requestCommandList"), true}}); sendPacket(np); } QString RemoteCommandsPlugin::dbusPath() const { - return "/modules/kdeconnect/devices/" + device()->id() + "/remotecommands"; + return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/remotecommands"); } void RemoteCommandsPlugin::setCommands(const QByteArray& cmds) @@ -74,13 +74,13 @@ void RemoteCommandsPlugin::setCommands(const QByteArray& cmds) void RemoteCommandsPlugin::triggerCommand(const QString& key) { - NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{ "key", key }}); + NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{QStringLiteral("key"), key }}); sendPacket(np); } void RemoteCommandsPlugin::editCommands() { - NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{ "setup", true }}); + NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{QStringLiteral("setup"), true }}); sendPacket(np); } diff --git a/plugins/remotecontrol/remotecontrolplugin.cpp b/plugins/remotecontrol/remotecontrolplugin.cpp index 0e348a1a4..939f7d287 100644 --- a/plugins/remotecontrol/remotecontrolplugin.cpp +++ b/plugins/remotecontrol/remotecontrolplugin.cpp @@ -45,8 +45,8 @@ RemoteControlPlugin::~RemoteControlPlugin() void RemoteControlPlugin::moveCursor(const QPoint &p) { NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, { - {"dx", p.x()}, - {"dy", p.y()} + {QStringLiteral("dx"), p.x()}, + {QStringLiteral("dy"), p.y()} }); sendPacket(np); } @@ -59,7 +59,7 @@ void RemoteControlPlugin::sendCommand(const QString &name, bool val) QString RemoteControlPlugin::dbusPath() const { - return "/modules/kdeconnect/devices/" + device()->id() + "/remotecontrol"; + return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/remotecontrol"); } #include "remotecontrolplugin.moc" diff --git a/plugins/remotekeyboard/remotekeyboardplugin.cpp b/plugins/remotekeyboard/remotekeyboardplugin.cpp index a9c59ee63..9ac8272ab 100644 --- a/plugins/remotekeyboard/remotekeyboardplugin.cpp +++ b/plugins/remotekeyboard/remotekeyboardplugin.cpp @@ -79,22 +79,22 @@ RemoteKeyboardPlugin::~RemoteKeyboardPlugin() bool RemoteKeyboardPlugin::receivePacket(const NetworkPacket& np) { if (np.type() == PACKET_TYPE_MOUSEPAD_ECHO) { - if (!np.has("isAck") || !np.has("key")) { + if (!np.has(QStringLiteral("isAck")) || !np.has(QStringLiteral("key"))) { qCWarning(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "Invalid packet of type" << PACKET_TYPE_MOUSEPAD_ECHO; return false; } // qCWarning(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "Received keypress" << np; - Q_EMIT keyPressReceived(np.get("key"), - np.get("specialKey", 0), - np.get("shift", false), - np.get("ctrl", false), - np.get("alt", false)); + Q_EMIT keyPressReceived(np.get(QStringLiteral("key")), + np.get(QStringLiteral("specialKey"), 0), + np.get(QStringLiteral("shift"), false), + np.get(QStringLiteral("ctrl"), false), + np.get(QStringLiteral("alt"), 0)); return true; } else if (np.type() == PACKET_TYPE_MOUSEPAD_KEYBOARDSTATE) { // qCWarning(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "Received keyboardstate" << np; - if (m_remoteState != np.get("state")) { - m_remoteState = np.get("state"); + if (m_remoteState != np.get(QStringLiteral("state"))) { + m_remoteState = np.get(QStringLiteral("state")); Q_EMIT remoteStateChanged(m_remoteState); } return true; @@ -107,23 +107,23 @@ void RemoteKeyboardPlugin::sendKeyPress(const QString& key, int specialKey, bool alt, bool sendAck) const { NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, { - {"key", key}, - {"specialKey", specialKey}, - {"shift", shift}, - {"ctrl", ctrl}, - {"alt", alt}, - {"sendAck", sendAck} + {QStringLiteral("key"), key}, + {QStringLiteral("specialKey"), specialKey}, + {QStringLiteral("shift"), shift}, + {QStringLiteral("ctrl"), ctrl}, + {QStringLiteral("alt"), alt}, + {QStringLiteral("sendAck"), sendAck} }); sendPacket(np); } void RemoteKeyboardPlugin::sendQKeyEvent(const QVariantMap& keyEvent, bool sendAck) const { - if (!keyEvent.contains("key")) + if (!keyEvent.contains(QStringLiteral("key"))) return; - int k = translateQtKey(keyEvent.value("key").toInt()); - int modifiers = keyEvent.value("modifiers").toInt(); - sendKeyPress(keyEvent.value("text").toString(), k, + int k = translateQtKey(keyEvent.value(QStringLiteral("key")).toInt()); + int modifiers = keyEvent.value(QStringLiteral("modifiers")).toInt(); + sendKeyPress(keyEvent.value(QStringLiteral("text")).toString(), k, modifiers & Qt::ShiftModifier, modifiers & Qt::ControlModifier, modifiers & Qt::AltModifier, @@ -141,7 +141,7 @@ void RemoteKeyboardPlugin::connected() QString RemoteKeyboardPlugin::dbusPath() const { - return "/modules/kdeconnect/devices/" + device()->id() + "/remotekeyboard"; + return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/remotekeyboard"); } diff --git a/plugins/remotesystemvolume/remotesystemvolumeplugin.cpp b/plugins/remotesystemvolume/remotesystemvolumeplugin.cpp index 6b579024f..6eafa8b67 100644 --- a/plugins/remotesystemvolume/remotesystemvolumeplugin.cpp +++ b/plugins/remotesystemvolume/remotesystemvolumeplugin.cpp @@ -98,7 +98,7 @@ QByteArray RemoteSystemVolumePlugin::sinks() QString RemoteSystemVolumePlugin::dbusPath() const { - return "/modules/kdeconnect/devices/" + device()->id() + "/remotesystemvolume"; + return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/remotesystemvolume"); } #include "remotesystemvolumeplugin.moc" diff --git a/plugins/runcommand/runcommandplugin.cpp b/plugins/runcommand/runcommandplugin.cpp index f32f6dfce..e962fd56d 100644 --- a/plugins/runcommand/runcommandplugin.cpp +++ b/plugins/runcommand/runcommandplugin.cpp @@ -79,7 +79,7 @@ bool RunCommandPlugin::receivePacket(const NetworkPacket& np) qCInfo(KDECONNECT_PLUGIN_RUNCOMMAND) << "Running:" << COMMAND << ARGS << commandJson[QStringLiteral("command")].toString(); QProcess::startDetached(QStringLiteral(COMMAND), QStringList()<< QStringLiteral(ARGS) << commandJson[QStringLiteral("command")].toString()); return true; - } else if (np.has("setup")) { + } else if (np.has(QStringLiteral("setup"))) { QProcess::startDetached(QStringLiteral("kcmshell5"), {QStringLiteral("kdeconnect"), QStringLiteral("--args"), QString(device()->id() + QStringLiteral(":kdeconnect_runcommand")) }); } @@ -95,7 +95,7 @@ void RunCommandPlugin::connected() void RunCommandPlugin::sendConfig() { QString commands = config()->get(QStringLiteral("commands"),QStringLiteral("{}")); - NetworkPacket np(PACKET_TYPE_RUNCOMMAND, {{"commandList", commands}}); + NetworkPacket np(PACKET_TYPE_RUNCOMMAND, {{QStringLiteral("commandList"), commands}}); #if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 45, 0) np.set(QStringLiteral("canAddCommand"), true); diff --git a/plugins/screensaver-inhibit/screensaverinhibitplugin.cpp b/plugins/screensaver-inhibit/screensaverinhibitplugin.cpp index 775517c53..0f9b9615c 100644 --- a/plugins/screensaver-inhibit/screensaverinhibitplugin.cpp +++ b/plugins/screensaver-inhibit/screensaverinhibitplugin.cpp @@ -44,7 +44,7 @@ ScreensaverInhibitPlugin::ScreensaverInhibitPlugin(QObject* parent, const QVaria QDBusMessage reply = inhibitInterface.call(INHIBIT_METHOD, QStringLiteral("org.kde.kdeconnect.daemon"), i18n("Phone is connected")); - if (reply.errorMessage() != nullptr) { + if (!reply.errorMessage().isEmpty()) { qCDebug(KDECONNECT_PLUGIN_SCREENSAVERINHIBIT) << "Unable to inhibit the screensaver: " << reply.errorMessage(); inhibitCookie = 0; } else { diff --git a/plugins/sendnotifications/notificationslistener.cpp b/plugins/sendnotifications/notificationslistener.cpp index b954c6ddb..250953a43 100644 --- a/plugins/sendnotifications/notificationslistener.cpp +++ b/plugins/sendnotifications/notificationslistener.cpp @@ -65,7 +65,7 @@ NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin) QDBusInterface iface(QStringLiteral("org.freedesktop.DBus"), QStringLiteral("/org/freedesktop/DBus"), QStringLiteral("org.freedesktop.DBus")); iface.call(QStringLiteral("AddMatch"), - "interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'"); + QStringLiteral("interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'")); setTranslatedAppName(); loadApplications(); @@ -79,7 +79,7 @@ NotificationsListener::~NotificationsListener() QDBusInterface iface(QStringLiteral("org.freedesktop.DBus"), QStringLiteral("/org/freedesktop/DBus"), QStringLiteral("org.freedesktop.DBus")); QDBusMessage res = iface.call(QStringLiteral("RemoveMatch"), - "interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'"); + QStringLiteral("interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'")); DbusHelper::sessionBus().unregisterObject(QStringLiteral("/org/freedesktop/Notifications")); } @@ -172,7 +172,7 @@ QSharedPointer NotificationsListener::iconForIconName(const QString& // try falling back to hicolor theme: KIconTheme hicolor(QStringLiteral("hicolor")); if (hicolor.isValid()) { - iconPath = hicolor.iconPath(iconName + ".png", size, KIconLoader::MatchBest); + iconPath = hicolor.iconPath(iconName + QStringLiteral(".png"), size, KIconLoader::MatchBest); //qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Found non-png icon in default theme trying fallback to hicolor:" << iconPath; } } @@ -242,10 +242,10 @@ uint NotificationsListener::Notify(const QString& appName, uint replacesId, //qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Sending notification from" << appName << ":" < 0 ? replacesId : ++id)}, - {"appName", appName}, - {"ticker", ticker}, - {"isClearable", timeout == 0} + {QStringLiteral("id"), QString::number(replacesId > 0 ? replacesId : ++id)}, + {QStringLiteral("appName"), appName}, + {QStringLiteral("ticker"), ticker}, + {QStringLiteral("isClearable"), timeout == 0} }); // KNotifications are persistent if // timeout == 0, for other notifications // clearability is pointless diff --git a/plugins/sftp/mounter.cpp b/plugins/sftp/mounter.cpp index 0241e7e83..9144e6833 100644 --- a/plugins/sftp/mounter.cpp +++ b/plugins/sftp/mounter.cpp @@ -83,8 +83,8 @@ void Mounter::onPackageReceived(const NetworkPacket& np) return; } - if (np.has("errorMessage")) { - Q_EMIT failed(np.get("errorMessage", "")); + if (np.has(QStringLiteral("errorMessage"))) { + Q_EMIT failed(np.get(QStringLiteral("errorMessage"))); return; } @@ -116,7 +116,7 @@ void Mounter::onPackageReceived(const NetworkPacket& np) const QString program = QStringLiteral("sshfs"); QString path; - if (np.has(QStringLiteral("multiPaths"))) path = '/'; + if (np.has(QStringLiteral("multiPaths"))) path = QStringLiteral("/"); else path = np.get(QStringLiteral("path")); QHostAddress addr = m_sftp->device()->getLocalIpAddress(); @@ -136,7 +136,7 @@ void Mounter::onPackageReceived(const NetworkPacket& np) << QStringLiteral("-s") // This fixes a bug where file chunks are sent out of order and get corrupted on reception << QStringLiteral("-f") << QStringLiteral("-F") << QStringLiteral("/dev/null") //Do not use ~/.ssh/config - << QStringLiteral("-o") << "IdentityFile=" + KdeConnectConfig::instance()->privateKeyPath() + << QStringLiteral("-o") << QStringLiteral("IdentityFile=") + KdeConnectConfig::instance()->privateKeyPath() << QStringLiteral("-o") << QStringLiteral("StrictHostKeyChecking=no") //Do not ask for confirmation because it is not a known host << QStringLiteral("-o") << QStringLiteral("UserKnownHostsFile=/dev/null") //Prevent storing as a known host << QStringLiteral("-o") << QStringLiteral("HostKeyAlgorithms=+ssh-dss") //https://bugs.kde.org/show_bug.cgi?id=351725 @@ -218,7 +218,7 @@ void Mounter::onMountTimeout() void Mounter::start() { - NetworkPacket np(PACKET_TYPE_SFTP_REQUEST, {{"startBrowsing", true}}); + NetworkPacket np(PACKET_TYPE_SFTP_REQUEST, {{QStringLiteral("startBrowsing"), true}}); m_sftp->sendPacket(np); m_connectTimer.start(); diff --git a/plugins/sftp/sftpplugin.cpp b/plugins/sftp/sftpplugin.cpp index 28ac90876..b0e1d03dd 100644 --- a/plugins/sftp/sftpplugin.cpp +++ b/plugins/sftp/sftpplugin.cpp @@ -68,14 +68,14 @@ void SftpPlugin::addToDolphin() { removeFromDolphin(); - QUrl kioUrl("kdeconnect://"+deviceId+"/"); + QUrl kioUrl(QStringLiteral("kdeconnect://") + deviceId + QStringLiteral("/")); d->m_placesModel.addPlace(device()->name(), kioUrl, QStringLiteral("kdeconnect")); qCDebug(KDECONNECT_PLUGIN_SFTP) << "add to dolphin"; } void SftpPlugin::removeFromDolphin() { - QUrl kioUrl("kdeconnect://"+deviceId+"/"); + QUrl kioUrl(QStringLiteral("kdeconnect://") + deviceId + QStringLiteral("/")); QModelIndex index = d->m_placesModel.closestItem(kioUrl); while (index.row() != -1) { d->m_placesModel.removePlace(index); @@ -129,14 +129,14 @@ bool SftpPlugin::startBrowsing() { if (mountAndWait()) { //return new KRun(QUrl::fromLocalFile(mountPoint()), 0); - return new KRun(QUrl("kdeconnect://"+deviceId), nullptr); + return new KRun(QUrl(QStringLiteral("kdeconnect://") + deviceId), nullptr); } return false; } bool SftpPlugin::receivePacket(const NetworkPacket& np) { - if (!(fields_c - np.body().keys().toSet()).isEmpty() && !np.has("errorMessage")) { + if (!(fields_c - np.body().keys().toSet()).isEmpty() && !np.has(QStringLiteral("errorMessage"))) { // packet is invalid return false; } @@ -153,7 +153,7 @@ bool SftpPlugin::receivePacket(const NetworkPacket& np) } } else { remoteDirectories.insert(mountPoint(), i18n("All files")); - remoteDirectories.insert(mountPoint() + "/DCIM/Camera", i18n("Camera pictures")); + remoteDirectories.insert(mountPoint() + QStringLiteral("/DCIM/Camera"), i18n("Camera pictures")); } return true; } diff --git a/plugins/sftp/sftpplugin.h b/plugins/sftp/sftpplugin.h index 044368ea1..389cf2074 100644 --- a/plugins/sftp/sftpplugin.h +++ b/plugins/sftp/sftpplugin.h @@ -38,7 +38,7 @@ public: bool receivePacket(const NetworkPacket& np) override; void connected() override {} - QString dbusPath() const override { return "/modules/kdeconnect/devices/" + deviceId + "/sftp"; } + QString dbusPath() const override { return QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/sftp"); } Q_SIGNALS: void packetReceived(const NetworkPacket& np); diff --git a/plugins/share/shareplugin.cpp b/plugins/share/shareplugin.cpp index 9f102c065..321b67a28 100644 --- a/plugins/share/shareplugin.cpp +++ b/plugins/share/shareplugin.cpp @@ -69,9 +69,9 @@ QUrl SharePlugin::getFileDestination(const QString filename) const { const QUrl dir = destinationDir().adjusted(QUrl::StripTrailingSlash); QUrl destination(dir); - destination.setPath(dir.path() + '/' + filename, QUrl::DecodedMode); + destination.setPath(dir.path() + QStringLiteral("/") + filename, QUrl::DecodedMode); if (destination.isLocalFile() && QFile::exists(destination.toLocalFile())) { - destination.setPath(dir.path() + '/' + KIO::suggestName(dir, filename), QUrl::DecodedMode); + destination.setPath(dir.path() + QStringLiteral("/") + KIO::suggestName(dir, filename), QUrl::DecodedMode); } return destination; } @@ -128,7 +128,7 @@ bool SharePlugin::receivePacket(const NetworkPacket& np) } FileTransferJob* job = np.createPayloadTransferJob(destination); - job->setOriginName(device()->name() + ": " + filename); + job->setOriginName(device()->name() + QStringLiteral(": ") + filename); connect(job, &KJob::result, this, [this, dateModified] (KJob* job) -> void { finished(job, dateModified); }); m_compositeJob->addSubjob(job); @@ -149,7 +149,7 @@ bool SharePlugin::receivePacket(const NetworkPacket& np) if (defaultApp == QLatin1String("org.kde.kate") || defaultApp == QLatin1String("org.kde.kwrite")) { QProcess* proc = new QProcess(); connect(proc, SIGNAL(finished(int)), proc, SLOT(deleteLater())); - proc->start(defaultApp.section('.', 2,2), QStringList(QStringLiteral("--stdin"))); + proc->start(defaultApp.section(QStringLiteral("."), 2,2), QStringList(QStringLiteral("--stdin"))); proc->write(text.toUtf8()); proc->closeWriteChannel(); } else { @@ -232,7 +232,7 @@ void SharePlugin::openFile(const QUrl& url) QString SharePlugin::dbusPath() const { - return "/modules/kdeconnect/devices/" + device()->id() + "/share"; + return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/share"); } #include "shareplugin.moc" diff --git a/plugins/sms/smsplugin.cpp b/plugins/sms/smsplugin.cpp index 68773e79f..03d7dec37 100644 --- a/plugins/sms/smsplugin.cpp +++ b/plugins/sms/smsplugin.cpp @@ -61,9 +61,9 @@ bool SmsPlugin::receivePacket(const NetworkPacket& np) void SmsPlugin::sendSms(const QString& phoneNumber, const QString& messageBody) { NetworkPacket np(PACKET_TYPE_SMS_REQUEST, { - {"sendSms", true}, - {"phoneNumber", phoneNumber}, - {"messageBody", messageBody} + {QStringLiteral("sendSms"), true}, + {QStringLiteral("phoneNumber"), phoneNumber}, + {QStringLiteral("messageBody"), messageBody} }); qCDebug(KDECONNECT_PLUGIN_SMS) << "Dispatching SMS send request to remote"; sendPacket(np); @@ -79,7 +79,7 @@ void SmsPlugin::requestAllConversations() void SmsPlugin::requestConversation (const qint64& conversationID) const { NetworkPacket np(PACKET_TYPE_SMS_REQUEST_CONVERSATION); - np.set("threadID", conversationID); + np.set(QStringLiteral("threadID"), conversationID); sendPacket(np); } @@ -99,7 +99,7 @@ void SmsPlugin::forwardToTelepathy(const ConversationMessage& message) bool SmsPlugin::handleBatchMessages(const NetworkPacket& np) { - const auto messages = np.get("messages"); + const auto messages = np.get(QStringLiteral("messages")); QList messagesList; messagesList.reserve(messages.count()); @@ -119,7 +119,7 @@ bool SmsPlugin::handleBatchMessages(const NetworkPacket& np) QString SmsPlugin::dbusPath() const { - return "/modules/kdeconnect/devices/" + device()->id() + "/sms"; + return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/sms"); } #include "smsplugin.moc" diff --git a/plugins/systemvolume/systemvolumeplugin-pulse.cpp b/plugins/systemvolume/systemvolumeplugin-pulse.cpp index 6f983927d..a4e77abf0 100644 --- a/plugins/systemvolume/systemvolumeplugin-pulse.cpp +++ b/plugins/systemvolume/systemvolumeplugin-pulse.cpp @@ -93,11 +93,11 @@ void SystemvolumePlugin::sendSinkList() { }); QJsonObject sinkObject { - {"name", sink->name()}, - {"muted", sink->isMuted()}, - {"description", sink->description()}, - {"volume", sink->volume()}, - {"maxVolume", PulseAudioQt::normalVolume()} + {QStringLiteral("name"), sink->name()}, + {QStringLiteral("muted"), sink->isMuted()}, + {QStringLiteral("description"), sink->description()}, + {QStringLiteral("volume"), sink->volume()}, + {QStringLiteral("maxVolume"), PulseAudioQt::normalVolume()} }; array.append(sinkObject); diff --git a/plugins/systemvolume/systemvolumeplugin-win.cpp b/plugins/systemvolume/systemvolumeplugin-win.cpp index d01cf585c..8a8916e9d 100644 --- a/plugins/systemvolume/systemvolumeplugin-win.cpp +++ b/plugins/systemvolume/systemvolumeplugin-win.cpp @@ -270,8 +270,8 @@ bool SystemvolumePlugin::sendSinkList() #endif QJsonObject sinkObject; - sinkObject.insert("name", name); - sinkObject.insert("description", desc); + sinkObject.insert(QStringLiteral("name"), name); + sinkObject.insert(QStringLiteral("description"), desc); hr = device->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, (void **)&endpoint); if (hr != S_OK) @@ -285,9 +285,9 @@ bool SystemvolumePlugin::sendSinkList() endpoint->GetMasterVolumeLevelScalar(&volume); endpoint->GetMute(&muted); - sinkObject.insert("muted", (bool)muted); - sinkObject.insert("volume", (qint64)(volume * 100)); - sinkObject.insert("maxVolume", (qint64)100); + sinkObject.insert(QStringLiteral("muted"), (bool)muted); + sinkObject.insert(QStringLiteral("volume"), (qint64)(volume * 100)); + sinkObject.insert(QStringLiteral("maxVolume"), (qint64)100); // Register Callback callback = new CAudioEndpointVolumeCallback(*this, name); diff --git a/plugins/telephony/telephonyplugin.cpp b/plugins/telephony/telephonyplugin.cpp index 3ffcf6758..7a450186b 100644 --- a/plugins/telephony/telephonyplugin.cpp +++ b/plugins/telephony/telephonyplugin.cpp @@ -122,13 +122,13 @@ bool TelephonyPlugin::receivePacket(const NetworkPacket& np) void TelephonyPlugin::sendMutePacket() { - NetworkPacket packet(PACKET_TYPE_TELEPHONY_REQUEST_MUTE, {{"action", "mute"}}); + NetworkPacket packet(PACKET_TYPE_TELEPHONY_REQUEST_MUTE, {{QStringLiteral("action"), QStringLiteral("mute")}}); sendPacket(packet); } QString TelephonyPlugin::dbusPath() const { - return "/modules/kdeconnect/devices/" + device()->id() + "/telephony"; + return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/telephony"); } #include "telephonyplugin.moc" diff --git a/runners/remotecommands/remotecommandsrunner.cpp b/runners/remotecommands/remotecommandsrunner.cpp index 884c3e15e..cacdd79a3 100644 --- a/runners/remotecommands/remotecommandsrunner.cpp +++ b/runners/remotecommands/remotecommandsrunner.cpp @@ -51,7 +51,7 @@ void RemoteCommandsRunner::match(Plasma::RunnerContext &context) DeviceDbusInterface deviceInterface(deviceId, this); - if(!deviceInterface.hasPlugin("kdeconnect_remotecommands")) { + if(!deviceInterface.hasPlugin(QStringLiteral("kdeconnect_remotecommands"))) { continue; } @@ -71,9 +71,9 @@ void RemoteCommandsRunner::match(Plasma::RunnerContext &context) match.setType(Plasma::QueryMatch::PossibleMatch); match.setId(it.key()); match.setIconName(QStringLiteral("kdeconnect")); - match.setText(deviceName + ": " + commandName); + match.setText(deviceName + QStringLiteral(": ") + commandName); match.setSubtext(cont.value(QStringLiteral("command")).toString()); - match.setData(deviceId + "$" + it.key()); + match.setData(deviceId + QStringLiteral("$") + it.key()); context.addMatch(match); } } @@ -83,9 +83,9 @@ void RemoteCommandsRunner::match(Plasma::RunnerContext &context) void RemoteCommandsRunner::run(const Plasma::RunnerContext &/*context*/, const Plasma::QueryMatch &match) { - RemoteCommandsDbusInterface remoteCommandsInterface(match.data().toString().split("$")[0], this); + RemoteCommandsDbusInterface remoteCommandsInterface(match.data().toString().split(QStringLiteral("$"))[0], this); - remoteCommandsInterface.triggerCommand(match.data().toString().split("$")[1]); + remoteCommandsInterface.triggerCommand(match.data().toString().split(QStringLiteral("$"))[1]); } #include "remotecommandsrunner.moc" diff --git a/smsapp/main.cpp b/smsapp/main.cpp index ba87513d2..6445f30f3 100644 --- a/smsapp/main.cpp +++ b/smsapp/main.cpp @@ -35,10 +35,10 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - KAboutData aboutData("org.kde.kdeconnect.sms", i18n("SMS Instant Messaging"), QStringLiteral(KDECONNECT_VERSION_STRING), i18n("KDE Connect SMS"), KAboutLicense::GPL, i18n("(c) 2018, Aleix Pol Gonzalez")); - aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), {}, "aleixpol@kde.org"); - aboutData.addAuthor(i18n("Nicolas Fella"), {}, "nicolas.fella@gmx.de"); - aboutData.addAuthor(i18n("Simon Redman"), {}, "simon@ergotech.com"); + KAboutData aboutData(QStringLiteral("org.kde.kdeconnect.sms"), i18n("SMS Instant Messaging"), QStringLiteral(KDECONNECT_VERSION_STRING), i18n("KDE Connect SMS"), KAboutLicense::GPL, i18n("(c) 2018, Aleix Pol Gonzalez")); + aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), {}, QStringLiteral("aleixpol@kde.org")); + aboutData.addAuthor(i18n("Nicolas Fella"), {}, QStringLiteral("nicolas.fella@gmx.de")); + aboutData.addAuthor(i18n("Simon Redman"), {}, QStringLiteral("simon@ergotech.com")); KAboutData::setApplicationData(aboutData); QString initialMessage; @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) QQmlApplicationEngine engine; engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); engine.rootContext()->setContextProperty(QStringLiteral("_initialMessage"), QVariant(initialMessage)); - engine.load(QUrl("qrc:/qml/main.qml")); + engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml"))); return app.exec(); } diff --git a/smsapp/smshelper.cpp b/smsapp/smshelper.cpp index a20c0d720..eac16c445 100644 --- a/smsapp/smshelper.cpp +++ b/smsapp/smshelper.cpp @@ -69,7 +69,7 @@ bool SmsHelper::isShortCode(const QString& phoneNumber, const SmsHelper::Country if (phoneNumber.length() <= 6) { return true; } - if (country == CountryCode::Australia && phoneNumber.length() == 8 && phoneNumber.startsWith("19")) { + if (country == CountryCode::Australia && phoneNumber.length() == 8 && phoneNumber.startsWith(QStringLiteral("19"))) { return true; } if (country == CountryCode::CzechRepublic && phoneNumber.length() <= 9) { @@ -86,10 +86,10 @@ SmsHelper::CountryCode SmsHelper::determineCountryCode(const QString& canonicalN // This is going to fall apart if someone has not entered a country code into their contact book // or if Android decides it can't be bothered to report the country code, but probably we will // be fine anyway - if (canonicalNumber.startsWith("41")) { + if (canonicalNumber.startsWith(QStringLiteral("41"))) { return CountryCode::Australia; } - if (canonicalNumber.startsWith("420")) { + if (canonicalNumber.startsWith(QStringLiteral("420"))) { return CountryCode::CzechRepublic; } @@ -101,12 +101,12 @@ SmsHelper::CountryCode SmsHelper::determineCountryCode(const QString& canonicalN QString SmsHelper::canonicalizePhoneNumber(const QString& phoneNumber) { QString toReturn(phoneNumber); - toReturn = toReturn.remove(' '); - toReturn = toReturn.remove('-'); - toReturn = toReturn.remove('('); - toReturn = toReturn.remove(')'); - toReturn = toReturn.remove('+'); - toReturn = toReturn.remove(QRegularExpression("^0*")); // Strip leading zeroes + toReturn = toReturn.remove(QStringLiteral(" ")); + toReturn = toReturn.remove(QStringLiteral("-")); + toReturn = toReturn.remove(QStringLiteral("(")); + toReturn = toReturn.remove(QStringLiteral(")")); + toReturn = toReturn.remove(QStringLiteral("+")); + toReturn = toReturn.remove(QRegularExpression(QStringLiteral("^0*"))); // Strip leading zeroes if (toReturn.length() == 0) { // If we have stripped away everything, assume this is a special number (and already canonicalized) diff --git a/tests/kdeconnectconfigtest.cpp b/tests/kdeconnectconfigtest.cpp index 02e3acbe1..94975c699 100644 --- a/tests/kdeconnectconfigtest.cpp +++ b/tests/kdeconnectconfigtest.cpp @@ -52,8 +52,8 @@ void KdeConnectConfigTest::addTrustedDevice() { kcc->addTrustedDevice(QStringLiteral("testdevice"), QStringLiteral("Test Device"), QStringLiteral("phone")); KdeConnectConfig::DeviceInfo devInfo = kcc->getTrustedDevice(QStringLiteral("testdevice")); - QCOMPARE(devInfo.deviceName, QString("Test Device")); - QCOMPARE(devInfo.deviceType, QString("phone")); + QCOMPARE(devInfo.deviceName, QStringLiteral("Test Device")); + QCOMPARE(devInfo.deviceType, QStringLiteral("phone")); } /* @@ -85,8 +85,8 @@ void KdeConnectConfigTest::removeTrustedDevice() { kcc->removeTrustedDevice(QStringLiteral("testdevice")); KdeConnectConfig::DeviceInfo devInfo = kcc->getTrustedDevice(QStringLiteral("testdevice")); - QCOMPARE(devInfo.deviceName, QString("unnamed")); - QCOMPARE(devInfo.deviceType, QString("unknown")); + QCOMPARE(devInfo.deviceName, QStringLiteral("unnamed")); + QCOMPARE(devInfo.deviceType, QStringLiteral("unknown")); } QTEST_GUILESS_MAIN(KdeConnectConfigTest) diff --git a/tests/lanlinkprovidertest.cpp b/tests/lanlinkprovidertest.cpp index 3589404a6..3d0ed68ab 100644 --- a/tests/lanlinkprovidertest.cpp +++ b/tests/lanlinkprovidertest.cpp @@ -398,11 +398,11 @@ void LanLinkProviderTest::testIdentityPacket(QByteArray& identityPacket) QJsonObject jsonObject = jsonDocument.object(); QJsonObject body = jsonObject.value(QStringLiteral("body")).toObject(); - QCOMPARE(jsonObject.value("type").toString(), QString("kdeconnect.identity")); - QVERIFY2(body.contains("deviceName"), "Device name not found in identity packet"); - QVERIFY2(body.contains("deviceId"), "Device id not found in identity packet"); - QVERIFY2(body.contains("protocolVersion"), "Protocol version not found in identity packet"); - QVERIFY2(body.contains("deviceType"), "Device type not found in identity packet"); + QCOMPARE(jsonObject.value(QStringLiteral("type")).toString(), QStringLiteral("kdeconnect.identity")); + QVERIFY2(body.contains(QStringLiteral("deviceName")), "Device name not found in identity packet"); + QVERIFY2(body.contains(QStringLiteral("deviceId")), "Device id not found in identity packet"); + QVERIFY2(body.contains(QStringLiteral("protocolVersion")), "Protocol version not found in identity packet"); + QVERIFY2(body.contains(QStringLiteral("deviceType")), "Device type not found in identity packet"); } QSslCertificate LanLinkProviderTest::generateCertificate(QString& commonName, QCA::PrivateKey& privateKey) @@ -448,7 +448,7 @@ void LanLinkProviderTest::socketBindErrorFail(const QUdpSocket& socket) QAbstractSocket::SocketError sockErr = socket.error(); // Refer to https://doc.qt.io/qt-5/qabstractsocket.html#SocketError-enum to decode socket error number QString errorMessage = QLatin1String("Failed to bind UDP socket with error "); - errorMessage = errorMessage + QMetaEnum::fromType().valueToKey(sockErr); + errorMessage = errorMessage + QString::fromLatin1(QMetaEnum::fromType().valueToKey(sockErr)); QFAIL(errorMessage.toLocal8Bit().data()); } diff --git a/tests/networkpackettests.cpp b/tests/networkpackettests.cpp index d6e1d3237..09d57d789 100644 --- a/tests/networkpackettests.cpp +++ b/tests/networkpackettests.cpp @@ -35,16 +35,16 @@ void NetworkPacketTests::networkPacketTest() { NetworkPacket np(QStringLiteral("com.test")); - np.set(QStringLiteral("hello"),"hola"); - QCOMPARE( (np.get("hello","bye")) , QString("hola") ); + np.set(QStringLiteral("hello"), QStringLiteral("hola")); + QCOMPARE( (np.get(QStringLiteral("hello"), QStringLiteral("bye"))) , QStringLiteral("hola") ); - np.set(QStringLiteral("hello"),""); - QCOMPARE( (np.get("hello","bye")) , QString("") ); + np.set(QStringLiteral("hello"), QString()); + QCOMPARE((np.get(QStringLiteral("hello"), QStringLiteral("bye"))) , QString()); np.body().remove(QStringLiteral("hello")); - QCOMPARE( (np.get("hello","bye")) , QString("bye") ); + QCOMPARE((np.get(QStringLiteral("hello"), QStringLiteral("bye"))) , QStringLiteral("bye")); - np.set(QStringLiteral("foo"), "bar"); + np.set(QStringLiteral("foo"), QStringLiteral("bar")); QByteArray ba = np.serialize(); //qDebug() << "Serialized packet:" << ba; NetworkPacket np2(QLatin1String("")); @@ -57,10 +57,10 @@ void NetworkPacketTests::networkPacketTest() QByteArray json("{\"id\":\"123\",\"type\":\"test\",\"body\":{\"testing\":true}}"); //qDebug() << json; NetworkPacket::unserialize(json,&np2); - QCOMPARE( np2.id(), QString("123") ); - QCOMPARE( (np2.get("testing")), true ); - QCOMPARE( (np2.get("not_testing")), false ); - QCOMPARE( (np2.get("not_testing",true)), true ); + QCOMPARE( np2.id(), QStringLiteral("123") ); + QCOMPARE( (np2.get(QStringLiteral("testing"))), true ); + QCOMPARE( (np2.get(QStringLiteral("not_testing"))), false ); + QCOMPARE( (np2.get(QStringLiteral("not_testing"),true)), true ); //NetworkPacket::unserialize("this is not json",&np2); //QtTest::ignoreMessage(QtSystemMsg, "json_parser - syntax error found, forcing abort, Line 1 Column 0"); @@ -73,7 +73,7 @@ void NetworkPacketTests::networkPacketIdentityTest() NetworkPacket np(QLatin1String("")); NetworkPacket::createIdentityPacket(&np); - QCOMPARE( np.get("protocolVersion", -1) , NetworkPacket::s_protocolVersion ); + QCOMPARE( np.get(QStringLiteral("protocolVersion"), -1) , NetworkPacket::s_protocolVersion ); QCOMPARE( np.type() , PACKET_TYPE_IDENTITY ); } diff --git a/tests/pluginloadtest.cpp b/tests/pluginloadtest.cpp index 98f9cd896..864d6abd4 100644 --- a/tests/pluginloadtest.cpp +++ b/tests/pluginloadtest.cpp @@ -75,12 +75,12 @@ class PluginLoadTest : public QObject QVERIFY(d->isReachable()); d->setPluginEnabled(QStringLiteral("kdeconnect_mousepad"), false); - QCOMPARE(d->isPluginEnabled("kdeconnect_mousepad"), false); - QVERIFY(d->supportedPlugins().contains("kdeconnect_remotecontrol")); + QCOMPARE(d->isPluginEnabled(QStringLiteral("kdeconnect_mousepad")), false); + QVERIFY(d->supportedPlugins().contains(QStringLiteral("kdeconnect_remotecontrol"))); d->setPluginEnabled(QStringLiteral("kdeconnect_mousepad"), true); - QCOMPARE(d->isPluginEnabled("kdeconnect_mousepad"), true); - QVERIFY(d->supportedPlugins().contains("kdeconnect_remotecontrol")); + QCOMPARE(d->isPluginEnabled(QStringLiteral("kdeconnect_mousepad")), true); + QVERIFY(d->supportedPlugins().contains(QStringLiteral("kdeconnect_remotecontrol"))); } private: diff --git a/tests/sendfiletest.cpp b/tests/sendfiletest.cpp index 892adc7c4..02d87f236 100644 --- a/tests/sendfiletest.cpp +++ b/tests/sendfiletest.cpp @@ -98,7 +98,7 @@ class TestSendFile : public QObject void testSslJobs() { const QString aFile = QFINDTESTDATA("sendfiletest.cpp"); - const QString destFile = QDir::tempPath() + "/kdeconnect-test-sentfile"; + const QString destFile = QDir::tempPath() + QStringLiteral("/kdeconnect-test-sentfile"); QFile(destFile).remove(); const QString deviceId = KdeConnectConfig::instance()->deviceId() diff --git a/tests/testnotificationlistener.cpp b/tests/testnotificationlistener.cpp index 4897df6a8..6de12a4fa 100644 --- a/tests/testnotificationlistener.cpp +++ b/tests/testnotificationlistener.cpp @@ -137,9 +137,9 @@ void TestNotificationListener::testNotify() QCOMPARE(proxiedNotifications, d->getSentPackets()); plugin = new TestNotificationsPlugin(this, QVariantList({ QVariant::fromValue(d), - "notifications_plugin", - {"kdeconnect.notification"}, - "preferences-desktop-notification"})); + QStringLiteral("notifications_plugin"), + {QStringLiteral("kdeconnect.notification")}, + QStringLiteral("preferences-desktop-notification")})); QVERIFY(plugin->getNotificationsListener()); delete plugin->getNotificationsListener(); @@ -153,9 +153,9 @@ void TestNotificationListener::testNotify() plugin->config()->set(QStringLiteral("generalPersistent"), false); plugin->config()->set(QStringLiteral("generalIncludeBody"), true); plugin->config()->set(QStringLiteral("generalUrgency"), 0); - QCOMPARE(plugin->config()->get("generalPersistent"), false); - QCOMPARE(plugin->config()->get("generalIncludeBody"), true); - QCOMPARE(plugin->config()->get("generalUrgency"), false); + QCOMPARE(plugin->config()->get(QStringLiteral("generalPersistent")), false); + QCOMPARE(plugin->config()->get(QStringLiteral("generalIncludeBody")), true); + QCOMPARE(plugin->config()->get(QStringLiteral("generalUrgency")), false); // applications are modified directly: listener->getApplications().clear(); @@ -179,10 +179,10 @@ void TestNotificationListener::testNotify() // ... have triggered sending a packet QCOMPARE(++proxiedNotifications, d->getSentPackets()); // ... with our properties, - QCOMPARE(d->getLastPacket()->get("id"), replacesId); - QCOMPARE(d->getLastPacket()->get("appName"), appName); - QCOMPARE(d->getLastPacket()->get("ticker"), summary + ": " + body); - QCOMPARE(d->getLastPacket()->get("isClearable"), true); + QCOMPARE(d->getLastPacket()->get(QStringLiteral("id")), replacesId); + QCOMPARE(d->getLastPacket()->get(QStringLiteral("appName")), appName); + QCOMPARE(d->getLastPacket()->get(QStringLiteral("ticker")), summary + QStringLiteral(": ") + body); + QCOMPARE(d->getLastPacket()->get(QStringLiteral("isClearable")), true); QCOMPARE(d->getLastPacket()->hasPayload(), false); // ... and create a new application internally that is initialized correctly: @@ -200,13 +200,13 @@ void TestNotificationListener::testNotify() QString icon2(QStringLiteral("some-icon2")); QString summary2(QStringLiteral("some-summary2")); - retId = listener->Notify(appName2, replacesId+1, icon2, summary2, body2, {}, {{"urgency", 2}}, 10); + retId = listener->Notify(appName2, replacesId+1, icon2, summary2, body2, {}, {{QStringLiteral("urgency"), 2}}, 10); QCOMPARE(retId, replacesId+1); QCOMPARE(++proxiedNotifications, d->getSentPackets()); - QCOMPARE(d->getLastPacket()->get("id"), replacesId+1); - QCOMPARE(d->getLastPacket()->get("appName"), appName2); - QCOMPARE(d->getLastPacket()->get("ticker"), summary2 + ": " + body2); - QCOMPARE(d->getLastPacket()->get("isClearable"), false); // timeout != 0 + QCOMPARE(d->getLastPacket()->get(QStringLiteral("id")), replacesId+1); + QCOMPARE(d->getLastPacket()->get(QStringLiteral("appName")), appName2); + QCOMPARE(d->getLastPacket()->get(QStringLiteral("ticker")), summary2 + QStringLiteral(": ") + body2); + QCOMPARE(d->getLastPacket()->get(QStringLiteral("isClearable")), false); // timeout != 0 QCOMPARE(d->getLastPacket()->hasPayload(), false); QCOMPARE(listener->getApplications().count(), 2); QVERIFY(listener->getApplications().contains(appName2)); @@ -228,15 +228,15 @@ void TestNotificationListener::testNotify() // if min-urgency is set, lower urgency levels are not synced: plugin->config()->set(QStringLiteral("generalUrgency"), 1); - retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{"urgency", 0}}, 0); + retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{QStringLiteral("urgency"), 0}}, 0); QCOMPARE(retId, 0U); QCOMPARE(proxiedNotifications, d->getSentPackets()); // equal urgency is - retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{"urgency", 1}}, 0); + retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{QStringLiteral("urgency"), 1}}, 0); QCOMPARE(retId, replacesId); QCOMPARE(++proxiedNotifications, d->getSentPackets()); // higher urgency as well - retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{"urgency", 2}}, 0); + retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{QStringLiteral("urgency"), 2}}, 0); QCOMPARE(retId, replacesId); QCOMPARE(++proxiedNotifications, d->getSentPackets()); plugin->config()->set(QStringLiteral("generalUrgency"), 0); @@ -245,7 +245,7 @@ void TestNotificationListener::testNotify() QVERIFY(listener->getApplications().contains(appName)); listener->getApplications()[appName].active = false; QVERIFY(!listener->getApplications()[appName].active); - retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{"urgency", 0}}, 0); + retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{QStringLiteral("urgency"), 0}}, 0); QCOMPARE(retId, 0U); QCOMPARE(proxiedNotifications, d->getSentPackets()); // others are still: @@ -289,7 +289,7 @@ void TestNotificationListener::testNotify() QCOMPARE(retId, replacesId); QCOMPARE(++proxiedNotifications, d->getSentPackets()); // without body, also ticker value is different: - QCOMPARE(d->getLastPacket()->get("ticker"), summary); + QCOMPARE(d->getLastPacket()->get(QStringLiteral("ticker")), summary); retId = listener->Notify(appName, replacesId, icon, summary, QStringLiteral("body foobaz"), {}, {{}}, 0); QCOMPARE(retId, replacesId); QCOMPARE(++proxiedNotifications, d->getSentPackets()); @@ -331,7 +331,7 @@ void TestNotificationListener::testNotify() QVERIFY(d->getLastPacket()->hasPayload()); QCOMPARE(d->getLastPacket()->payloadSize(), fi.size()); // extensions other than png are not accepted: - retId = listener->Notify(appName, replacesId, iconName + ".svg", summary, body, {}, {{}}, 0); + retId = listener->Notify(appName, replacesId, iconName + QStringLiteral(".svg"), summary, body, {}, {{}}, 0); QCOMPARE(retId, replacesId); QCOMPARE(++proxiedNotifications, d->getSentPackets()); QVERIFY(!d->getLastPacket()->hasPayload()); @@ -348,7 +348,7 @@ void TestNotificationListener::testNotify() // image-path in hints if (iconPaths.size() > 0) { - retId = listener->Notify(appName, replacesId, iconPaths.size() > 1 ? iconPaths[1] : icon, summary, body, {}, {{"image-path", iconPaths[0]}}, 0); + retId = listener->Notify(appName, replacesId, iconPaths.size() > 1 ? iconPaths[1] : icon, summary, body, {}, {{QStringLiteral("image-path"), iconPaths[0]}}, 0); QCOMPARE(retId, replacesId); QCOMPARE(++proxiedNotifications, d->getSentPackets()); QVERIFY(d->getLastPacket()->hasPayload()); @@ -359,7 +359,7 @@ void TestNotificationListener::testNotify() // image_path in hints if (iconPaths.size() > 0) { - retId = listener->Notify(appName, replacesId, iconPaths.size() > 1 ? iconPaths[1] : icon, summary, body, {}, {{"image_path", iconPaths[0]}}, 0); + retId = listener->Notify(appName, replacesId, iconPaths.size() > 1 ? iconPaths[1] : icon, summary, body, {}, {{QStringLiteral("image_path"), iconPaths[0]}}, 0); QCOMPARE(retId, replacesId); QCOMPARE(++proxiedNotifications, d->getSentPackets()); QVERIFY(d->getLastPacket()->hasPayload()); @@ -379,9 +379,9 @@ void TestNotificationListener::testNotify() 0x11, 0x12, 0x13, 0x14, 0x21, 0x22, 0x23, 0x24, 0x31, 0x32, 0x33, 0x34 }; - QVariantMap imageData = {{"width", width}, {"height", height}, {"rowStride", rowStride}, - {"bitsPerSample", bitsPerSample}, {"channels", channels}, - {"hasAlpha", hasAlpha}, {"imageData", QByteArray(rawData, sizeof(rawData))}}; + QVariantMap imageData = {{QStringLiteral("width"), width}, {QStringLiteral("height"), height}, {QStringLiteral("rowStride"), rowStride}, + {QStringLiteral("bitsPerSample"), bitsPerSample}, {QStringLiteral("channels"), channels}, + {QStringLiteral("hasAlpha"), hasAlpha}, {QStringLiteral("imageData"), QByteArray(rawData, sizeof(rawData))}}; QVariantMap hints; #define COMPARE_PIXEL(x, y) \ QCOMPARE(qRed(image.pixel(x,y)), (int)rawData[x*4 + y*rowStride + 0]); \ diff --git a/urlhandler/kdeconnect-handler.cpp b/urlhandler/kdeconnect-handler.cpp index 2aec828f1..b2ea5f1d7 100644 --- a/urlhandler/kdeconnect-handler.cpp +++ b/urlhandler/kdeconnect-handler.cpp @@ -117,7 +117,7 @@ int main(int argc, char** argv) const QString device = proxyModel.index(currentDeviceIndex, 0).data(DevicesModel::IdModelRole).toString(); const QString action = open && url.isLocalFile() ? QStringLiteral("openFile") : QStringLiteral("shareUrl"); - QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device+"/share", QStringLiteral("org.kde.kdeconnect.device.share"), action); + QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), action); msg.setArguments({ url.toString() }); blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); return 0;