@@ -120,6 +120,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
120120 modalOverlay(0 ),
121121 prevBlocks(0 ),
122122 spinnerFrame(0 ),
123+ m_wallet_selector_label(nullptr ),
123124 platformStyle(_platformStyle)
124125{
125126 QSettings settings;
@@ -477,6 +478,16 @@ void BitcoinGUI::createToolBars()
477478
478479 m_wallet_selector = new QComboBox ();
479480 connect (m_wallet_selector, SIGNAL (currentIndexChanged (int )), this , SLOT (setCurrentWalletBySelectorIndex (int )));
481+
482+ m_wallet_selector_label = new QLabel ();
483+ m_wallet_selector_label->setText (tr (" Wallet:" ) + " " );
484+ m_wallet_selector_label->setBuddy (m_wallet_selector);
485+
486+ m_wallet_selector_label_action = appToolBar->addWidget (m_wallet_selector_label);
487+ m_wallet_selector_action = appToolBar->addWidget (m_wallet_selector);
488+
489+ m_wallet_selector_label_action->setVisible (false );
490+ m_wallet_selector_action->setVisible (false );
480491#endif
481492 }
482493}
@@ -556,16 +567,29 @@ bool BitcoinGUI::addWallet(WalletModel *walletModel)
556567 setWalletActionsEnabled (true );
557568 m_wallet_selector->addItem (display_name, name);
558569 if (m_wallet_selector->count () == 2 ) {
559- m_wallet_selector_label = new QLabel ();
560- m_wallet_selector_label->setText (tr (" Wallet:" ) + " " );
561- m_wallet_selector_label->setBuddy (m_wallet_selector);
562- appToolBar->addWidget (m_wallet_selector_label);
563- appToolBar->addWidget (m_wallet_selector);
570+ m_wallet_selector_label_action->setVisible (true );
571+ m_wallet_selector_action->setVisible (true );
564572 }
565573 rpcConsole->addWallet (walletModel);
566574 return walletFrame->addWallet (walletModel);
567575}
568576
577+ bool BitcoinGUI::removeWallet (WalletModel* walletModel)
578+ {
579+ if (!walletFrame) return false ;
580+ QString name = walletModel->getWalletName ();
581+ int index = m_wallet_selector->findData (name);
582+ m_wallet_selector->removeItem (index);
583+ if (m_wallet_selector->count () == 0 ) {
584+ setWalletActionsEnabled (false );
585+ } else if (m_wallet_selector->count () == 1 ) {
586+ m_wallet_selector_label_action->setVisible (false );
587+ m_wallet_selector_action->setVisible (false );
588+ }
589+ rpcConsole->removeWallet (walletModel);
590+ return walletFrame->removeWallet (name);
591+ }
592+
569593bool BitcoinGUI::setCurrentWallet (const QString& name)
570594{
571595 if (!walletFrame)
0 commit comments