Skip to content

Commit c3ef63a

Browse files
committed
Show loaded wallets as disabled in open menu instead of nothing
1 parent c5ffe8d commit c3ef63a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/qt/bitcoingui.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,18 @@ void BitcoinGUI::createActions()
370370
connect(openAction, &QAction::triggered, this, &BitcoinGUI::openClicked);
371371
connect(m_open_wallet_action->menu(), &QMenu::aboutToShow, [this] {
372372
m_open_wallet_action->menu()->clear();
373-
for (std::string path : m_wallet_controller->getWalletsAvailableToOpen()) {
373+
std::vector<std::string> available_wallets = m_wallet_controller->getWalletsAvailableToOpen();
374+
std::vector<std::string> wallets = m_node.listWalletDir();
375+
for (const auto& path : wallets) {
374376
QString name = path.empty() ? QString("["+tr("default wallet")+"]") : QString::fromStdString(path);
375377
QAction* action = m_open_wallet_action->menu()->addAction(name);
378+
379+
if (std::find(available_wallets.begin(), available_wallets.end(), path) == available_wallets.end()) {
380+
// This wallet is already loaded
381+
action->setEnabled(false);
382+
continue;
383+
}
384+
376385
connect(action, &QAction::triggered, [this, name, path] {
377386
OpenWalletActivity* activity = m_wallet_controller->openWallet(path);
378387

@@ -400,6 +409,10 @@ void BitcoinGUI::createActions()
400409
assert(invoked);
401410
});
402411
}
412+
if (wallets.empty()) {
413+
QAction* action = m_open_wallet_action->menu()->addAction(tr("No wallets available"));
414+
action->setEnabled(false);
415+
}
403416
});
404417
connect(m_close_wallet_action, &QAction::triggered, [this] {
405418
m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), this);

0 commit comments

Comments
 (0)