Also use QLatin1String::arg in remaining places

This is more readable, slightly faster at runtime and results in a slightly smaller binary size
This commit is contained in:
Alexander Lohnau 2023-08-27 07:25:47 +02:00 committed by Albert Vaca Cintora
parent 88d89e7211
commit cfde9ced77
6 changed files with 29 additions and 29 deletions

View file

@ -205,7 +205,7 @@ int main(int argc, char **argv)
}
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"),
QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/share"),
QLatin1String("/modules/kdeconnect/devices/%1/share").arg(device),
QStringLiteral("org.kde.kdeconnect.device.share"),
QStringLiteral("shareUrls"));
@ -217,7 +217,7 @@ int main(int argc, char **argv)
}
} else if (parser.isSet(QStringLiteral("share-text"))) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"),
QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/share"),
QLatin1String("/modules/kdeconnect/devices/%1/share").arg(device),
QStringLiteral("org.kde.kdeconnect.device.share"),
QStringLiteral("shareText"));
msg.setArguments(QVariantList{parser.value(QStringLiteral("share-text"))});
@ -268,13 +268,13 @@ int main(int argc, char **argv)
}
} else if (parser.isSet(QStringLiteral("send-clipboard"))) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"),
QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/clipboard"),
QLatin1String("/modules/kdeconnect/devices/%1/clipboard").arg(device),
QStringLiteral("org.kde.kdeconnect.device.clipboard"),
QStringLiteral("sendClipboard"));
blockOnReply(QDBusConnection::sessionBus().asyncCall(msg));
} else if (parser.isSet(QStringLiteral("ping")) || parser.isSet(QStringLiteral("ping-msg"))) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"),
QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/ping"),
QLatin1String("/modules/kdeconnect/devices/%1/ping").arg(device),
QStringLiteral("org.kde.kdeconnect.device.ping"),
QStringLiteral("sendPing"));
if (parser.isSet(QStringLiteral("ping-msg"))) {
@ -314,7 +314,7 @@ int main(int argc, char **argv)
}
} else if (parser.isSet(QStringLiteral("ring"))) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"),
QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/findmyphone"),
QLatin1String("/modules/kdeconnect/devices/%1/findmyphone").arg(device),
QStringLiteral("org.kde.kdeconnect.device.findmyphone"),
QStringLiteral("ring"));
blockOnReply(QDBusConnection::sessionBus().asyncCall(msg));
@ -322,7 +322,7 @@ int main(int argc, char **argv)
const QString fileName = parser.value(QStringLiteral("photo"));
if (!fileName.isEmpty()) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"),
QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/photo"),
QLatin1String("/modules/kdeconnect/devices/%1/photo").arg(device),
QStringLiteral("org.kde.kdeconnect.device.photo"),
QStringLiteral("requestPhoto"));
msg.setArguments({QUrl::fromLocalFile(fileName).toString()});
@ -333,7 +333,7 @@ int main(int argc, char **argv)
} 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"),
QLatin1String("/modules/kdeconnect/devices/%1/remotekeyboard").arg(device),
QStringLiteral("org.kde.kdeconnect.device.remotekeyboard"),
QStringLiteral("sendKeyPress"));
if (seq.trimmed() == QLatin1String("-")) {

View file

@ -58,7 +58,7 @@ QList<QAction *> SendFileItemAction::actions(const KFileItemListProperties &file
connect(action, &QAction::triggered, this, [id, urls]() {
for (const QUrl &url : urls) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"),
QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/share"),
QLatin1String("/modules/kdeconnect/devices/%1/share").arg(id),
QStringLiteral("org.kde.kdeconnect.device.share"),
QStringLiteral("shareUrl"));
msg.setArguments(QVariantList{url.toString()});

View file

@ -52,7 +52,7 @@ void DeviceDbusInterface::pluginCall(const QString &plugin, const QString &metho
BatteryDbusInterface::BatteryDbusInterface(const QString &id, QObject *parent)
: OrgKdeKdeconnectDeviceBatteryInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/battery"),
QLatin1String("/modules/kdeconnect/devices/%1/battery").arg(id),
QDBusConnection::sessionBus(),
parent)
{
@ -61,7 +61,7 @@ BatteryDbusInterface::BatteryDbusInterface(const QString &id, QObject *parent)
ConnectivityReportDbusInterface::ConnectivityReportDbusInterface(const QString &id, QObject *parent)
: OrgKdeKdeconnectDeviceConnectivity_reportInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/connectivity_report"),
QLatin1String("/modules/kdeconnect/devices/%1/connectivity_report").arg(id),
QDBusConnection::sessionBus(),
parent)
{
@ -70,7 +70,7 @@ ConnectivityReportDbusInterface::ConnectivityReportDbusInterface(const QString &
DeviceNotificationsDbusInterface::DeviceNotificationsDbusInterface(const QString &id, QObject *parent)
: OrgKdeKdeconnectDeviceNotificationsInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/notifications"),
QLatin1String("/modules/kdeconnect/devices/%1/notifications").arg(id),
QDBusConnection::sessionBus(),
parent)
{
@ -78,7 +78,7 @@ DeviceNotificationsDbusInterface::DeviceNotificationsDbusInterface(const QString
NotificationDbusInterface::NotificationDbusInterface(const QString &deviceId, const QString &notificationId, QObject *parent)
: OrgKdeKdeconnectDeviceNotificationsNotificationInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/notifications/")
QLatin1String("/modules/kdeconnect/devices/%1/notifications/").arg(deviceId)
+ notificationId,
QDBusConnection::sessionBus(),
parent)
@ -96,7 +96,7 @@ DeviceConversationsDbusInterface::DeviceConversationsDbusInterface(const QString
SftpDbusInterface::SftpDbusInterface(const QString &id, QObject *parent)
: OrgKdeKdeconnectDeviceSftpInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/sftp"),
QLatin1String("/modules/kdeconnect/devices/%1/sftp").arg(id),
QDBusConnection::sessionBus(),
parent)
{
@ -104,7 +104,7 @@ SftpDbusInterface::SftpDbusInterface(const QString &id, QObject *parent)
MprisDbusInterface::MprisDbusInterface(const QString &id, QObject *parent)
: OrgKdeKdeconnectDeviceMprisremoteInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/mprisremote"),
QLatin1String("/modules/kdeconnect/devices/%1/mprisremote").arg(id),
QDBusConnection::sessionBus(),
parent)
{
@ -113,7 +113,7 @@ MprisDbusInterface::MprisDbusInterface(const QString &id, QObject *parent)
RemoteControlDbusInterface::RemoteControlDbusInterface(const QString &id, QObject *parent)
: OrgKdeKdeconnectDeviceRemotecontrolInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/remotecontrol"),
QLatin1String("/modules/kdeconnect/devices/%1/remotecontrol").arg(id),
QDBusConnection::sessionBus(),
parent)
{
@ -121,7 +121,7 @@ RemoteControlDbusInterface::RemoteControlDbusInterface(const QString &id, QObjec
LockDeviceDbusInterface::LockDeviceDbusInterface(const QString &id, QObject *parent)
: OrgKdeKdeconnectDeviceLockdeviceInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/lockdevice"),
QLatin1String("/modules/kdeconnect/devices/%1/lockdevice").arg(id),
QDBusConnection::sessionBus(),
parent)
{
@ -131,7 +131,7 @@ LockDeviceDbusInterface::LockDeviceDbusInterface(const QString &id, QObject *par
FindMyPhoneDeviceDbusInterface::FindMyPhoneDeviceDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceFindmyphoneInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/findmyphone"),
QLatin1String("/modules/kdeconnect/devices/%1/findmyphone").arg(deviceId),
QDBusConnection::sessionBus(),
parent)
{
@ -139,7 +139,7 @@ FindMyPhoneDeviceDbusInterface::FindMyPhoneDeviceDbusInterface(const QString &de
RemoteCommandsDbusInterface::RemoteCommandsDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceRemotecommandsInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotecommands"),
QLatin1String("/modules/kdeconnect/devices/%1/remotecommands").arg(deviceId),
QDBusConnection::sessionBus(),
parent)
{
@ -147,7 +147,7 @@ RemoteCommandsDbusInterface::RemoteCommandsDbusInterface(const QString &deviceId
RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceRemotekeyboardInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotekeyboard"),
QLatin1String("/modules/kdeconnect/devices/%1/remotekeyboard").arg(deviceId),
QDBusConnection::sessionBus(),
parent)
{
@ -156,7 +156,7 @@ RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString &deviceId
SmsDbusInterface::SmsDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceSmsInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/sms"),
QLatin1String("/modules/kdeconnect/devices/%1/sms").arg(deviceId),
QDBusConnection::sessionBus(),
parent)
{
@ -164,7 +164,7 @@ SmsDbusInterface::SmsDbusInterface(const QString &deviceId, QObject *parent)
ShareDbusInterface::ShareDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceShareInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/share"),
QLatin1String("/modules/kdeconnect/devices/%1/share").arg(deviceId),
QDBusConnection::sessionBus(),
parent)
{
@ -172,7 +172,7 @@ ShareDbusInterface::ShareDbusInterface(const QString &deviceId, QObject *parent)
PhotoDbusInterface::PhotoDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDevicePhotoInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/photo"),
QLatin1String("/modules/kdeconnect/devices/%1/photo").arg(deviceId),
QDBusConnection::sessionBus(),
parent)
{
@ -180,7 +180,7 @@ PhotoDbusInterface::PhotoDbusInterface(const QString &deviceId, QObject *parent)
RemoteSystemVolumeDbusInterface::RemoteSystemVolumeDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceRemotesystemvolumeInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotesystemvolume"),
QLatin1String("/modules/kdeconnect/devices/%1/remotesystemvolume").arg(deviceId),
QDBusConnection::sessionBus(),
parent)
{
@ -188,7 +188,7 @@ RemoteSystemVolumeDbusInterface::RemoteSystemVolumeDbusInterface(const QString &
BigscreenDbusInterface::BigscreenDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceBigscreenInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/bigscreen"),
QLatin1String("/modules/kdeconnect/devices/%1/bigscreen").arg(deviceId),
QDBusConnection::sessionBus(),
parent)
{
@ -196,7 +196,7 @@ BigscreenDbusInterface::BigscreenDbusInterface(const QString &deviceId, QObject
VirtualmonitorDbusInterface::VirtualmonitorDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceVirtualmonitorInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/virtualmonitor"),
QLatin1String("/modules/kdeconnect/devices/%1/virtualmonitor").arg(deviceId),
QDBusConnection::sessionBus(),
parent)
{
@ -204,7 +204,7 @@ VirtualmonitorDbusInterface::VirtualmonitorDbusInterface(const QString &deviceId
ClipboardDbusInterface::ClipboardDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceClipboardInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/clipboard"),
QLatin1String("/modules/kdeconnect/devices/%1/clipboard").arg(deviceId),
QDBusConnection::sessionBus(),
parent)
{

View file

@ -25,7 +25,7 @@ public:
void receivePacket(const NetworkPacket &np) override;
QString dbusPath() const override
{
return QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/sftp");
return QLatin1String("/modules/kdeconnect/devices/%1/sftp").arg(deviceId);
}
public Q_SLOTS:

View file

@ -25,7 +25,7 @@ public:
void receivePacket(const NetworkPacket &np) override;
QString dbusPath() const override
{
return QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/sftp");
return QLatin1String("/modules/kdeconnect/devices/%1/sftp").arg(deviceId);
}
Q_SCRIPTABLE bool startBrowsing();

View file

@ -163,7 +163,7 @@ int main(int argc, char **argv)
const QString action = open && url.isLocalFile() ? QStringLiteral("openFile") : QStringLiteral("shareUrl");
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"),
QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/share"),
QLatin1String("/modules/kdeconnect/devices/%1/share").arg(device),
QStringLiteral("org.kde.kdeconnect.device.share"),
action);
msg.setArguments({url.toString()});