From: Steve Brokenshire Date: Sat, 2 Jul 2016 19:11:46 +0000 (+0100) Subject: Added CALADRURI to the SaveString function of ContactDataObject X-Git-Tag: release-0.14~29 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=c6e1c40cb86bed7b264cba6b2e6a70cc1f584dfa;p=xestiaab%2F.git Added CALADRURI to the SaveString function of ContactDataObject --- diff --git a/source/contacteditor/cdo/ContactDataObject-Save.cpp b/source/contacteditor/cdo/ContactDataObject-Save.cpp index 642ea5c..bf755f1 100644 --- a/source/contacteditor/cdo/ContactDataObject-Save.cpp +++ b/source/contacteditor/cdo/ContactDataObject-Save.cpp @@ -598,6 +598,13 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){ &CalendarListAltID, &CalendarListPID, &CalendarListType, &CalendarListPref, &CalendarListTokens, SaveData); + + // Process CALADRURI. + + SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype, + &CalendarRequestListAltID, &CalendarRequestListPID, + &CalendarRequestListType, &CalendarRequestListPref, + &CalendarRequestListTokens, SaveData); // Write the end part of the vCard data file. @@ -2028,4 +2035,83 @@ void ContactDataObject::SaveCalendarURI(map *CalendarList, map *CalendarRequestList, map *CalendarRequestListMediatype, + map *CalendarRequestListAltID, map *CalendarRequestListPID, + map *CalendarRequestListType, map *CalendarRequestListPref, + map *CalendarRequestListTokens, wxString *SaveData){ + + wxString ProcessData = ""; + + for (std::map::iterator CalendarRequestIter = CalendarRequestList->begin(); + CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){ + + ProcessData.Append("CALADRURI"); + + // Check if there is a value for TYPE. + + if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]); + + } + + // Check if there is a value for ALTID. + + if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]); + + } + + // Check if there is a value for MEDIATYPE. + + if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){ + + ProcessData.Append(";MEDIATYPE="); + ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]); + + } + + // Check if there is a value for PID. + + if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(CalendarRequestIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + } \ No newline at end of file diff --git a/source/contacteditor/cdo/ContactDataObject.h b/source/contacteditor/cdo/ContactDataObject.h index 1a47af9..db79545 100644 --- a/source/contacteditor/cdo/ContactDataObject.h +++ b/source/contacteditor/cdo/ContactDataObject.h @@ -176,6 +176,10 @@ class ContactDataObject{ std::map *CalendarListPID, std::map *CalendarListType, std::map *CalendarListMediatype, std::map *CalendarListPref, std::map *CalendarListTokens, wxString *SaveData); + void SaveCalendarRequestURI(std::map *CalendarRequestList, std::map *CalendarRequestListAltID, + std::map *CalendarRequestListPID, std::map *CalendarRequestListType, + std::map *CalendarRequestListMediatype, std::map *CalendarRequestListPref, + std::map *CalendarRequestListTokens, wxString *SaveData); public: diff --git a/source/tests/xestiaab_contactsave.h b/source/tests/xestiaab_contactsave.h index b2be408..524b835 100644 --- a/source/tests/xestiaab_contactsave.h +++ b/source/tests/xestiaab_contactsave.h @@ -550,6 +550,12 @@ TEST(ContactSave, ContactSaveTests){ " 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" + "CALADRURI;ALTID=14;MEDIATYPE=text/plain;PID=11;PREF=12;REQUEST=YES:http://exa\n" + " mple.com/request\n" + "CALADRURI;TYPE=home;ALTID=24;MEDIATYPE=text/dryplain;PID=21;PREF=22;REQUEST=M\n" + " AYBE:http://example.com/home/request\n" + "CALADRURI;TYPE=work;ALTID=34;MEDIATYPE=text/stillwetink;PID=31;PREF=32;REQUES\n" + " T=NO:http://example.com/business/request\n" "END:VCARD"; ASSERT_EQ(CONTACTLOAD_OK, TestFile3.LoadFile("LoadCheck-Load4.vcf"));