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
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
z: 51
|
z: 51
|
||||||
onClicked: function (mouse) {
|
onClicked: function (mouse) {
|
||||||
|
const isAddBookmarkButton = url === Constants.newBookmark
|
||||||
|
if (mouse.button === Qt.RightButton && isAddBookmarkButton) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (mouse.button === Qt.RightButton) {
|
if (mouse.button === Qt.RightButton) {
|
||||||
favoriteMenu.url = url
|
favoriteMenu.url = url
|
||||||
favoriteMenu.x = favoriteBtn.x + mouse.x
|
favoriteMenu.x = favoriteBtn.x + mouse.x
|
||||||
|
@ -42,13 +47,18 @@ RowLayout {
|
||||||
favoriteMenu.open()
|
favoriteMenu.open()
|
||||||
return
|
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()
|
addFavoriteModal.open()
|
||||||
} else {
|
return
|
||||||
|
}
|
||||||
|
|
||||||
currentWebView.url = determineRealURL(url)
|
currentWebView.url = determineRealURL(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,9 +159,9 @@ ModalPopup {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (!popup.modifiyModal) {
|
if (!popup.modifiyModal) {
|
||||||
// remove "add favorite" button at the end, add new bookmark, add "add favorite" button back
|
// 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(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) {
|
} else if (popup.ogName !== nameInput.input.text || popup.ogUrl !== urlInput.input.text) {
|
||||||
BookmarksStore.updateBookmark(popup.ogUrl, urlInput.input.text, nameInput.input.text)
|
BookmarksStore.updateBookmark(popup.ogUrl, urlInput.input.text, nameInput.input.text)
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,9 +183,9 @@ WebEngineView {
|
||||||
model: BookmarksStore.bookmarksModel
|
model: BookmarksStore.bookmarksModel
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
// Add fav button at the end of the grid
|
// Add fav button at the end of the grid
|
||||||
var index = BookmarksStore.getBookmarkIndexByUrl(" ")
|
var index = BookmarksStore.getBookmarkIndexByUrl(Constants.newBookmark)
|
||||||
if (index !== -1) { BookmarksStore.deleteBookmark(" ") }
|
if (index !== -1) { BookmarksStore.deleteBookmark(Constants.newBookmark) }
|
||||||
BookmarksStore.addBookmark(" ", qsTr("Add Favorite"))
|
BookmarksStore.addBookmark(Constants.newBookmark, qsTr("Add Favorite"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,6 +176,8 @@ QtObject {
|
||||||
//% "(edited)"
|
//% "(edited)"
|
||||||
readonly property string editLabel: ` <span class="isEdited">` + qsTrId("-edited-") + `</span>`
|
readonly property string editLabel: ` <span class="isEdited">` + qsTrId("-edited-") + `</span>`
|
||||||
|
|
||||||
|
readonly property string newBookmark: " "
|
||||||
|
|
||||||
readonly property var ensState: {
|
readonly property var ensState: {
|
||||||
//% "Username already taken :("
|
//% "Username already taken :("
|
||||||
"taken": qsTrId("ens-username-taken"),
|
"taken": qsTrId("ens-username-taken"),
|
||||||
|
|
Loading…
Reference in New Issue