Changeset View
Changeset View
Standalone View
Standalone View
src/qt/sendcoinsdialog.cpp
Show First 20 Lines • Show All 833 Lines • ▼ Show 20 Lines | if (model && model->getAddressTableModel()) { | ||||
// Nothing entered | // Nothing entered | ||||
ui->labelCoinControlChangeLabel->setText(""); | ui->labelCoinControlChangeLabel->setText(""); | ||||
} else if (!addr.IsValid()) { | } else if (!addr.IsValid()) { | ||||
// Invalid address | // Invalid address | ||||
ui->labelCoinControlChangeLabel->setText( | ui->labelCoinControlChangeLabel->setText( | ||||
tr("Warning: Invalid Bitcoin address")); | tr("Warning: Invalid Bitcoin address")); | ||||
} else { | } else { | ||||
// Valid address | // Valid address | ||||
CKeyID keyid; | const CTxDestination dest = addr.Get(); | ||||
addr.GetKeyID(keyid); | if (!model->IsSpendable(dest)) { | ||||
// Unknown change address | |||||
if (!model->havePrivKey(keyid)) { | |||||
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 " | ||||
"this wallet. Any or all funds in your wallet may be " | "this wallet. Any or all funds in your wallet may be " | ||||
"sent to this address. Are you sure?"), | "sent to this address. Are you sure?"), | ||||
QMessageBox::Yes | QMessageBox::Cancel, | QMessageBox::Yes | QMessageBox::Cancel, | ||||
QMessageBox::Cancel); | QMessageBox::Cancel); | ||||
if (btnRetVal == QMessageBox::Yes) | if (btnRetVal == QMessageBox::Yes) | ||||
CoinControlDialog::coinControl->destChange = addr.Get(); | CoinControlDialog::coinControl->destChange = dest; | ||||
else { | else { | ||||
ui->lineEditCoinControlChange->setText(""); | ui->lineEditCoinControlChange->setText(""); | ||||
ui->labelCoinControlChangeLabel->setStyleSheet( | ui->labelCoinControlChangeLabel->setStyleSheet( | ||||
"QLabel{color:black;}"); | "QLabel{color:black;}"); | ||||
ui->labelCoinControlChangeLabel->setText(""); | ui->labelCoinControlChangeLabel->setText(""); | ||||
} | } | ||||
} else { | } else { | ||||
// Known change address | // Known change address | ||||
ui->labelCoinControlChangeLabel->setStyleSheet( | ui->labelCoinControlChangeLabel->setStyleSheet( | ||||
"QLabel{color:black;}"); | "QLabel{color:black;}"); | ||||
// Query label | // Query label | ||||
QString associatedLabel = | QString associatedLabel = | ||||
model->getAddressTableModel()->labelForAddress(text); | model->getAddressTableModel()->labelForAddress(text); | ||||
if (!associatedLabel.isEmpty()) | if (!associatedLabel.isEmpty()) | ||||
ui->labelCoinControlChangeLabel->setText(associatedLabel); | ui->labelCoinControlChangeLabel->setText(associatedLabel); | ||||
else | else | ||||
ui->labelCoinControlChangeLabel->setText(tr("(no label)")); | ui->labelCoinControlChangeLabel->setText(tr("(no label)")); | ||||
CoinControlDialog::coinControl->destChange = addr.Get(); | CoinControlDialog::coinControl->destChange = dest; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// Coin Control: update labels | // Coin Control: update labels | ||||
void SendCoinsDialog::coinControlUpdateLabels() { | void SendCoinsDialog::coinControlUpdateLabels() { | ||||
if (!model || !model->getOptionsModel()) return; | if (!model || !model->getOptionsModel()) return; | ||||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |