diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-09-08 01:41:57 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-09-08 01:41:57 +0200 |
commit | 0a3aeb0a1ab6638152a4d70f8319ad4587d32159 (patch) | |
tree | b286aa7060049c4b247c97a7afaf5ccc249ec43e /resources | |
parent | Reenable status part of timeline messages (diff) | |
download | nheko-0a3aeb0a1ab6638152a4d70f8319ad4587d32159.tar.xz |
Fix timeline menus
Diffstat (limited to 'resources')
-rw-r--r-- | resources/qml/MessageView.qml | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index a013c78b..411254d8 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -84,9 +84,13 @@ Item { required property var reactions required property int status required property int trustlevel + required property int type + required property bool isEditable property int avatarMargin: (wrapper.isStateEvent || Settings.smallAvatars ? 0 : (Nheko.avatarSize + 8)) // align bubble with section header + property alias hovered: messageHover.hovered + data: [ Loader { id: section @@ -109,6 +113,19 @@ Item { visible: status == Loader.Ready z: 4 }, + Rectangle { + anchors.fill: gridContainer + color: (Settings.messageHoverHighlight && messageHover.hovered) ? palette.alternateBase : "transparent" + + // this looks better without margins + TapHandler { + acceptedButtons: Qt.RightButton + acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad + gesturePolicy: TapHandler.ReleaseWithinBounds + + onSingleTapped: messageContextMenu.show(wrapper.eventId, wrapper.threadId, wrapper.type, wrapper.isSender, wrapper.isEncrypted, wrapper.isEditable, wrapper.main.hoveredLink, wrapper.main.copyText) + } + }, RowLayout { id: gridContainer @@ -276,7 +293,23 @@ Item { } } }, - + Item { + id: messageActionsAnchor + anchors.fill: gridContainer + property alias hovered: messageHover.hovered + HoverHandler { + id: messageHover + onHoveredChanged: () => { + if (!Settings.mobileMode && hovered) { + if (!messageActions.hovered) { + messageActions.model = wrapper; + messageActions.attached = wrapper; + messageActions.anchors.bottomMargin = -gridContainer.y + } + } + } + } + }, Reactions { id: reactionRow @@ -346,15 +379,15 @@ Item { property Item attached: null // use comma to update on scroll - property var attachedPos: chat.contentY, attached ? chat.mapFromItem(attached, attached ? attached.width - width : 0, -height) : null property alias model: row.model hoverEnabled: true padding: Nheko.paddingSmall visible: Settings.buttonsInTimeline && !!attached && (attached.hovered || hovered) - x: attached ? attachedPos.x : 0 - y: attached ? attachedPos.y + Nheko.paddingSmall : 0 z: 10 + parent: chat.contentItem + anchors.bottom: attached?.top + anchors.right: attached?.right background: Rectangle { border.color: palette.buttonText |