gui: Add closeWallet to WalletController
This commit is contained in:
parent
f6122abe03
commit
f77ba34313
2 changed files with 17 additions and 0 deletions
|
@ -63,6 +63,22 @@ OpenWalletActivity* WalletController::openWallet(const std::string& name, QWidge
|
||||||
return activity;
|
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)
|
WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wallet> wallet)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&m_mutex);
|
QMutexLocker locker(&m_mutex);
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
std::vector<std::string> getWalletsAvailableToOpen() const;
|
std::vector<std::string> getWalletsAvailableToOpen() const;
|
||||||
|
|
||||||
OpenWalletActivity* openWallet(const std::string& name, QWidget* parent = nullptr);
|
OpenWalletActivity* openWallet(const std::string& name, QWidget* parent = nullptr);
|
||||||
|
void closeWallet(WalletModel* wallet_model, QWidget* parent = nullptr);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void addWallet(WalletModel* wallet_model);
|
void addWallet(WalletModel* wallet_model);
|
||||||
|
|
Loading…
Reference in a new issue