Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added REV to the SaveString function of ContactDataObject
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 3 Jul 2016 08:42:18 +0000 (09:42 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 3 Jul 2016 08:42:18 +0000 (09:42 +0100)
source/contacteditor/cdo/ContactDataObject-Save.cpp
source/tests/xestiaab_contactsave.h

index 191355f..9e14252 100644 (file)
@@ -79,7 +79,54 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                
        }
        
-       // TODO: Sortout REV.
+       // Process REV.
+       
+       wxDateTime DateTimeSave;
+       DateTimeSave = DateTimeSave.SetToCurrent();
+       wxString DateTimeSaveValue;
+       
+#ifdef XAB_UNITTEST
+       
+       DateTimeSaveValue += "20160703T091000Z";
+       
+#else
+    
+       DateTimeSaveValue += wxString::Format("%04i", DateTimeSave.GetYear());
+       DateTimeSaveValue += wxString::Format("%02i", (DateTimeSave.GetMonth() + 1));
+       DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetDay());
+       DateTimeSaveValue += "T";
+       DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetHour());
+       DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetMinute());
+       DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetSecond());
+       DateTimeSaveValue += "Z";
+    
+#endif
+       
+       if (!RevisionTokens.IsEmpty()){
+               
+               ProcessData.Append("REV;");
+               ProcessData.Append(RevisionTokens);
+               ProcessData.Append(":");
+               ProcessData.Append(DateTimeSaveValue);
+               ProcessData.Append("\n");
+               
+               ProcessData = OutputText(&ProcessData);
+               
+               SaveData->Append(ProcessData);
+               ProcessData.clear();            
+               
+       } else {
+       
+               ProcessData.Append("REV:");
+               ProcessData.Append(DateTimeSaveValue);
+               ProcessData.Append("\n");
+               
+               ProcessData = OutputText(&ProcessData);
+               
+               SaveData->Append(ProcessData);
+               ProcessData.clear();
+               
+       }
        
        // Process XML.
 
@@ -310,8 +357,12 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
 
        // TODO: Process IMPP.
        
+       
+       
        // TODO: Process TEL.
        
+       
+       
        // Process LANG.
        
        SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID, 
index bab693e..8afffd6 100644 (file)
@@ -30,6 +30,7 @@ TEST(ContactSave, ContactSaveTests){
        wxString SaveDataCompare = "BEGIN:VCARD\n"
        "VERSION:4.0\n"
        "PRODID:-//Xestia//Address Book Unit Testing//KW\n"
+       "REV:20160703T091000Z\n"
        "FN:Test vCard\n"
        "TITLE:Knight of the Tests\n"
        "TITLE:The Tester of Cornwall\n"
@@ -47,6 +48,7 @@ TEST(ContactSave, ContactSaveTests){
        SaveDataCompare = "BEGIN:VCARD\n"
        "VERSION:4.0\n"
        "PRODID:-//Xestia//Address Book Unit Testing//KW\n"
+       "REV:20160703T091000Z\n"
        "FN:Test vCard\n"
        "TITLE:The Third Title\n"
        "TITLE:Knight of the Tests\n"
@@ -62,6 +64,7 @@ TEST(ContactSave, ContactSaveTests){
        "PRODID:-//Xestia//Address Book Unit Testing//KW\n"
        "UID:903588-9082374-989120310-AAFECDBCDF\n"
        "KIND:individual\n"
+       "REV;TEST=YES;DATA=NO;MORE=MAYBE:20160703T091000Z\n"
        "XML:<a xmlns=\"http://www.w3.org/1999/xhtml\"\\n   href=\"http://example.com/\">Ex\n"
        " ample Page 1</a>\n"
        "XML;ALTID=3:<a xmlns=\"http://www.w3.org/1999/xhtml\"\\n   href=\"http://example.\n"
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