diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index 790d5d6c3..ad4aa5290 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -39,7 +39,7 @@ - -1 + 0 0 @@ -173,7 +173,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -219,12 +228,6 @@ - - - Monospace - 10 - - IBeamCursor @@ -254,12 +257,6 @@ - - - Monospace - 10 - - IBeamCursor @@ -308,12 +305,6 @@ - - - Monospace - 10 - - IBeamCursor @@ -340,12 +331,6 @@ - - - Monospace - 10 - - IBeamCursor @@ -394,12 +379,6 @@ - - - Monospace - 10 - - IBeamCursor @@ -426,12 +405,6 @@ - - - Monospace - 10 - - IBeamCursor @@ -480,12 +453,6 @@ - - - Monospace - 10 - - IBeamCursor @@ -512,12 +479,6 @@ - - - Monospace - 10 - - IBeamCursor @@ -555,13 +516,16 @@ + + If this is activated, but the change address is empty or invalid, change will be sent to a newly generated address. + - custom change address + Custom change address - + false @@ -626,7 +590,7 @@ 0 0 830 - 165 + 178 @@ -778,6 +742,13 @@ + + + QValidatedLineEdit + QLineEdit +
qvalidatedlineedit.h
+
+
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 6c3535b2f..73cfa27c8 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -529,16 +529,17 @@ void SendCoinsDialog::coinControlButtonClicked() // Coin Control: checkbox custom change address void SendCoinsDialog::coinControlChangeChecked(int state) { - if (model) + if (state == Qt::Unchecked) { - if (state == Qt::Checked) - CoinControlDialog::coinControl->destChange = CBitcoinAddress(ui->lineEditCoinControlChange->text().toStdString()).Get(); - else - CoinControlDialog::coinControl->destChange = CNoDestination(); + CoinControlDialog::coinControl->destChange = CNoDestination(); + ui->lineEditCoinControlChange->setValid(true); + ui->labelCoinControlChangeLabel->clear(); } + else + // use this to re-validate an already entered address + coinControlChangeEdited(ui->lineEditCoinControlChange->text()); ui->lineEditCoinControlChange->setEnabled((state == Qt::Checked)); - ui->labelCoinControlChangeLabel->setVisible((state == Qt::Checked)); } // Coin Control: custom change address changed @@ -554,6 +555,10 @@ void SendCoinsDialog::coinControlChangeEdited(const QString & text) ui->labelCoinControlChangeLabel->setText(""); else if (!CBitcoinAddress(text.toStdString()).IsValid()) { + // invalid change address + CoinControlDialog::coinControl->destChange = CNoDestination(); + + ui->lineEditCoinControlChange->setValid(false); ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}"); ui->labelCoinControlChangeLabel->setText(tr("Warning: Invalid Bitcoin address")); } @@ -571,6 +576,10 @@ void SendCoinsDialog::coinControlChangeEdited(const QString & text) ui->labelCoinControlChangeLabel->setText(tr("(no label)")); else { + // unknown change address + CoinControlDialog::coinControl->destChange = CNoDestination(); + + ui->lineEditCoinControlChange->setValid(false); ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}"); ui->labelCoinControlChangeLabel->setText(tr("Warning: Unknown change address")); }