2023-09-05 16:04:58 +00:00
|
|
|
import QtQuick 2.15
|
2023-05-19 16:07:50 +00:00
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
StatusMenu {
|
|
|
|
id: root
|
|
|
|
|
2023-09-05 16:04:58 +00:00
|
|
|
property string url
|
2023-05-19 16:07:50 +00:00
|
|
|
property string imageSource
|
|
|
|
|
2023-09-05 16:04:58 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
readonly property bool isUnfurled: (!!url&&url!=="")
|
|
|
|
readonly property bool isGif: root.imageSource.toLowerCase().endsWith(".gif")
|
|
|
|
}
|
2023-06-12 08:32:27 +00:00
|
|
|
|
2023-05-19 16:07:50 +00:00
|
|
|
StatusAction {
|
2023-09-05 16:04:58 +00:00
|
|
|
text: d.isGif ? qsTr("Copy GIF") : qsTr("Copy image")
|
2023-05-19 16:07:50 +00:00
|
|
|
icon.name: "copy"
|
|
|
|
enabled: !!root.imageSource
|
|
|
|
onTriggered: {
|
|
|
|
Utils.copyImageToClipboardByUrl(root.imageSource)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusAction {
|
2023-09-05 16:04:58 +00:00
|
|
|
text: d.isGif ? qsTr("Download GIF") : qsTr("Download image")
|
2023-05-19 16:07:50 +00:00
|
|
|
icon.name: "download"
|
|
|
|
enabled: !!root.imageSource
|
|
|
|
onTriggered: {
|
2023-09-05 16:04:58 +00:00
|
|
|
Global.openDownloadImageDialog(root.imageSource);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusAction {
|
|
|
|
text: qsTr("Copy link")
|
|
|
|
icon.name: "copy"
|
|
|
|
enabled: d.isUnfurled
|
|
|
|
onTriggered: {
|
|
|
|
Utils.copyToClipboard(url);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusAction {
|
|
|
|
text: qsTr("Open link")
|
|
|
|
icon.name: "browser"
|
|
|
|
enabled: d.isUnfurled
|
|
|
|
onTriggered: {
|
|
|
|
Qt.openUrlExternally(url);
|
2023-05-19 16:07:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|