Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmContactEditor: Check save was successful before closing
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 14 Jan 2018 17:24:22 +0000 (17:24 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 14 Jan 2018 17:24:22 +0000 (17:24 +0000)
source/contacteditor/frmContactEditor-Save.cpp
source/contacteditor/frmContactEditor.h

index baeeae5..dca32d0 100644 (file)
@@ -33,7 +33,8 @@ void frmContactEditor::SaveContact( wxCommandEvent& event )
        
        if (boolUnsupportedAccount == true){
        
-               wxMessageBox(_("Cannot make changes to a contact from an unsupported account type."), _("Unsupported account"), wxICON_ERROR);          
+               wxMessageBox(_("Cannot make changes to a contact from an unsupported account type."), _("Unsupported account"), wxICON_ERROR);
+               saveSuccess = false;
                return;
                
        }
@@ -46,6 +47,7 @@ void frmContactEditor::SaveContact( wxCommandEvent& event )
        if (cmbDisplayAsValue.IsEmpty()){
         
                wxMessageBox(_("Display As value cannot be left blank."), _("Display As value empty"), wxICON_ERROR);
+               saveSuccess = false;
                return;
         
        }
@@ -566,6 +568,8 @@ void frmContactEditor::SaveContact( wxCommandEvent& event )
                event2.SetClientData(ucd);
                wxPostEvent(MainPtr, event2);
        }
+       
+       saveSuccess = true;     
     
 }
 
@@ -576,6 +580,9 @@ void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
     
        wxCommandEvent NullEvent;
        this->SaveContact(NullEvent);
-       this->Close();
+       if (saveSuccess)
+       {
+               this->Close();
+       }
     
 }
\ No newline at end of file
index 49dd826..dbad355 100644 (file)
@@ -744,6 +744,7 @@ class frmContactEditor : public frmContactEditorADT
                bool EditMode = FALSE;
                bool StartupEditMode = FALSE;
                bool DialogOpen = FALSE;
+               bool saveSuccess = false;
                
                /*
                std::string base64dec;
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy