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

@@ -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
}
]
}
}
}

View File

@@ -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)
}
}
}