Commit a1ebbdfc authored by Simon Redman's avatar Simon Redman Committed by Nicolas Fella

[CLI] Use ConversationsDbusInterface to avoid problems with using raw dbus

parent be63cea8
Pipeline #37228 passed with stage
in 9 minutes and 10 seconds
......@@ -259,12 +259,20 @@ int main(int argc, char** argv)
addresses << QVariant::fromValue(address);
}
const QStringList urlList = parser.value(QStringLiteral("attachment")).split(QRegularExpression(QStringLiteral("\\s+")));
const QString message = parser.value(QStringLiteral("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"));
const QString text = parser.value(QStringLiteral("send-sms"));
msg.setArguments(QVariantList() << QVariant::fromValue(addresses) << text << QVariant(urlList));
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
const QStringList rawAttachmentUrlsList = parser.value(QStringLiteral("attachment")).split(QRegularExpression(QStringLiteral("\\s+")));
QVariantList attachments;
for (const QString& attachmentUrl : rawAttachmentUrlsList) {
// TODO: Construct attachment objects from the list of Urls
Q_UNUSED(attachmentUrl);
}
DeviceConversationsDbusInterface conversationDbusInterface(device);
auto reply = conversationDbusInterface.sendWithoutConversation(addresses, message, attachments);
reply.waitForFinished();
} else {
QTextStream(stderr) << i18n("error: should specify the SMS's recipient by passing --destination <phone number>");
return 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment