From 6d4f7413b44821bd3054dd0fcfea10449c5585e4 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 14 Mar 2021 02:06:11 +0300 Subject: Add colored border to quotes --- qml/Message.qml | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'qml') diff --git a/qml/Message.qml b/qml/Message.qml index 73d91fc..fd13c52 100644 --- a/qml/Message.qml +++ b/qml/Message.qml @@ -13,6 +13,8 @@ RowLayout { property DcMessage message readonly property DcContact from: context.getContact(message.fromId) + readonly property DcMessage quoteMessage: message.quotedMessage + readonly property DcContact quoteFrom: quoteMessage ? context.getContact(quoteMessage.fromId) : null width: ListView.view.width layoutDirection: message.fromId == 1 ? Qt.RightToLeft : Qt.LeftToRight @@ -120,17 +122,31 @@ RowLayout { : [40, 41].includes(messageObject.message.viewtype) ? audioMessageView : textMessageView } - TextEdit { - Layout.maximumWidth: messageObject.width > 30 ? messageObject.width - 30 : messageObject.width - text: messageObject.message.quotedText ? messageObject.message.quotedText : "" - textFormat: Text.PlainText - selectByMouse: true - readOnly: true - color: "grey" - wrapMode: Text.Wrap - font.pixelSize: 12 + // Quote + RowLayout { + Layout.leftMargin: Kirigami.Units.smallSpacing + visible: messageObject.message.quotedText + implicitHeight: quoteTextEdit.height + spacing: Kirigami.Units.smallSpacing + Rectangle { + width: Kirigami.Units.smallSpacing + color: quoteFrom ? quoteFrom.color : "black" + Layout.fillHeight: true + } + TextEdit { + id: quoteTextEdit + Layout.maximumWidth: messageObject.width > 30 ? messageObject.width - 30 : messageObject.width + text: messageObject.message.quotedText ? messageObject.message.quotedText : "" + textFormat: Text.PlainText + selectByMouse: true + readOnly: true + color: "grey" + wrapMode: Text.Wrap + font.pixelSize: 12 + } } + // Message TextEdit { Layout.maximumWidth: messageObject.width > 30 ? messageObject.width - 30 : messageObject.width text: messageObject.message.text -- cgit v1.2.3-70-g09d2