mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 23:03:45 +01:00
gui: Disallow loading legacy wallets
Instead of allowing users to load a legacy wallet from the "Open Wallet" menu, show the legacy wallet greyed out with a message that the wallet needs to be migrated.
This commit is contained in:
@@ -398,15 +398,19 @@ void BitcoinGUI::createActions()
|
|||||||
connect(m_open_wallet_menu, &QMenu::aboutToShow, [this] {
|
connect(m_open_wallet_menu, &QMenu::aboutToShow, [this] {
|
||||||
m_open_wallet_menu->clear();
|
m_open_wallet_menu->clear();
|
||||||
for (const auto& [path, info] : m_wallet_controller->listWalletDir()) {
|
for (const auto& [path, info] : m_wallet_controller->listWalletDir()) {
|
||||||
const auto& [loaded, _] = info;
|
const auto& [loaded, format] = info;
|
||||||
QString name = GUIUtil::WalletDisplayName(path);
|
QString name = GUIUtil::WalletDisplayName(path);
|
||||||
// An single ampersand in the menu item's text sets a shortcut for this item.
|
// 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 &&.
|
// Single & are shown when && is in the string. So replace & with &&.
|
||||||
name.replace(QChar('&'), QString("&&"));
|
name.replace(QChar('&'), QString("&&"));
|
||||||
|
bool is_legacy = format == "bdb";
|
||||||
|
if (is_legacy) {
|
||||||
|
name += " (needs migration)";
|
||||||
|
}
|
||||||
QAction* action = m_open_wallet_menu->addAction(name);
|
QAction* action = m_open_wallet_menu->addAction(name);
|
||||||
|
|
||||||
if (loaded) {
|
if (loaded || is_legacy) {
|
||||||
// This wallet is already loaded
|
// This wallet is already loaded or it is a legacy wallet
|
||||||
action->setEnabled(false);
|
action->setEnabled(false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user