Page MenuHomePhorge

No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None
diff --git a/src/contents/ui/Bubble.qml b/src/contents/ui/Bubble.qml
index 7895e7e..95bb9a9 100644
--- a/src/contents/ui/Bubble.qml
+++ b/src/contents/ui/Bubble.qml
@@ -1,127 +1,134 @@
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2020-2023 tusooa <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import org.kde.kirigami 2.13 as Kirigami
import '.' as Kazv
ItemDelegate {
id: upper
default property var children
property var currentEvent: event
property var menuContent: []
readonly property var bubbleSpacing: leftPadding + rightPadding
Layout.fillWidth: true
Layout.preferredHeight: bubbleRootLayout.implicitHeight
property var backgroundItem: Rectangle {
anchors.fill: parent
color: hovered ? Kirigami.Theme.activeBackgroundColor : Kirigami.Theme.backgroundColor
}
background: compactMode ? null : backgroundItem
TapHandler {
acceptedButtons: Qt.LeftButton | Qt.RightButton
property var menu: Menu {
objectName: 'bubbleContextMenu'
property list<QtObject> staticItems: [
Kirigami.Action {
objectName: 'replyToMenuItem'
text: l10n.get('event-reply-action')
onTriggered: setDraftReplyTo(currentEvent.eventId)
enabled: event && !event.redacted
},
Kirigami.Action {
objectName: 'deleteMenuItem'
text: l10n.get('event-delete')
onTriggered: eventView.redactSelf()
enabled: event && !event.redacted
},
MenuSeparator {},
Kirigami.Action {
text: l10n.get('event-view-source')
onTriggered: eventSourcePopup.open()
}
]
contentData: Array.from(staticItems).concat(upper.menuContent)
}
onLongPressed: maybePopup()
onTapped: {
if (eventPoint.event.button === Qt.RightButton) {
maybePopup()
}
}
function shouldPopup() {
return !compactMode
}
function maybePopup() {
if (shouldPopup()) {
menu.popup(parent)
}
}
}
property var eventSourcePopup: Kirigami.OverlaySheet {
title: l10n.get('event-source-popup-title')
Kazv.EventSourceView {
event: upper.currentEvent
}
}
ColumnLayout {
id: bubbleRootLayout
anchors.left: parent.left
anchors.right: parent.right
property var inReplyTo: RowLayout {
Layout.fillWidth: true
+ Layout.margins: 0
+
+ Rectangle {
+ Layout.fillHeight: true
+ Layout.preferredWidth: Kirigami.Units.smallSpacing
+ color: Kirigami.Theme.activeTextColor
+ }
Loader {
id: inReplyToLoader
source: 'qrc:/EventViewCompact.qml'
active: currentEvent.replyingToEventId && !compactMode
asynchronous: true
Layout.minimumHeight: inReplyToLoader.item ? inReplyToLoader.item.height : 0
Layout.fillWidth: true
property var event: room.messageById(currentEvent.replyingToEventId)
property var props: ({
event,
sender: room.member(event.sender || matrixSdk.userId),
stateKeyUser: event.stateKey ? room.member(event.stateKey) : {},
isGapped: timeline.gaps.includes(event.eventId),
})
}
}
property var eventContent: RowLayout {
Layout.fillWidth: true
property var encryptedIcon: Kirigami.Icon {
source: 'emblem-encrypted-locked'
Layout.preferredHeight: inlineBadgeSize
Layout.preferredWidth: inlineBadgeSize
}
data: [
...(event && event.encrypted ? [encryptedIcon] : []),
...(Array.isArray(upper.children) ? upper.children :
upper.children ? [upper.children] : [])
]
}
children: event.replyingToEventId && !compactMode ? [inReplyTo, eventContent] : [eventContent];
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jan 19, 6:43 PM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
55380
Default Alt Text
(3 KB)

Event Timeline