diff options
author | link2xt <link2xt@testrun.org> | 1970-01-01 00:00:00 +0000 |
---|---|---|
committer | link2xt <link2xt@testrun.org> | 1970-01-01 00:00:00 +0000 |
commit | 021d00d9d9148be3c5969ac7834403c695f9258d (patch) | |
tree | 7f3da0eeeb9b7f56b333af0fca5dd2a4795322b9 /qml/ComposePane.qml | |
parent | d4c66cd1341084b37dfabe3126d13ff8f062fd59 (diff) | |
download | kdeltachat-021d00d9d9148be3c5969ac7834403c695f9258d.tar.gz kdeltachat-021d00d9d9148be3c5969ac7834403c695f9258d.zip |
Add Message.setFile method
This allows setting file from JavaScript, so C++ remains a thin wrapper to Delta Chat core API.
sendMessage only calls dc_send_msg, and all the attachment logic goes to the JavaScript code.
Diffstat (limited to 'qml/ComposePane.qml')
-rw-r--r-- | qml/ComposePane.qml | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/qml/ComposePane.qml b/qml/ComposePane.qml index a108e9f..2dc24d1 100644 --- a/qml/ComposePane.qml +++ b/qml/ComposePane.qml @@ -18,10 +18,12 @@ Pane { let DC_MSG_TEXT = 10; let DC_MSG_FILE = 60; - if (attachFileUrl.length > 0) + if (attachFileUrl.length > 0) { var msg = root.context.newMessage(DC_MSG_FILE); - else + msg.setFile(attachFileUrl) + } else var msg = root.context.newMessage(DC_MSG_TEXT); + msg.setText(messageField.text); return msg; } @@ -92,10 +94,7 @@ Pane { enabled: messageField.length > 0 | attachFileUrl.length > 0 onClicked: { let msg = root.createMessage(); - if (attachFileUrl.length > 0) - root.context.sendMessage(root.chatId, msg, attachFileUrl) - else - root.context.sendMessage(root.chatId, msg, "") + root.context.sendMessage(root.chatId, msg) attachFileUrl = ""; messageField.text = ""; |