status-desktop/ui/app/AppLayouts/Browser/popups/FavoriteMenu.qml

58 lines
1.3 KiB
QML
Raw Normal View History

2020-10-29 20:07:52 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.3
import shared.panels 1.0
import shared.popups 1.0
import utils 1.0
import "../stores"
2020-10-29 20:07:52 +00:00
// TODO: replace with StatusPopupMenu
2020-10-29 20:07:52 +00:00
PopupMenu {
id: favoritePopupMenu
2020-10-29 20:07:52 +00:00
property var openInNewTab: function () {}
property string url
property var currentFavorite: BookmarksStore.getCurrentFavorite(url)
2020-10-29 20:07:52 +00:00
signal editFavoriteTriggered()
2020-10-29 20:07:52 +00:00
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
Action {
text: qsTr("Open in new Tab")
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: {
openInNewTab(favoritePopupMenu.url)
2020-10-29 20:07:52 +00:00
}
}
Separator {}
Action {
text: qsTr("Edit")
icon.source: Style.svg("edit")
2020-10-29 20:07:52 +00:00
icon.width: 16
icon.height: 16
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 {
text: qsTr("Remove")
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: {
BookmarksStore.deleteBookmark(favoritePopupMenu.url)
2020-10-29 20:07:52 +00:00
}
}
}