diff options
| author | João Barbosa <[email protected]> | 2019-05-27 19:07:05 +0100 |
|---|---|---|
| committer | João Barbosa <[email protected]> | 2019-07-08 15:03:49 +0100 |
| commit | 224eb9534a8d2b0f140ecb0cc00c61af8ba1da4e (patch) | |
| tree | 18a876a6a2ec1af930fa8e9e1300d4be89ca0424 /src/qt/walletcontroller.cpp | |
| parent | Merge #15687: test: tool wallet test coverage for unexpected writes to wallet (diff) | |
| download | discoin-224eb9534a8d2b0f140ecb0cc00c61af8ba1da4e.tar.xz discoin-224eb9534a8d2b0f140ecb0cc00c61af8ba1da4e.zip | |
gui: Sort wallets in open wallet menu
Diffstat (limited to 'src/qt/walletcontroller.cpp')
| -rw-r--r-- | src/qt/walletcontroller.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp index 019bd6582..3bb0b8dbb 100644 --- a/src/qt/walletcontroller.cpp +++ b/src/qt/walletcontroller.cpp @@ -46,13 +46,16 @@ std::vector<WalletModel*> WalletController::getWallets() const return m_wallets; } -std::vector<std::string> WalletController::getWalletsAvailableToOpen() const +std::map<std::string, bool> WalletController::listWalletDir() const { QMutexLocker locker(&m_mutex); - std::vector<std::string> wallets = m_node.listWalletDir(); + std::map<std::string, bool> wallets; + for (const std::string& name : m_node.listWalletDir()) { + wallets[name] = false; + } for (WalletModel* wallet_model : m_wallets) { - auto it = std::remove(wallets.begin(), wallets.end(), wallet_model->wallet().getWalletName()); - if (it != wallets.end()) wallets.erase(it); + auto it = wallets.find(wallet_model->wallet().getWalletName()); + if (it != wallets.end()) it->second = true; } return wallets; } |