From 35a2dd5244b4901b34aa68e749969c69c6267bd9 Mon Sep 17 00:00:00 2001 From: Patryk Osmaczko Date: Tue, 23 May 2023 14:46:16 +0200 Subject: [PATCH] [Popups]: added destroy() function in all popups by default Also switched StatusModal to derive from StatusDialog instead of Popup type Closes #10149 --- ui/StatusQ/sandbox/controls/Popups.qml | 88 +++++++++---------- .../demoapp/DemoCommunityDetailModal.qml | 8 +- .../demoapp/DemoContactRequestsModal.qml | 2 +- .../pages/StatusImageCropPanelPage.qml | 2 +- .../Controls/StatusAccountSelector.qml | 2 +- .../StatusQ/Popups/Dialog/StatusDialog.qml | 19 +++- ui/StatusQ/src/StatusQ/Popups/StatusModal.qml | 53 +++++------ .../src/StatusQ/Popups/StatusSearchPopup.qml | 1 - .../src/StatusQ/Popups/StatusStackModal.qml | 2 +- ui/app/AppLayouts/Browser/BrowserLayout.qml | 48 ++++++---- .../Browser/panels/BrowserHeader.qml | 24 ++--- .../Browser/popups/BrowserWalletMenu.qml | 5 +- .../Browser/popups/SignMessageModal.qml | 2 +- .../Chat/panels/InlineSelectorPanel.qml | 3 + .../CommunityMembersSettingsPanel.qml | 4 +- .../Chat/popups/ChatCommandModal.qml | 4 +- .../community/CommunityProfilePopup.qml | 15 ++-- .../popups/community/CreateCategoryPopup.qml | 4 +- .../popups/community/CreateChannelPopup.qml | 2 +- .../AppLayouts/Chat/views/ChatColumnView.qml | 4 +- .../Chat/views/ChatContextMenuView.qml | 2 +- .../communities/CommunityPermissionsView.qml | 2 +- .../popups/DiscordImportProgressContents.qml | 2 +- .../Onboarding/OnboardingLayout.qml | 13 +-- .../popups/KeycardCreatePINModal.qml | 2 +- .../Profile/controls/FleetRadioSelector.qml | 2 +- .../Profile/panels/CommunitiesListPanel.qml | 2 +- .../Profile/popups/AddSocialLinkModal.qml | 2 +- .../Profile/popups/AddWakuNodeModal.qml | 2 +- .../Profile/popups/AddWakuStoreModal.qml | 2 +- .../Profile/popups/BackupSeedModal.qml | 2 +- .../Profile/popups/ChangePasswordModal.qml | 2 +- .../popups/ExemptionNotificationsModal.qml | 4 +- .../Profile/popups/RenameAccontModal.qml | 2 +- .../popups/SendContactRequestModal.qml | 2 +- .../Profile/popups/WakuNodesModal.qml | 2 +- .../Profile/popups/WakuStoreModal.qml | 2 +- .../AppLayouts/Profile/views/AdvancedView.qml | 4 +- .../AppLayouts/Profile/views/ContactsView.qml | 22 +---- .../AppLayouts/Profile/views/EnsListView.qml | 3 - .../AppLayouts/Profile/views/KeycardView.qml | 14 +-- .../AppLayouts/Profile/views/LanguageView.qml | 2 +- .../AppLayouts/Profile/views/LeftTabView.qml | 2 +- .../Profile/views/MyProfileView.qml | 15 ++-- .../Profile/views/wallet/AccountView.qml | 2 +- .../Wallet/addaccount/AddAccountPopup.qml | 2 +- .../controls/SavedAddressesDelegate.qml | 4 +- .../Wallet/popups/CryptoServicesModal.qml | 2 +- .../AppLayouts/Wallet/popups/ReceiveModal.qml | 2 +- ui/app/mainui/AppMain.qml | 13 +-- ui/app/mainui/Popups.qml | 22 +++-- .../popups/ActivityCenterPopup.qml | 4 +- .../shared/popups/ChatCommandsPopup.qml | 4 +- .../shared/popups/ConfirmationDialog.qml | 2 +- .../popups/DeleteMessageConfirmationPopup.qml | 2 +- ui/imports/shared/popups/DisplayNamePopup.qml | 2 +- .../shared/popups/ImageCropWorkflow.qml | 4 +- .../shared/popups/InviteFriendsPopup.qml | 2 +- ui/imports/shared/popups/ModalPopup.qml | 9 +- ui/imports/shared/popups/NicknamePopup.qml | 4 +- .../popups/RemoveAccountConfirmationPopup.qml | 2 +- .../shared/popups/SelectAccountModal.qml | 2 +- .../shared/popups/SendContactRequestModal.qml | 2 +- .../shared/popups/SignTransactionModal.qml | 4 +- ui/imports/shared/popups/ToastMessage.qml | 1 + .../shared/popups/keycard/KeycardPopup.qml | 8 +- .../popups/keycard/KeycardPopupDetails.qml | 5 +- .../popups/keycard/states/ManageAccounts.qml | 2 +- ui/imports/shared/status/StatusChatInput.qml | 40 +++++---- .../StatusGifPopup/ConfirmationPopup.qml | 4 + .../shared/status/StatusSearchListPopup.qml | 4 + ui/imports/shared/views/AssetsView.qml | 16 ++-- .../shared/views/NoFriendsRectangle.qml | 9 +- ui/imports/shared/views/ProfileDialogView.qml | 2 +- .../views/chat/AcceptTransactionView.qml | 21 +++-- ui/imports/shared/views/chat/MessageView.qml | 2 +- ui/imports/utils/Global.qml | 7 +- 77 files changed, 313 insertions(+), 299 deletions(-) diff --git a/ui/StatusQ/sandbox/controls/Popups.qml b/ui/StatusQ/sandbox/controls/Popups.qml index f9a6117b7d..14554431eb 100644 --- a/ui/StatusQ/sandbox/controls/Popups.qml +++ b/ui/StatusQ/sandbox/controls/Popups.qml @@ -89,32 +89,32 @@ Column { StatusModal { id: simpleModal anchors.centerIn: parent - header.title: "Some Title" - header.subTitle: "Subtitle" + headerSettings.title: "Some Title" + headerSettings.subTitle: "Subtitle" } StatusModal { id: simpleTitleModal anchors.centerIn: parent - header.title: "Some Title" + headerSettings.title: "Some Title" } StatusModal { id: headerImageModal anchors.centerIn: parent - header.title: "Some Title" - header.subTitle: "Subtitle" - header.asset.isImage: true - header.asset.name: "qrc:/demoapp/data/profile-image-1.jpeg" + headerSettings.title: "Some Title" + headerSettings.subTitle: "Subtitle" + headerSettings.asset.isImage: true + headerSettings.asset.name: "qrc:/demoapp/data/profile-image-1.jpeg" } StatusModal { id: footerButtonsModal anchors.centerIn: parent - header.title: "Some Title" - header.subTitle: "Subtitle" - header.asset.isImage: true - header.asset.name: "qrc:/demoapp/data/profile-image-1.jpeg" + headerSettings.title: "Some Title" + headerSettings.subTitle: "Subtitle" + headerSettings.asset.isImage: true + headerSettings.asset.name: "qrc:/demoapp/data/profile-image-1.jpeg" leftButtons: [ StatusBackButton { } ] @@ -131,10 +131,10 @@ Column { StatusModal { id: headerActionButtonModal anchors.centerIn: parent - header.title: "Some Title" - header.subTitle: "Subtitle" - header.asset.isImage: true - header.asset.name: "qrc:/demoapp/data/profile-image-1.jpeg" + headerSettings.title: "Some Title" + headerSettings.subTitle: "Subtitle" + headerSettings.asset.isImage: true + headerSettings.asset.name: "qrc:/demoapp/data/profile-image-1.jpeg" headerActionButton: StatusFlatRoundButton { type: StatusFlatRoundButton.Type.Secondary @@ -162,10 +162,10 @@ Column { StatusModal { id: modalExample anchors.centerIn: parent - header.asset.isImage: true - header.asset.name: "qrc:/demoapp/data/profile-image-1.jpeg" - header.title: "Header" - header.subTitle: "SubTitle" + headerSettings.asset.isImage: true + headerSettings.asset.name: "qrc:/demoapp/data/profile-image-1.jpeg" + headerSettings.title: "Header" + headerSettings.subTitle: "SubTitle" rightButtons: [ StatusButton { text: "Button" @@ -200,8 +200,8 @@ Column { StatusModal { id: modalWithContentAccess anchors.centerIn: parent - header.title: "Header" - header.subTitle: "SubTitle" + headerSettings.title: "Header" + headerSettings.subTitle: "SubTitle" contentItem: StatusBaseText { id: text @@ -224,10 +224,10 @@ Column { StatusModal { id: modalWithLetterIdenticon anchors.centerIn: parent - header.title: "Header" - header.subTitle: "SubTitle" - header.asset.isLetterIdenticon: true - header.asset.bgColor: "red" + headerSettings.title: "Header" + headerSettings.subTitle: "SubTitle" + headerSettings.asset.isLetterIdenticon: true + headerSettings.asset.bgColor: "red" contentItem: StatusBaseText { anchors.centerIn: parent @@ -249,11 +249,11 @@ Column { StatusModal { id: modalWithIdenticon anchors.centerIn: parent - header.title: "Header" - header.subTitle: "SubTitle" - header.asset.name: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/ + headerSettings.title: "Header" + headerSettings.subTitle: "SubTitle" + headerSettings.asset.name: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/ nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC" - header.asset.imgIsIdenticon: true + headerSettings.asset.imgIsIdenticon: true contentItem: StatusBaseText { anchors.centerIn: parent @@ -275,12 +275,12 @@ Column { StatusModal { id: modalWithEditableIdenticon anchors.centerIn: parent - header.title: "Header" - header.subTitle: "SubTitle" - header.headerImageEditable: true - header.asset.name: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/ + headerSettings.title: "Header" + headerSettings.subTitle: "SubTitle" + headerSettings.headerImageEditable: true + headerSettings.asset.name: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/ nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC" - header.asset.imgIsIdenticon: true + headerSettings.asset.imgIsIdenticon: true contentItem: StatusBaseText { anchors.centerIn: parent @@ -302,12 +302,12 @@ Column { StatusModal { id: modalWithLongTitles anchors.centerIn: parent - header.title: "Some super long text here that exceeds the available space" - header.subTitle: "Some super long text here that exceeds the available space" - header.subTitleElide: Text.ElideMiddle - header.asset.name: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/ + headerSettings.title: "Some super long text here that exceeds the available space" + headerSettings.subTitle: "Some super long text here that exceeds the available space" + headerSettings.subTitleElide: Text.ElideMiddle + headerSettings.asset.name: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/ nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC" - header.asset.imgIsIdenticon: true + headerSettings.asset.imgIsIdenticon: true contentItem: StatusBaseText { anchors.centerIn: parent @@ -329,9 +329,9 @@ Column { StatusModal { id: modalWithHeaderPopupMenu anchors.centerIn: parent - header.title: "helloworld.eth" - header.subTitle: "Basic address" - header.popupMenu: StatusMenu { + headerSettings.title: "helloworld.eth" + headerSettings.subTitle: "Basic address" + headerSettings.popupMenu: StatusMenu { id: popupMenu StatusMenuInstantiator { @@ -351,8 +351,8 @@ Column { StatusModal { id: editTitleModal anchors.centerIn: parent - header.title: "This title can be edited" - header.editable: true + headerSettings.title: "This title can be edited" + headerSettings.editable: true } StatusModal { diff --git a/ui/StatusQ/sandbox/demoapp/DemoCommunityDetailModal.qml b/ui/StatusQ/sandbox/demoapp/DemoCommunityDetailModal.qml index 6aaec89782..983b7ed507 100644 --- a/ui/StatusQ/sandbox/demoapp/DemoCommunityDetailModal.qml +++ b/ui/StatusQ/sandbox/demoapp/DemoCommunityDetailModal.qml @@ -11,10 +11,10 @@ StatusModal { anchors.centerIn: parent - header.title: "Cryptokitties" - header.subTitle: "Public Community" - header.asset.isImage: true - header.asset.name: "qrc:/demoapp/data/profile-image-1.jpeg" + headerSettings.title: "Cryptokitties" + headerSettings.subTitle: "Public Community" + headerSettings.asset.isImage: true + headerSettings.asset.name: "qrc:/demoapp/data/profile-image-1.jpeg" contentItem: Column { width: root.width diff --git a/ui/StatusQ/sandbox/demoapp/DemoContactRequestsModal.qml b/ui/StatusQ/sandbox/demoapp/DemoContactRequestsModal.qml index ca8eec8495..b21fd995b5 100644 --- a/ui/StatusQ/sandbox/demoapp/DemoContactRequestsModal.qml +++ b/ui/StatusQ/sandbox/demoapp/DemoContactRequestsModal.qml @@ -8,7 +8,7 @@ import StatusQ.Core.Theme 0.1 StatusModal { id: root - header.title: "Contact Requests" + headerSettings.title: "Contact Requests" headerActionButton: StatusFlatRoundButton { type: StatusFlatRoundButton.Type.Secondary width: 32 diff --git a/ui/StatusQ/sandbox/pages/StatusImageCropPanelPage.qml b/ui/StatusQ/sandbox/pages/StatusImageCropPanelPage.qml index 64b4f5b014..5fbb74b6ba 100644 --- a/ui/StatusQ/sandbox/pages/StatusImageCropPanelPage.qml +++ b/ui/StatusQ/sandbox/pages/StatusImageCropPanelPage.qml @@ -189,7 +189,7 @@ Item { StatusModal { id: imageCropperModal - header.title: workflowItem.title + headerSettings.title: workflowItem.title anchors.centerIn: Overlay.overlay diff --git a/ui/StatusQ/src/StatusQ/Controls/StatusAccountSelector.qml b/ui/StatusQ/src/StatusQ/Controls/StatusAccountSelector.qml index 922dacaf63..6ce9c020b7 100644 --- a/ui/StatusQ/src/StatusQ/Controls/StatusAccountSelector.qml +++ b/ui/StatusQ/src/StatusQ/Controls/StatusAccountSelector.qml @@ -146,7 +146,7 @@ Item { width: parent.width model: SortFilterProxyModel { - sourceModel: root.accounts + sourceModel: !!root.accounts ? root.accounts : null filters: [ ValueFilter { roleName: "walletType" diff --git a/ui/StatusQ/src/StatusQ/Popups/Dialog/StatusDialog.qml b/ui/StatusQ/src/StatusQ/Popups/Dialog/StatusDialog.qml index 5ba571f001..3189854ec3 100644 --- a/ui/StatusQ/src/StatusQ/Popups/Dialog/StatusDialog.qml +++ b/ui/StatusQ/src/StatusQ/Popups/Dialog/StatusDialog.qml @@ -11,6 +11,16 @@ Dialog { id: root property string subtitle + /*! + \qmlproperty destroyOnClose + This property decides whether the popup component should be destroyed when closed. Default value is true. + */ + property bool destroyOnClose: true + /*! + \qmlproperty color backgroundColor + This property decides the modal background color + */ + property string backgroundColor: Theme.palette.statusModal.backgroundColor anchors.centerIn: Overlay.overlay @@ -24,7 +34,9 @@ Dialog { color: Theme.palette.backdropColor } - background: StatusDialogBackground {} + background: StatusDialogBackground { + color: root.backgroundColor + } header: StatusDialogHeader { visible: root.title || root.subtitle @@ -101,4 +113,9 @@ Dialog { } } } + + onClosed: { + if (root.destroyOnClose) + root.destroy(); + } } diff --git a/ui/StatusQ/src/StatusQ/Popups/StatusModal.qml b/ui/StatusQ/src/StatusQ/Popups/StatusModal.qml index fbed284de1..1a0a852f98 100644 --- a/ui/StatusQ/src/StatusQ/Popups/StatusModal.qml +++ b/ui/StatusQ/src/StatusQ/Popups/StatusModal.qml @@ -1,9 +1,10 @@ import QtQuick 2.14 -import QtQuick.Controls 2.14 as QC +import QtQuick.Controls 2.14 import StatusQ.Core 0.1 import StatusQ.Core.Theme 0.1 import StatusQ.Controls 0.1 +import StatusQ.Popups.Dialog 0.1 import "statusModal" as Spares @@ -19,8 +20,8 @@ import "statusModal" as Spares \qml StatusModal { anchors.centerIn: parent - header.title: "Some Title" - header.subTitle: "Subtitle" + headerSettings.title: "Some Title" + headerSettings.subTitle: "Subtitle" headerActionButton: StatusFlatRoundButton { type: StatusFlatRoundButton.Type.Secondary width: 32 @@ -50,9 +51,7 @@ import "statusModal" as Spares For a list of components available see StatusQ. */ -// Deprecation annotations come with Qt6.2 -// @Deprecated { reason: "Use StatusDialog instead, see reasoning: https://github.com/status-im/StatusQ/issues/720" } -QC.Popup { +StatusDialog { id: root /*! @@ -135,7 +134,7 @@ QC.Popup { type: StatusModalHeaderSettings This property exposes the different properties of the standard header. */ - property StatusModalHeaderSettings header: StatusModalHeaderSettings {} + property StatusModalHeaderSettings headerSettings: StatusModalHeaderSettings {} /*! \qmlproperty rightButtons This property helps user assign the right buttons on the footer. @@ -182,17 +181,16 @@ QC.Popup { This property decides whether the advanced header has floating buttons on top of the Modal */ property bool hasFloatingButtons: false + /*! - \qmlproperty color backgroundColor - This property decides the modal background color + \qmlproperty destroyOnClose + This property decides whether the popup component should be destroyed when closed. Default value is true. */ - property string backgroundColor: Theme.palette.statusModal.backgroundColor + property bool destroyOnClose: true signal editButtonClicked() signal headerImageClicked() - parent: QC.Overlay.overlay - width: 480 padding: 0 @@ -201,18 +199,7 @@ QC.Popup { leftPadding: padding rightPadding: padding - margins: 64 - - modal: true - - QC.Overlay.modal: Rectangle { - color: Theme.palette.backdropColor - } - - background: Rectangle { - color: root.backgroundColor - radius: 8 - + header: Item { Spares.StatusModalHeader { id: headerImpl anchors.top: parent.top @@ -220,14 +207,14 @@ QC.Popup { height: visible ? implicitHeight : 0 visible: root.showHeader - title: header.title - titleElide: header.titleElide - subTitle: header.subTitle - subTitleElide: header.subTitleElide - asset: header.asset - popupMenu: header.popupMenu - headerImageEditable: header.headerImageEditable - editable: header.editable + title: headerSettings.title + titleElide: headerSettings.titleElide + subTitle: headerSettings.subTitle + subTitleElide: headerSettings.subTitleElide + asset: headerSettings.asset + popupMenu: headerSettings.popupMenu + headerImageEditable: headerSettings.headerImageEditable + editable: headerSettings.editable onEditButtonClicked: root.editButtonClicked() onHeaderImageClicked: root.headerImageClicked() @@ -241,7 +228,9 @@ QC.Popup { width: visible ? parent.width : 0 active: root.showAdvancedHeader } + } + footer: Item { Spares.StatusModalFooter { id: footerImpl anchors.bottom: parent.bottom diff --git a/ui/StatusQ/src/StatusQ/Popups/StatusSearchPopup.qml b/ui/StatusQ/src/StatusQ/Popups/StatusSearchPopup.qml index a69d9a8fc7..8bda13f905 100644 --- a/ui/StatusQ/src/StatusQ/Popups/StatusSearchPopup.qml +++ b/ui/StatusQ/src/StatusQ/Popups/StatusSearchPopup.qml @@ -13,7 +13,6 @@ StatusModal { id: root width: 700 height: !!searchResults && searchResults.count >= 0 && searchText !== "" ? 560 : 122 - anchors.centerIn: parent showHeader: false showFooter: false diff --git a/ui/StatusQ/src/StatusQ/Popups/StatusStackModal.qml b/ui/StatusQ/src/StatusQ/Popups/StatusStackModal.qml index fd8e5795d8..bf6b4e5300 100644 --- a/ui/StatusQ/src/StatusQ/Popups/StatusStackModal.qml +++ b/ui/StatusQ/src/StatusQ/Popups/StatusStackModal.qml @@ -63,7 +63,7 @@ StatusModal { onCurrentIndexChanged: updateRightButtons() onReplaceItemChanged: updateRightButtons() - header.title: replaceLoader.item && typeof(replaceLoader.item.title) != "undefined" + headerSettings.title: replaceLoader.item && typeof(replaceLoader.item.title) != "undefined" ? replaceLoader.item.title : stackTitle padding: 16 diff --git a/ui/app/AppLayouts/Browser/BrowserLayout.qml b/ui/app/AppLayouts/Browser/BrowserLayout.qml index 4d80143c2e..c046420494 100644 --- a/ui/app/AppLayouts/Browser/BrowserLayout.qml +++ b/ui/app/AppLayouts/Browser/BrowserLayout.qml @@ -204,6 +204,8 @@ StatusSectionLayout { BrowserHeader { id: browserHeader + property bool walletMenuPopupOpen: false + anchors.top: parent.top anchors.topMargin: tabs.tabHeight + tabs.anchors.topMargin z: 52 @@ -212,7 +214,6 @@ StatusSectionLayout { dappBrowserAccName: WalletStore.dappBrowserAccount.name dappBrowserAccIcon: WalletStore.dappBrowserAccount.color settingMenu: settingsMenu - walletMenu: browserWalletMenu currentUrl: !!_internal.currentWebView ? _internal.currentWebView.url : "" isLoading: (!!_internal.currentWebView && _internal.currentWebView.loading) canGoBack: (!!_internal.currentWebView && _internal.currentWebView.canGoBack) @@ -248,6 +249,10 @@ StatusSectionLayout { } _internal.currentWebView.url = _internal.determineRealURL(url); } + onOpenWalletMenu: { + walletMenuPopupOpen ? Global.closePopup() : Global.openPopup(browserWalletMenu); + walletMenuPopupOpen = !walletMenuPopupOpen; + } } BrowserTabView { @@ -423,25 +428,32 @@ StatusSectionLayout { Global.changeAppSectionBySectionType(Constants.appSection.profile, Constants.settingsSubsection.browserSettings); } } - - BrowserWalletMenu { + Component { id: browserWalletMenu - y: browserHeader.height + browserHeader.anchors.topMargin - x: parent.width - width - Style.current.halfPadding - onSendTriggered: { - sendTransactionModal.selectedAccount = selectedAccount - sendTransactionModal.open() - } - onReload: { - for (let i = 0; i < tabs.count; ++i){ - tabs.getTab(i).item.reload(); + BrowserWalletMenu { + property point headerPoint: Qt.point(browserHeader.x, browserHeader.y) + x: (parent.width - width - Style.current.halfPadding) + y: (Math.abs(browserHeader.mapFromGlobal(headerPoint).y) + + browserHeader.anchors.topMargin + Style.current.halfPadding) + onSendTriggered: { + sendTransactionModal.selectedAccount = selectedAccount + sendTransactionModal.open() + } + onReload: { + for (let i = 0; i < tabs.count; ++i){ + tabs.getTab(i).item.reload(); + } + } + onDisconnect: { + Web3ProviderStore.disconnect(Utils.getHostname(browserHeader.addressBar.text)) + provider.postMessage("web3-disconnect-account", "{}"); + _internal.currentWebView.reload() + close() + } + Component.onDestruction: { + if (browserHeader.walletMenuPopupOpen) + browserHeader.walletMenuPopupOpen = false; } - } - onDisconnect: { - Web3ProviderStore.disconnect(Utils.getHostname(browserHeader.addressBar.text)) - provider.postMessage("web3-disconnect-account", "{}"); - _internal.currentWebView.reload() - close() } } } diff --git a/ui/app/AppLayouts/Browser/panels/BrowserHeader.qml b/ui/app/AppLayouts/Browser/panels/BrowserHeader.qml index 2427bab033..659a6cdaa7 100644 --- a/ui/app/AppLayouts/Browser/panels/BrowserHeader.qml +++ b/ui/app/AppLayouts/Browser/panels/BrowserHeader.qml @@ -15,7 +15,7 @@ import "../popups" import "../controls" Rectangle { - id: browserHeader + id: root property alias favoriteComponent: favoritesBarLoader.sourceComponent property alias addressBar: addressBar @@ -29,7 +29,6 @@ Rectangle { property string dappBrowserAccName: "" property string dappBrowserAccIcon: "" property var settingMenu - property var walletMenu signal addNewFavoritelClicked(var xPos) signal launchInBrowser(var url) @@ -38,6 +37,7 @@ Rectangle { signal goBack() signal reload() signal stopLoading() + signal openWalletMenu() QtObject { id: _internal @@ -129,7 +129,7 @@ Rectangle { anchors.right: reloadBtn.left anchors.rightMargin: Style.current.halfPadding visible: !!currentUrl - icon.source: !!browserHeader.currentFavorite ? Style.svg("browser/favoriteActive") : Style.svg("browser/favorite") + icon.source: !!root.currentFavorite ? Style.svg("browser/favoriteActive") : Style.svg("browser/favorite") color: "transparent" type: StatusFlatRoundButton.Type.Tertiary onClicked: addNewFavoritelClicked(addFavoriteBtn.x) @@ -150,6 +150,8 @@ Rectangle { } Loader { + Layout.preferredWidth: 44 + Layout.preferredHeight: 44 active: true sourceComponent: currentTabConnected ? connectedBtnComponent : notConnectedBtnCompoent } @@ -164,12 +166,8 @@ Rectangle { icon.height: 24 icon.name: "filled-account" type: StatusFlatRoundButton.Type.Tertiary - onClicked: { - if (walletMenu.opened) { - walletMenu.close() - } else { - walletMenu.open() - } + onPressed: { + root.openWalletMenu() } } } @@ -183,12 +181,8 @@ Rectangle { icon.height: 18 icon.color: dappBrowserAccIcon text: dappBrowserAccName - onClicked: { - if (walletMenu.opened) { - walletMenu.close() - } else { - walletMenu.open() - } + onPressed: { + root.openWalletMenu(); } } } diff --git a/ui/app/AppLayouts/Browser/popups/BrowserWalletMenu.qml b/ui/app/AppLayouts/Browser/popups/BrowserWalletMenu.qml index fcd642fb6f..7a34c3d887 100644 --- a/ui/app/AppLayouts/Browser/popups/BrowserWalletMenu.qml +++ b/ui/app/AppLayouts/Browser/popups/BrowserWalletMenu.qml @@ -13,7 +13,7 @@ import utils 1.0 import "../stores" // TODO: replace with StatusMenu -Popup { +Dialog { id: popup signal sendTriggered(var selectedAccount) @@ -212,4 +212,7 @@ Popup { } } } + onClosed: { + popup.destroy(); + } } diff --git a/ui/app/AppLayouts/Browser/popups/SignMessageModal.qml b/ui/app/AppLayouts/Browser/popups/SignMessageModal.qml index 342579c659..05cde7379a 100644 --- a/ui/app/AppLayouts/Browser/popups/SignMessageModal.qml +++ b/ui/app/AppLayouts/Browser/popups/SignMessageModal.qml @@ -35,7 +35,7 @@ StatusModal { anchors.centerIn: parent id: root - header.title: qsTr("Signature request") + headerSettings.title: qsTr("Signature request") height: 504 onClosed: { diff --git a/ui/app/AppLayouts/Chat/panels/InlineSelectorPanel.qml b/ui/app/AppLayouts/Chat/panels/InlineSelectorPanel.qml index 1b61833e02..8c0be4635d 100644 --- a/ui/app/AppLayouts/Chat/panels/InlineSelectorPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/InlineSelectorPanel.qml @@ -286,5 +286,8 @@ Item { onCountChanged: currentIndex = 0 } } + onClosed: { + suggestionsDialog.destroy(); + } } } diff --git a/ui/app/AppLayouts/Chat/panels/communities/CommunityMembersSettingsPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/CommunityMembersSettingsPanel.qml index 5f37797f26..7958b14bb2 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/CommunityMembersSettingsPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/CommunityMembersSettingsPanel.qml @@ -204,7 +204,7 @@ SettingsPageLayout { anchors.centerIn: parent width: 400 - header.title: qsTr("Ban %1").arg(userNameToBan) + headerSettings.title: qsTr("Ban %1").arg(userNameToBan) contentItem: StatusBaseText { id: banContentText @@ -245,7 +245,7 @@ SettingsPageLayout { anchors.centerIn: parent width: 400 - header.title: qsTr("Kick %1").arg(userNameToKick) + headerSettings.title: qsTr("Kick %1").arg(userNameToKick) contentItem: StatusBaseText { id: kickContentText diff --git a/ui/app/AppLayouts/Chat/popups/ChatCommandModal.qml b/ui/app/AppLayouts/Chat/popups/ChatCommandModal.qml index a41f3fc22b..6074aa4f66 100644 --- a/ui/app/AppLayouts/Chat/popups/ChatCommandModal.qml +++ b/ui/app/AppLayouts/Chat/popups/ChatCommandModal.qml @@ -24,7 +24,7 @@ StatusModal { id: root anchors.centerIn: parent - header.title: root.commandTitle + headerSettings.title: root.commandTitle height: 504 property alias selectRecipient: selectRecipient @@ -40,7 +40,7 @@ StatusModal { anchors.rightMargin: Style.current.padding onGroupActivated: { - root.header.title = group.headerText + root.headerSettings.title = group.headerText btnNext.text = group.footerText } TransactionFormGroup { diff --git a/ui/app/AppLayouts/Chat/popups/community/CommunityProfilePopup.qml b/ui/app/AppLayouts/Chat/popups/community/CommunityProfilePopup.qml index 8a70946e6b..e0ee3e705a 100644 --- a/ui/app/AppLayouts/Chat/popups/community/CommunityProfilePopup.qml +++ b/ui/app/AppLayouts/Chat/popups/community/CommunityProfilePopup.qml @@ -24,12 +24,12 @@ StatusModal { } } - header.title: contentItem.currentItem.headerTitle - header.subTitle: contentItem.currentItem.headerSubtitle || "" - header.asset.name: contentItem.currentItem.headerImageSource || "" - header.asset.isImage: !!contentItem.currentItem.headerImageSource - header.asset.isLetterIdenticon: contentItem.currentItem.headerTitle === root.community.name && !contentItem.currentItem.headerImageSource - header.asset.bgColor: root.community.color + headerSettings.title: contentItem.currentItem.headerTitle + headerSettings.subTitle: contentItem.currentItem.headerSubtitle || "" + headerSettings.asset.name: contentItem.currentItem.headerImageSource || "" + headerSettings.asset.isImage: !!contentItem.currentItem.headerImageSource + headerSettings.asset.isLetterIdenticon: contentItem.currentItem.headerTitle === root.community.name && !contentItem.currentItem.headerImageSource + headerSettings.asset.bgColor: root.community.color contentItem: StackView { id: stack @@ -77,9 +77,6 @@ StatusModal { id: transferOwnershiproot TransferOwnershipPopup { anchors.centerIn: parent - onClosed: { - destroy() - } } } diff --git a/ui/app/AppLayouts/Chat/popups/community/CreateCategoryPopup.qml b/ui/app/AppLayouts/Chat/popups/community/CreateCategoryPopup.qml index 3f132568c9..68e7330af6 100644 --- a/ui/app/AppLayouts/Chat/popups/community/CreateCategoryPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/community/CreateCategoryPopup.qml @@ -42,7 +42,7 @@ StatusModal { return contentItem.categoryName.valid } - header.title: isEdit ? qsTr("Edit category") : qsTr("New category") + headerSettings.title: isEdit ? qsTr("Edit category") : qsTr("New category") contentItem: Column { property alias categoryName: nameInput @@ -196,7 +196,7 @@ StatusModal { text: qsTr("Delete Category") onClicked: { Global.openPopup(deleteCategoryConfirmationDialogComponent, { - "header.title": qsTr("Delete '%1' category").arg(nameInput.text), + "headerSettings.title": qsTr("Delete '%1' category").arg(nameInput.text), confirmationText: qsTr("Are you sure you want to delete '%1' category? Channels inside the category won’t be deleted.").arg(nameInput.text) }) } diff --git a/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml b/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml index 2e6609f65d..13542061ab 100644 --- a/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml @@ -201,7 +201,7 @@ StatusDialog { id: colorDialog anchors.centerIn: parent property bool colorSelected: root.isEdit && root.channelColor - header.title: qsTr("Channel Colour") + headerSettings.title: qsTr("Channel Colour") color: root.isEdit && root.channelColor ? root.channelColor : Theme.palette.primaryColor1 onAccepted: colorSelected = true diff --git a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml index c4e7b1aece..1bc4e4cb54 100644 --- a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml @@ -155,7 +155,7 @@ Item { sendChatCommand: root.requestAddressForTransaction isRequested: false commandTitle: qsTr("Send") - header.title: commandTitle + headerSettings.title: commandTitle finalButtonLabel: qsTr("Request Address") selectRecipient.selectedRecipient: { parentModule.prepareChatContentModuleForChatId(activeChatId) @@ -187,7 +187,7 @@ Item { sendChatCommand: root.requestTransaction isRequested: true commandTitle: qsTr("Request") - header.title: commandTitle + headerSettings.title: commandTitle finalButtonLabel: qsTr("Request") selectRecipient.selectedRecipient: { parentModule.prepareChatContentModuleForChatId(activeChatId) diff --git a/ui/app/AppLayouts/Chat/views/ChatContextMenuView.qml b/ui/app/AppLayouts/Chat/views/ChatContextMenuView.qml index 966b212d13..525fffc0b7 100644 --- a/ui/app/AppLayouts/Chat/views/ChatContextMenuView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatContextMenuView.qml @@ -257,7 +257,7 @@ StatusMenu { ConfirmationDialog { confirmButtonObjectName: "deleteChatConfirmationDialogDeleteButton" btnType: "warn" - header.title: root.isCommunityChat ? qsTr("Delete #%1").arg(root.chatName) : + headerSettings.title: root.isCommunityChat ? qsTr("Delete #%1").arg(root.chatName) : root.chatType === Constants.chatType.oneToOne ? qsTr("Delete chat") : qsTr("Leave chat") diff --git a/ui/app/AppLayouts/Chat/views/communities/CommunityPermissionsView.qml b/ui/app/AppLayouts/Chat/views/communities/CommunityPermissionsView.qml index d617d24704..2acba7f7db 100644 --- a/ui/app/AppLayouts/Chat/views/communities/CommunityPermissionsView.qml +++ b/ui/app/AppLayouts/Chat/views/communities/CommunityPermissionsView.qml @@ -87,7 +87,7 @@ StatusScrollView { ConfirmationDialog { id: declineAllDialog - header.title: qsTr("Sure you want to delete permission") + headerSettings.title: qsTr("Sure you want to delete permission") confirmationText: qsTr("If you delete this permission, any of your community members who rely on this permission will lose the access this permission gives them.") onConfirmButtonClicked: { diff --git a/ui/app/AppLayouts/CommunitiesPortal/popups/DiscordImportProgressContents.qml b/ui/app/AppLayouts/CommunitiesPortal/popups/DiscordImportProgressContents.qml index 0567ae40bd..982be3712d 100644 --- a/ui/app/AppLayouts/CommunitiesPortal/popups/DiscordImportProgressContents.qml +++ b/ui/app/AppLayouts/CommunitiesPortal/popups/DiscordImportProgressContents.qml @@ -338,7 +338,7 @@ StatusScrollView { id: cancelConfirmationPopupCmp ConfirmationDialog { id: cancelConfirmationPopup - header.title: qsTr("Are you sure you want to cancel the import?") + headerSettings.title: qsTr("Are you sure you want to cancel the import?") confirmationText: qsTr("Your new Status community will be deleted and all information entered will be lost.") showCancelButton: true cancelBtnType: "default" diff --git a/ui/app/AppLayouts/Onboarding/OnboardingLayout.qml b/ui/app/AppLayouts/Onboarding/OnboardingLayout.qml index 5e0ca6ded9..25c17c4215 100644 --- a/ui/app/AppLayouts/Onboarding/OnboardingLayout.qml +++ b/ui/app/AppLayouts/Onboarding/OnboardingLayout.qml @@ -182,10 +182,10 @@ following the \"Add existing Status user\" flow, using your seed phrase.") } function onDisplayKeycardSharedModuleFlow() { - keycardPopup.active = true + Global.openPopup(keycardPopup); } function onDestroyKeycardSharedModuleFlow() { - keycardPopup.active = false + Global.closePopup(); } } @@ -339,16 +339,11 @@ following the \"Add existing Status user\" flow, using your seed phrase.") } } - Loader { + Component { id: keycardPopup - active: false - sourceComponent: KeycardPopup { + KeycardPopup { anchors.centerIn: parent sharedKeycardModule: root.startupStore.startupModuleInst.keycardSharedModule } - - onLoaded: { - keycardPopup.item.open() - } } } diff --git a/ui/app/AppLayouts/Onboarding/popups/KeycardCreatePINModal.qml b/ui/app/AppLayouts/Onboarding/popups/KeycardCreatePINModal.qml index b3d4c52f94..c304aff4d6 100644 --- a/ui/app/AppLayouts/Onboarding/popups/KeycardCreatePINModal.qml +++ b/ui/app/AppLayouts/Onboarding/popups/KeycardCreatePINModal.qml @@ -22,7 +22,7 @@ StatusModal { signal submitBtnClicked(string pin) id: popup - header.title: qsTr("Create PIN") + headerSettings.title: qsTr("Create PIN") anchors.centerIn: parent height: 500 diff --git a/ui/app/AppLayouts/Profile/controls/FleetRadioSelector.qml b/ui/app/AppLayouts/Profile/controls/FleetRadioSelector.qml index 9125b48ed6..3e8705d510 100644 --- a/ui/app/AppLayouts/Profile/controls/FleetRadioSelector.qml +++ b/ui/app/AppLayouts/Profile/controls/FleetRadioSelector.qml @@ -30,7 +30,7 @@ RadioButtonSelector { Component { id: confirmDialogComponent ConfirmationDialog { - header.title: qsTr("Warning!") + headerSettings.title: qsTr("Warning!") confirmationText: qsTr("Change fleet to %1").arg(root.newFleet) onConfirmButtonClicked: { root.advancedStore.setFleet(root.newFleet) diff --git a/ui/app/AppLayouts/Profile/panels/CommunitiesListPanel.qml b/ui/app/AppLayouts/Profile/panels/CommunitiesListPanel.qml index 8a367445ce..15ff397220 100644 --- a/ui/app/AppLayouts/Profile/panels/CommunitiesListPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/CommunitiesListPanel.qml @@ -78,7 +78,7 @@ StatusListView { property string communityId: "" anchors.centerIn: parent - header.title: qsTr("Leave %1").arg(community) + headerSettings.title: qsTr("Leave %1").arg(community) contentItem: Item { implicitWidth: 368 implicitHeight: msg.implicitHeight + 32 diff --git a/ui/app/AppLayouts/Profile/popups/AddSocialLinkModal.qml b/ui/app/AppLayouts/Profile/popups/AddSocialLinkModal.qml index 7134d98cc0..db3a45c1d3 100644 --- a/ui/app/AppLayouts/Profile/popups/AddSocialLinkModal.qml +++ b/ui/app/AppLayouts/Profile/popups/AddSocialLinkModal.qml @@ -22,7 +22,7 @@ StatusStackModal { anchors.centerIn: parent padding: currentIndex === 0 ? 0 : Style.current.padding - header.title: qsTr("Add more links") + headerSettings.title: qsTr("Add more links") rightButtons: [finishButton] finishButton: StatusButton { text: qsTr("Add") diff --git a/ui/app/AppLayouts/Profile/popups/AddWakuNodeModal.qml b/ui/app/AppLayouts/Profile/popups/AddWakuNodeModal.qml index 59b834ea5e..125940039d 100644 --- a/ui/app/AppLayouts/Profile/popups/AddWakuNodeModal.qml +++ b/ui/app/AppLayouts/Profile/popups/AddWakuNodeModal.qml @@ -20,7 +20,7 @@ StatusModal { anchors.centerIn: parent height: 560 padding: 8 - header.title: qsTr("Waku nodes") + headerSettings.title: qsTr("Waku nodes") onClosed: { destroy() diff --git a/ui/app/AppLayouts/Profile/popups/AddWakuStoreModal.qml b/ui/app/AppLayouts/Profile/popups/AddWakuStoreModal.qml index a1cd480807..1423e24a17 100644 --- a/ui/app/AppLayouts/Profile/popups/AddWakuStoreModal.qml +++ b/ui/app/AppLayouts/Profile/popups/AddWakuStoreModal.qml @@ -17,7 +17,7 @@ StatusModal { anchors.centerIn: parent height: 560 padding: 8 - header.title: qsTr("Waku nodes") + headerSettings.title: qsTr("Waku nodes") property var messagingStore property var advancedStore diff --git a/ui/app/AppLayouts/Profile/popups/BackupSeedModal.qml b/ui/app/AppLayouts/Profile/popups/BackupSeedModal.qml index 1997e65ae2..124e3b230f 100644 --- a/ui/app/AppLayouts/Profile/popups/BackupSeedModal.qml +++ b/ui/app/AppLayouts/Profile/popups/BackupSeedModal.qml @@ -62,7 +62,7 @@ StatusStackModal { implicitHeight: 748 width: 480 - header.title: qsTr("Back up your seed phrase") + headerSettings.title: qsTr("Back up your seed phrase") rightButtons: [ d.skipButton, nextButton, finishButton ] nextButton: StatusButton { diff --git a/ui/app/AppLayouts/Profile/popups/ChangePasswordModal.qml b/ui/app/AppLayouts/Profile/popups/ChangePasswordModal.qml index 3effb47a33..1515c41f38 100644 --- a/ui/app/AppLayouts/Profile/popups/ChangePasswordModal.qml +++ b/ui/app/AppLayouts/Profile/popups/ChangePasswordModal.qml @@ -64,7 +64,7 @@ StatusModal { height: 546 closePolicy: submitBtn.loading? Popup.NoAutoClose : Popup.CloseOnEscape | Popup.CloseOnPressOutside hasCloseButton: !submitBtn.loading - header.title: qsTr("Change password") + headerSettings.title: qsTr("Change password") onOpened: view.reset() diff --git a/ui/app/AppLayouts/Profile/popups/ExemptionNotificationsModal.qml b/ui/app/AppLayouts/Profile/popups/ExemptionNotificationsModal.qml index c4e6827e4b..197754fc4c 100644 --- a/ui/app/AppLayouts/Profile/popups/ExemptionNotificationsModal.qml +++ b/ui/app/AppLayouts/Profile/popups/ExemptionNotificationsModal.qml @@ -28,8 +28,8 @@ StatusModal { globalMentions: Constants.settingsSection.notifications.sendAlertsValue, otherMessages: Constants.settingsSection.notifications.turnOffValue }) - header.title: qsTr("%1 exemption").arg(root.item.name) - header.asset: StatusAssetSettings { + headerSettings.title: qsTr("%1 exemption").arg(root.item.name) + headerSettings.asset: StatusAssetSettings { // Once we introduce StatusSmartIdenticon in popup header, we should use the folowing // color: root.item.type === Constants.settingsSection.exemptions.oneToOneChat? // Theme.palette.userCustomizationColors[Utils.colorIdForPubkey(root.item.itemId)] : diff --git a/ui/app/AppLayouts/Profile/popups/RenameAccontModal.qml b/ui/app/AppLayouts/Profile/popups/RenameAccontModal.qml index c6e7a5f4a7..1929c1e161 100644 --- a/ui/app/AppLayouts/Profile/popups/RenameAccontModal.qml +++ b/ui/app/AppLayouts/Profile/popups/RenameAccontModal.qml @@ -23,7 +23,7 @@ StatusModal { property var account property var emojiPopup - header.title: qsTr("Rename %1").arg(popup.account.name) + headerSettings.title: qsTr("Rename %1").arg(popup.account.name) property int marginBetweenInputs: 30 diff --git a/ui/app/AppLayouts/Profile/popups/SendContactRequestModal.qml b/ui/app/AppLayouts/Profile/popups/SendContactRequestModal.qml index 3047a653fc..73a28606fa 100644 --- a/ui/app/AppLayouts/Profile/popups/SendContactRequestModal.qml +++ b/ui/app/AppLayouts/Profile/popups/SendContactRequestModal.qml @@ -15,7 +15,7 @@ StatusModal { property var contactsStore - header.title: qsTr("Send Contact Request to chat key") + headerSettings.title: qsTr("Send Contact Request to chat key") QtObject { id: d diff --git a/ui/app/AppLayouts/Profile/popups/WakuNodesModal.qml b/ui/app/AppLayouts/Profile/popups/WakuNodesModal.qml index bd128bd78b..f221c1751d 100644 --- a/ui/app/AppLayouts/Profile/popups/WakuNodesModal.qml +++ b/ui/app/AppLayouts/Profile/popups/WakuNodesModal.qml @@ -23,7 +23,7 @@ StatusModal { anchors.centerIn: parent height: 560 padding: 8 - header.title: qsTr("Waku nodes") + headerSettings.title: qsTr("Waku nodes") property var messagingStore property var advancedStore diff --git a/ui/app/AppLayouts/Profile/popups/WakuStoreModal.qml b/ui/app/AppLayouts/Profile/popups/WakuStoreModal.qml index 6110586564..87a055b9e9 100644 --- a/ui/app/AppLayouts/Profile/popups/WakuStoreModal.qml +++ b/ui/app/AppLayouts/Profile/popups/WakuStoreModal.qml @@ -23,7 +23,7 @@ StatusModal { anchors.centerIn: parent height: 560 padding: 8 - header.title: qsTr("History Nodes") + headerSettings.title: qsTr("History Nodes") property var messagingStore property var advancedStore diff --git a/ui/app/AppLayouts/Profile/views/AdvancedView.qml b/ui/app/AppLayouts/Profile/views/AdvancedView.qml index 69ddb5fa54..69e22adedd 100644 --- a/ui/app/AppLayouts/Profile/views/AdvancedView.qml +++ b/ui/app/AppLayouts/Profile/views/AdvancedView.qml @@ -204,7 +204,7 @@ SettingsContentBase { property string mode: "normal" id: confirmDialog - header.title: qsTr("Warning!") + headerSettings.title: qsTr("Warning!") confirmationText: qsTr("The account will be logged out. When you login again, the selected mode will be enabled") onConfirmButtonClicked: { root.advancedStore.setBloomLevel(mode) @@ -549,7 +549,7 @@ SettingsContentBase { onClosed: destroy() anchors.centerIn: parent width: 400 - header.title: qsTr("How many log files do you want to keep archived?") + headerSettings.title: qsTr("How many log files do you want to keep archived?") contentItem: Column { width: parent.width diff --git a/ui/app/AppLayouts/Profile/views/ContactsView.qml b/ui/app/AppLayouts/Profile/views/ContactsView.qml index f6e994cc00..fde26b87de 100644 --- a/ui/app/AppLayouts/Profile/views/ContactsView.qml +++ b/ui/app/AppLayouts/Profile/views/ContactsView.qml @@ -29,7 +29,7 @@ SettingsContentBase { objectName: "ContactsView_ContactRequest_Button" text: qsTr("Send contact request to chat key") onClicked: { - sendContactRequest.open() + Global.openPopup(sendContactRequest); } } @@ -311,26 +311,10 @@ SettingsContentBase { } } - Loader { + Component { id: sendContactRequest - width: parent.width - height: parent.height - active: false - - function open() { - active = true - sendContactRequest.item.open() - } - function close() { - active = false - } - - sourceComponent: SendContactRequestModal { - anchors.centerIn: parent + SendContactRequestModal { contactsStore: root.contactsStore - onClosed: { - sendContactRequest.close(); - } } } } diff --git a/ui/app/AppLayouts/Profile/views/EnsListView.qml b/ui/app/AppLayouts/Profile/views/EnsListView.qml index a0ea15a993..4760e4d9be 100644 --- a/ui/app/AppLayouts/Profile/views/EnsListView.qml +++ b/ui/app/AppLayouts/Profile/views/EnsListView.qml @@ -249,9 +249,6 @@ Item { ENSPopup { ensUsernamesStore: root.ensUsernamesStore - onClosed: { - destroy() - } } } } diff --git a/ui/app/AppLayouts/Profile/views/KeycardView.qml b/ui/app/AppLayouts/Profile/views/KeycardView.qml index 10e3cad9ae..6d76849782 100644 --- a/ui/app/AppLayouts/Profile/views/KeycardView.qml +++ b/ui/app/AppLayouts/Profile/views/KeycardView.qml @@ -94,28 +94,22 @@ SettingsContentBase { target: root.keycardStore.keycardModule function onDisplayKeycardSharedModuleFlow() { - keycardPopup.active = true + Global.openPopup(keycardPopup); } function onDestroyKeycardSharedModuleFlow() { - keycardPopup.active = false + Global.closePopup(); } function onSharedModuleBusy() { Global.openPopup(sharedModuleBusyPopupComponent) } } - Loader { + Component { id: keycardPopup - active: false - sourceComponent: KeycardPopup { - anchors.centerIn: parent + KeycardPopup { sharedKeycardModule: root.keycardStore.keycardModule.keycardSharedModule emojiPopup: root.emojiPopup } - - onLoaded: { - keycardPopup.item.open() - } } } } diff --git a/ui/app/AppLayouts/Profile/views/LanguageView.qml b/ui/app/AppLayouts/Profile/views/LanguageView.qml index a37a86ebf7..101f64391e 100644 --- a/ui/app/AppLayouts/Profile/views/LanguageView.qml +++ b/ui/app/AppLayouts/Profile/views/LanguageView.qml @@ -193,7 +193,7 @@ SettingsContentBase { id: languageConfirmationDialog active: false sourceComponent: ConfirmationDialog { - header.title: qsTr("Change language") + headerSettings.title: qsTr("Change language") confirmationText: qsTr("Display language has been changed. You must restart the application for changes to take effect.") confirmButtonLabel: qsTr("Close the app now") onConfirmButtonClicked: { diff --git a/ui/app/AppLayouts/Profile/views/LeftTabView.qml b/ui/app/AppLayouts/Profile/views/LeftTabView.qml index 816b65b84b..350c2c200b 100644 --- a/ui/app/AppLayouts/Profile/views/LeftTabView.qml +++ b/ui/app/AppLayouts/Profile/views/LeftTabView.qml @@ -72,7 +72,7 @@ Item { ConfirmationDialog { id: confirmDialog confirmButtonObjectName: "signOutConfirmation" - header.title: qsTr("Sign out") + headerSettings.title: qsTr("Sign out") confirmationText: qsTr("Make sure you have your account password and seed phrase stored. Without them you can lock yourself out of your account and lose funds.") confirmButtonLabel: qsTr("Sign out & Quit") onConfirmButtonClicked: { diff --git a/ui/app/AppLayouts/Profile/views/MyProfileView.qml b/ui/app/AppLayouts/Profile/views/MyProfileView.qml index 13868f2e50..2a4a0a926a 100644 --- a/ui/app/AppLayouts/Profile/views/MyProfileView.qml +++ b/ui/app/AppLayouts/Profile/views/MyProfileView.qml @@ -30,7 +30,7 @@ SettingsContentBase { titleRowComponentLoader.sourceComponent: StatusButton { objectName: "profileSettingsChangePasswordButton" text: qsTr("Change Password") - onClicked: changePasswordModal.open() + onClicked: Global.openPopup(changePasswordModal) enabled: !userProfile.isKeycardUser } @@ -92,16 +92,17 @@ SettingsContentBase { } } - ChangePasswordModal { + Component { id: changePasswordModal - privacyStore: root.privacyStore - anchors.centerIn: parent - onPasswordChanged: successPopup.open() + ChangePasswordModal { + privacyStore: root.privacyStore + onPasswordChanged: Global.openPopup(successPopup); + } } - ChangePasswordSuccessModal { + Component { id: successPopup - anchors.centerIn: parent + ChangePasswordSuccessModal { } } } } diff --git a/ui/app/AppLayouts/Profile/views/wallet/AccountView.qml b/ui/app/AppLayouts/Profile/views/wallet/AccountView.qml index 4117d692af..8d0ad89b8b 100644 --- a/ui/app/AppLayouts/Profile/views/wallet/AccountView.qml +++ b/ui/app/AppLayouts/Profile/views/wallet/AccountView.qml @@ -155,7 +155,7 @@ Item { ConfirmationDialog { id: confirmationPopup confirmButtonObjectName: "confirmDeleteAccountButton" - header.title: qsTr("Confirm %1 Removal").arg(root.account ? root.account.name : "") + headerSettings.title: qsTr("Confirm %1 Removal").arg(root.account ? root.account.name : "") confirmationText: qsTr("You will not be able to restore viewing access to this account in the future unless you enter this account’s address again.") confirmButtonLabel: qsTr("Remove Account") onConfirmButtonClicked: { diff --git a/ui/app/AppLayouts/Wallet/addaccount/AddAccountPopup.qml b/ui/app/AppLayouts/Wallet/addaccount/AddAccountPopup.qml index 80ec07dc1d..3823ea1649 100644 --- a/ui/app/AppLayouts/Wallet/addaccount/AddAccountPopup.qml +++ b/ui/app/AppLayouts/Wallet/addaccount/AddAccountPopup.qml @@ -20,7 +20,7 @@ StatusModal { closePolicy: root.store.disablePopup? Popup.NoAutoClose : Popup.CloseOnEscape | Popup.CloseOnPressOutside hasCloseButton: !root.store.disablePopup - header.title: root.store.editMode? qsTr("Edit account") : qsTr("Add a new account") + headerSettings.title: root.store.editMode? qsTr("Edit account") : qsTr("Add a new account") onOpened: { root.store.resetStoreValues() diff --git a/ui/app/AppLayouts/Wallet/controls/SavedAddressesDelegate.qml b/ui/app/AppLayouts/Wallet/controls/SavedAddressesDelegate.qml index df51561d21..8b38f6fadd 100644 --- a/ui/app/AppLayouts/Wallet/controls/SavedAddressesDelegate.qml +++ b/ui/app/AppLayouts/Wallet/controls/SavedAddressesDelegate.qml @@ -225,8 +225,8 @@ StatusListItem { property string name property bool favourite anchors.centerIn: parent - header.title: qsTr("Are you sure?") - header.subTitle: name + headerSettings.title: qsTr("Are you sure?") + headerSettings.subTitle: name contentItem: StatusBaseText { anchors.centerIn: parent height: contentHeight + topPadding + bottomPadding diff --git a/ui/app/AppLayouts/Wallet/popups/CryptoServicesModal.qml b/ui/app/AppLayouts/Wallet/popups/CryptoServicesModal.qml index 09050a9b97..872adf0ec0 100644 --- a/ui/app/AppLayouts/Wallet/popups/CryptoServicesModal.qml +++ b/ui/app/AppLayouts/Wallet/popups/CryptoServicesModal.qml @@ -16,7 +16,7 @@ StatusModal { id: cryptoServicesPopupRoot height: 400 - header.title: qsTr("Buy crypto") + headerSettings.title: qsTr("Buy crypto") anchors.centerIn: parent Loader { diff --git a/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml b/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml index a4324d1b2c..9acdfb350d 100644 --- a/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml +++ b/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml @@ -33,7 +33,7 @@ StatusModal { property string completeAddressWithNetworkPrefix } - header.title: qsTr("Receive") + headerSettings.title: qsTr("Receive") contentHeight: layout.implicitHeight width: 556 diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index c92a90729c..1494f2b8eb 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -71,11 +71,11 @@ Item { } function onDisplayKeycardSharedModuleFlow() { - keycardPopup.active = true + Global.openPopup(keycardPopup); } function onDestroyKeycardSharedModuleFlow() { - keycardPopup.active = false + Global.closePopup(); } function onMailserverWorking() { @@ -1365,17 +1365,12 @@ Item { Global.settingsLoaded() } - Loader { + Component { id: keycardPopup - active: false - sourceComponent: KeycardPopup { + KeycardPopup { anchors.centerIn: parent sharedKeycardModule: appMain.rootStore.mainModuleInst.keycardSharedModule } - - onLoaded: { - keycardPopup.item.open() - } } DropAreaPanel { diff --git a/ui/app/mainui/Popups.qml b/ui/app/mainui/Popups.qml index ccd1354400..4f30c2010a 100644 --- a/ui/app/mainui/Popups.qml +++ b/ui/app/mainui/Popups.qml @@ -41,24 +41,25 @@ QtObject { Global.importCommunityPopupRequested.connect(openImportCommunityPopup) Global.removeContactRequested.connect(openRemoveContactConfirmationPopup) Global.openPopupRequested.connect(openPopup) + Global.closePopupRequested.connect(closePopup) Global.openDeleteMessagePopup.connect(openDeleteMessagePopup) Global.openDownloadImageDialog.connect(openDownloadImageDialog) } + property var currentPopup function openPopup(popupComponent, params = {}, cb = null) { if (activePopupComponents.includes(popupComponent)) { return } - const popup = popupComponent.createObject(popupParent, params) - popup.open() - + root.currentPopup = popupComponent.createObject(popupParent, params) + root.currentPopup.open(); if (cb) - cb(popup) + cb(root.currentPopup) activePopupComponents.push(popupComponent) - popup.closed.connect(() => { + root.currentPopup.closed.connect(() => { const removeIndex = activePopupComponents.indexOf(popupComponent) if (removeIndex !== -1) { activePopupComponents.splice(removeIndex, 1) @@ -66,6 +67,11 @@ QtObject { }) } + function closePopup() { + if (!!root.currentPopup) + root.currentPopup.close(); + } + function openChooseBrowserPopup(link: string) { openPopup(chooseBrowserPopupComponent, {link: link}) } @@ -90,7 +96,7 @@ QtObject { } function openNicknamePopup(publicKey: string, nickname: string, subtitle: string) { - openPopup(nicknamePopupComponent, {publicKey: publicKey, nickname: nickname, "header.subTitle": subtitle}) + openPopup(nicknamePopupComponent, {publicKey: publicKey, nickname: nickname, "headerSettings.subTitle": subtitle}) } function openBlockContactPopup(publicKey: string, contactName: string) { @@ -125,7 +131,7 @@ QtObject { userDisplayName: contactDetails.displayName, userIcon: contactDetails.largeImage, userIsEnsVerified: contactDetails.ensVerified, - "header.title": qsTr("Verify %1's Identity").arg(contactDetails.displayName), + "headerSettings.title": qsTr("Verify %1's Identity").arg(contactDetails.displayName), challengeText: qsTr("Ask a question that only the real %1 will be able to answer e.g. a question about a shared experience, or ask %1 to enter a code or phrase you have sent to them via a different communication channel (phone, post, etc...).").arg(contactDetails.displayName), buttonText: qsTr("Send verification request") }, cb) @@ -229,7 +235,7 @@ QtObject { ConfirmationDialog { property string displayName property string publicKey - header.title: qsTr("Remove '%1' as a contact").arg(displayName) + headerSettings.title: qsTr("Remove '%1' as a contact").arg(displayName) confirmationText: qsTr("This will mean that you and '%1' will no longer be able to send direct messages to each other. You will need to send them a new Contact Request in order to message again. All previous direct messages between you and '%1' will be retained in read-only mode.").arg(displayName) showCancelButton: true cancelBtnType: "" diff --git a/ui/app/mainui/activitycenter/popups/ActivityCenterPopup.qml b/ui/app/mainui/activitycenter/popups/ActivityCenterPopup.qml index 4ceb2820e7..ff2ffb0ec3 100644 --- a/ui/app/mainui/activitycenter/popups/ActivityCenterPopup.qml +++ b/ui/app/mainui/activitycenter/popups/ActivityCenterPopup.qml @@ -22,10 +22,10 @@ Popup { property var store onOpened: { - Global.popupOpened = true + Global.activityPopupOpened = true } onClosed: { - Global.popupOpened = false + Global.activityPopupOpened = false Qt.callLater(activityCenterStore.markAsSeenActivityCenterNotifications) } diff --git a/ui/imports/shared/popups/ChatCommandsPopup.qml b/ui/imports/shared/popups/ChatCommandsPopup.qml index 2585b98d53..d9cd2bc1ea 100644 --- a/ui/imports/shared/popups/ChatCommandsPopup.qml +++ b/ui/imports/shared/popups/ChatCommandsPopup.qml @@ -8,13 +8,13 @@ import shared.stores 1.0 import StatusQ.Controls 0.1 -Popup { +Dialog { id: root width: buttonRow.width height: buttonRow.height padding: 0 margins: 0 - closePolicy: Popup.CloseOnReleaseOutsideParent | Popup.CloseOnEscape + closePolicy: Popup.CloseOnReleaseOutside | Popup.CloseOnEscape signal sendTransactionCommandButtonClicked() signal receiveTransactionCommandButtonClicked() diff --git a/ui/imports/shared/popups/ConfirmationDialog.qml b/ui/imports/shared/popups/ConfirmationDialog.qml index 6e2eec27c5..ea85e85db7 100644 --- a/ui/imports/shared/popups/ConfirmationDialog.qml +++ b/ui/imports/shared/popups/ConfirmationDialog.qml @@ -28,7 +28,7 @@ StatusModal { property alias checkbox: checkbox - header.title: qsTr("Confirm your action") + headerSettings.title: qsTr("Confirm your action") focus: visible signal confirmButtonClicked() diff --git a/ui/imports/shared/popups/DeleteMessageConfirmationPopup.qml b/ui/imports/shared/popups/DeleteMessageConfirmationPopup.qml index 4384f0cf22..151e788e66 100644 --- a/ui/imports/shared/popups/DeleteMessageConfirmationPopup.qml +++ b/ui/imports/shared/popups/DeleteMessageConfirmationPopup.qml @@ -6,7 +6,7 @@ ConfirmationDialog { property var messageStore property string messageId - header.title: qsTr("Confirm deleting this message") + headerSettings.title: qsTr("Confirm deleting this message") confirmationText: qsTr("Are you sure you want to delete this message? Be aware that other clients are not guaranteed to delete the message as well.") height: 260 checkbox.visible: true diff --git a/ui/imports/shared/popups/DisplayNamePopup.qml b/ui/imports/shared/popups/DisplayNamePopup.qml index 88e2468644..200cf814fa 100644 --- a/ui/imports/shared/popups/DisplayNamePopup.qml +++ b/ui/imports/shared/popups/DisplayNamePopup.qml @@ -19,7 +19,7 @@ StatusModal { width: 420 height: 250 closePolicy: Popup.NoAutoClose - header.title: qsTr("Edit") + headerSettings.title: qsTr("Edit") contentItem: Item { StatusInput { id: displayNameInput diff --git a/ui/imports/shared/popups/ImageCropWorkflow.qml b/ui/imports/shared/popups/ImageCropWorkflow.qml index 049d2c08a3..67ff0fb090 100644 --- a/ui/imports/shared/popups/ImageCropWorkflow.qml +++ b/ui/imports/shared/popups/ImageCropWorkflow.qml @@ -50,12 +50,12 @@ Item { StatusModal { id: imageCropperModal - header.title: root.title + headerSettings.title: root.title anchors.centerIn: Overlay.overlay width: root.roundedImage ? 480 : 580 - + destroyOnClose: false StatusImageCropPanel { id: imageCropper objectName: "profileImageCropper" diff --git a/ui/imports/shared/popups/InviteFriendsPopup.qml b/ui/imports/shared/popups/InviteFriendsPopup.qml index 8720c222e6..6ca17fc9da 100644 --- a/ui/imports/shared/popups/InviteFriendsPopup.qml +++ b/ui/imports/shared/popups/InviteFriendsPopup.qml @@ -10,7 +10,7 @@ StatusModal { property var rootStore - header.title: qsTr("Download Status link") + headerSettings.title: qsTr("Download Status link") height: 156 StatusDescriptionListItem { diff --git a/ui/imports/shared/popups/ModalPopup.qml b/ui/imports/shared/popups/ModalPopup.qml index c2c7141888..09f09da9bb 100644 --- a/ui/imports/shared/popups/ModalPopup.qml +++ b/ui/imports/shared/popups/ModalPopup.qml @@ -14,6 +14,7 @@ Popup { default property alias content: popupContent.children property alias contentWrapper: popupContent property alias header: headerContent.children + property bool destroyOnClose: true id: popup modal: true @@ -33,11 +34,9 @@ Popup { color: Style.current.background radius: 8 } - onOpened: { - Global.popupOpened = true - } onClosed: { - Global.popupOpened = false + if (popup.destroyOnClose) + popup.destroy(); } padding: 0 contentItem: Item { @@ -165,5 +164,5 @@ Popup { anchors.rightMargin: visible ? Style.current.padding : 0 anchors.leftMargin: visible ? Style.current.padding : 0 } - } + } } diff --git a/ui/imports/shared/popups/NicknamePopup.qml b/ui/imports/shared/popups/NicknamePopup.qml index 0974af5b94..b649afc61a 100644 --- a/ui/imports/shared/popups/NicknamePopup.qml +++ b/ui/imports/shared/popups/NicknamePopup.qml @@ -17,8 +17,8 @@ StatusModal { height: 340 anchors.centerIn: parent - header.title: qsTr("Nickname") - header.subTitleElide: Text.ElideMiddle + headerSettings.title: qsTr("Nickname") + headerSettings.subTitleElide: Text.ElideMiddle /*required*/ property string publicKey property string nickname diff --git a/ui/imports/shared/popups/RemoveAccountConfirmationPopup.qml b/ui/imports/shared/popups/RemoveAccountConfirmationPopup.qml index bcd47e78b4..a5efb160fd 100644 --- a/ui/imports/shared/popups/RemoveAccountConfirmationPopup.qml +++ b/ui/imports/shared/popups/RemoveAccountConfirmationPopup.qml @@ -20,7 +20,7 @@ StatusModal { signal removeAccount(string address) - header.title: qsTr("Remove %1").arg(root.accountName) + headerSettings.title: qsTr("Remove %1").arg(root.accountName) focus: visible padding: Style.current.padding diff --git a/ui/imports/shared/popups/SelectAccountModal.qml b/ui/imports/shared/popups/SelectAccountModal.qml index ba998c3556..46b06be849 100644 --- a/ui/imports/shared/popups/SelectAccountModal.qml +++ b/ui/imports/shared/popups/SelectAccountModal.qml @@ -11,7 +11,7 @@ import StatusQ.Controls 0.1 StatusModal { id: root - header.title: qsTr("Select account") + headerSettings.title: qsTr("Select account") height: 284 property var accounts diff --git a/ui/imports/shared/popups/SendContactRequestModal.qml b/ui/imports/shared/popups/SendContactRequestModal.qml index 8187d968c9..89c768898b 100644 --- a/ui/imports/shared/popups/SendContactRequestModal.qml +++ b/ui/imports/shared/popups/SendContactRequestModal.qml @@ -29,7 +29,7 @@ StatusModal { width: 480 height: 548 - header.title: d.loadingContactDetails ? qsTr("Send Contact Request") + headerSettings.title: d.loadingContactDetails ? qsTr("Send Contact Request") : qsTr("Send Contact Request to %1").arg(d.userDisplayName) onAboutToShow: { diff --git a/ui/imports/shared/popups/SignTransactionModal.qml b/ui/imports/shared/popups/SignTransactionModal.qml index a12f01e83d..6af56a5645 100644 --- a/ui/imports/shared/popups/SignTransactionModal.qml +++ b/ui/imports/shared/popups/SignTransactionModal.qml @@ -16,7 +16,7 @@ import AppLayouts.Wallet 1.0 StatusModal { id: root - header.title: qsTr("Send") + headerSettings.title: qsTr("Send") height: 540 property var store @@ -88,7 +88,7 @@ StatusModal { // initialItem: groupPreview // isLastGroup: stack.currentGroup === groupSignTx // onGroupActivated: { -// root.header.title = group.headerText +// root.headerSettings.title = group.headerText // btnNext.text = group.footerText // } // TransactionFormGroup { diff --git a/ui/imports/shared/popups/ToastMessage.qml b/ui/imports/shared/popups/ToastMessage.qml index 291ab4c480..21dba10a6f 100644 --- a/ui/imports/shared/popups/ToastMessage.qml +++ b/ui/imports/shared/popups/ToastMessage.qml @@ -53,6 +53,7 @@ Popup { dissapearInMs = 4000 displayCloseButton = true displayLink = true + root.destroy(); } Timer { diff --git a/ui/imports/shared/popups/keycard/KeycardPopup.qml b/ui/imports/shared/popups/keycard/KeycardPopup.qml index 2b1df43fac..8a202e23d8 100644 --- a/ui/imports/shared/popups/keycard/KeycardPopup.qml +++ b/ui/imports/shared/popups/keycard/KeycardPopup.qml @@ -14,8 +14,9 @@ StatusModal { closePolicy: d.disableActionPopupButtons || d.disableCloseButton? Popup.NoAutoClose : Popup.CloseOnEscape | Popup.CloseOnPressOutside hasCloseButton: !d.disableActionPopupButtons && !d.disableCloseButton + destroyOnClose: false - header.title: { + headerSettings.title: { switch (root.sharedKeycardModule.currentState.flowType) { case Constants.keycardSharedFlow.setupNewKeycard: return qsTr("Set up a new Keycard with an existing account") @@ -51,10 +52,13 @@ StatusModal { KeycardPopupDetails { id: d sharedKeycardModule: root.sharedKeycardModule + onCancelBtnClicked: { + root.close(); + } } onClosed: { - root.sharedKeycardModule.currentState.doCancelAction() + root.sharedKeycardModule.currentState.doCancelAction(); } StatusScrollView { diff --git a/ui/imports/shared/popups/keycard/KeycardPopupDetails.qml b/ui/imports/shared/popups/keycard/KeycardPopupDetails.qml index 8cc18d7041..d807088858 100644 --- a/ui/imports/shared/popups/keycard/KeycardPopupDetails.qml +++ b/ui/imports/shared/popups/keycard/KeycardPopupDetails.qml @@ -12,6 +12,8 @@ QtObject { property bool primaryButtonEnabled: false + signal cancelBtnClicked() + // disables action buttons (back, cancel, primary, secondary) and close button (upper right "X" button) as well readonly property bool disableActionPopupButtons: { if (root.sharedKeycardModule.disablePopup) { @@ -369,9 +371,8 @@ QtObject { return false } enabled: !root.disableActionPopupButtons - onClicked: { - root.sharedKeycardModule.currentState.doCancelAction() + root.cancelBtnClicked(); } }, diff --git a/ui/imports/shared/popups/keycard/states/ManageAccounts.qml b/ui/imports/shared/popups/keycard/states/ManageAccounts.qml index 50b394cefc..0cce688167 100644 --- a/ui/imports/shared/popups/keycard/states/ManageAccounts.qml +++ b/ui/imports/shared/popups/keycard/states/ManageAccounts.qml @@ -88,7 +88,7 @@ Item { ConfirmationDialog { id: confirmationPopup - header.title: qsTr("Remove account") + headerSettings.title: qsTr("Remove account") confirmationText: d.accountNameToBeRemoved.length > 0? qsTr("Do you want to delete the %1 account?").arg(d.accountNameToBeRemoved) : qsTr("Do you want to delete the last account?") diff --git a/ui/imports/shared/status/StatusChatInput.qml b/ui/imports/shared/status/StatusChatInput.qml index 48d0ead504..5a0afae3b5 100644 --- a/ui/imports/shared/status/StatusChatInput.qml +++ b/ui/imports/shared/status/StatusChatInput.qml @@ -120,7 +120,6 @@ Rectangle { QtObject { id: d - readonly property string emojiReplacementSymbols: ":='xX><0O;*dB8-D#%\\" //mentions helper properties @@ -161,6 +160,8 @@ Rectangle { } } + property bool chatCommandsPopupOpen: false + function copyMentions(start, end) { copiedMentionsPos = [] for (let k = 0; k < mentionsPos.length; k++) { @@ -1025,27 +1026,30 @@ Rectangle { } } - // TODO remove that Loader when the Chat Commands are re-implemented and fixed - // Bonus if we use `openPopup` instead with a Component instead - Loader { - active: false - sourceComponent: ChatCommandsPopup { - id: chatCommandsPopup - x: 8 - y: -height + + Component { + id: chatCommandsPopup + ChatCommandsPopup { + x: (parent.width - control.width - Style.current.halfPadding) + y: 716 onSendTransactionCommandButtonClicked: { - control.sendTransactionCommandButtonClicked() - chatCommandsPopup.close() + control.sendTransactionCommandButtonClicked(); + chatCommandsPopup.close(); } onReceiveTransactionCommandButtonClicked: { - control.receiveTransactionCommandButtonClicked() - chatCommandsPopup.close() + control.receiveTransactionCommandButtonClicked(); + chatCommandsPopup.close(); } onClosed: { - chatCommandsBtn.highlighted = false + chatCommandsBtnLoader.highlighted = false; + destroy(); + } + Component.onDestruction: { + if (d.chatCommandsPopupOpen) + d.chatCommandsPopupOpen = false; } onOpened: { - chatCommandsBtn.highlighted = true + chatCommandsBtnLoader.highlighted = true; } } } @@ -1077,6 +1081,7 @@ Rectangle { // TODO remove that Loader when the Chat Commands are re-implemented and fixed Loader { + id: chatCommandsBtnLoader active: false sourceComponent: StatusQ.StatusFlatRoundButton { id: chatCommandsBtn @@ -1089,9 +1094,8 @@ Rectangle { visible: RootStore.isWalletEnabled && !isEdit && control.chatType === Constants.chatType.oneToOne enabled: !control.isContactBlocked onClicked: { - chatCommandsPopup.opened ? - chatCommandsPopup.close() : - chatCommandsPopup.open() + d.chatCommandsPopupOpen ? Global.closePopup() : Global.openPopup(chatCommandsPopup); + d.chatCommandsPopupOpen = !d.chatCommandsPopupOpen; } } } diff --git a/ui/imports/shared/status/StatusGifPopup/ConfirmationPopup.qml b/ui/imports/shared/status/StatusGifPopup/ConfirmationPopup.qml index 390b945abb..f97d9ab4ba 100644 --- a/ui/imports/shared/status/StatusGifPopup/ConfirmationPopup.qml +++ b/ui/imports/shared/status/StatusGifPopup/ConfirmationPopup.qml @@ -85,4 +85,8 @@ Popup { root.close() } } + + onClosed: { + root.destroy(); + } } diff --git a/ui/imports/shared/status/StatusSearchListPopup.qml b/ui/imports/shared/status/StatusSearchListPopup.qml index 01a1b2983e..f70a1801c4 100644 --- a/ui/imports/shared/status/StatusSearchListPopup.qml +++ b/ui/imports/shared/status/StatusSearchListPopup.qml @@ -159,4 +159,8 @@ Popup { searchBox.text = "" searchBox.input.edit.forceActiveFocus() } + + onClosed: { + root.destroy(); + } } diff --git a/ui/imports/shared/views/AssetsView.qml b/ui/imports/shared/views/AssetsView.qml index 6a66e419b3..529a93b2e4 100644 --- a/ui/imports/shared/views/AssetsView.qml +++ b/ui/imports/shared/views/AssetsView.qml @@ -39,7 +39,7 @@ Item { SortFilterProxyModel { id: filteredModel - sourceModel: assets + sourceModel: !!assets ? assets : null filters: [ ExpressionFilter { expression: visibleForNetworkWithPositiveBalance || loading @@ -67,13 +67,13 @@ Item { Component { id: tokenDelegate TokenDelegate { - objectName: "AssetView_TokenListItem_" + (modelData ? modelData.symbol : "") - readonly property string balance: modelData ? "%1".arg(modelData.enabledNetworkBalance.amount) : "" // Needed for the tests - errorTooltipText_1: modelData ? networkConnectionStore.getBlockchainNetworkDownTextForToken(modelData.balances) : "" - errorTooltipText_2: networkConnectionStore.getMarketNetworkDownText() - subTitle: !modelData || networkConnectionStore.noTokenBalanceAvailable ? "" : LocaleUtils.currencyAmountToLocaleString(modelData.enabledNetworkBalance) - errorMode: networkConnectionStore.noBlockchainConnectionAndNoCache && !networkConnectionStore.noMarketConnectionAndNoCache - errorIcon.tooltip.text: networkConnectionStore.noBlockchainConnectionAndNoCacheText + objectName: "AssetView_TokenListItem_" + (!!modelData ? modelData.symbol : "") + readonly property string balance: !!modelData ? "%1".arg(modelData.enabledNetworkBalance.amount) : "" // Needed for the tests + errorTooltipText_1: !!modelData && !! networkConnectionStore ? networkConnectionStore.getBlockchainNetworkDownTextForToken(modelData.balances) : "" + errorTooltipText_2: !!networkConnectionStore ? networkConnectionStore.getMarketNetworkDownText() : "" + subTitle: !modelData || (!!networkConnectionStore && !networkConnectionStore.noTokenBalanceAvailable) ? "" : LocaleUtils.currencyAmountToLocaleString(modelData.enabledNetworkBalance) + errorMode: !!networkConnectionStore ? networkConnectionStore.noBlockchainConnectionAndNoCache && !networkConnectionStore.noMarketConnectionAndNoCache : false + errorIcon.tooltip.text: !!networkConnectionStore ? networkConnectionStore.noBlockchainConnectionAndNoCacheText : "" onClicked: { RootStore.getHistoricalDataForToken(modelData.symbol, RootStore.currencyStore.currentCurrency) d.selectedAssetIndex = index diff --git a/ui/imports/shared/views/NoFriendsRectangle.qml b/ui/imports/shared/views/NoFriendsRectangle.qml index b7c91723b7..24465a5a5e 100644 --- a/ui/imports/shared/views/NoFriendsRectangle.qml +++ b/ui/imports/shared/views/NoFriendsRectangle.qml @@ -34,10 +34,13 @@ Item { anchors.horizontalCenter: parent.horizontalCenter anchors.top: noContacts.bottom anchors.topMargin: Style.current.padding - onClicked: inviteFriendsPopup.open() + onClicked: Global.openPopup(inviteFriendsPopup); } - InviteFriendsPopup { + + Component { id: inviteFriendsPopup - rootStore: noContactsRect.rootStore + InviteFriendsPopup { + rootStore: noContactsRect.rootStore + } } } diff --git a/ui/imports/shared/views/ProfileDialogView.qml b/ui/imports/shared/views/ProfileDialogView.qml index a538ada147..afdb29c26a 100644 --- a/ui/imports/shared/views/ProfileDialogView.qml +++ b/ui/imports/shared/views/ProfileDialogView.qml @@ -257,7 +257,7 @@ Pane { ConfirmationDialog { id: removeVerificationConfirmationDialog - header.title: qsTr("Remove contact verification") + headerSettings.title: qsTr("Remove contact verification") confirmationText: qsTr("This will remove the contact's verified status. Please confirm.") onConfirmButtonClicked: { root.contactsStore.removeTrustStatus(root.publicKey) diff --git a/ui/imports/shared/views/chat/AcceptTransactionView.qml b/ui/imports/shared/views/chat/AcceptTransactionView.qml index 9b1de6f97c..e3d072bce9 100644 --- a/ui/imports/shared/views/chat/AcceptTransactionView.qml +++ b/ui/imports/shared/views/chat/AcceptTransactionView.qml @@ -46,7 +46,7 @@ Item { cursorShape: Qt.PointingHandCursor onClicked: { if (root.state === Constants.addressRequested) { - selectAccountModal.open() + Global.openPopup(selectAccountModalComponent); } else if (root.state === Constants.transactionRequested) { Global.openPopup(signTxComponent) } @@ -117,14 +117,17 @@ Item { } } - SelectAccountModal { - id: selectAccountModal - anchors.centerIn: parent - accounts: root.store.accounts - currency: root.store.currentCurrency - onSelectAndShareAddressButtonClicked: { - root.store.acceptAddressRequest(messageId, accountSelector.selectedAccount.address) - selectAccountModal.close() + Component { + id: selectAccountModalComponent + SelectAccountModal { + id: selectAccountModal + anchors.centerIn: parent + accounts: root.store.accounts + currency: root.store.currentCurrency + onSelectAndShareAddressButtonClicked: { + root.store.acceptAddressRequest(messageId, accountSelector.selectedAccount.address) + selectAccountModal.close() + } } } } diff --git a/ui/imports/shared/views/chat/MessageView.qml b/ui/imports/shared/views/chat/MessageView.qml index 0e80ea86d6..3c64be83bb 100644 --- a/ui/imports/shared/views/chat/MessageView.qml +++ b/ui/imports/shared/views/chat/MessageView.qml @@ -486,7 +486,7 @@ Loader { disableHover: root.disableHover || delegate.hideQuickActions || (root.chatLogView && root.chatLogView.moving) || - Global.popupOpened + Global.activityPopupOpened disableEmojis: root.isChatBlocked hideMessage: d.hideMessage diff --git a/ui/imports/utils/Global.qml b/ui/imports/utils/Global.qml index 566d1fc30a..e8486364f8 100644 --- a/ui/imports/utils/Global.qml +++ b/ui/imports/utils/Global.qml @@ -7,7 +7,7 @@ QtObject { property var dragArea property var applicationWindow - property bool popupOpened: false + property bool activityPopupOpened: false property int settingsSubsection: Constants.settingsSubsection.profile property var userProfile @@ -28,6 +28,7 @@ QtObject { signal displayToastMessage(string title, string subTitle, string icon, bool loading, int ephNotifType, string url) signal openPopupRequested(var popupComponent, var params) + signal closePopupRequested() signal openNicknamePopupRequested(string publicKey, string nickname, string subtitle) signal openDownloadModalRequested(bool available, string version, string url) signal openChangeProfilePicPopup(var cb) @@ -72,6 +73,10 @@ QtObject { root.openPopupRequested(popupComponent, params); } + function closePopup() { + root.closePopupRequested(); + } + function openDownloadModal(available, version, url){ root.openDownloadModalRequested(available, version, url); }