Skip to content

Commit

Permalink
messageActions onPressAndHold
Browse files Browse the repository at this point in the history
  • Loading branch information
maltee1 authored and deepbluev7 committed Apr 2, 2022
1 parent a100a5b commit 24970b8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
27 changes: 23 additions & 4 deletions resources/qml/MessageView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Item {
id: row

property var model
property int buttonSize: Settings.mobileMode? 22 : 16

spacing: messageActions.padding

Expand All @@ -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: {
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions resources/qml/TimelineRow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 24970b8

Please sign in to comment.