From 180c87353ba52b79a177943047d9de0d32605a17 Mon Sep 17 00:00:00 2001 From: Aniket Kumar Date: Fri, 28 Aug 2020 21:57:15 +0530 Subject: [PATCH] Update kdeconnect-cli send-sms interface. This patch fixes the BUG: 425731 --- cli/kdeconnect-cli.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp index fa9899193..fcb76c5db 100644 --- a/cli/kdeconnect-cli.cpp +++ b/cli/kdeconnect-cli.cpp @@ -31,6 +31,7 @@ #include "interfaces/notificationsmodel.h" #include "interfaces/dbusinterfaces.h" #include "interfaces/dbushelpers.h" +#include "interfaces/conversationmessage.h" #include "kdeconnect-version.h" #include @@ -261,8 +262,19 @@ int main(int argc, char** argv) blockOnReply(DBusHelper::sessionBus().asyncCall(msg)); } else if(parser.isSet(QStringLiteral("send-sms"))) { if (parser.isSet(QStringLiteral("destination"))) { + qDBusRegisterMetaType(); + QVariantList addresses; + + const QStringList addressList = parser.value(QStringLiteral("destination")).split(QRegularExpression(QStringLiteral("\\s+"))); + + for (const QString& input : addressList) { + ConversationAddress address(input); + addresses << QVariant::fromValue(address); + } + 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"))}); + const QString text = parser.value(QStringLiteral("send-sms")); + msg.setArguments(QVariantList() << QVariant::fromValue(QDBusVariant(addresses)) << text); blockOnReply(DBusHelper::sessionBus().asyncCall(msg)); } else { QTextStream(stderr) << i18n("error: should specify the SMS's recipient by passing --destination ");