Changeset View
Changeset View
Standalone View
Standalone View
src/qt/walletcontroller.cpp
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
OpenWalletActivity *WalletController::openWallet(const CChainParams ¶ms, | OpenWalletActivity *WalletController::openWallet(const CChainParams ¶ms, | ||||
const std::string &name, | const std::string &name, | ||||
QWidget *parent) { | QWidget *parent) { | ||||
OpenWalletActivity *activity = new OpenWalletActivity(this, name, params); | OpenWalletActivity *activity = new OpenWalletActivity(this, name, params); | ||||
activity->moveToThread(&m_activity_thread); | activity->moveToThread(&m_activity_thread); | ||||
QMetaObject::invokeMethod(activity, "open", Qt::QueuedConnection); | QMetaObject::invokeMethod(activity, "open", Qt::QueuedConnection); | ||||
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( | WalletModel *WalletController::getOrCreateWallet( | ||||
std::unique_ptr<interfaces::Wallet> wallet) { | std::unique_ptr<interfaces::Wallet> wallet) { | ||||
QMutexLocker locker(&m_mutex); | QMutexLocker locker(&m_mutex); | ||||
// Return model instance if exists. | // Return model instance if exists. | ||||
if (!m_wallets.empty()) { | if (!m_wallets.empty()) { | ||||
std::string name = wallet->getWalletName(); | std::string name = wallet->getWalletName(); | ||||
for (WalletModel *wallet_model : m_wallets) { | for (WalletModel *wallet_model : m_wallets) { | ||||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |