Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added code and unit tests for the SaveFile function in ContactDataObject
[xestiaab/.git] / source / contacteditor / cdo / ContactDataObject-Save.cpp
index d14240b..daf6159 100644 (file)
 #include "ContactDataObject.h"
 #include "../../version.h"
 
+ContactSaveStatus ContactDataObject::SaveFile(wxString SaveFilename){
+       
+       // Get the data using SaveString.
+       
+       wxString SaveData = "";
+       SaveString(&SaveData);
+       
+       // Open a file and try to write into it.
+       
+       wxFile ContactFile;
+       
+       if (!ContactFile.Open(SaveFilename, wxFile::write, wxS_DEFAULT)){
+       
+               return CONTACTSAVE_FILEERROR;
+       
+       }
+       
+       if (ContactFile.Write(SaveData, wxConvUTF8) == false){
+               
+               return CONTACTSAVE_WRITEERROR;
+               
+       }
+       
+       ContactFile.Close();
+       
+       return CONTACTSAVE_OK;
+       
+}
+
 ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
        
        ContactSaveStatus SaveDataStatus = CONTACTSAVE_UNITTESTFAIL;
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