2020-10-29 20:07:52 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.3
|
2021-12-07 23:15:17 +00:00
|
|
|
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.popups 1.0
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-01 15:58:36 +00:00
|
|
|
|
2021-12-07 23:15:17 +00:00
|
|
|
import "../stores"
|
2020-10-29 20:07:52 +00:00
|
|
|
|
2022-12-01 16:58:37 +00:00
|
|
|
// TODO: replace with StatusMenu
|
2020-10-29 20:07:52 +00:00
|
|
|
PopupMenu {
|
2021-12-07 23:15:17 +00:00
|
|
|
id: favoritePopupMenu
|
|
|
|
|
2020-10-29 20:07:52 +00:00
|
|
|
property var openInNewTab: function () {}
|
|
|
|
property string url
|
2021-09-30 09:43:29 +00:00
|
|
|
property var currentFavorite: BookmarksStore.getCurrentFavorite(url)
|
2020-10-29 20:07:52 +00:00
|
|
|
|
2021-12-07 23:15:17 +00:00
|
|
|
signal editFavoriteTriggered()
|
|
|
|
|
2020-10-29 20:07:52 +00:00
|
|
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
|
|
|
|
|
|
|
Action {
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Open in new Tab")
|
2021-09-28 15:04:06 +00:00
|
|
|
icon.source: Style.svg("generate_account")
|
2020-11-27 20:31:50 +00:00
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
2020-10-29 20:07:52 +00:00
|
|
|
onTriggered: {
|
2021-12-07 23:15:17 +00:00
|
|
|
openInNewTab(favoritePopupMenu.url)
|
2020-10-29 20:07:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {}
|
|
|
|
|
|
|
|
Action {
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Edit")
|
2021-09-28 15:04:06 +00:00
|
|
|
icon.source: Style.svg("edit")
|
2020-10-29 20:07:52 +00:00
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
2022-01-31 11:19:40 +00:00
|
|
|
onTriggered: {
|
|
|
|
// Force reloading current favorite as it could have been modified when edited:
|
|
|
|
favoritePopupMenu.currentFavorite = BookmarksStore.getCurrentFavorite(url)
|
|
|
|
editFavoriteTriggered()
|
|
|
|
}
|
2020-10-29 20:07:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Remove")
|
2021-09-28 15:04:06 +00:00
|
|
|
icon.source: Style.svg("remove")
|
2020-10-29 20:07:52 +00:00
|
|
|
icon.color: Style.current.danger
|
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
|
|
|
onTriggered: {
|
2021-12-07 23:15:17 +00:00
|
|
|
BookmarksStore.deleteBookmark(favoritePopupMenu.url)
|
2020-10-29 20:07:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|