Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added RELATED to the SaveString function of ContactDataObject
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Wed, 29 Jun 2016 19:55:43 +0000 (20:55 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Wed, 29 Jun 2016 19:55:43 +0000 (20:55 +0100)
source/contacteditor/cdo/ContactDataObject-Save.cpp
source/tests/xestiaab_contactsave.h

index b7d2688..6276454 100644 (file)
@@ -334,6 +334,169 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                &BusinessGeographyListPref, &BusinessGeographyListTokens, 
                SaveData, "work");
 
+       // Process RELATED.
+       
+       int Moo = 0;
+
+       for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
+               RelatedIter != GeneralRelatedList.end(); RelatedIter++){
+               
+               ProcessData.Append("RELATED");
+
+               // Check if there is a value for TYPE.
+               
+               if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
+               
+                       wxString RelatedType = "";
+                       
+                       ProcessData.Append(";TYPE=");
+                       
+                       if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
+
+                               RelatedType = wxT("contact");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
+
+                               RelatedType = wxT("acquaintance");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
+
+                               RelatedType = wxT("friend");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
+
+                               RelatedType = wxT("met");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
+
+                               RelatedType = wxT("co-worker");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
+
+                               RelatedType = wxT("colleague");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
+
+                               RelatedType = wxT("co-resident");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
+
+                               RelatedType = wxT("neighbor");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
+
+                               RelatedType = wxT("child");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
+
+                               RelatedType = wxT("parent");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
+
+                               RelatedType = wxT("sibling");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
+
+                               RelatedType = wxT("spouse");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
+
+                               RelatedType = wxT("kin");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
+
+                               RelatedType = wxT("muse");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
+
+                               RelatedType = wxT("crush");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
+
+                               RelatedType = wxT("date");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
+
+                               RelatedType = wxT("sweetheart");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
+
+                               RelatedType = wxT("me");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
+
+                               RelatedType = wxT("agent");
+
+                       } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
+
+                               RelatedType = wxT("emergency");
+
+                       } else {
+
+                               RelatedType = GeneralRelatedListRelType[RelatedIter->first];
+
+                       }
+                       
+                       ProcessData.Append(RelatedType);
+                       
+               }
+
+               // Check if there is a value for LANGUAGE.
+               
+               if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
+               
+                       ProcessData.Append(";LANGUAGE=");
+                       ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
+                       
+               }
+               
+               // Check if there is a value for ALTID.
+               
+               if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
+                       
+               }
+               
+               // Check if there is a value for PID.
+
+               if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
+               
+                       ProcessData.Append(";PID=");
+                       ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
+                       
+               }
+
+               // Check if there is a value for PREF.
+
+               if (GeneralRelatedListPref[RelatedIter->first] > 0){
+               
+                       ProcessData.Append(";PREF=");
+                       ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
+                       
+               }
+
+               // Check if there is a value for tokens.
+
+               if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
+                       
+               }
+               
+               ProcessData.Append(":");
+               ProcessData.Append(RelatedIter->second);
+               ProcessData.Append("\n");
+               
+               ProcessData = OutputText(&ProcessData);
+               
+               SaveData->Append(ProcessData);
+               ProcessData.clear();
+                       
+       }
+
        // Write the end part of the vCard data file.
        
        SaveData->Append("END:VCARD");
index ab44064..9f7a587 100644 (file)
@@ -118,6 +118,9 @@ TEST(ContactSave, ContactSaveTests){
        " :7.0,7.0\n"
        "GEO;TYPE=work;ALTID=75;MEDIATYPE=text/greenplain;PID=32;PREF=4;POS=Money:geo:\n"
        " 14.0,14.0\n"
+       "RELATED;TYPE=kin;ALTID=5;PID=10;PREF=20;OPTION=Yes:Friend Test\n"
+       "RELATED;TYPE=spouse;ALTID=1;PID=2;PREF=3;OPTION=No:Friend Test Two\n"
+       "RELATED;TYPE=muse;ALTID=4;PID=5;PREF=6;OPTION=Maybe:Friend Test Three\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