Make "In reply to" properly react to taps

This commit is contained in:
Slava Monich 2021-12-18 02:38:52 +02:00
parent 833f5f1df7
commit 1179c86a06

View file

@ -82,6 +82,15 @@ ListItem {
Clipboard.text = Functions.getMessageText(myMessage, true, userInformation.id, true) Clipboard.text = Functions.getMessageText(myMessage, true, userInformation.id, true)
} }
function openContextMenu() {
messageOptionsDrawer.open = false
if (menu) {
openMenu()
} else {
contextMenuLoader.active = true
}
}
onClicked: { onClicked: {
if(messageListItem.precalculatedValues.pageIsSelecting) { if(messageListItem.precalculatedValues.pageIsSelecting) {
page.toggleMessageSelection(myMessage); page.toggleMessageSelection(myMessage);
@ -100,12 +109,11 @@ ListItem {
} }
onPressAndHold: { onPressAndHold: {
if(messageListItem.precalculatedValues.pageIsSelecting) { if (openMenuOnPressAndHold) {
page.selectedMessages = []; openContextMenu()
page.state = ""
} else { } else {
messageOptionsDrawer.open = false page.selectedMessages = []
contextMenuLoader.active = true; page.state = ""
} }
} }
@ -364,15 +372,27 @@ ListItem {
InReplyToRow { InReplyToRow {
id: messageInReplyToRow id: messageInReplyToRow
myUserId: page.myUserId myUserId: page.myUserId
visible: true layer.enabled: messageInReplyToMouseArea.pressed && !messageListItem.highlighted && !messageListItem.menuOpen
layer.effect: PressEffect { source: messageInReplyToRow }
inReplyToMessage: messageInReplyToLoader.inReplyToMessage inReplyToMessage: messageInReplyToLoader.inReplyToMessage
inReplyToMessageDeleted: messageInReplyToLoader.inReplyToMessageDeleted inReplyToMessageDeleted: messageInReplyToLoader.inReplyToMessageDeleted
} }
MouseArea { MouseArea {
id: messageInReplyToMouseArea
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
messageOverlayLoader.overlayMessage = messageInReplyToRow.inReplyToMessage; if (precalculatedValues.pageIsSelecting) {
messageOverlayLoader.active = true; page.toggleMessageSelection(myMessage)
} else {
messageOptionsDrawer.open = false
messageOverlayLoader.overlayMessage = messageInReplyToRow.inReplyToMessage
messageOverlayLoader.active = true
}
}
onPressAndHold: {
if (openMenuOnPressAndHold) {
openContextMenu()
}
} }
} }
} }