Qt: Get wallet name from WalletModel rather than passing it around

This commit is contained in:
Luke Dashjr
2017-10-12 07:22:48 +00:00
committed by Jonas Schnelli
parent 12d8d2681e
commit b6d04fc7cc
7 changed files with 20 additions and 16 deletions

View File

@@ -3,6 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <qt/walletframe.h>
#include <qt/walletmodel.h>
#include <qt/bitcoingui.h>
#include <qt/walletview.h>
@@ -39,10 +40,16 @@ void WalletFrame::setClientModel(ClientModel *_clientModel)
this->clientModel = _clientModel;
}
bool WalletFrame::addWallet(const QString& name, WalletModel *walletModel)
bool WalletFrame::addWallet(WalletModel *walletModel)
{
if (!gui || !clientModel || !walletModel || mapWalletViews.count(name) > 0)
if (!gui || !clientModel || !walletModel) {
return false;
}
const QString name = walletModel->getWalletName();
if (mapWalletViews.count(name) > 0) {
return false;
}
WalletView *walletView = new WalletView(platformStyle, this);
walletView->setBitcoinGUI(gui);