aboutsummaryrefslogtreecommitdiff
path: root/qml
diff options
context:
space:
mode:
authorlink2xt <link2xt@testrun.org>2021-05-29 23:40:34 +0300
committerlink2xt <link2xt@testrun.org>2021-05-29 23:40:34 +0300
commit69ff191c83e5277cfe22d3735e9ac2f0256be3c5 (patch)
treea138c9a4b1914d9ef20e19d9f24401ee0179b984 /qml
parent9c22c6d6a03f620f14f289b464354159b8a76f6b (diff)
downloadkdeltachat-69ff191c83e5277cfe22d3735e9ac2f0256be3c5.tar.gz
kdeltachat-69ff191c83e5277cfe22d3735e9ac2f0256be3c5.zip
Implement message drafts
Diffstat (limited to 'qml')
-rw-r--r--qml/ComposePane.qml15
-rw-r--r--qml/Message.qml5
2 files changed, 19 insertions, 1 deletions
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 {
diff --git a/qml/Message.qml b/qml/Message.qml
index fdd895a..68b2979 100644
--- a/qml/Message.qml
+++ b/qml/Message.qml
@@ -161,13 +161,16 @@ RowLayout {
// Message
TextEdit {
Layout.maximumWidth: messageObject.width > 30 ? messageObject.width - 30 : messageObject.width
- text: messageObject.message.text
textFormat: Text.PlainText
selectByMouse: true
readOnly: true
color: "black"
wrapMode: Text.Wrap
font.pixelSize: 14
+
+ Component.onCompleted: {
+ text = messageObject.message.text
+ }
}
Row {
HtmlViewSheet {