aboutsummaryrefslogtreecommitdiff
path: root/src/qt/walletcontroller.cpp
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-05-27 19:07:05 +0100
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-07-08 15:03:49 +0100
commit224eb9534a8d2b0f140ecb0cc00c61af8ba1da4e (patch)
tree18a876a6a2ec1af930fa8e9e1300d4be89ca0424 /src/qt/walletcontroller.cpp
parentb5fa2319d86343499ae0c49605d379a20038ca85 (diff)
gui: Sort wallets in open wallet menu
Diffstat (limited to 'src/qt/walletcontroller.cpp')
-rw-r--r--src/qt/walletcontroller.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp
index 019bd65823..3bb0b8dbb6 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;
}