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