MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / coinControlChangeEdited

Method coinControlChangeEdited

src/qt/sendcoinsdialog.cpp:798–849  ·  view source on GitHub ↗

Coin Control: custom change address changed

Source from the content-addressed store, hash-verified

796
797// Coin Control: custom change address changed
798void SendCoinsDialog::coinControlChangeEdited(const QString& text)
799{
800 if (model && model->getAddressTableModel())
801 {
802 // Default to no change address until verified
803 CoinControlDialog::coinControl()->destChange = CNoDestination();
804 ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}");
805
806 const CTxDestination dest = DecodeDestination(text.toStdString());
807
808 if (text.isEmpty()) // Nothing entered
809 {
810 ui->labelCoinControlChangeLabel->setText("");
811 }
812 else if (!IsValidDestination(dest)) // Invalid address
813 {
814 ui->labelCoinControlChangeLabel->setText(tr("Warning: Invalid Bitcoin address"));
815 }
816 else // Valid address
817 {
818 if (!model->wallet().isSpendable(dest)) {
819 ui->labelCoinControlChangeLabel->setText(tr("Warning: Unknown change address"));
820
821 // confirmation dialog
822 QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm custom change address"), tr("The address you selected for change is not part of this wallet. Any or all funds in your wallet may be sent to this address. Are you sure?"),
823 QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
824
825 if(btnRetVal == QMessageBox::Yes)
826 CoinControlDialog::coinControl()->destChange = dest;
827 else
828 {
829 ui->lineEditCoinControlChange->setText("");
830 ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:black;}");
831 ui->labelCoinControlChangeLabel->setText("");
832 }
833 }
834 else // Known change address
835 {
836 ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:black;}");
837
838 // Query label
839 QString associatedLabel = model->getAddressTableModel()->labelForAddress(text);
840 if (!associatedLabel.isEmpty())
841 ui->labelCoinControlChangeLabel->setText(associatedLabel);
842 else
843 ui->labelCoinControlChangeLabel->setText(tr("(no label)"));
844
845 CoinControlDialog::coinControl()->destChange = dest;
846 }
847 }
848 }
849}
850
851// Coin Control: update labels
852void SendCoinsDialog::coinControlUpdateLabels()

Callers

nothing calls this directly

Calls 6

CNoDestinationClass · 0.85
DecodeDestinationFunction · 0.85
IsValidDestinationFunction · 0.85
isSpendableMethod · 0.80
labelForAddressMethod · 0.80
getAddressTableModelMethod · 0.45

Tested by

no test coverage detected