Add the right click menu for image delegates in fullscreen mode

Add the right click menu for image delegates in fullscreen mode

BUG: 455147
This commit is contained in:
James Graham
2022-08-27 11:52:45 +00:00
parent 696b34e094
commit 6cca3dbe3a
3 changed files with 27 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ ApplicationWindow {
property string blurhash: "" property string blurhash: ""
property int imageWidth: -1 property int imageWidth: -1
property int imageHeight: -1 property int imageHeight: -1
property var modelData
flags: Qt.FramelessWindowHint | Qt.WA_TranslucentBackground flags: Qt.FramelessWindowHint | Qt.WA_TranslucentBackground
@@ -52,6 +53,24 @@ ApplicationWindow {
source: root.blurhash !== "" ? ("image://blurhash/" + root.blurhash) : "" source: root.blurhash !== "" ? ("image://blurhash/" + root.blurhash) : ""
visible: root.blurhash !== "" && parent.status !== Image.Ready visible: root.blurhash !== "" && parent.status !== Image.Ready
} }
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: {
const contextMenu = fileDelegateContextMenu.createObject(parent, {
author: modelData.author,
message: modelData.message,
eventId: modelData.eventId,
source: modelData.source,
file: root.parent,
mimeType: modelData.mimeType,
progressInfo: modelData.progressInfo,
plainMessage: modelData.message,
});
contextMenu.closeFullscreen.connect(root.destroy)
contextMenu.open();
}
}
} }
Button { Button {

View File

@@ -91,10 +91,11 @@ TimelineContainer {
onTapped: { onTapped: {
fullScreenImage.createObject(parent, { fullScreenImage.createObject(parent, {
filename: eventId, filename: eventId,
source: model.mediaUrl, source: mediaUrl,
blurhash: model.content.info["xyz.amorgan.blurhash"], blurhash: model.content.info["xyz.amorgan.blurhash"],
imageWidth: content.info.w, imageWidth: content.info.w,
imageHeight: content.info.h imageHeight: content.info.h,
modelData: model
}).showFullScreen(); }).showFullScreen();
} }
} }

View File

@@ -14,6 +14,8 @@ import NeoChat.Menu 1.0
MessageDelegateContextMenu { MessageDelegateContextMenu {
id: root id: root
signal closeFullscreen
required property var file required property var file
required property var progressInfo required property var progressInfo
required property string mimeType required property string mimeType
@@ -51,6 +53,7 @@ MessageDelegateContextMenu {
icon.name: "mail-replied-symbolic" icon.name: "mail-replied-symbolic"
onTriggered: { onTriggered: {
chatBoxHelper.replyToMessage(eventId, message, author); chatBoxHelper.replyToMessage(eventId, message, author);
root.closeFullscreen()
} }
}, },
Kirigami.Action { Kirigami.Action {
@@ -60,6 +63,7 @@ MessageDelegateContextMenu {
icon.color: "red" icon.color: "red"
onTriggered: { onTriggered: {
currentRoom.redactEvent(eventId); currentRoom.redactEvent(eventId);
root.closeFullscreen()
} }
}, },
Kirigami.Action { Kirigami.Action {
@@ -72,6 +76,7 @@ MessageDelegateContextMenu {
title: i18n("Message Source"), title: i18n("Message Source"),
width: Kirigami.Units.gridUnit * 25 width: Kirigami.Units.gridUnit * 25
}); });
root.closeFullscreen()
} }
} }
] ]