|
|
@ -370,9 +370,18 @@ void BitcoinGUI::createActions()
|
|
|
|
connect(openAction, &QAction::triggered, this, &BitcoinGUI::openClicked);
|
|
|
|
connect(openAction, &QAction::triggered, this, &BitcoinGUI::openClicked);
|
|
|
|
connect(m_open_wallet_action->menu(), &QMenu::aboutToShow, [this] {
|
|
|
|
connect(m_open_wallet_action->menu(), &QMenu::aboutToShow, [this] {
|
|
|
|
m_open_wallet_action->menu()->clear();
|
|
|
|
m_open_wallet_action->menu()->clear();
|
|
|
|
for (std::string path : m_wallet_controller->getWalletsAvailableToOpen()) {
|
|
|
|
std::vector<std::string> available_wallets = m_wallet_controller->getWalletsAvailableToOpen();
|
|
|
|
|
|
|
|
std::vector<std::string> wallets = m_node.listWalletDir();
|
|
|
|
|
|
|
|
for (const auto& path : wallets) {
|
|
|
|
QString name = path.empty() ? QString("["+tr("default wallet")+"]") : QString::fromStdString(path);
|
|
|
|
QString name = path.empty() ? QString("["+tr("default wallet")+"]") : QString::fromStdString(path);
|
|
|
|
QAction* action = m_open_wallet_action->menu()->addAction(name);
|
|
|
|
QAction* action = m_open_wallet_action->menu()->addAction(name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (std::find(available_wallets.begin(), available_wallets.end(), path) == available_wallets.end()) {
|
|
|
|
|
|
|
|
// This wallet is already loaded
|
|
|
|
|
|
|
|
action->setEnabled(false);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
connect(action, &QAction::triggered, [this, name, path] {
|
|
|
|
connect(action, &QAction::triggered, [this, name, path] {
|
|
|
|
OpenWalletActivity* activity = m_wallet_controller->openWallet(path);
|
|
|
|
OpenWalletActivity* activity = m_wallet_controller->openWallet(path);
|
|
|
|
|
|
|
|
|
|
|
@ -400,6 +409,10 @@ void BitcoinGUI::createActions()
|
|
|
|
assert(invoked);
|
|
|
|
assert(invoked);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wallets.empty()) {
|
|
|
|
|
|
|
|
QAction* action = m_open_wallet_action->menu()->addAction(tr("No wallets available"));
|
|
|
|
|
|
|
|
action->setEnabled(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
connect(m_close_wallet_action, &QAction::triggered, [this] {
|
|
|
|
connect(m_close_wallet_action, &QAction::triggered, [this] {
|
|
|
|
m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), this);
|
|
|
|
m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), this);
|
|
|
|