Bugfix: Replace "URL" with "URI" where we aren't actually working with URLs
[novacoin.git] / src / qt / editaddressdialog.cpp
index a0b27e8..8cc3c85 100644 (file)
@@ -54,9 +54,10 @@ void EditAddressDialog::loadRow(int row)
     mapper->setCurrentIndex(row);
 }
 
-QString EditAddressDialog::saveCurrentRow()
+bool EditAddressDialog::saveCurrentRow()
 {
-    QString address;
+    if(!model)
+        return false;
     switch(mode)
     {
     case NewReceivingAddress:
@@ -74,12 +75,14 @@ QString EditAddressDialog::saveCurrentRow()
         }
         break;
     }
-    return address;
+    return !address.isEmpty();
 }
 
 void EditAddressDialog::accept()
 {
-    if(saveCurrentRow().isEmpty())
+    if(!model)
+        return;
+    if(!saveCurrentRow())
     {
         switch(model->getEditStatus())
         {
@@ -93,6 +96,16 @@ void EditAddressDialog::accept()
                 tr("The entered address \"%1\" is not a valid bitcoin address.").arg(ui->addressEdit->text()),
                 QMessageBox::Ok, QMessageBox::Ok);
             return;
+        case AddressTableModel::WALLET_UNLOCK_FAILURE:
+            QMessageBox::critical(this, windowTitle(),
+                tr("Could not unlock wallet."),
+                QMessageBox::Ok, QMessageBox::Ok);
+            return;
+        case AddressTableModel::KEY_GENERATION_FAILURE:
+            QMessageBox::critical(this, windowTitle(),
+                tr("New key generation failed."),
+                QMessageBox::Ok, QMessageBox::Ok);
+            return;
         }
 
         return;
@@ -100,3 +113,13 @@ void EditAddressDialog::accept()
     QDialog::accept();
 }
 
+QString EditAddressDialog::getAddress() const
+{
+    return address;
+}
+
+void EditAddressDialog::setAddress(const QString &address)
+{
+    this->address = address;
+    ui->addressEdit->setText(address);
+}