fix(@desktop/browser): Add new bookmark Modal doesnt display url and name of website.

Also fixed behaviour of add/removing a bookmark.

fixes #4037
This commit is contained in:
Khushboo Mehta 2021-11-05 15:49:31 +01:00 committed by Iuri Matias
parent 480219b823
commit 0d7d09e351
3 changed files with 10 additions and 15 deletions

View File

@ -159,14 +159,7 @@ Rectangle {
dappBrowserAccName: WalletStore.dappBrowserAccount.name dappBrowserAccName: WalletStore.dappBrowserAccount.name
dappBrowserAccIcon: WalletStore.dappBrowserAccount.iconColor dappBrowserAccIcon: WalletStore.dappBrowserAccount.iconColor
onAddNewFavoritelClicked: { onAddNewFavoritelClicked: {
if (!browserHeader.currentFavorite) { addFavoriteModal.modifiyModal = browserHeader.currentFavorite
// remove "add favorite" button at the end, add new bookmark, add "add favorite" button back
BookmarksStore.deleteBookmark("")
BookmarksStore.addBookmark(currentWebView.url, currentWebView.title)
BookmarksStore.addBookmark("", qsTr("Add Favorite"))
}
addFavoriteModal.modifiyModal = true
addFavoriteModal.toolbarMode = true addFavoriteModal.toolbarMode = true
addFavoriteModal.x = xPos - 30 addFavoriteModal.x = xPos - 30
addFavoriteModal.y = browserHeader.y + browserHeader.height + 4 addFavoriteModal.y = browserHeader.y + browserHeader.height + 4

View File

@ -48,6 +48,8 @@ ModalPopup {
} }
onOpened: { onOpened: {
urlInput.input.text = ogUrl
nameInput.input.text = ogName
urlInput.input.forceActiveFocus(Qt.MouseFocusReason) urlInput.input.forceActiveFocus(Qt.MouseFocusReason)
} }
@ -86,7 +88,7 @@ ModalPopup {
leftPadding: 0 leftPadding: 0
rightPadding: 0 rightPadding: 0
label: qsTr("URL") label: qsTr("URL")
input.text: popup.ogurl input.text: ogUrl
input.placeholderText: qsTr("Paste URL") input.placeholderText: qsTr("Paste URL")
input.component: StatusButton { input.component: StatusButton {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -113,7 +115,7 @@ ModalPopup {
leftPadding: 0 leftPadding: 0
rightPadding: 0 rightPadding: 0
label: qsTr("Name") label: qsTr("Name")
input.text: popup.ogurl input.text: ogName
input.placeholderText: qsTr("Name of the website") input.placeholderText: qsTr("Name of the website")
validators: [ validators: [
StatusMinLengthValidator { StatusMinLengthValidator {
@ -157,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(" ")
BookmarksStore.addBookmark(urlInput.input.text, nameInput.input.text) BookmarksStore.addBookmark(urlInput.input.text, nameInput.input.text)
BookmarksStore.addBookmark("", qsTr("Add Favorite")) BookmarksStore.addBookmark(" ", 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)
} }

View File

@ -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(" ")
if (index !== -1) { BookmarksStore.deleteBookmark("") } if (index !== -1) { BookmarksStore.deleteBookmark(" ") }
BookmarksStore.addBookmark("", qsTr("Add Favorite")) BookmarksStore.addBookmark(" ", qsTr("Add Favorite"))
} }
} }
} }