2023-09-05 16:04:58 +00:00
|
|
|
import QtQuick 2.15
|
2024-08-27 14:35:52 +00:00
|
|
|
|
|
|
|
import StatusQ 0.1
|
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-10-25 15:20:02 +00:00
|
|
|
property string domain
|
|
|
|
property bool requireConfirmationOnOpen: false
|
2024-05-15 09:36:56 +00:00
|
|
|
property bool isGif: root.imageSource.toLowerCase().endsWith(".gif")
|
|
|
|
property bool isVideo: root.imageSource.toLowerCase().endsWith(".mp4")
|
2023-05-19 16:07:50 +00:00
|
|
|
|
2023-09-05 16:04:58 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
readonly property bool isUnfurled: (!!url&&url!=="")
|
|
|
|
}
|
2023-06-12 08:32:27 +00:00
|
|
|
|
2023-05-19 16:07:50 +00:00
|
|
|
StatusAction {
|
2024-05-15 09:36:56 +00:00
|
|
|
text: root.isGif ? qsTr("Copy GIF") : qsTr("Copy image")
|
2023-05-19 16:07:50 +00:00
|
|
|
icon.name: "copy"
|
2024-05-15 09:36:56 +00:00
|
|
|
enabled: !!root.imageSource && !root.isVideo
|
2023-05-19 16:07:50 +00:00
|
|
|
onTriggered: {
|
2024-08-28 08:37:52 +00:00
|
|
|
ClipboardUtils.setImageByUrl(root.imageSource)
|
2023-05-19 16:07:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusAction {
|
2024-05-15 09:36:56 +00:00
|
|
|
text: root.isGif ? qsTr("Download GIF") : root.isVideo ? qsTr("Download video") : 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
|
2024-08-27 14:35:52 +00:00
|
|
|
onTriggered: ClipboardUtils.setText(url)
|
2023-09-05 16:04:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusAction {
|
|
|
|
text: qsTr("Open link")
|
|
|
|
icon.name: "browser"
|
|
|
|
enabled: d.isUnfurled
|
2023-10-25 15:20:02 +00:00
|
|
|
onTriggered: requireConfirmationOnOpen ? Global.openLinkWithConfirmation(root.url, root.domain) : Global.openLink(root.url)
|
2023-05-19 16:07:50 +00:00
|
|
|
}
|
|
|
|
}
|