From 69ff191c83e5277cfe22d3735e9ac2f0256be3c5 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sat, 29 May 2021 23:40:34 +0300 Subject: Implement message drafts --- qml/ComposePane.qml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'qml/ComposePane.qml') diff --git a/qml/ComposePane.qml b/qml/ComposePane.qml index 54480d5..44cbd7c 100644 --- a/qml/ComposePane.qml +++ b/qml/ComposePane.qml @@ -20,6 +20,21 @@ Pane { placeholderText: qsTr("Message") wrapMode: TextArea.Wrap selectByMouse: true + + Component.onCompleted: { + let draft = context.getDraft(chatId) + if (draft) { + messageField.text = draft.text + } + } + + Connections { + function onEditingFinished() { + var msg = context.newMessage(10) + msg.setText(messageField.text) + context.setDraft(chatId, msg) + } + } } Button { -- cgit v1.2.3-70-g09d2