Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmEventEditor: Don't setup new empty event if saving failed
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 10 Jul 2017 20:04:01 +0000 (21:04 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 10 Jul 2017 20:04:01 +0000 (21:04 +0100)
source/forms/eventeditor/frmEventEditor.cpp
source/forms/eventeditor/frmEventEditor.h

index dda8dd1..090f53f 100644 (file)
@@ -159,7 +159,10 @@ void frmEventEditor::SaveContact(wxCommandEvent &event){
 
 void frmEventEditor::SaveNewContact(wxCommandEvent &event){
        
-       SaveContact();
+       if (!SaveContact())
+       {
+               return;
+       }
        
        // Reset the form for a new entry.
        
@@ -180,14 +183,14 @@ void frmEventEditor::SaveNewContact(wxCommandEvent &event){
        
 }
 
-void frmEventEditor::SaveContact(){
+bool frmEventEditor::SaveContact(){
 
        // Verify that a calendar has been selected.
        
        if (cmbCalendar->GetSelection() == -1 && editMode == false){
                
                wxMessageBox("Please select a calendar for this entry.", "No calendar selected", wxOK);
-               return;
+               return false;
                
        }
        
@@ -196,7 +199,7 @@ void frmEventEditor::SaveContact(){
        if (txtEventName->GetValue().IsEmpty()){
                
                wxMessageBox("The event name cannot be left empty.", "Event name is empty", wxOK);
-               return
+               return false;
                
        }
        
@@ -357,6 +360,8 @@ void frmEventEditor::SaveContact(){
                
        }
        
+       return true;
+       
 }
 
 void frmEventEditor::CloseWindow(wxCommandEvent &event)
index dca82a0..ef37eb1 100644 (file)
@@ -56,7 +56,7 @@ class frmEventEditor : public frmEventEditorADT
                int calendarID = 0;
                int windowID = 0;
                string eventFilePath;
-               void SaveContact();
+               bool SaveContact();
                XCALPreferences *preferences;
                void SetDefaultDateTime();
                void UpdateWindowName();
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