aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoingui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r--src/qt/bitcoingui.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index e483172796..266e16ebeb 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -371,13 +371,12 @@ void BitcoinGUI::createActions()
connect(openAction, &QAction::triggered, this, &BitcoinGUI::openClicked);
connect(m_open_wallet_menu, &QMenu::aboutToShow, [this] {
m_open_wallet_menu->clear();
- std::vector<std::string> available_wallets = m_wallet_controller->getWalletsAvailableToOpen();
- std::vector<std::string> wallets = m_node.listWalletDir();
- for (const auto& path : wallets) {
+ for (const std::pair<const std::string, bool>& i : m_wallet_controller->listWalletDir()) {
+ const std::string& path = i.first;
QString name = path.empty() ? QString("["+tr("default wallet")+"]") : QString::fromStdString(path);
QAction* action = m_open_wallet_menu->addAction(name);
- if (std::find(available_wallets.begin(), available_wallets.end(), path) == available_wallets.end()) {
+ if (i.second) {
// This wallet is already loaded
action->setEnabled(false);
continue;
@@ -410,7 +409,7 @@ void BitcoinGUI::createActions()
assert(invoked);
});
}
- if (wallets.empty()) {
+ if (m_open_wallet_menu->isEmpty()) {
QAction* action = m_open_wallet_menu->addAction(tr("No wallets available"));
action->setEnabled(false);
}
@@ -640,7 +639,7 @@ void BitcoinGUI::setWalletController(WalletController* wallet_controller)
connect(wallet_controller, &WalletController::walletAdded, this, &BitcoinGUI::addWallet);
connect(wallet_controller, &WalletController::walletRemoved, this, &BitcoinGUI::removeWallet);
- for (WalletModel* wallet_model : m_wallet_controller->getWallets()) {
+ for (WalletModel* wallet_model : m_wallet_controller->getOpenWallets()) {
addWallet(wallet_model);
}
}