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