Merge bitcoin-core/gui#924: Show an error message if the restored wallet name is empty

dd904298c1 gui: Show an error message if the restored wallet name is empty (Ava Chow)

Pull request description:

  The Restore Wallet dialog rejects wallet names that are empty, but was doing so silently. This is confusing, we should be presenting an error message to the user.

ACKs for top commit:
  hebasto:
    ACK dd904298c1. Tested on Fedora 43.

Tree-SHA512: f4b60f32d1c2550dbce8613f25d29a92588b1ecfc8e8e5dac691a6bdb21a77508288a904539b68333d96bde5ebb993912253f4a293e4c583891f553d95762e77
This commit is contained in:
Hennadii Stepanov
2026-01-17 10:04:47 +00:00

View File

@@ -452,7 +452,11 @@ void BitcoinGUI::createActions()
//: Label of the input field where the name of the wallet is entered.
QString label = tr("Wallet Name");
QString wallet_name = QInputDialog::getText(this, title, label, QLineEdit::Normal, "", &wallet_name_ok);
if (!wallet_name_ok || wallet_name.isEmpty()) return;
if (!wallet_name_ok) return;
if (wallet_name.isEmpty()) {
QMessageBox::critical(nullptr, tr("Invalid Wallet Name"), tr("Wallet name cannot be empty"));
return;
}
auto activity = new RestoreWalletActivity(m_wallet_controller, this);
connect(activity, &RestoreWalletActivity::restored, this, &BitcoinGUI::setCurrentWallet, Qt::QueuedConnection);