Merge pull request #470 from monich/long-tap

Make "In reply to" properly react to taps
This commit is contained in:
Sebastian Wolf 2021-12-18 20:37:44 +01:00 committed by GitHub
commit 55d046d318
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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()
}
} }
} }
} }