2020-12-29 17:10:22 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2020-12-29 17:10:22 +00:00
|
|
|
|
2021-10-20 08:44:04 +00:00
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
2020-12-29 17:10:22 +00:00
|
|
|
RowLayout {
|
|
|
|
id: favoritesBar
|
2021-09-30 09:43:29 +00:00
|
|
|
|
|
|
|
property alias bookmarkModel: bookmarkList.model
|
|
|
|
|
2020-12-29 17:10:22 +00:00
|
|
|
spacing: 0
|
2021-11-17 11:49:03 +00:00
|
|
|
height: 38
|
2020-12-29 17:10:22 +00:00
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: bookmarkList
|
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
orientation : ListView.Horizontal
|
|
|
|
height: parent.height
|
|
|
|
clip: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
width: parent.width
|
|
|
|
boundsBehavior: Flickable.StopAtBounds
|
2021-10-20 08:44:04 +00:00
|
|
|
delegate: StatusFlatButton {
|
2020-12-29 17:10:22 +00:00
|
|
|
id: favoriteBtn
|
|
|
|
height: 32
|
|
|
|
icon.source: imageUrl
|
|
|
|
icon.width: 24
|
|
|
|
icon.height: 24
|
|
|
|
text: name
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
|
|
z: 51
|
|
|
|
onClicked: function (mouse) {
|
2021-11-12 12:37:05 +00:00
|
|
|
const isAddBookmarkButton = url === Constants.newBookmark
|
|
|
|
if (mouse.button === Qt.RightButton && isAddBookmarkButton) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-12-29 17:10:22 +00:00
|
|
|
if (mouse.button === Qt.RightButton) {
|
|
|
|
favoriteMenu.url = url
|
|
|
|
favoriteMenu.x = favoriteBtn.x + mouse.x
|
|
|
|
favoriteMenu.y = Qt.binding(function () {return mouse.y + favoriteMenu.height})
|
|
|
|
favoriteMenu.open()
|
|
|
|
return
|
|
|
|
}
|
2021-11-12 12:37:05 +00:00
|
|
|
|
|
|
|
if (isAddBookmarkButton) {
|
|
|
|
addFavoriteModal.toolbarMode = true
|
|
|
|
addFavoriteModal.ogUrl = browserHeader.currentFavorite ? browserHeader.currentFavorite.url : currentWebView.url
|
|
|
|
addFavoriteModal.ogName = browserHeader.currentFavorite ? browserHeader.currentFavorite.name : currentWebView.title
|
2021-09-30 09:43:29 +00:00
|
|
|
addFavoriteModal.open()
|
2021-11-12 12:37:05 +00:00
|
|
|
return
|
2021-09-30 09:43:29 +00:00
|
|
|
}
|
2021-11-12 12:37:05 +00:00
|
|
|
|
|
|
|
currentWebView.url = determineRealURL(url)
|
2020-12-29 17:10:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|