From 24970b889eec41ed6975ea45d30ec49dedb98097 Mon Sep 17 00:00:00 2001 From: Malte E Date: Mon, 28 Mar 2022 22:01:48 +0200 Subject: [PATCH] messageActions onPressAndHold --- resources/qml/MessageView.qml | 27 +++++++++++++++++++++++---- resources/qml/TimelineRow.qml | 2 -- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index b20a1d88..d1cfdee8 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -82,6 +82,7 @@ Item { id: row property var model + property int buttonSize: Settings.mobileMode? 22 : 16 spacing: messageActions.padding @@ -95,6 +96,7 @@ Item { Layout.preferredHeight: fontMetrics.height font.family: Settings.emojiFont + font.pointSize: fontMetrics.font.pointSize*(Settings.mobileMode? 1.5 : 1) text: modelData onClicked: { @@ -109,7 +111,8 @@ Item { visible: !!row.model && row.model.isEditable buttonTextColor: Nheko.colors.buttonText - width: 16 + width: row.buttonSize + height: row.buttonSize hoverEnabled: true image: ":/icons/icons/ui/edit.svg" ToolTip.visible: hovered @@ -126,7 +129,8 @@ Item { id: reactButton visible: chat.model ? chat.model.permissions.canSend(MtxEvent.Reaction) : false - width: 16 + width: row.buttonSize + height: row.buttonSize hoverEnabled: true image: ":/icons/icons/ui/smile.svg" ToolTip.visible: hovered @@ -143,7 +147,8 @@ Item { id: replyButton visible: chat.model ? chat.model.permissions.canSend(MtxEvent.TextMessage) : false - width: 16 + width: row.buttonSize + height: row.buttonSize hoverEnabled: true image: ":/icons/icons/ui/reply.svg" ToolTip.visible: hovered @@ -155,7 +160,8 @@ Item { ImageButton { id: optionsButton - width: 16 + width: row.buttonSize + height: row.buttonSize hoverEnabled: true image: ":/icons/icons/ui/options.svg" ToolTip.visible: hovered @@ -472,6 +478,19 @@ Item { } } } + onPressAndHold: { + messageActions.attached = timelinerow; + messageActions.model = timelinerow; + } + onActiveFocusChanged: { + messageActions.attached = null + messageActions.model = null + } + onPressed: { + messageActions.attached = null + messageActions.model = null + } + background: Rectangle { id: scrollHighlight diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml index 3a7bf561..400fefec 100644 --- a/resources/qml/TimelineRow.qml +++ b/resources/qml/TimelineRow.qml @@ -63,8 +63,6 @@ AbstractButton { } } - - onPressAndHold: messageContextMenu.show(eventId, type, isSender, isEncrypted, isEditable, contentItem.child.hoveredLink, contentItem.child.copyText) onDoubleClicked: chat.model.reply = eventId DragHandler {