diff options
author | link2xt <link2xt@testrun.org> | 2021-08-07 21:36:54 +0000 |
---|---|---|
committer | link2xt <link2xt@testrun.org> | 2021-08-07 21:36:54 +0000 |
commit | 07b762aca4f93ab523fa84c7ddea5abf3e0bb1de (patch) | |
tree | 939de7d7c3194f4653f146a9f83ea7a63b43e6f0 /qml | |
parent | 80856b853b49b53322425a90ae801bca760cf740 (diff) | |
download | kdeltachat-07b762aca4f93ab523fa84c7ddea5abf3e0bb1de.tar.gz kdeltachat-07b762aca4f93ab523fa84c7ddea5abf3e0bb1de.zip |
ComposePane: move message creation to a separate function
Diffstat (limited to 'qml')
-rw-r--r-- | qml/ComposePane.qml | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/qml/ComposePane.qml b/qml/ComposePane.qml index dab07f1..1e454e0 100644 --- a/qml/ComposePane.qml +++ b/qml/ComposePane.qml @@ -10,6 +10,15 @@ Pane { required property DcContext context required property var chatId + function createMessage() + { + let DC_MSG_TEXT = 10; + + var msg = root.context.newMessage(DC_MSG_TEXT) + msg.setText(messageField.text) + return msg + } + padding: 0 RowLayout { @@ -32,8 +41,7 @@ Pane { Connections { function onEditingFinished() { - var msg = root.context.newMessage(10) - msg.setText(messageField.text) + let msg = root.createMessage() root.context.setDraft(chatId, msg) } } @@ -48,10 +56,7 @@ Pane { text: qsTr("Send") enabled: messageField.length > 0 onClicked: { - let DC_MSG_TEXT = 10; - - let msg = root.context.newMessage(DC_MSG_TEXT); - msg.setText(messageField.text) + let msg = root.createMessage() root.context.sendMessage(root.chatId, msg) messageField.text = "" |