|
|
@ -25,7 +25,7 @@ EditAddressDialog::EditAddressDialog(Mode mode, QWidget *parent) : |
|
|
|
break; |
|
|
|
break; |
|
|
|
case EditReceivingAddress: |
|
|
|
case EditReceivingAddress: |
|
|
|
setWindowTitle(tr("Edit receiving address")); |
|
|
|
setWindowTitle(tr("Edit receiving address")); |
|
|
|
ui->addressEdit->setDisabled(true); |
|
|
|
ui->addressEdit->setEnabled(false); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case EditSendingAddress: |
|
|
|
case EditSendingAddress: |
|
|
|
setWindowTitle(tr("Edit sending address")); |
|
|
|
setWindowTitle(tr("Edit sending address")); |
|
|
@ -44,6 +44,9 @@ EditAddressDialog::~EditAddressDialog() |
|
|
|
void EditAddressDialog::setModel(AddressTableModel *model) |
|
|
|
void EditAddressDialog::setModel(AddressTableModel *model) |
|
|
|
{ |
|
|
|
{ |
|
|
|
this->model = model; |
|
|
|
this->model = model; |
|
|
|
|
|
|
|
if(!model) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
mapper->setModel(model); |
|
|
|
mapper->setModel(model); |
|
|
|
mapper->addMapping(ui->labelEdit, AddressTableModel::Label); |
|
|
|
mapper->addMapping(ui->labelEdit, AddressTableModel::Label); |
|
|
|
mapper->addMapping(ui->addressEdit, AddressTableModel::Address); |
|
|
|
mapper->addMapping(ui->addressEdit, AddressTableModel::Address); |
|
|
@ -58,6 +61,7 @@ bool EditAddressDialog::saveCurrentRow() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(!model) |
|
|
|
if(!model) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
switch(mode) |
|
|
|
switch(mode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case NewReceivingAddress: |
|
|
|
case NewReceivingAddress: |
|
|
@ -82,35 +86,39 @@ void EditAddressDialog::accept() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(!model) |
|
|
|
if(!model) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if(!saveCurrentRow()) |
|
|
|
if(!saveCurrentRow()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
switch(model->getEditStatus()) |
|
|
|
switch(model->getEditStatus()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case AddressTableModel::DUPLICATE_ADDRESS: |
|
|
|
case AddressTableModel::OK: |
|
|
|
QMessageBox::warning(this, windowTitle(), |
|
|
|
// Failed with unknown reason. Just reject.
|
|
|
|
tr("The entered address \"%1\" is already in the address book.").arg(ui->addressEdit->text()), |
|
|
|
break; |
|
|
|
QMessageBox::Ok, QMessageBox::Ok); |
|
|
|
case AddressTableModel::NO_CHANGES: |
|
|
|
|
|
|
|
// No changes were made during edit operation. Just reject.
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case AddressTableModel::INVALID_ADDRESS: |
|
|
|
case AddressTableModel::INVALID_ADDRESS: |
|
|
|
QMessageBox::warning(this, windowTitle(), |
|
|
|
QMessageBox::warning(this, windowTitle(), |
|
|
|
tr("The entered address \"%1\" is not a valid Bitcoin address.").arg(ui->addressEdit->text()), |
|
|
|
tr("The entered address \"%1\" is not a valid Bitcoin address.").arg(ui->addressEdit->text()), |
|
|
|
QMessageBox::Ok, QMessageBox::Ok); |
|
|
|
QMessageBox::Ok, QMessageBox::Ok); |
|
|
|
return; |
|
|
|
break; |
|
|
|
|
|
|
|
case AddressTableModel::DUPLICATE_ADDRESS: |
|
|
|
|
|
|
|
QMessageBox::warning(this, windowTitle(), |
|
|
|
|
|
|
|
tr("The entered address \"%1\" is already in the address book.").arg(ui->addressEdit->text()), |
|
|
|
|
|
|
|
QMessageBox::Ok, QMessageBox::Ok); |
|
|
|
|
|
|
|
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); |
|
|
|
return; |
|
|
|
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); |
|
|
|
return; |
|
|
|
|
|
|
|
case AddressTableModel::OK: |
|
|
|
|
|
|
|
// Failed with unknown reason. Just reject.
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
QDialog::accept(); |
|
|
|
QDialog::accept(); |
|
|
|