mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-13 02:11:50 +02:00
gui: Add closeAllWallets to WalletController
This commit is contained in:
parent
a65b55fa45
commit
f30960adc0
@ -92,6 +92,23 @@ void WalletController::closeWallet(WalletModel* wallet_model, QWidget* parent)
|
|||||||
removeAndDeleteWallet(wallet_model);
|
removeAndDeleteWallet(wallet_model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WalletController::closeAllWallets(QWidget* parent)
|
||||||
|
{
|
||||||
|
QMessageBox::StandardButton button = QMessageBox::question(parent, tr("Close all wallets"),
|
||||||
|
tr("Are you sure you wish to close all wallets?"),
|
||||||
|
QMessageBox::Yes|QMessageBox::Cancel,
|
||||||
|
QMessageBox::Yes);
|
||||||
|
if (button != QMessageBox::Yes) return;
|
||||||
|
|
||||||
|
QMutexLocker locker(&m_mutex);
|
||||||
|
for (WalletModel* wallet_model : m_wallets) {
|
||||||
|
wallet_model->wallet().remove();
|
||||||
|
Q_EMIT walletRemoved(wallet_model);
|
||||||
|
delete wallet_model;
|
||||||
|
}
|
||||||
|
m_wallets.clear();
|
||||||
|
}
|
||||||
|
|
||||||
WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wallet> wallet)
|
WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wallet> wallet)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&m_mutex);
|
QMutexLocker locker(&m_mutex);
|
||||||
|
@ -62,6 +62,7 @@ public:
|
|||||||
std::map<std::string, bool> listWalletDir() const;
|
std::map<std::string, bool> listWalletDir() const;
|
||||||
|
|
||||||
void closeWallet(WalletModel* wallet_model, QWidget* parent = nullptr);
|
void closeWallet(WalletModel* wallet_model, QWidget* parent = nullptr);
|
||||||
|
void closeAllWallets(QWidget* parent = nullptr);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void walletAdded(WalletModel* wallet_model);
|
void walletAdded(WalletModel* wallet_model);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user