Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added X-* to the SaveString function of ContactDataObject
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 2 Jul 2016 22:06:47 +0000 (23:06 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 2 Jul 2016 22:06:47 +0000 (23:06 +0100)
source/contacteditor/cdo/ContactDataObject-Save.cpp
source/contacteditor/cdo/ContactDataObject.h
source/tests/xestiaab_contactsave.h

index 8a04c55..b78bdc0 100644 (file)
@@ -626,6 +626,11 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
        SaveVendor(&VendorList, &VendorListPEN, 
                &VendorListElement, SaveData);
 
+       // Process X-Tokens.
+       
+       SaveXToken(&XTokenList, &XTokenListTokens, 
+               SaveData);
+
        // Write the end part of the vCard data file.
        
        SaveData->Append("END:VCARD");
@@ -2313,4 +2318,27 @@ void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxSt
                        
        }
                
+}
+
+void ContactDataObject::SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens, 
+       wxString *SaveData){
+
+       wxString ProcessData = "";
+               
+       for (std::map<int, wxString>::iterator XTokenIter = XTokenList->begin();
+               XTokenIter != XTokenList->end(); XTokenIter++){
+
+               ProcessData.Append("X-");
+               ProcessData.Append((*XTokenListTokens)[XTokenIter->first]);
+               ProcessData.Append(":");
+               ProcessData.Append(XTokenIter->second);
+               ProcessData.Append("\n");
+
+               ProcessData = OutputText(&ProcessData);
+               
+               SaveData->Append(ProcessData);
+               ProcessData.clear();
+                       
+       }       
+               
 }
\ No newline at end of file
index 6886fcd..24451f1 100644 (file)
@@ -191,6 +191,8 @@ class ContactDataObject{
                map<int, wxString> *KeyListTokens, wxString *SaveData);
        void SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN, 
                map<int, wxString> *VendorListElement, wxString *SaveData);
+       void SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens, 
+               wxString *SaveData);
 
        public:
 
index 7261f8c..bab693e 100644 (file)
@@ -682,6 +682,15 @@ TEST(ContactSave, ContactSaveTests){
        "VND-696-CAKE:Lemon\n"
        "VND-696-DRINK:Orange\n"
        "VND-696-MUSIC:Shiena Nishizawa\n"
+       "X-FARM:Yard\n"
+       "X-FARM:Animals\n"
+       "X-FARM;LOCATION=Back;TYPE=Vehicles:Shed\n"
+       "X-DISKSERIAL:14444\n"
+       "X-DISKSERIAL:7555\n"
+       "X-DISKSERIAL;STATUS=DESTROYED;TYPE=FLASH:3250539032590\n"
+       "X-FOODS;STATUS=HIGH:Lemon Cake\n"
+       "X-FOODS;STATUS=LOW:Starrey Gazey Pie\n"
+       "X-FOODS;STATUS=FAVOURITE;TYPE=CHEESEANDONION:Cornish Pasties\n"
        "END:VCARD";
 
        ASSERT_EQ(CONTACTLOAD_OK, TestFile3.LoadFile("LoadCheck-Load4.vcf"));
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