Copy image to the clipboard

Add a context menu option to save an image in the timeline to the clipboard

BUG: 466478
This commit is contained in:
Alessio Mattiazzi
2023-03-05 23:19:02 +00:00
committed by Tobias Fella
parent bd4eeb405b
commit d1f7e7091e
3 changed files with 27 additions and 0 deletions

View File

@@ -55,6 +55,20 @@ MessageDelegateContextMenu {
root.closeFullscreen()
}
},
Kirigami.Action {
text: i18n("Copy")
icon.name: "edit-copy"
onTriggered: {
if(file.downloaded) {
Clipboard.setImage(progressInfo.localPath)
} else {
file.onDownloadedChanged.connect(function() {
Clipboard.setImage(progressInfo.localPath)
});
currentRoom.downloadFile(eventId, StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + eventId.replace(":", "_").replace("/", "_").replace("+", "_") + currentRoom.fileNameToDownload(eventId))
}
}
},
Kirigami.Action {
visible: author.id === currentRoom.localUser.id || currentRoom.canSendState("redact")
text: i18n("Remove")