Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85806965
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/contents/ui/EventReactions.qml b/src/contents/ui/EventReactions.qml
index 6e4a630..a173fa9 100644
--- a/src/contents/ui/EventReactions.qml
+++ b/src/contents/ui/EventReactions.qml
@@ -1,88 +1,89 @@
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2024 tusooa <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import org.kde.kirigami as Kirigami
import moe.kazv.mxc.kazv 0.0 as MK
Flow {
required property var reactions
Repeater {
model: reactions
delegate: RowLayout {
id: reaction
objectName: `reaction${index}`
spacing: -1
Kirigami.Theme.colorSet: Kirigami.Theme.Button
required property int index
readonly property var item: reactions.at(index)
readonly property string key: item.key
readonly property double commonHeight: Math.max(content.implicitHeight, count.implicitHeight)
readonly property string selfReactEventId: getSelfReactEventId()
function getSelfReactEventId() {
for (let i = 0; i < item.count; ++i) {
const e = item.at(i);
if (e.sender === matrixSdk.userId) {
return e.eventId;
}
}
return '';
}
ItemDelegate {
id: content
objectName: 'reactionContent'
Layout.preferredHeight: reaction.commonHeight
rightInset: 0
contentItem: Text {
objectName: 'reactionContentText'
textFormat: Qt.RichText
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
// See the comments in event-types/Reaction.qml
text: '<span style="font-family: emoji, sans-serif;">' + MK.KazvUtil.escapeHtml(key) + '</span>'
Accessible.description: l10n.get('event-react-button-description', { key })
color: content.checked ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor
}
checked: !!reaction.selfReactEventId
onClicked: reaction.selfReactEventId ? deleteEventRequestedNoConfirm(reaction.selfReactEventId, /* isLocalEcho = */ false) : eventView.reactWith(key)
background: Rectangle {
topLeftRadius: Kirigami.Units.cornerRadius
bottomLeftRadius: Kirigami.Units.cornerRadius
border.color: Kirigami.Theme.highlightColor
color: content.hovered
? Kirigami.Theme.hoverColor
: content.checked
? Kirigami.Theme.highlightColor
: 'transparent'
}
}
ItemDelegate {
id: count
objectName: 'reactionCount'
Layout.preferredHeight: reaction.commonHeight
leftInset: 0
contentItem: Text {
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
text: `${reaction.item.count}`
+ color: Kirigami.Theme.textColor
}
background: Rectangle {
topRightRadius: Kirigami.Units.cornerRadius
bottomRightRadius: Kirigami.Units.cornerRadius
border.color: Kirigami.Theme.highlightColor
color: count.hovered
? Kirigami.Theme.hoverColor
: 'transparent'
}
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Oct 13, 5:14 PM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1786837
Default Alt Text
(3 KB)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment