mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
[Qt] extend validate line edit and btc address validator
- remove btc address length from address validator - add an optional btc address check in validated line edit that defaults to off and is used in GUIUtil::setupAddressWidget() - an isAcceptable() check is added to validated line edit on focus out which only kicks in, when a validator is used with that widget - remove an isAcceptable() check from sendcoinsentry.cpp - remove obsolete attributes from ui files, which are set by calling GUIUtil::setupAddressWidget() - move some more things to GUIUtil::setupAddressWidget() and remove them from normal code e.g. placeholder text
This commit is contained in:
committed by
Wladimir J. van der Laan
parent
aab8fc58c6
commit
c78bd93701
@@ -33,9 +33,8 @@ SendCoinsDialog::SendCoinsDialog(QWidget *parent) :
|
||||
ui->clearButton->setIcon(QIcon());
|
||||
ui->sendButton->setIcon(QIcon());
|
||||
#endif
|
||||
#if QT_VERSION >= 0x040700
|
||||
ui->lineEditCoinControlChange->setPlaceholderText(tr("Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)"));
|
||||
#endif
|
||||
|
||||
GUIUtil::setupAddressWidget(ui->lineEditCoinControlChange, this);
|
||||
|
||||
addEntry();
|
||||
|
||||
@@ -43,7 +42,6 @@ SendCoinsDialog::SendCoinsDialog(QWidget *parent) :
|
||||
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
|
||||
|
||||
// Coin Control
|
||||
ui->lineEditCoinControlChange->setFont(GUIUtil::bitcoinAddressFont());
|
||||
connect(ui->pushButtonCoinControl, SIGNAL(clicked()), this, SLOT(coinControlButtonClicked()));
|
||||
connect(ui->checkBoxCoinControlChange, SIGNAL(stateChanged(int)), this, SLOT(coinControlChangeChecked(int)));
|
||||
connect(ui->lineEditCoinControlChange, SIGNAL(textEdited(const QString &)), this, SLOT(coinControlChangeEdited(const QString &)));
|
||||
@@ -536,7 +534,6 @@ void SendCoinsDialog::coinControlChangeChecked(int state)
|
||||
if (state == Qt::Unchecked)
|
||||
{
|
||||
CoinControlDialog::coinControl->destChange = CNoDestination();
|
||||
ui->lineEditCoinControlChange->setValid(true);
|
||||
ui->labelCoinControlChangeLabel->clear();
|
||||
}
|
||||
else
|
||||
@@ -563,7 +560,6 @@ void SendCoinsDialog::coinControlChangeEdited(const QString& text)
|
||||
}
|
||||
else if (!addr.IsValid()) // Invalid address
|
||||
{
|
||||
ui->lineEditCoinControlChange->setValid(false);
|
||||
ui->labelCoinControlChangeLabel->setText(tr("Warning: Invalid Bitcoin address"));
|
||||
}
|
||||
else // Valid address
|
||||
@@ -573,7 +569,6 @@ void SendCoinsDialog::coinControlChangeEdited(const QString& text)
|
||||
addr.GetKeyID(keyid);
|
||||
if (!model->getPubKey(keyid, pubkey)) // Unknown change address
|
||||
{
|
||||
ui->lineEditCoinControlChange->setValid(false);
|
||||
ui->labelCoinControlChangeLabel->setText(tr("Warning: Unknown change address"));
|
||||
}
|
||||
else // Known change address
|
||||
|
||||
Reference in New Issue
Block a user