From 3d6a5b178502dbf6157dd704f12ac18be6e14ced Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Fri, 9 Jun 2023 09:26:14 +0200 Subject: [PATCH] fix(@wallet): left bar selection fixes #10999 --- src/app/modules/main/wallet_section/module.nim | 1 + src/app/modules/main/wallet_section/view.nim | 2 ++ ui/app/AppLayouts/Wallet/views/LeftTabView.qml | 15 +++++++++------ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/modules/main/wallet_section/module.nim b/src/app/modules/main/wallet_section/module.nim index 804c6f9807..223e0d27db 100644 --- a/src/app/modules/main/wallet_section/module.nim +++ b/src/app/modules/main/wallet_section/module.nim @@ -137,6 +137,7 @@ method notifyFilterChanged(self: Module) = self.transactionsModule.filterChanged(self.filter.addresses, self.filter.chainIds) self.accountsModule.filterChanged(self.filter.addresses, self.filter.chainIds, self.filter.excludeWatchOnly) self.sendModule.filterChanged(self.filter.addresses, self.filter.chainIds) + self.view.filterChanged(self.filter.addresses[0], self.filter.excludeWatchOnly, self.filter.allAddresses) method getCurrencyAmount*(self: Module, amount: float64, symbol: string): CurrencyAmount = return self.controller.getCurrencyAmount(amount, symbol) diff --git a/src/app/modules/main/wallet_section/view.nim b/src/app/modules/main/wallet_section/view.nim index 5f6a6f587a..b78289f19f 100644 --- a/src/app/modules/main/wallet_section/view.nim +++ b/src/app/modules/main/wallet_section/view.nim @@ -39,6 +39,8 @@ QtObject: QtProperty[string] currentCurrency: read = getCurrentCurrency + proc filterChanged*(self: View, addresses: string, excludeWatchOnly: bool, allAddresses: bool) {.signal.} + proc totalCurrencyBalanceChanged*(self: View) {.signal.} proc getTotalCurrencyBalance(self: View): QVariant {.slot.} = diff --git a/ui/app/AppLayouts/Wallet/views/LeftTabView.qml b/ui/app/AppLayouts/Wallet/views/LeftTabView.qml index d78c1cbf62..15fedadf2c 100644 --- a/ui/app/AppLayouts/Wallet/views/LeftTabView.qml +++ b/ui/app/AppLayouts/Wallet/views/LeftTabView.qml @@ -32,18 +32,18 @@ Rectangle { property var changeSelectedAccount: function(){} property bool showSavedAddresses: false property bool showAllAccounts: true + property string currentAddress: "" onShowSavedAddressesChanged: { + root.currentAddress = "" walletAccountsListView.headerItem.highlighted = root.showAllAccounts walletAccountsListView.footerItem.button.highlighted = root.showSavedAddresses } onShowAllAccountsChanged: { + root.currentAddress = "" walletAccountsListView.headerItem.highlighted = root.showAllAccounts walletAccountsListView.footerItem.button.highlighted = root.showSavedAddresses - if (root.showAllAccounts) { - selectAllAccounts() - } } property var emojiPopup: null @@ -125,6 +125,10 @@ Rectangle { function onDestroyAddAccountPopup() { addAccount.active = false } + function onFilterChanged(address, excludeWatchOnly, allAddresses) { + root.currentAddress = allAddresses ? "" : address + root.showAllAccounts = allAddresses + } } MouseArea { @@ -197,8 +201,7 @@ Rectangle { objectName: "walletAccount-" + model.name readonly property bool itemLoaded: !model.assetsLoading // needed for e2e tests width: ListView.view.width - Style.current.padding * 2 - highlighted: !ListView.view.footerItem.button.highlighted && - RootStore.overview.mixedcaseAddress.toLowerCase() === model.address.toLowerCase() + highlighted: root.currentAddress.toLowerCase() === model.address.toLowerCase() anchors.horizontalCenter: !!parent ? parent.horizontalCenter : undefined title: model.name subTitle: LocaleUtils.currencyAmountToLocaleString(model.currencyBalance) @@ -294,7 +297,7 @@ Rectangle { cursorShape: Qt.PointingHandCursor onClicked: { root.showSavedAddresses = false - root.showAllAccounts = true + root.selectAllAccounts() } hoverEnabled: true }