wallet, interfaces: Include database format in listWalletDir
This commit is contained in:
1 parent
1873e4116f
commit
28fc562f26
8 files changed
+33
-25
No files matched your search
@@ -396,15 +396,15 @@ void BitcoinGUI::createActions()
|
||||
connect(openAction, &QAction::triggered, this, &BitcoinGUI::openClicked);
|
||||
connect(m_open_wallet_menu, &QMenu::aboutToShow, [this] {
|
||||
m_open_wallet_menu->clear();
|
||||
for (const std::pair<const std::string, bool>& i : m_wallet_controller->listWalletDir()) {
|
||||
const std::string& path = i.first;
|
||||
for (const auto& [path, info] : m_wallet_controller->listWalletDir()) {
|
||||
const auto& [loaded, _] = info;
|
||||
QString name = path.empty() ? QString("["+tr("default wallet")+"]") : QString::fromStdString(path);
|
||||
// An single ampersand in the menu item's text sets a shortcut for this item.
|
||||
// Single & are shown when && is in the string. So replace & with &&.
|
||||
name.replace(QChar('&'), QString("&&"));
|
||||
QAction* action = m_open_wallet_menu->addAction(name);
|
||||
|
||||
if (i.second) {
|
||||
if (loaded) {
|
||||
// This wallet is already loaded
|
||||
action->setEnabled(false);
|
||||
continue;
|
||||
|
||||
@@ -65,16 +65,16 @@ WalletController::~WalletController()
|
||||
delete m_activity_worker;
|
||||
}
|
||||
|
||||
std::map<std::string, bool> WalletController::listWalletDir() const
|
||||
std::map<std::string, std::pair<bool, std::string>> WalletController::listWalletDir() const
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
std::map<std::string, bool> wallets;
|
||||
for (const std::string& name : m_node.walletLoader().listWalletDir()) {
|
||||
wallets[name] = false;
|
||||
std::map<std::string, std::pair<bool, std::string>> wallets;
|
||||
for (const auto& [name, format] : m_node.walletLoader().listWalletDir()) {
|
||||
wallets[name] = std::make_pair(false, format);
|
||||
}
|
||||
for (WalletModel* wallet_model : m_wallets) {
|
||||
auto it = wallets.find(wallet_model->wallet().getWalletName());
|
||||
if (it != wallets.end()) it->second = true;
|
||||
if (it != wallets.end()) it->second.first = true;
|
||||
}
|
||||
return wallets;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
|
||||
//! Returns all wallet names in the wallet dir mapped to whether the wallet
|
||||
//! is loaded.
|
||||
std::map<std::string, bool> listWalletDir() const;
|
||||
std::map<std::string, std::pair<bool, std::string>> listWalletDir() const;
|
||||
|
||||
void closeWallet(WalletModel* wallet_model, QWidget* parent = nullptr);
|
||||
void closeAllWallets(QWidget* parent = nullptr);
|
||||
|
||||
Reference in new issue
Block a user