]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
AccountSwitcherDialog: ensure update on show
authortobtoht <tob@featherwallet.org>
Mon, 13 Mar 2023 18:46:31 +0000 (19:46 +0100)
committertobtoht <tob@featherwallet.org>
Mon, 13 Mar 2023 18:46:31 +0000 (19:46 +0100)
src/MainWindow.cpp
src/dialog/AccountSwitcherDialog.cpp
src/dialog/AccountSwitcherDialog.h

index 8ab3521a770db2ca6ebcaa7d4817392c18bc47e4..8dc8119c9dbcbd54784ef76116865553bdfd6b8e 100644 (file)
@@ -1122,6 +1122,7 @@ void MainWindow::showWalletCacheDebugDialog() {
 
 void MainWindow::showAccountSwitcherDialog() {
     m_accountSwitcherDialog->show();
+    m_accountSwitcherDialog->update();
 }
 
 void MainWindow::showAddressChecker() {
index 68fae9194d4320db59ba298b50d1b4d3d1a34381..9ae3f69b2afbbca7ed7dc412842cd6e18294aeb3 100644 (file)
@@ -21,11 +21,9 @@ AccountSwitcherDialog::AccountSwitcherDialog(Wallet *wallet, QWidget *parent)
 {
     ui->setupUi(this);
 
-    m_wallet->subaddressAccount()->refresh();
     m_proxyModel->setSourceModel(m_model);
 
     ui->label_totalBalance->setFont(ModelUtils::getMonospaceFont());
-    ui->label_totalBalance->setText(WalletManager::displayAmount(m_wallet->balanceAll()));
 
     this->setWindowModality(Qt::WindowModal);
 
@@ -52,9 +50,15 @@ AccountSwitcherDialog::AccountSwitcherDialog(Wallet *wallet, QWidget *parent)
     connect(m_wallet, &Wallet::currentSubaddressAccountChanged, this, &AccountSwitcherDialog::updateSelection);
     connect(m_wallet->subaddressAccount(), &SubaddressAccount::refreshFinished, this, &AccountSwitcherDialog::updateSelection);
 
+    this->update();
     this->updateSelection();
 }
 
+void AccountSwitcherDialog::update() {
+    ui->label_totalBalance->setText(WalletManager::displayAmount(m_wallet->balanceAll()));
+    m_wallet->subaddressAccount()->refresh();
+}
+
 void AccountSwitcherDialog::switchAccount() {
     auto row = this->currentEntry();
     if (!row) {
index 329de74b5add8cd7a408432d2ce4293b8c586102..5e3c6bb3bbd2bcbc1e8a17e08ec575b4927e8586 100644 (file)
@@ -22,6 +22,8 @@ public:
     explicit AccountSwitcherDialog(Wallet *wallet, QWidget *parent = nullptr);
     ~AccountSwitcherDialog() override;
 
+    void update();
+
 private slots:
     void showContextMenu(const QPoint& point);
     void updateSelection();