diff options
author | Jonas Schnelli <dev@jonasschnelli.ch> | 2018-05-18 14:34:53 +0200 |
---|---|---|
committer | Jonas Schnelli <dev@jonasschnelli.ch> | 2018-05-19 11:24:40 +0200 |
commit | 2885c131b6b8ec1140e02ed8f2933c2ffbf41fd1 (patch) | |
tree | b27311c1c58e8c2698ff262f263fd41d12fb0de8 /src/qt | |
parent | 1a8b12c69c0158e6440c53a34b03a32fc0580878 (diff) |
Qt: use [default wallet] as name for wallet with no name
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/bitcoingui.cpp | 11 | ||||
-rw-r--r-- | src/qt/bitcoingui.h | 1 | ||||
-rw-r--r-- | src/qt/rpcconsole.cpp | 3 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 5511ca84e6..9f5ea02e14 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -476,7 +476,7 @@ void BitcoinGUI::createToolBars() toolbar->addWidget(spacer); m_wallet_selector = new QComboBox(); - connect(m_wallet_selector, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(setCurrentWallet(const QString&))); + connect(m_wallet_selector, SIGNAL(currentIndexChanged(int)), this, SLOT(setCurrentWalletBySelectorIndex(int))); #endif } } @@ -552,8 +552,9 @@ bool BitcoinGUI::addWallet(WalletModel *walletModel) if(!walletFrame) return false; const QString name = walletModel->getWalletName(); + QString display_name = name.isEmpty() ? "["+tr("default wallet")+"]" : name; setWalletActionsEnabled(true); - m_wallet_selector->addItem(name); + m_wallet_selector->addItem(display_name, name); if (m_wallet_selector->count() == 2) { m_wallet_selector_label = new QLabel(); m_wallet_selector_label->setText(tr("Wallet:") + " "); @@ -572,6 +573,12 @@ bool BitcoinGUI::setCurrentWallet(const QString& name) return walletFrame->setCurrentWallet(name); } +bool BitcoinGUI::setCurrentWalletBySelectorIndex(int index) +{ + QString internal_name = m_wallet_selector->itemData(index).toString(); + return setCurrentWallet(internal_name); +} + void BitcoinGUI::removeAllWallets() { if(!walletFrame) diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 8ce14f06c6..89c1c73a79 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -186,6 +186,7 @@ public Q_SLOTS: #ifdef ENABLE_WALLET bool setCurrentWallet(const QString& name); + bool setCurrentWalletBySelectorIndex(int index); /** Set the UI status indicators based on the currently selected wallet. */ void updateWalletStatus(); diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 4032729a84..85e3586d64 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -702,7 +702,8 @@ 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); + QString display_name = name.isEmpty() ? "["+tr("default wallet")+"]" : name; + ui->WalletSelector->addItem(display_name, name); if (ui->WalletSelector->count() == 2 && !isVisible()) { // First wallet added, set to default so long as the window isn't presently visible (and potentially in use) ui->WalletSelector->setCurrentIndex(1); |