diff options
author | João Barbosa <joao.paulo.barbosa@gmail.com> | 2019-01-18 00:21:36 +0000 |
---|---|---|
committer | João Barbosa <joao.paulo.barbosa@gmail.com> | 2019-02-12 22:07:45 +0000 |
commit | f77ba34313768fde9b813243dcd408f9755b0418 (patch) | |
tree | f82671faace45374c31cdde667123dd2594b012b /src/qt/walletcontroller.cpp | |
parent | f6122abe03699423faca29035f16f3afc527f4d3 (diff) |
gui: Add closeWallet to WalletController
Diffstat (limited to 'src/qt/walletcontroller.cpp')
-rw-r--r-- | src/qt/walletcontroller.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp index 3483c75970..c532ffbbfe 100644 --- a/src/qt/walletcontroller.cpp +++ b/src/qt/walletcontroller.cpp @@ -63,6 +63,22 @@ OpenWalletActivity* WalletController::openWallet(const std::string& name, QWidge return activity; } +void WalletController::closeWallet(WalletModel* wallet_model, QWidget* parent) +{ + QMessageBox box(parent); + box.setWindowTitle(tr("Close wallet")); + box.setText(tr("Are you sure you wish to close wallet <i>%1</i>?").arg(wallet_model->getDisplayName())); + box.setInformativeText(tr("Closing the wallet for too long can result in having to resync the entire chain if pruning is enabled.")); + box.setStandardButtons(QMessageBox::Yes|QMessageBox::Cancel); + box.setDefaultButton(QMessageBox::Yes); + if (box.exec() != QMessageBox::Yes) return; + + // First remove wallet from node. + wallet_model->wallet().remove(); + // Now release the model. + removeAndDeleteWallet(wallet_model); +} + WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wallet> wallet) { QMutexLocker locker(&m_mutex); |