From 55739dad5a0156a08c79eb8de97123884d5ef785 Mon Sep 17 00:00:00 2001 From: fanquake Date: Thu, 13 Jun 2019 16:36:43 +0800 Subject: [PATCH] Merge #16118: gui: Enable open wallet menu on setWalletController MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 75485ef09 gui: Enable open wallet menu on setWalletController (João Barbosa) Pull request description: `BitcoinApplication::initializeResult` and `BitcoinGUI::setWalletController` are only called after the startup rescan is completed. While the rescan is in progress the window menus are already available. This PR makes the Open Wallet menu disabled until `BitcoinGUI::setWalletController` is called. ![Screenshot 2019-05-29 at 14 17 48](https://user-images.githubusercontent.com/3534524/58560510-35377480-821d-11e9-8f96-d0573c9e47b0.png) Fixes #16087 ACKs for commit 75485e: jonasschnelli: utACK 75485ef0962a53946f17b761c4445627b07e6eff ryanofsky: utACK 75485ef0962a53946f17b761c4445627b07e6eff. It's a simple, sensible fix. Tree-SHA512: 9395ceed54bbceb6cbf1cd443f783d07a6ebb8fc5515b63c6e1b8b19b216b08d1cba7eaf872814d7c426ab7192f3b416ba0d57fc84f3bcbfebf01ce153794201 --- src/qt/bitcoingui.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index fed92e4121..1530eeb974 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -428,7 +428,7 @@ void BitcoinGUI::createActions() openAction->setStatusTip(tr("Open a dash: URI or payment request")); m_open_wallet_action = new QAction(tr("Open Wallet"), this); - m_open_wallet_action->setMenu(new QMenu(this)); + m_open_wallet_action->setEnabled(false); m_open_wallet_action->setStatusTip(tr("Open a wallet")); m_close_wallet_action = new QAction(tr("Close Wallet..."), this); @@ -856,6 +856,9 @@ void BitcoinGUI::setWalletController(WalletController* wallet_controller) m_wallet_controller = wallet_controller; + m_open_wallet_action->setEnabled(true); + m_open_wallet_action->setMenu(new QMenu(this)); + connect(wallet_controller, &WalletController::walletAdded, this, &BitcoinGUI::addWallet); connect(wallet_controller, &WalletController::walletRemoved, this, &BitcoinGUI::removeWallet);