Coin Control: custom change address changed
| 987 | |
| 988 | // Coin Control: custom change address changed |
| 989 | void SendCoinsDialog::coinControlChangeEdited(const QString& text) |
| 990 | { |
| 991 | if (model && model->getAddressTableModel()) |
| 992 | { |
| 993 | // Default to no change address until verified |
| 994 | // ELEMENTS: it's a map now, should be initialized automatically |
| 995 | //m_coin_control->destChange = CNoDestination(); |
| 996 | ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}"); |
| 997 | |
| 998 | const CTxDestination dest = DecodeDestination(text.toStdString()); |
| 999 | |
| 1000 | if (text.isEmpty()) // Nothing entered |
| 1001 | { |
| 1002 | ui->labelCoinControlChangeLabel->setText(""); |
| 1003 | } |
| 1004 | else if (!IsValidDestination(dest)) // Invalid address |
| 1005 | { |
| 1006 | ui->labelCoinControlChangeLabel->setText(tr("Warning: Invalid address")); |
| 1007 | } |
| 1008 | else // Valid address |
| 1009 | { |
| 1010 | if (!model->wallet().isSpendable(dest)) { |
| 1011 | ui->labelCoinControlChangeLabel->setText(tr("Warning: Unknown change address")); |
| 1012 | |
| 1013 | // confirmation dialog |
| 1014 | 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?"), |
| 1015 | QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel); |
| 1016 | |
| 1017 | if(btnRetVal == QMessageBox::Yes) { |
| 1018 | // ELEMENTS: it's a map now |
| 1019 | //m_coin_control->destChange = dest; |
| 1020 | } |
| 1021 | else |
| 1022 | { |
| 1023 | ui->lineEditCoinControlChange->setText(""); |
| 1024 | ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:black;}"); |
| 1025 | ui->labelCoinControlChangeLabel->setText(""); |
| 1026 | } |
| 1027 | } |
| 1028 | else // Known change address |
| 1029 | { |
| 1030 | ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:black;}"); |
| 1031 | |
| 1032 | // Query label |
| 1033 | QString associatedLabel = model->getAddressTableModel()->labelForAddress(text); |
| 1034 | if (!associatedLabel.isEmpty()) |
| 1035 | ui->labelCoinControlChangeLabel->setText(associatedLabel); |
| 1036 | else |
| 1037 | ui->labelCoinControlChangeLabel->setText(tr("(no label)")); |
| 1038 | |
| 1039 | // ELEMENTS: it's a map now |
| 1040 | //m_coin_control->destChange = dest; |
| 1041 | } |
| 1042 | } |
| 1043 | } |
| 1044 | } |
| 1045 | |
| 1046 | // Coin Control: update labels |
nothing calls this directly
no test coverage detected