aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bitcoin.cpp9
-rw-r--r--src/qt/bitcoingui.cpp7
-rw-r--r--src/qt/bitcoingui.h2
-rw-r--r--src/qt/rpcconsole.cpp3
-rw-r--r--src/qt/rpcconsole.h2
-rw-r--r--src/qt/walletframe.cpp11
-rw-r--r--src/qt/walletframe.h2
7 files changed, 20 insertions, 16 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 424d82ae1f..df1be35c8d 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -487,14 +487,9 @@ void BitcoinApplication::initializeResult(bool success)
for (CWalletRef pwallet : vpwallets) {
WalletModel * const walletModel = new WalletModel(platformStyle, pwallet, optionsModel);
- QString WalletName = QString::fromStdString(pwallet->GetName());
- if (WalletName.endsWith(".dat")) {
- WalletName.truncate(WalletName.size() - 4);
- }
-
- window->addWallet(WalletName, walletModel);
+ window->addWallet(walletModel);
if (fFirstWallet) {
- window->setCurrentWallet(WalletName);
+ window->setCurrentWallet(walletModel->getWalletName());
fFirstWallet = false;
}
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 249c27ad6a..e9090e6a26 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -538,10 +538,11 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
}
#ifdef ENABLE_WALLET
-bool BitcoinGUI::addWallet(const QString& name, WalletModel *walletModel)
+bool BitcoinGUI::addWallet(WalletModel *walletModel)
{
if(!walletFrame)
return false;
+ const QString name = walletModel->getWalletName();
setWalletActionsEnabled(true);
m_wallet_selector->addItem(name);
if (m_wallet_selector->count() == 2) {
@@ -551,8 +552,8 @@ bool BitcoinGUI::addWallet(const QString& name, WalletModel *walletModel)
appToolBar->addWidget(m_wallet_selector_label);
appToolBar->addWidget(m_wallet_selector);
}
- rpcConsole->addWallet(name, walletModel);
- return walletFrame->addWallet(name, walletModel);
+ rpcConsole->addWallet(walletModel);
+ return walletFrame->addWallet(walletModel);
}
bool BitcoinGUI::setCurrentWallet(const QString& name)
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index 9ba50a6eca..b9e92f2d5b 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -62,7 +62,7 @@ public:
The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
functionality.
*/
- bool addWallet(const QString& name, WalletModel *walletModel);
+ bool addWallet(WalletModel *walletModel);
void removeAllWallets();
#endif // ENABLE_WALLET
bool enableWallet;
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 5e72b7b62e..f1f9f6fc4c 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -688,8 +688,9 @@ void RPCConsole::setClientModel(ClientModel *model)
}
#ifdef ENABLE_WALLET
-void RPCConsole::addWallet(const QString name, WalletModel * const walletModel)
+void RPCConsole::addWallet(WalletModel * const walletModel)
{
+ const QString name = walletModel->getWalletName();
// use name for text and internal data object (to allow to move to a wallet id later)
ui->WalletSelector->addItem(name, name);
if (ui->WalletSelector->count() == 2 && !isVisible()) {
diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h
index 6299d80793..5a22be3987 100644
--- a/src/qt/rpcconsole.h
+++ b/src/qt/rpcconsole.h
@@ -43,7 +43,7 @@ public:
}
void setClientModel(ClientModel *model);
- void addWallet(const QString name, WalletModel * const walletModel);
+ void addWallet(WalletModel * const walletModel);
enum MessageClass {
MC_ERROR,
diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp
index c0b9d04269..5b13353d7b 100644
--- a/src/qt/walletframe.cpp
+++ b/src/qt/walletframe.cpp
@@ -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);
diff --git a/src/qt/walletframe.h b/src/qt/walletframe.h
index ce37e456f1..6eedcf370c 100644
--- a/src/qt/walletframe.h
+++ b/src/qt/walletframe.h
@@ -36,7 +36,7 @@ public:
void setClientModel(ClientModel *clientModel);
- bool addWallet(const QString& name, WalletModel *walletModel);
+ bool addWallet(WalletModel *walletModel);
bool setCurrentWallet(const QString& name);
bool removeWallet(const QString &name);
void removeAllWallets();