From 224eb9534a8d2b0f140ecb0cc00c61af8ba1da4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Barbosa?= Date: Mon, 27 May 2019 19:07:05 +0100 Subject: gui: Sort wallets in open wallet menu --- src/qt/walletcontroller.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/qt/walletcontroller.cpp') 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 WalletController::getWallets() const return m_wallets; } -std::vector WalletController::getWalletsAvailableToOpen() const +std::map WalletController::listWalletDir() const { QMutexLocker locker(&m_mutex); - std::vector wallets = m_node.listWalletDir(); + std::map 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; } -- cgit v1.2.3