Changeset View
Changeset View
Standalone View
Standalone View
src/qt/editaddressdialog.cpp
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | if (!saveCurrentRow()) { | ||||
QMessageBox::warning(this, windowTitle(), | QMessageBox::warning(this, windowTitle(), | ||||
tr("The entered address \"%1\" is not a " | tr("The entered address \"%1\" is not a " | ||||
"valid Bitcoin address.") | "valid Bitcoin address.") | ||||
.arg(ui->addressEdit->text()), | .arg(ui->addressEdit->text()), | ||||
QMessageBox::Ok, QMessageBox::Ok); | QMessageBox::Ok, QMessageBox::Ok); | ||||
break; | break; | ||||
case AddressTableModel::DUPLICATE_ADDRESS: | case AddressTableModel::DUPLICATE_ADDRESS: | ||||
QMessageBox::warning(this, windowTitle(), | QMessageBox::warning(this, windowTitle(), | ||||
tr("The entered address \"%1\" is already " | getDuplicateAddressWarning(), | ||||
"in the address book.") | |||||
.arg(ui->addressEdit->text()), | |||||
QMessageBox::Ok, QMessageBox::Ok); | QMessageBox::Ok, QMessageBox::Ok); | ||||
break; | break; | ||||
case AddressTableModel::WALLET_UNLOCK_FAILURE: | case AddressTableModel::WALLET_UNLOCK_FAILURE: | ||||
QMessageBox::critical(this, windowTitle(), | QMessageBox::critical(this, windowTitle(), | ||||
tr("Could not unlock wallet."), | tr("Could not unlock wallet."), | ||||
QMessageBox::Ok, QMessageBox::Ok); | QMessageBox::Ok, QMessageBox::Ok); | ||||
break; | break; | ||||
case AddressTableModel::KEY_GENERATION_FAILURE: | case AddressTableModel::KEY_GENERATION_FAILURE: | ||||
QMessageBox::critical(this, windowTitle(), | QMessageBox::critical(this, windowTitle(), | ||||
tr("New key generation failed."), | tr("New key generation failed."), | ||||
QMessageBox::Ok, QMessageBox::Ok); | QMessageBox::Ok, QMessageBox::Ok); | ||||
break; | break; | ||||
} | } | ||||
return; | return; | ||||
} | } | ||||
QDialog::accept(); | QDialog::accept(); | ||||
} | } | ||||
QString EditAddressDialog::getDuplicateAddressWarning() const { | |||||
QString dup_address = ui->addressEdit->text(); | |||||
QString existing_label = model->labelForAddress(dup_address); | |||||
QString existing_purpose = model->purposeForAddress(dup_address); | |||||
if (existing_purpose == "receive" && | |||||
(mode == NewSendingAddress || mode == EditSendingAddress)) { | |||||
return tr("Address \"%1\" already exists as a receiving address with " | |||||
"label " | |||||
"\"%2\" and so cannot be added as a sending address.") | |||||
.arg(dup_address) | |||||
.arg(existing_label); | |||||
} | |||||
return tr("The entered address \"%1\" is already in the address book with " | |||||
"label \"%2\".") | |||||
.arg(dup_address) | |||||
.arg(existing_label); | |||||
} | |||||
QString EditAddressDialog::getAddress() const { | QString EditAddressDialog::getAddress() const { | ||||
return address; | return address; | ||||
} | } | ||||
void EditAddressDialog::setAddress(const QString &_address) { | void EditAddressDialog::setAddress(const QString &_address) { | ||||
this->address = _address; | this->address = _address; | ||||
ui->addressEdit->setText(_address); | ui->addressEdit->setText(_address); | ||||
} | } |