From 0d02a6f99e46e002a89c259ae30b02f23661e06c Mon Sep 17 00:00:00 2001 From: Dmytrii Zavalnyi Date: Fri, 21 Apr 2023 16:28:58 +0000 Subject: [PATCH] Fix inactive "Send Arrow" in smsapp after first message sent The "enabled" property of the button was set to false and has overwritten the default value based on the message length. The message field had "anchors.fill" positioning and raised "Binding loop detected for property "implicitHeight"" error. attachmentList property of ChatMessage didn't have the default value and was undefined. BUG: 455149 --- smsapp/qml/ChatMessage.qml | 2 +- smsapp/qml/SendingArea.qml | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/smsapp/qml/ChatMessage.qml b/smsapp/qml/ChatMessage.qml index a6b20f585..925d31f0e 100644 --- a/smsapp/qml/ChatMessage.qml +++ b/smsapp/qml/ChatMessage.qml @@ -21,7 +21,7 @@ Item { property date dateTime property string name property bool multiTarget - property var attachmentList + property var attachmentList: [] signal messageCopyRequested(string message) diff --git a/smsapp/qml/SendingArea.qml b/smsapp/qml/SendingArea.qml index fafbbe582..79aed4d39 100644 --- a/smsapp/qml/SendingArea.qml +++ b/smsapp/qml/SendingArea.qml @@ -68,7 +68,7 @@ ColumnLayout { Controls.ScrollBar.horizontal.policy: Controls.ScrollBar.AlwaysOff Controls.TextArea { - anchors.fill: parent + width: parent.width id: messageField placeholderText: i18nd("kdeconnect-sms", "Compose message") wrapMode: TextEdit.Wrap @@ -144,15 +144,14 @@ ColumnLayout { onClicked: { selectedFileUrls = [] - if (messageField.text == "") { - sendButton.enabled = false - } } } Controls.ToolButton { + property bool isSendingInProcess: false + id: sendButton - enabled: messageField.text.length || selectedFileUrls.length + enabled: (messageField.text.length || selectedFileUrls.length) && !isSendingInProcess Layout.preferredWidth: Kirigami.Units.gridUnit * 2 Layout.preferredHeight: Kirigami.Units.gridUnit * 2 padding: 0 @@ -169,9 +168,13 @@ ColumnLayout { property bool messageSent: false onClicked: { - // disable the button to prevent sending - // the same message several times - sendButton.enabled = false + + // prevent sending the same message several times + // and don't touch enabled property + if (isSendingInProcess){ + return; + } + isSendingInProcess = true if (SmsHelper.totalMessageSize(selectedFileUrls, messageField.text) > maxMessageSize) { messageDialog.visible = true @@ -184,14 +187,14 @@ ColumnLayout { if (messageSent) { messageField.text = "" selectedFileUrls = [] - sendButton.enabled = false } + isSendingInProcess = false } } } Controls.Label { - id: "charCount" + id: charCount text: conversationModel.getCharCountInfo(messageField.text) visible: text.length > 0 Layout.minimumWidth: Math.max(Layout.minimumWidth, width) // Make this label only grow, never shrink