Qt: use [default wallet] as name for wallet with no name

This commit is contained in:
Jonas Schnelli
2018-05-18 14:34:53 +02:00
parent 1a8b12c69c
commit 2885c131b6
3 changed files with 12 additions and 3 deletions

View File

@@ -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)