status-desktop/ui/imports/shared/views/chat/ImageContextMenu.qml
Lukáš Tinkl 6bfe79a7f3 fix(Chat): Context menu for gif downloads/copies a png file
Detect the MIME type using `QMimeDatabase` from the actual content and
save it in that same format using `QSaveFile`, as `QImage` does NOT
support saving a GIF

Fixes #10747
2023-06-12 16:51:33 +02:00

30 lines
696 B
QML

import StatusQ.Popups 0.1
import utils 1.0
StatusMenu {
id: root
property string imageSource
readonly property bool isGif: root.imageSource.toLowerCase().endsWith(".gif")
StatusAction {
text: root.isGif ? qsTr("Copy GIF") : qsTr("Copy image")
icon.name: "copy"
enabled: !!root.imageSource
onTriggered: {
Utils.copyImageToClipboardByUrl(root.imageSource)
}
}
StatusAction {
text: root.isGif ? qsTr("Download GIF") : qsTr("Download image")
icon.name: "download"
enabled: !!root.imageSource
onTriggered: {
Global.openDownloadImageDialog(root.imageSource)
}
}
}