Skip to content

Commit 94086fb

Browse files
committed
gui: Add close wallet action
1 parent f77ba34 commit 94086fb

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/qt/bitcoingui.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ void BitcoinGUI::createActions()
338338
m_open_wallet_action->setMenu(new QMenu(this));
339339
m_open_wallet_action->setStatusTip(tr("Open a wallet"));
340340

341+
m_close_wallet_action = new QAction(tr("Close Wallet..."), this);
342+
m_close_wallet_action->setStatusTip(tr("Close wallet"));
343+
341344
showHelpMessageAction = new QAction(platformStyle->TextColorIcon(":/icons/info"), tr("&Command-line options"), this);
342345
showHelpMessageAction->setMenuRole(QAction::NoRole);
343346
showHelpMessageAction->setStatusTip(tr("Show the %1 help message to get a list with possible Bitcoin command-line options").arg(tr(PACKAGE_NAME)));
@@ -396,6 +399,9 @@ void BitcoinGUI::createActions()
396399
});
397400
}
398401
});
402+
connect(m_close_wallet_action, &QAction::triggered, [this] {
403+
m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), this);
404+
});
399405
}
400406
#endif // ENABLE_WALLET
401407

@@ -418,6 +424,7 @@ void BitcoinGUI::createMenuBar()
418424
if(walletFrame)
419425
{
420426
file->addAction(m_open_wallet_action);
427+
file->addAction(m_close_wallet_action);
421428
file->addSeparator();
422429
file->addAction(openAction);
423430
file->addAction(backupWalletAction);
@@ -693,6 +700,7 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
693700
usedSendingAddressesAction->setEnabled(enabled);
694701
usedReceivingAddressesAction->setEnabled(enabled);
695702
openAction->setEnabled(enabled);
703+
m_close_wallet_action->setEnabled(enabled);
696704
}
697705

698706
void BitcoinGUI::createTrayIcon()

src/qt/bitcoingui.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ class BitcoinGUI : public QMainWindow
148148
QAction* openAction = nullptr;
149149
QAction* showHelpMessageAction = nullptr;
150150
QAction* m_open_wallet_action{nullptr};
151+
QAction* m_close_wallet_action{nullptr};
151152
QAction* m_wallet_selector_label_action = nullptr;
152153
QAction* m_wallet_selector_action = nullptr;
153154

0 commit comments

Comments
 (0)