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
|
readonly property color replyAuthorColor: replyVisible ? reply.author.color : Kirigami.Theme.focusColor
|
||||||
|
|
||||||
property alias mouseArea: controlContainer.children
|
property alias mouseArea: controlContainer.children
|
||||||
|
property bool isEmote: false
|
||||||
|
|
||||||
signal saveFileAs()
|
signal saveFileAs()
|
||||||
signal openExternally()
|
signal openExternally()
|
||||||
@@ -90,7 +91,7 @@ RowLayout {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
topInset: 0
|
topInset: 0
|
||||||
|
|
||||||
visible: showAuthor
|
visible: showAuthor && !isEmote
|
||||||
|
|
||||||
text: author.displayName
|
text: author.displayName
|
||||||
font.bold: true
|
font.bold: true
|
||||||
@@ -98,7 +99,7 @@ RowLayout {
|
|||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
}
|
}
|
||||||
QQC2.Label {
|
QQC2.Label {
|
||||||
visible: showAuthor
|
visible: showAuthor && !isEmote
|
||||||
text: time.toLocaleTimeString(Locale.ShortFormat)
|
text: time.toLocaleTimeString(Locale.ShortFormat)
|
||||||
color: Kirigami.Theme.disabledTextColor
|
color: Kirigami.Theme.disabledTextColor
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,12 +11,13 @@ import org.kde.kirigami 2.4 as Kirigami
|
|||||||
TextEdit {
|
TextEdit {
|
||||||
id: contentLabel
|
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])+$/
|
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
|
font.pointSize: isEmoji.test(message) ? Kirigami.Theme.defaultFont.pointSize * 4 : Kirigami.Theme.defaultFont.pointSize
|
||||||
selectByMouse: !Kirigami.Settings.isMobile
|
selectByMouse: !Kirigami.Settings.isMobile
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
|||||||
@@ -183,10 +183,29 @@ Kirigami.ScrollablePage {
|
|||||||
roleValue: "emote"
|
roleValue: "emote"
|
||||||
delegate: TimelineContainer {
|
delegate: TimelineContainer {
|
||||||
width: messageListView.width
|
width: messageListView.width
|
||||||
|
innerObject: MessageDelegate {
|
||||||
innerObject: StateDelegate {
|
Layout.fillWidth: true
|
||||||
Layout.maximumWidth: parent.width
|
Layout.maximumWidth: messageListView.width
|
||||||
Layout.alignment: Qt.AlignHCenter
|
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")
|
title: i18n("Start a Chat")
|
||||||
|
|
||||||
header: RowLayout {
|
header: Control {
|
||||||
Layout.fillWidth: true
|
padding: Kirigami.Units.largeSpacing
|
||||||
Kirigami.SearchField {
|
contentItem: RowLayout {
|
||||||
id: identifierField
|
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 {
|
Button {
|
||||||
visible: identifierField.isUserID
|
visible: identifierField.isUserID
|
||||||
|
|
||||||
text: i18n("Chat")
|
text: i18n("Chat")
|
||||||
highlighted: true
|
highlighted: true
|
||||||
|
|
||||||
onClicked: Controller.createDirectChat(connection, identifierField.text)
|
onClicked: Controller.createDirectChat(connection, identifierField.text)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user