diff --git a/ui/app/AppLayouts/stores/RootStore.qml b/ui/app/AppLayouts/stores/RootStore.qml index 39bff13f04..bbf972af7f 100644 --- a/ui/app/AppLayouts/stores/RootStore.qml +++ b/ui/app/AppLayouts/stores/RootStore.qml @@ -1,5 +1,7 @@ import QtQuick 2.13 +import utils 1.0 + import "../Profile/stores" QtObject { @@ -170,4 +172,11 @@ QtObject { function setActiveCommunity(communityId) { mainModule.setActiveSectionById(communityId); } + + function switchAccount(newIndex) { + if(Constants.isCppApp) + walletSectionAccounts.switchAccount(newIndex) + else + walletSection.switchAccount(newIndex) + } } diff --git a/ui/imports/shared/popups/SendModal.qml b/ui/imports/shared/popups/SendModal.qml index f0a37656f7..d8555b4c02 100644 --- a/ui/imports/shared/popups/SendModal.qml +++ b/ui/imports/shared/popups/SendModal.qml @@ -111,8 +111,11 @@ StatusDialog { anchors.topMargin: -height - 18 model: popup.store.accounts selectedAccount: popup.selectedAccount - onUpdatedSelectedAccount: { - popup.selectedAccount = account + changeSelectedAccount: function(newIndex) { + if (newIndex > popup.store.accounts) { + return + } + popup.store.switchAccount(newIndex) } } diff --git a/ui/imports/shared/views/SendModalHeader.qml b/ui/imports/shared/views/SendModalHeader.qml index 3335869797..9e27ac9735 100644 --- a/ui/imports/shared/views/SendModalHeader.qml +++ b/ui/imports/shared/views/SendModalHeader.qml @@ -19,6 +19,7 @@ StatusFloatingButtonsSelector { id: floatingHeader property var selectedAccount + property var changeSelectedAccount: function(){} repeater.objectName: "accountsListFloatingHeader" @@ -50,7 +51,7 @@ StatusFloatingButtonsSelector { hoverColor: Theme.palette.statusFloatingButtonHighlight highlighted: index === floatingHeader.currentIndex onClicked: { - updatedSelectedAccount(model) + changeSelectedAccount(index) floatingHeader.currentIndex = index } Component.onCompleted: { @@ -73,8 +74,8 @@ StatusFloatingButtonsSelector { floatingHeader.currentIndex = index } else { + changeSelectedAccount(0) floatingHeader.currentIndex = 0 - updatedSelectedAccount(d.firstModelData) } } } @@ -91,7 +92,7 @@ StatusFloatingButtonsSelector { icon.isLetterIdenticon: !!model.emoji icon.background.color: Theme.palette.indirectColor1 onClicked: { - updatedSelectedAccount(model) + changeSelectedAccount(index) floatingHeader.itemSelected(index) } visible: !floatingHeader.visibleIndices.includes(index) && walletType !== Constants.watchWalletType