This PR adds the action to close all wallets.
<img width="405" alt="Screenshot 2020-06-01 at 01 06 12" src="https://user-images.githubusercontent.com/3534524/83365986-25a8b980-a3a4-11ea-9613-24dcd8eaa55c.png">
This PR adds the action to close all wallets.
<img width="405" alt="Screenshot 2020-06-01 at 01 06 12" src="https://user-images.githubusercontent.com/3534524/83365986-25a8b980-a3a4-11ea-9613-24dcd8eaa55c.png">
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
No conflicts as of last run.
I'm Concept Meh on this.
Concept ACK.
77 | @@ -78,6 +78,23 @@ void WalletController::closeWallet(WalletModel* wallet_model, QWidget* parent) 78 | removeAndDeleteWallet(wallet_model); 79 | } 80 | 81 | +void WalletController::closeAllWallets(QWidget* parent) 82 | +{ 83 | + QMessageBox::StandardButton button = QMessageBox::question(parent, tr("Close all wallets"),
We want to avoid these sync calls (these create a temporary event loop) so here there's 2 options:
Not sure what is preferable.
Just use exec and a lambda?
Rebased. Currently it creates a wallet if the folder is not a wallet, and I think this shouldn't be the case - it should show an error message "Not a wallet" or something. Will fix.
Concept ACK
340 | @@ -341,6 +341,9 @@ void BitcoinGUI::createActions() 341 | m_close_wallet_action = new QAction(tr("Close Wallet..."), this); 342 | m_close_wallet_action->setStatusTip(tr("Close wallet")); 343 | 344 | + m_close_all_wallets_action = new QAction(tr("Close All Wallets..."), this);
I'm not sure if ... is appropriate here, just for a confirmation dialog?
I know the feeling, I'm just following the "rule".
Needs rebase
I think so? Seems harmless worst-case scenario. Can always remove later if nobody uses it.
I have proposed a similar solution yesterday but didn't know that your PR exists (since Jan 2019 btw.). Anyway. :)
I'd recommend to implement an additional MsgBox about closing all wallets automatically. This way users would be able to start the closing procedure while still having an option to keep some of their wallets open.

This is how I implemented it in my demo code.
Regards,
Needs rebase.
@jonasschnelli done.
98 | + tr("Are you sure you wish to close all wallets?"), 99 | + QMessageBox::Yes|QMessageBox::Cancel, 100 | + QMessageBox::Yes); 101 | + if (button != QMessageBox::Yes) return; 102 | + 103 | + QMutexLocker locker(&m_mutex);
Why do you prefer QMutexLocker to our annotated variants?
No preference, m_mutex is a QMutex so we have to change that too.
It seems deserve its own pull :)
Tested c4b574899abfa27f83c6948593838ed418c78f9c on Linux Mint 19.3 (x86_64) -- works as expected.
Tested ACK c4b574899abfa27f83c6948593838ed418c78f9c