Use more adapted delegate for showing emote (/me)

Now use a standard MessageDelegate and don't display the title part.
This now make the reply and reaction button available and also make it
possible to see the reactions.

Fix: #69
Fix: #75
This commit is contained in:
Carl Schwan
2020-11-27 15:29:11 +01:00
parent c1dccf7a7e
commit 550cef52d0
4 changed files with 47 additions and 24 deletions

View File

@@ -27,6 +27,7 @@ RowLayout {
readonly property color replyAuthorColor: replyVisible ? reply.author.color : Kirigami.Theme.focusColor
property alias mouseArea: controlContainer.children
property bool isEmote: false
signal saveFileAs()
signal openExternally()
@@ -90,7 +91,7 @@ RowLayout {
Layout.fillWidth: true
topInset: 0
visible: showAuthor
visible: showAuthor && !isEmote
text: author.displayName
font.bold: true
@@ -98,7 +99,7 @@ RowLayout {
wrapMode: Text.Wrap
}
QQC2.Label {
visible: showAuthor
visible: showAuthor && !isEmote
text: time.toLocaleTimeString(Locale.ShortFormat)
color: Kirigami.Theme.disabledTextColor
}

View File

@@ -11,12 +11,13 @@ import org.kde.kirigami 2.4 as Kirigami
TextEdit {
id: contentLabel
text: "<style>pre {white-space: pre-wrap} a{color: " + Kirigami.Theme.linkColor + ";} .user-pill{}</style>" + display
color: Kirigami.Theme.textColor
readonly property var isEmoji: /^(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])+$/
property bool isEmote: false
text: "<style>pre {white-space: pre-wrap} a{color: " + Kirigami.Theme.linkColor + ";} .user-pill{}</style>" + (isEmote ? "* <a href='https://matrix.to/#/" + author.id + "' style='color: " + author.color + "'>" + author.displayName + "</a> " : "") + display
color: Kirigami.Theme.textColor
font.pointSize: isEmoji.test(message) ? Kirigami.Theme.defaultFont.pointSize * 4 : Kirigami.Theme.defaultFont.pointSize
selectByMouse: !Kirigami.Settings.isMobile
readOnly: true