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
dappBrowserAccIcon: WalletStore.dappBrowserAccount.iconColor
onAddNewFavoritelClicked: {
if (!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.modifiyModal = browserHeader.currentFavorite
addFavoriteModal.toolbarMode = true
addFavoriteModal.x = xPos - 30
addFavoriteModal.y = browserHeader.y + browserHeader.height + 4

View File

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

View File

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