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

index 540b5ec..642ea5c 100644 (file)
@@ -592,6 +592,13 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                &SoundsListPref, &SoundsListTokens, 
                SaveData);
 
+       // Process CALURI.
+       
+       SaveCalendarURI(&CalendarList, &CalendarListMediatype,
+               &CalendarListAltID, &CalendarListPID,
+               &CalendarListType, &CalendarListPref,
+               &CalendarListTokens, SaveData);
+
        // Write the end part of the vCard data file.
        
        SaveData->Append("END:VCARD");
@@ -1942,4 +1949,83 @@ void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxStrin
                        
        }
                
+}
+
+void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
+       map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
+       map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
+       map<int, wxString> *CalendarListTokens, wxString *SaveData){
+
+       wxString ProcessData = "";
+               
+       for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
+               CalendarIter != CalendarList->end(); CalendarIter++){
+
+               ProcessData.Append("CALURI");
+                       
+               // Check if there is a value for TYPE.
+               
+               if ((*CalendarListType)[CalendarIter->first].size() > 0){
+               
+                       ProcessData.Append(";TYPE=");
+                       ProcessData.Append((*CalendarListType)[CalendarIter->first]);
+                       
+               }
+               
+               // Check if there is a value for ALTID.
+               
+               if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
+                       
+               }
+
+               // Check if there is a value for MEDIATYPE.
+               
+               if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
+               
+                       ProcessData.Append(";MEDIATYPE=");
+                       ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
+                       
+               }
+               
+               // Check if there is a value for PID.
+
+               if ((*CalendarListPID)[CalendarIter->first].size() > 0){
+               
+                       ProcessData.Append(";PID=");
+                       ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
+                       
+               }
+
+               // Check if there is a value for PREF.
+
+               if ((*CalendarListPref)[CalendarIter->first] > 0){
+               
+                       ProcessData.Append(";PREF=");
+                       ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
+                       
+               }
+
+               // Check if there is a value for tokens.
+
+               if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
+                       
+               }
+                       
+               ProcessData.Append(":");
+               ProcessData.Append(CalendarIter->second);
+               ProcessData.Append("\n");
+
+               ProcessData = OutputText(&ProcessData);
+               
+               SaveData->Append(ProcessData);
+               ProcessData.clear();
+                       
+       }
+               
 }
\ No newline at end of file
index 9bb8773..1a47af9 100644 (file)
@@ -172,6 +172,10 @@ class ContactDataObject{
                map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage, 
                map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens, 
                wxString *SaveData);
+       void SaveCalendarURI(std::map<int, wxString> *CalendarList, std::map<int, wxString> *CalendarListAltID, 
+               std::map<int, wxString> *CalendarListPID, std::map<int, wxString> *CalendarListType,
+               std::map<int, wxString> *CalendarListMediatype, std::map<int, int> *CalendarListPref, 
+               std::map<int, wxString> *CalendarListTokens, wxString *SaveData);
 
        public:
 
index 8a09b03..b2be408 100644 (file)
@@ -544,6 +544,12 @@ TEST(ContactSave, ContactSaveTests){
        " rOiaKk49EpYoqYecozQYDhT04juULDYbJn7IXeksuXpi2v2irciAXICHx2PAvM4SVoUKcberP+c9\n"
        " c+Pj7unVvPkyBqbwKmHWBSOj4S4e7W5oSH9nHhrW1jnyCtQZClVD86hh6E7vpEDb8Ny+AbwuSlI+\n"
        " b4KyFDt6/fEADBnCOeFgDID42jkBQ+wFjNEAGMJtbcK5WgAODg==\n"
+       "CALURI;ALTID=34;MEDIATYPE=text/plain;PID=31;PREF=32;CALENDARS=FLYING:http://e\n"
+       " xample.com\n"
+       "CALURI;TYPE=home;ALTID=44;MEDIATYPE=text/dryplain;PID=41;PREF=42;CALENDARS=GR\n"
+       " OUNDED:http://example.com/home\n"
+       "CALURI;TYPE=work;ALTID=54;MEDIATYPE=text/stillwetink;PID=51;PREF=52;CALENDARS\n"
+       " =CANCELLED:http://example.com/business\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