From f778fc932c69bdf9fb8dfbdd292b6f4b6b60d48b Mon Sep 17 00:00:00 2001 From: Aniket Kumar Date: Fri, 28 Aug 2020 12:45:49 +0530 Subject: [PATCH] Updated kdeconnect-cli send-sms message to adapt sendSms interfce changes. 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 cd55ef560..96c4f9584 100644 --- a/cli/kdeconnect-cli.cpp +++ b/cli/kdeconnect-cli.cpp @@ -17,6 +17,7 @@ #include "interfaces/notificationsmodel.h" #include "interfaces/dbusinterfaces.h" #include "interfaces/dbushelpers.h" +#include "interfaces/conversationmessage.h" #include "kdeconnect-version.h" #include @@ -247,8 +248,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(addresses) << text); blockOnReply(DBusHelper::sessionBus().asyncCall(msg)); } else { QTextStream(stderr) << i18n("error: should specify the SMS's recipient by passing --destination ");