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:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -183,10 +183,29 @@ Kirigami.ScrollablePage {
|
||||
roleValue: "emote"
|
||||
delegate: TimelineContainer {
|
||||
width: messageListView.width
|
||||
|
||||
innerObject: StateDelegate {
|
||||
Layout.maximumWidth: parent.width
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
innerObject: MessageDelegate {
|
||||
Layout.fillWidth: true
|
||||
Layout.maximumWidth: messageListView.width
|
||||
isEmote: true
|
||||
mouseArea: MouseArea {
|
||||
acceptedButtons: Qt.RightButton
|
||||
anchors.fill: parent
|
||||
onClicked: openMessageContext(author, display, eventId, toolTip);
|
||||
}
|
||||
onReplyClicked: goToEvent(eventID)
|
||||
onReplyToMessageClicked: replyToMessage(replyUser, replyContent, eventId);
|
||||
innerObject: [
|
||||
TextDelegate {
|
||||
isEmote: true
|
||||
Layout.fillWidth: true
|
||||
Layout.rightMargin: Kirigami.Units.largeSpacing
|
||||
},
|
||||
ReactionDelegate {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 0
|
||||
Layout.bottomMargin: Kirigami.Units.largeSpacing * 2
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,27 +22,29 @@ Kirigami.ScrollablePage {
|
||||
|
||||
title: i18n("Start a Chat")
|
||||
|
||||
header: RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Kirigami.SearchField {
|
||||
id: identifierField
|
||||
header: Control {
|
||||
padding: Kirigami.Units.largeSpacing
|
||||
contentItem: RowLayout {
|
||||
Kirigami.SearchField {
|
||||
id: identifierField
|
||||
|
||||
property bool isUserID: text.match(/@(.+):(.+)/g)
|
||||
property bool isUserID: text.match(/@(.+):(.+)/g)
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
placeholderText: i18n("Find a user...")
|
||||
placeholderText: i18n("Find a user...")
|
||||
|
||||
onAccepted: userDictListModel.search()
|
||||
}
|
||||
onAccepted: userDictListModel.search()
|
||||
}
|
||||
|
||||
Button {
|
||||
visible: identifierField.isUserID
|
||||
Button {
|
||||
visible: identifierField.isUserID
|
||||
|
||||
text: i18n("Chat")
|
||||
highlighted: true
|
||||
text: i18n("Chat")
|
||||
highlighted: true
|
||||
|
||||
onClicked: Controller.createDirectChat(connection, identifierField.text)
|
||||
onClicked: Controller.createDirectChat(connection, identifierField.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user