From ee86c948aec5fe72979fc6df97f4a6ef711bdf94 Mon Sep 17 00:00:00 2001 From: Black Hat Date: Fri, 30 Aug 2019 23:27:59 +0800 Subject: [PATCH] Add the ability to resend/cancel failed message. --- .../Component/Timeline/MessageDelegate.qml | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/imports/Spectral/Component/Timeline/MessageDelegate.qml b/imports/Spectral/Component/Timeline/MessageDelegate.qml index b793a3409..b96749e67 100644 --- a/imports/Spectral/Component/Timeline/MessageDelegate.qml +++ b/imports/Spectral/Component/Timeline/MessageDelegate.qml @@ -16,6 +16,7 @@ ColumnLayout { readonly property bool sentByMe: author === currentRoom.localUser readonly property bool darkBackground: !sentByMe readonly property bool replyVisible: reply || false + readonly property bool failed: marks === EventStatus.SendingFailed signal saveFileAs() signal openExternally() @@ -240,7 +241,7 @@ ColumnLayout { Layout.rightMargin: sentByMe ? 12 : undefined Layout.bottomMargin: 4 - visible: showAuthor + visible: showAuthor && !failed Label { visible: !sentByMe @@ -254,4 +255,45 @@ ColumnLayout { color: MPalette.lighter } } + + RowLayout { + Layout.alignment: sentByMe ? Qt.AlignRight : Qt.AlignLeft + Layout.leftMargin: sentByMe ? undefined : 36 + messageRow.spacing + 12 + Layout.rightMargin: sentByMe ? 12 : undefined + Layout.bottomMargin: 4 + + visible: failed + + Label { + text: "Send failed:" + color: MPalette.lighter + } + + Label { + text: "Resend" + color: MPalette.lighter + + MouseArea { + anchors.fill: parent + + onClicked: currentRoom.retryMessage(eventId) + } + } + + Label { + text: "|" + color: MPalette.lighter + } + + Label { + text: "Discard" + color: MPalette.lighter + + MouseArea { + anchors.fill: parent + + onClicked: currentRoom.discardMessage(eventId) + } + } + } }