Changeset View
Changeset View
Standalone View
Standalone View
src/qt/sendcoinsdialog.cpp
Show First 20 Lines • Show All 822 Lines • ▼ Show 20 Lines | |||||
// Coin Control: custom change address changed | // Coin Control: custom change address changed | ||||
void SendCoinsDialog::coinControlChangeEdited(const QString &text) { | void SendCoinsDialog::coinControlChangeEdited(const QString &text) { | ||||
if (model && model->getAddressTableModel()) { | if (model && model->getAddressTableModel()) { | ||||
// Default to no change address until verified | // Default to no change address until verified | ||||
CoinControlDialog::coinControl->destChange = CNoDestination(); | CoinControlDialog::coinControl->destChange = CNoDestination(); | ||||
ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}"); | ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}"); | ||||
CBitcoinAddress addr = CBitcoinAddress(text.toStdString()); | const CTxDestination dest = DecodeDestination(text.toStdString()); | ||||
if (text.isEmpty()) { | if (text.isEmpty()) { | ||||
// Nothing entered | // Nothing entered | ||||
ui->labelCoinControlChangeLabel->setText(""); | ui->labelCoinControlChangeLabel->setText(""); | ||||
} else if (!addr.IsValid()) // Invalid address | } else if (!IsValidDestination(dest)) // Invalid address | ||||
{ | { | ||||
ui->labelCoinControlChangeLabel->setText( | ui->labelCoinControlChangeLabel->setText( | ||||
tr("Warning: Invalid Bitcoin address")); | tr("Warning: Invalid Bitcoin address")); | ||||
} else // Valid address | } else // Valid address | ||||
{ | { | ||||
const CTxDestination dest = addr.Get(); | |||||
if (!model->IsSpendable(dest)) { | if (!model->IsSpendable(dest)) { | ||||
ui->labelCoinControlChangeLabel->setText( | ui->labelCoinControlChangeLabel->setText( | ||||
tr("Warning: Unknown change address")); | tr("Warning: Unknown change address")); | ||||
// confirmation dialog | // confirmation dialog | ||||
QMessageBox::StandardButton btnRetVal = QMessageBox::question( | QMessageBox::StandardButton btnRetVal = QMessageBox::question( | ||||
this, tr("Confirm custom change address"), | this, tr("Confirm custom change address"), | ||||
tr("The address you selected for change is not part of " | tr("The address you selected for change is not part of " | ||||
▲ Show 20 Lines • Show All 117 Lines • Show Last 20 Lines |