messageActions onPressAndHold

This commit is contained in:
Malte E 2022-03-28 22:01:48 +02:00 committed by Nicolas Werner
parent a100a5b2f0
commit 24970b889e
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
2 changed files with 23 additions and 6 deletions

View file

@ -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

View file

@ -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 {