diff --git a/ui/app/AppLayouts/Profile/ProfileLayout.qml b/ui/app/AppLayouts/Profile/ProfileLayout.qml index 0d327b3e37..af89d939d4 100644 --- a/ui/app/AppLayouts/Profile/ProfileLayout.qml +++ b/ui/app/AppLayouts/Profile/ProfileLayout.qml @@ -34,6 +34,8 @@ import AppLayouts.Communities.stores 1.0 as CommunitiesStore StatusSectionLayout { id: root + property alias settingsSubsection: profileContainer.currentIndex + objectName: "profileStatusSectionLayout" property SharedStores.RootStore sharedRootStore @@ -56,7 +58,7 @@ StatusSectionLayout { onNotificationButtonClicked: Global.openActivityCenterPopup() onBackButtonClicked: { - switch (Global.settingsSubsection) { + switch (root.settingsSubsection) { case Constants.settingsSubsection.contacts: Global.changeAppSectionBySectionType(Constants.appSection.profile, Constants.settingsSubsection.messaging) break; @@ -75,8 +77,7 @@ StatusSectionLayout { } Component.onCompleted: { - profileContainer.currentIndex = -1 - profileContainer.currentIndex = Qt.binding(() => Global.settingsSubsection) + profileContainer.currentIndexChanged() root.store.devicesStore.loadDevices() // Load devices to get non-paired number for badge } @@ -109,6 +110,12 @@ StatusSectionLayout { profileContainer.currentItem.notifyDirty(); } } + + onSettingsSubsectionChanged: root.settingsSubsection = settingsSubsection + + Binding on settingsSubsection { + value: root.settingsSubsection + } } centerPanel: StackLayout { @@ -119,8 +126,6 @@ StatusSectionLayout { anchors.fill: parent anchors.leftMargin: Constants.settingsSection.leftMargin - currentIndex: Global.settingsSubsection - onCurrentIndexChanged: { if (!!children[currentIndex] && !children[currentIndex].active) children[currentIndex].active = true diff --git a/ui/app/AppLayouts/Profile/panels/MenuPanel.qml b/ui/app/AppLayouts/Profile/panels/MenuPanel.qml index d8160e852f..a842026af7 100644 --- a/ui/app/AppLayouts/Profile/panels/MenuPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/MenuPanel.qml @@ -22,6 +22,8 @@ Column { property bool walletMenuItemEnabled: false + property int settingsSubsection + signal menuItemClicked(var menu_item) Repeater { @@ -33,7 +35,7 @@ Column { itemId: model.subsection title: model.text asset.name: model.icon - selected: Global.settingsSubsection === model.subsection + selected: root.settingsSubsection === model.subsection highlighted: !!betaTagLoader.item && betaTagLoader.item.hovered onClicked: root.menuItemClicked(model) badge.value: { @@ -85,7 +87,7 @@ Column { itemId: model.subsection title: model.text asset.name: model.icon - selected: Global.settingsSubsection === model.subsection + selected: root.settingsSubsection === model.subsection onClicked: root.menuItemClicked(model) visible: { (model.subsection !== Constants.settingsSubsection.wallet) || @@ -116,7 +118,7 @@ Column { itemId: model.subsection title: model.text asset.name: model.icon - selected: Global.settingsSubsection === model.subsection + selected: root.settingsSubsection === model.subsection onClicked: root.menuItemClicked(model) } } @@ -134,7 +136,7 @@ Column { itemId: model.subsection title: model.text asset.name: model.icon - selected: Global.settingsSubsection === model.subsection + selected: root.settingsSubsection === model.subsection onClicked: root.menuItemClicked(model) } } diff --git a/ui/app/AppLayouts/Profile/views/LeftTabView.qml b/ui/app/AppLayouts/Profile/views/LeftTabView.qml index a94c138fe3..47059fcadd 100644 --- a/ui/app/AppLayouts/Profile/views/LeftTabView.qml +++ b/ui/app/AppLayouts/Profile/views/LeftTabView.qml @@ -18,6 +18,8 @@ Item { signal menuItemClicked(var event) + property alias settingsSubsection: profileMenu.settingsSubsection + StatusNavigationPanelHeadline { id: title text: qsTr("Settings") @@ -68,7 +70,7 @@ Item { if (menu_item.subsection === Constants.settingsSubsection.signout) return confirmDialog.open() - Global.settingsSubsection = menu_item.subsection + profileMenu.settingsSubsection = menu_item.subsection } } } diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index d9608387ee..6fc89da5a3 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -501,7 +501,7 @@ Item { appMain.rootStore.mainModuleInst.setActiveSectionBySectionType(sectionType) if (sectionType === Constants.appSection.profile) { - Global.settingsSubsection = subsection; + profileLoader.settingsSubsection = subsection Global.settingsSubSubsection = subSubsection; } else if (sectionType === Constants.appSection.wallet) { appView.children[Constants.appViewStackIndex.wallet].item.openDesiredView(subsection, subSubsection, data) @@ -1432,6 +1432,10 @@ Item { } Loader { + id: profileLoader + + property int settingsSubsection: Constants.settingsSubsection.profile + active: appView.currentIndex === Constants.appViewStackIndex.profile asynchronous: true sourceComponent: ProfileLayout { @@ -1448,6 +1452,12 @@ Item { collectiblesStore: appMain.walletCollectiblesStore currencyStore: appMain.currencyStore isCentralizedMetricsEnabled: appMain.isCentralizedMetricsEnabled + + Binding on settingsSubsection { + value: profileLoader.settingsSubsection + } + + onSettingsSubsectionChanged: profileLoader.settingsSubsection = settingsSubsection } } diff --git a/ui/imports/utils/Global.qml b/ui/imports/utils/Global.qml index 87ad9474fd..78ea0acfed 100644 --- a/ui/imports/utils/Global.qml +++ b/ui/imports/utils/Global.qml @@ -6,7 +6,6 @@ QtObject { id: root property bool activityPopupOpened: false - property int settingsSubsection: Constants.settingsSubsection.profile property int settingsSubSubsection: -1 property bool appIsReady: false