diff --git a/ui/app/AppLayouts/Browser/BrowserLayout.qml b/ui/app/AppLayouts/Browser/BrowserLayout.qml index 54e2efbf17..99a30db1e1 100644 --- a/ui/app/AppLayouts/Browser/BrowserLayout.qml +++ b/ui/app/AppLayouts/Browser/BrowserLayout.qml @@ -238,13 +238,13 @@ Rectangle { onReload: _internal.currentWebView.reload() onStopLoading: _internal.currentWebView.stop() onAddNewFavoritelClicked: { - addFavoriteModal.modifiyModal = browserHeader.currentFavorite - addFavoriteModal.toolbarMode = true - addFavoriteModal.x = xPos - 30 - addFavoriteModal.y = browserHeader.y + browserHeader.height + 4 - addFavoriteModal.ogUrl = browserHeader.currentFavorite ? browserHeader.currentFavorite.url : _internal.currentWebView.url - addFavoriteModal.ogName = browserHeader.currentFavorite ? browserHeader.currentFavorite.name : _internal.currentWebView.title - addFavoriteModal.open() + Global.openPopup(addFavoriteModal, { + x = xPos - 30, + y = browserHeader.y + browserHeader.height + 4, + modifiyModal: browserHeader.currentFavorite, + toolbarMode: true, + ogUrl: browserHeader.currentFavorite ? browserHeader.currentFavorite.url : _internal.currentWebView.url, + ogName: browserHeader.currentFavorite ? browserHeader.currentFavorite.name : _internal.currentWebView.title}) } onLaunchInBrowser: { // TODO: disable browsing local files? file:// @@ -315,8 +315,9 @@ Rectangle { z: 100 } - AddFavoriteModal { + Component { id: addFavoriteModal + AddFavoriteModal {} } FavoriteMenu { @@ -324,11 +325,11 @@ Rectangle { openInNewTab: function (url) { browserWindow.openUrlInNewTab(url) } - onEditFavoriteTriggered: { - addFavoriteModal.modifiyModal = true - addFavoriteModal.ogUrl = favoriteMenu.currentFavorite ? favoriteMenu.currentFavorite.url : _internal.currentWebView.url - addFavoriteModal.ogName = favoriteMenu.currentFavorite ? favoriteMenu.currentFavorite.name : _internal.currentWebView.title - addFavoriteModal.open() + onEditFavoriteTriggered: { + Global.openPopup(addFavoriteModal, { + modifiyModal: true, + ogUrl: favoriteMenu.currentFavorite ? favoriteMenu.currentFavorite.url : _internal.currentWebView.url, + ogName: favoriteMenu.currentFavorite ? favoriteMenu.currentFavorite.name : _internal.currentWebView.title}) } } @@ -525,10 +526,9 @@ Rectangle { _internal.currentWebView.url = _internal.determineRealURL(url) } addFavModal: function() { - addFavoriteModal.toolbarMode = true - addFavoriteModal.ogUrl = browserHeader.currentFavorite ? browserHeader.currentFavorite.url : _internal.currentWebView.url - addFavoriteModal.ogName = browserHeader.currentFavorite ? browserHeader.currentFavorite.name : _internal.currentWebView.title - addFavoriteModal.open() + Global.openPopup(addFavoriteModal, {toolbarMode: true, + ogUrl: browserHeader.currentFavorite ? browserHeader.currentFavorite.url : _internal.currentWebView.url, + ogName: browserHeader.currentFavorite ? browserHeader.currentFavorite.name : _internal.currentWebView.title}) } } } diff --git a/ui/app/AppLayouts/Browser/panels/FavoritesList.qml b/ui/app/AppLayouts/Browser/panels/FavoritesList.qml index 98b64d74b6..eb5431089b 100644 --- a/ui/app/AppLayouts/Browser/panels/FavoritesList.qml +++ b/ui/app/AppLayouts/Browser/panels/FavoritesList.qml @@ -22,7 +22,7 @@ GridView { webUrl: determineRealURLFn(url) onClicked: { if (!webUrl.toString()) { - addFavModal.open() + Global.openPopup(addFavModal) } else { setAsCurrentWebUrl(webUrl) } diff --git a/ui/app/AppLayouts/Browser/popups/AddFavoriteModal.qml b/ui/app/AppLayouts/Browser/popups/AddFavoriteModal.qml index dbc635c51a..620b35c8f5 100644 --- a/ui/app/AppLayouts/Browser/popups/AddFavoriteModal.qml +++ b/ui/app/AppLayouts/Browser/popups/AddFavoriteModal.qml @@ -13,8 +13,8 @@ import "../stores" // TODO: replace with StatusModal ModalPopup { - property string ogUrl - property string ogName + property string ogUrl: "" + property string ogName: "" property bool modifiyModal: false property bool toolbarMode: false @@ -152,7 +152,7 @@ ModalPopup { //% "Add" qsTrId("add") anchors.bottom: parent.bottom - enabled: nameInput.valid && urlInput.valid + enabled: nameInput.valid && !!nameInput.text && urlInput.valid && !!urlInput.text onClicked: { if (!popup.modifiyModal) { // remove "add favorite" button at the end, add new bookmark, add "add favorite" button back