fix(desktop/browser): Fix add bookmark button
This button needs special case when it is not a real bookmark
This commit is contained in:
parent
fb687383b6
commit
da4d895131
|
@ -35,6 +35,11 @@ RowLayout {
|
|||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
z: 51
|
||||
onClicked: function (mouse) {
|
||||
const isAddBookmarkButton = url === Constants.newBookmark
|
||||
if (mouse.button === Qt.RightButton && isAddBookmarkButton) {
|
||||
return
|
||||
}
|
||||
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
favoriteMenu.url = url
|
||||
favoriteMenu.x = favoriteBtn.x + mouse.x
|
||||
|
@ -42,11 +47,16 @@ RowLayout {
|
|||
favoriteMenu.open()
|
||||
return
|
||||
}
|
||||
if (!url.toString()) {
|
||||
|
||||
if (isAddBookmarkButton) {
|
||||
addFavoriteModal.toolbarMode = true
|
||||
addFavoriteModal.ogUrl = browserHeader.currentFavorite ? browserHeader.currentFavorite.url : currentWebView.url
|
||||
addFavoriteModal.ogName = browserHeader.currentFavorite ? browserHeader.currentFavorite.name : currentWebView.title
|
||||
addFavoriteModal.open()
|
||||
} else {
|
||||
currentWebView.url = determineRealURL(url)
|
||||
return
|
||||
}
|
||||
|
||||
currentWebView.url = determineRealURL(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,9 +159,9 @@ ModalPopup {
|
|||
onClicked: {
|
||||
if (!popup.modifiyModal) {
|
||||
// remove "add favorite" button at the end, add new bookmark, add "add favorite" button back
|
||||
BookmarksStore.deleteBookmark(" ")
|
||||
BookmarksStore.deleteBookmark(Constants.newBookmark)
|
||||
BookmarksStore.addBookmark(urlInput.input.text, nameInput.input.text)
|
||||
BookmarksStore.addBookmark(" ", qsTr("Add Favorite"))
|
||||
BookmarksStore.addBookmark(Constants.newBookmark, qsTr("Add Favorite"))
|
||||
} else if (popup.ogName !== nameInput.input.text || popup.ogUrl !== urlInput.input.text) {
|
||||
BookmarksStore.updateBookmark(popup.ogUrl, urlInput.input.text, nameInput.input.text)
|
||||
}
|
||||
|
|
|
@ -183,9 +183,9 @@ WebEngineView {
|
|||
model: BookmarksStore.bookmarksModel
|
||||
Component.onCompleted: {
|
||||
// Add fav button at the end of the grid
|
||||
var index = BookmarksStore.getBookmarkIndexByUrl(" ")
|
||||
if (index !== -1) { BookmarksStore.deleteBookmark(" ") }
|
||||
BookmarksStore.addBookmark(" ", qsTr("Add Favorite"))
|
||||
var index = BookmarksStore.getBookmarkIndexByUrl(Constants.newBookmark)
|
||||
if (index !== -1) { BookmarksStore.deleteBookmark(Constants.newBookmark) }
|
||||
BookmarksStore.addBookmark(Constants.newBookmark, qsTr("Add Favorite"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,6 +176,8 @@ QtObject {
|
|||
//% "(edited)"
|
||||
readonly property string editLabel: ` <span class="isEdited">` + qsTrId("-edited-") + `</span>`
|
||||
|
||||
readonly property string newBookmark: " "
|
||||
|
||||
readonly property var ensState: {
|
||||
//% "Username already taken :("
|
||||
"taken": qsTrId("ens-username-taken"),
|
||||
|
|
Loading…
Reference in New Issue