X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2Fcdo%2FContactDataObject-Save.cpp;h=9e3db13f9523c27c6978153995b10c1d11bea76f;hb=316e255b6797f8b7a63ccd62e50e39cfcc474c11;hp=8a0f2b7f620a524dc50a088d9212ee804f2634f2;hpb=4417b88a03989fadac9099843cbcb107e66ffa0a;p=xestiaab%2F.git diff --git a/source/contacteditor/cdo/ContactDataObject-Save.cpp b/source/contacteditor/cdo/ContactDataObject-Save.cpp index 8a0f2b7..9e3db13 100644 --- a/source/contacteditor/cdo/ContactDataObject-Save.cpp +++ b/source/contacteditor/cdo/ContactDataObject-Save.cpp @@ -19,6 +19,35 @@ #include "ContactDataObject.h" #include "../../version.h" +ContactSaveStatus ContactDataObject::SaveFile(wxString SaveFilename){ + + // Get the data using SaveString. + + wxString SaveData = ""; + SaveString(&SaveData); + + // Open a file and try to write into it. + + wxFile ContactFile; + + if (!ContactFile.Open(SaveFilename, wxFile::write, wxS_DEFAULT)){ + + return CONTACTSAVE_FILEERROR; + + } + + if (ContactFile.Write(SaveData, wxConvUTF8) == false){ + + return CONTACTSAVE_WRITEERROR; + + } + + ContactFile.Close(); + + return CONTACTSAVE_OK; + +} + ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){ ContactSaveStatus SaveDataStatus = CONTACTSAVE_UNITTESTFAIL; @@ -36,40 +65,2836 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){ #else - SaveData->Append(wxT("-//Xestia//Address Book Version ")); + SaveData->Append(wxT("PRODID:-//Xestia//Address Book Version ")); SaveData->Append(wxT(XSDAB_VERSION)); SaveData->Append(wxT("//KW\n")); #endif + + wxString ProcessData = ""; + + // Process UID. + + if (UIDToken.size() > 0){ + + ProcessData.Append("UID:"); + ProcessData.Append(UIDToken); + ProcessData.Append("\n"); + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + + // Process KIND. + + switch(ContactKind){ + + case CONTACTKIND_NONE: + break; + case CONTACTKIND_INDIVIDUAL: + SaveData->Append("KIND:individual\n"); + break; + case CONTACTKIND_GROUP: + SaveData->Append("KIND:group\n"); + break; + case CONTACTKIND_ORGANISATION: + SaveData->Append("KIND:org\n"); + break; + case CONTACTKIND_LOCATION: + SaveData->Append("KIND:location\n"); + break; + default: + break; + + } + + // 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. + + for (std::map::iterator XMLIter = XMLList.begin(); + XMLIter != XMLList.end(); XMLIter++){ + + ProcessData.Append("XML"); + + if (XMLListAltID[XMLIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append(XMLListAltID[XMLIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(XMLIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + + // Process SOURCE. + + SaveSource(&SourceList, &SourceListAltID, + &SourceListPID, &SourceListType, + &SourceListMediatype, &SourceListPref, + &SourceListTokens, SaveData); + + // Process MEMBER (if contact kind is CONTACTKIND_GROUP). + + if (ContactKind == CONTACTKIND_GROUP){ + + SaveMember(&GroupsList, &GroupsListAltID, + &GroupsListPID, &GroupsListType, + &GroupsListMediaType, &GroupsListPref, + &GroupsListTokens, SaveData); + + } + + // Process CLIENTPIDMAP. + + for (std::map::iterator CPIDIter = ClientPIDList.begin(); + CPIDIter != ClientPIDList.end(); CPIDIter++){ + + ProcessData.Append("CLIENTPIDMAP"); + + if (ClientPIDListTokens[CPIDIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append(ClientPIDListTokens[CPIDIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(CPIDIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } // Process FN. for (std::map::iterator FNIter = FullNamesList.begin(); FNIter != FullNamesList.end(); FNIter++){ - SaveData->Append("FN:"); - SaveData->Append(FNIter->second); - SaveData->Append("\n"); + ProcessData.Append("FN"); + + // Check if there is a value for TYPE. + + if (FullNamesListType[FNIter->first].size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append(FullNamesListType[FNIter->first]); + + } + + // Check if there is a value for LANGUAGE. + + if (FullNamesListLanguage[FNIter->first].size() > 0){ + + ProcessData.Append(";LANGUAGE="); + ProcessData.Append(FullNamesListLanguage[FNIter->first]); + + } + + // Check if there is a value for ALTID. + + if (FullNamesListAltID[FNIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append(FullNamesListAltID[FNIter->first]); + + } + + // Check if there is a value for PID. + + if (FullNamesListPID[FNIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append(FullNamesListPID[FNIter->first]); + + } + + // Check if there is a value for PREF. + + if (FullNamesListPref[FNIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", FullNamesListPref[FNIter->first])); + + } + + // Check if there is a value for tokens. + + if (FullNamesListTokens[FNIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append(FullNamesListTokens[FNIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(FNIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); } - // Process TITLE. + // Process N. + + if (!NameTitle.IsEmpty() || !NameForename.IsEmpty() || !NameSurname.IsEmpty() || + !NameOtherNames.IsEmpty() || !NameSuffix.IsEmpty()){ + + ProcessData.Append("N"); + + // Check if there is a value for ALTID. + + if (NameAltID.size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append(NameAltID); + + } + + // Check if there is a value for LANGUAGE. + + if (NameLanguage.size() > 0){ + + ProcessData.Append(";LANGUAGE="); + ProcessData.Append(NameLanguage); + + } + + // Check if there is a value for SORT-AS. + + if (NameDisplayAs.size() > 0){ + + ProcessData.Append(";SORT-AS=\""); + ProcessData.Append(NameDisplayAs); + ProcessData.Append("\""); + + } + + // Check if there is a value for tokens. + + if (NameTokens.size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append(NameTokens); + + } + + ProcessData.Append(":"); + ProcessData.Append(NameSurname); + ProcessData.Append(";"); + ProcessData.Append(NameForename); + ProcessData.Append(";"); + ProcessData.Append(NameOtherNames); + ProcessData.Append(";"); + ProcessData.Append(NameTitle); + ProcessData.Append(";"); + ProcessData.Append(NameSuffix); + + ProcessData.Append("\n"); - for (std::map::iterator TitleIter = GeneralTitleList.begin(); - TitleIter != GeneralTitleList.end(); TitleIter++){ + ProcessData = OutputText(&ProcessData); - SaveData->Append("TITLE:"); - SaveData->Append(TitleIter->second); - SaveData->Append("\n"); + SaveData->Append(ProcessData); + ProcessData.clear(); } - // Write the end part of the vCard data file. + // Process NICKNAME. - SaveData->Append("END:VCARD"); + SaveNickname(&GeneralNicknamesList, &GeneralNicknamesListAltID, + &GeneralNicknamesListPID, &GeneralNicknamesListType, + &GeneralNicknamesListLanguage, &GeneralNicknamesListPref, + &GeneralNicknamesListTokens, SaveData, ""); + SaveNickname(&HomeNicknamesList, &HomeNicknamesListAltID, + &HomeNicknamesListPID, &HomeNicknamesListType, + &HomeNicknamesListLanguage, &HomeNicknamesListPref, + &HomeNicknamesListTokens, SaveData, "home"); + SaveNickname(&BusinessNicknamesList, &BusinessNicknamesListAltID, + &BusinessNicknamesListPID, &BusinessNicknamesListType, + &BusinessNicknamesListLanguage, &BusinessNicknamesListPref, + &BusinessNicknamesListTokens, SaveData, "work"); - SaveDataStatus = CONTACTSAVE_OK; + // Process GENDER. - return SaveDataStatus; + if (Gender.size() > 0){ + + ProcessData.Append("GENDER"); + + if (GenderTokens.size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append(GenderTokens); + + } + + ProcessData.Append(":"); + ProcessData.Append(Gender); + + if (GenderDetails.size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append(GenderDetails); + + } + + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + + // Process BDAY. + + if (Birthday.size() > 0){ + + ProcessData.Append("BDAY"); + + // Check if there is a value for ALTID. + + if (BirthdayAltID.size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append(BirthdayAltID); + + } + + // Check if there is a value for CALSCALE. + + if (BirthdayAltID.size() > 0){ + + ProcessData.Append(";CALSCALE="); + ProcessData.Append(BirthdayCalScale); + + } + + // Check if there is a value for tokens. + + if (BirthdayTokens.size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append(BirthdayTokens); + + } + + ProcessData.Append(":"); + ProcessData.Append(Birthday); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + + // Process ANNIVERSARY. + + if (Anniversary.size() > 0){ + + ProcessData.Append("ANNIVERSARY"); + + // Check if there is a value for ALTID. + + if (AnniversaryAltID.size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append(AnniversaryAltID); + + } + + // Check if there is a value for CALSCALE. + + if (AnniversaryAltID.size() > 0){ + + ProcessData.Append(";CALSCALE="); + ProcessData.Append(AnniversaryCalScale); + + } + + // Check if there is a value for tokens. + + if (AnniversaryTokens.size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append(AnniversaryTokens); + + } + + ProcessData.Append(":"); + ProcessData.Append(Anniversary); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + + // Process TITLE. + + SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage, + &GeneralTitleListAltID, &GeneralTitleListPID, + &GeneralTitleListType, &GeneralTitleListPref, + &GeneralTitleListTokens, SaveData, ""); + SaveTitle(&HomeTitleList, &HomeTitleListLanguage, + &HomeTitleListAltID, &HomeTitleListPID, + &HomeTitleListType, &HomeTitleListPref, + &HomeTitleListTokens, SaveData, "home"); + SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage, + &BusinessTitleListAltID, &BusinessTitleListPID, + &BusinessTitleListType, &BusinessTitleListPref, + &BusinessTitleListTokens, SaveData, "work"); + + // Process TZ. + + SaveTimezone(&GeneralTZList, &GeneralTZListAltID, + &GeneralTZListPID, &GeneralTZListType, + &GeneralTZListMediatype, &GeneralTZListPref, + &GeneralTZListTokens, SaveData, ""); + SaveTimezone(&HomeTZList, &HomeTZListAltID, + &HomeTZListPID, &HomeTZListType, + &HomeTZListMediatype, &HomeTZListPref, + &HomeTZListTokens, SaveData, "home"); + SaveTimezone(&BusinessTZList, &BusinessTZListAltID, + &BusinessTZListPID, &BusinessTZListType, + &BusinessTZListMediatype, &BusinessTZListPref, + &BusinessTZListTokens, SaveData, "work"); + + // Process ADR. + + SaveAddress(&GeneralAddressList, &GeneralAddressListTown, + &GeneralAddressListCounty, &GeneralAddressListPostCode, + &GeneralAddressListCountry, &GeneralAddressListLabel, + &GeneralAddressListLang, &GeneralAddressListAltID, + &GeneralAddressListPID, &GeneralAddressListGeo, + &GeneralAddressListTimezone, &GeneralAddressListType, + &GeneralAddressListMediatype, &GeneralAddressListPref, + &GeneralAddressListTokens, SaveData, ""); + SaveAddress(&HomeAddressList, &HomeAddressListTown, + &HomeAddressListCounty, &HomeAddressListPostCode, + &HomeAddressListCountry, &HomeAddressListLabel, + &HomeAddressListLang, &HomeAddressListAltID, + &HomeAddressListPID, &HomeAddressListGeo, + &HomeAddressListTimezone, &HomeAddressListType, + &HomeAddressListMediatype, &HomeAddressListPref, + &HomeAddressListTokens, SaveData, "home"); + SaveAddress(&BusinessAddressList, &BusinessAddressListTown, + &BusinessAddressListCounty, &BusinessAddressListPostCode, + &BusinessAddressListCountry, &BusinessAddressListLabel, + &BusinessAddressListLang, &BusinessAddressListAltID, + &BusinessAddressListPID, &BusinessAddressListGeo, + &BusinessAddressListTimezone, &BusinessAddressListType, + &BusinessAddressListMediatype, &BusinessAddressListPref, + &BusinessAddressListTokens, SaveData, "work"); + + // Process EMAIL. + + SaveEmail(&GeneralEmailList, &GeneralEmailListAltID, + &GeneralEmailListPID, &GeneralEmailListType, + &GeneralEmailListPref, &GeneralEmailListTokens, + SaveData, ""); + SaveEmail(&HomeEmailList, &HomeEmailListAltID, + &HomeEmailListPID, &HomeEmailListType, + &HomeEmailListPref, &HomeEmailListTokens, + SaveData, "home"); + SaveEmail(&BusinessEmailList, &BusinessEmailListAltID, + &BusinessEmailListPID, &BusinessEmailListType, + &BusinessEmailListPref, &BusinessEmailListTokens, + SaveData, "work"); + + // Process IMPP. + + SaveIMPP(&GeneralIMList, &GeneralIMListAltID, + &GeneralIMListPID, &GeneralIMListType, + &GeneralIMListTypeInfo, &GeneralIMListMediatype, + &GeneralIMListPref, &GeneralIMListTokens, + SaveData, ""); + SaveIMPP(&HomeIMList, &HomeIMListAltID, + &HomeIMListPID, &HomeIMListType, + &HomeIMListTypeInfo, &HomeIMListMediatype, + &HomeIMListPref, &HomeIMListTokens, + SaveData, "home"); + SaveIMPP(&BusinessIMList, &BusinessIMListAltID, + &BusinessIMListPID, &BusinessIMListType, + &BusinessIMListTypeInfo, &BusinessIMListMediatype, + &BusinessIMListPref, &BusinessIMListTokens, + SaveData, "work"); + + // Process TEL. + + SaveTelephone(&GeneralTelephoneList, &GeneralTelephoneListAltID, + &GeneralTelephoneListPID, &GeneralTelephoneListType, + &GeneralTelephoneListTypeInfo, &GeneralTelephoneListDataType, + &GeneralTelephoneListPref, &GeneralTelephoneListTokens, + SaveData, ""); + SaveTelephone(&HomeTelephoneList, &HomeTelephoneListAltID, + &HomeTelephoneListPID, &HomeTelephoneListType, + &HomeTelephoneListTypeInfo, &HomeTelephoneListDataType, + &HomeTelephoneListPref, &HomeTelephoneListTokens, + SaveData, "home"); + SaveTelephone(&BusinessTelephoneList, &BusinessTelephoneListAltID, + &BusinessTelephoneListPID, &BusinessTelephoneListType, + &BusinessTelephoneListTypeInfo, &BusinessTelephoneListDataType, + &BusinessTelephoneListPref, &BusinessTelephoneListTokens, + SaveData, "work"); + + // Process LANG. + + SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID, + &GeneralLanguageListPID, &GeneralLanguageListType, + &GeneralLanguageListPref, &GeneralLanguageListTokens, + SaveData, ""); + SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID, + &HomeLanguageListPID, &HomeLanguageListType, + &HomeLanguageListPref, &HomeLanguageListTokens, + SaveData, "home"); + SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID, + &BusinessLanguageListPID, &BusinessLanguageListType, + &BusinessLanguageListPref, &BusinessLanguageListTokens, + SaveData, "work"); + + // Process GEO. + + SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID, + &GeneralGeographyListPID, &GeneralGeographyListType, + &GeneralGeographyListMediatype, &GeneralGeographyListDataType, + &GeneralGeographyListPref, &GeneralGeographyListTokens, + SaveData, ""); + SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID, + &HomeGeographyListPID, &HomeGeographyListType, + &HomeGeographyListMediatype, &HomeGeographyListDataType, + &HomeGeographyListPref, &HomeGeographyListTokens, + SaveData, "home"); + SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID, + &BusinessGeographyListPID, &BusinessGeographyListType, + &BusinessGeographyListMediatype, &BusinessGeographyListDataType, + &BusinessGeographyListPref, &BusinessGeographyListTokens, + SaveData, "work"); + + // Process RELATED. + int Moo = 0; + + for (std::map::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(); + + } + + // Process URL. + + SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID, + &GeneralWebsiteListPID, &GeneralWebsiteListType, + &GeneralWebsiteListMediatype, &GeneralWebsiteListPref, + &GeneralWebsiteListTokens, SaveData, ""); + SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID, + &HomeWebsiteListPID, &HomeWebsiteListType, + &HomeWebsiteListMediatype, &HomeWebsiteListPref, + &HomeWebsiteListTokens, SaveData, "home"); + SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID, + &BusinessWebsiteListPID, &BusinessWebsiteListType, + &BusinessWebsiteListMediatype, &BusinessWebsiteListPref, + &BusinessWebsiteListTokens, SaveData, "work"); + + // Process ROLE. + + SaveRole(&GeneralRoleList, &GeneralRoleListLanguage, + &GeneralRoleListAltID, &GeneralRoleListPID, + &GeneralRoleListType, &GeneralRoleListPref, + &GeneralRoleListTokens, SaveData, ""); + SaveRole(&HomeRoleList, &HomeRoleListLanguage, + &HomeRoleListAltID, &HomeRoleListPID, + &HomeRoleListType, &HomeRoleListPref, + &HomeRoleListTokens, SaveData, "home"); + SaveRole(&BusinessRoleList, &BusinessRoleListLanguage, + &BusinessRoleListAltID, &BusinessRoleListPID, + &BusinessRoleListType, &BusinessRoleListPref, + &BusinessRoleListTokens, SaveData, "work"); + + // Process ORG. + + SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID, + &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage, + &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType, + &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens, + SaveData, ""); + SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID, + &HomeOrganisationsListPID, &HomeOrganisationsListLanguage, + &HomeOrganisationsListSortAs, &HomeOrganisationsListType, + &HomeOrganisationsListPref, &HomeOrganisationsListTokens, + SaveData, "home"); + SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID, + &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage, + &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType, + &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens, + SaveData, "work"); + + // Process NOTE. + + SaveNote(&GeneralNoteList, &GeneralNoteListLanguage, + &GeneralNoteListAltID, &GeneralNoteListPID, + &GeneralNoteListType, &GeneralNoteListPref, + &GeneralNoteListTokens, SaveData, ""); + SaveNote(&HomeNoteList, &HomeNoteListLanguage, + &HomeNoteListAltID, &HomeNoteListPID, + &HomeNoteListType, &HomeNoteListPref, + &HomeNoteListTokens, SaveData, "home"); + SaveNote(&BusinessNoteList, &BusinessNoteListLanguage, + &BusinessNoteListAltID, &BusinessNoteListPID, + &BusinessNoteListType, &BusinessNoteListPref, + &BusinessNoteListTokens, SaveData, "work"); + + // Process CATEGORIES. + + SaveCategory(&CategoriesList, &CategoriesListLanguage, + &CategoriesListAltID, &CategoriesListPID, + &CategoriesListType, &CategoriesListPref, + &CategoriesListTokens, SaveData); + + // Process PHOTO. + + SavePhoto(&PicturesList, &PicturesListAltID, + &PicturesListPID, &PicturesListType, + &PicturesListPicEncType, &PicturesListPictureType, + &PicturesListMediatype, &PicturesListPref, + &PicturesListTokens, SaveData); + + // Process LOGO. + + SaveLogo(&LogosList, &LogosListAltID, + &LogosListPID, &LogosListType, + &LogosListPicEncType, &LogosListPictureType, + &LogosListMediatype, &LogosListPref, + &LogosListTokens, SaveData); + + // Process SOUND. + + SaveSound(&SoundsList, &SoundsListAltID, + &SoundsListPID, &SoundsListType, + &SoundsListAudioEncType, &SoundsListAudioType, + &SoundsListMediatype, &SoundsListLanguage, + &SoundsListPref, &SoundsListTokens, + SaveData); + + // Process CALURI. + + SaveCalendarURI(&CalendarList, &CalendarListMediatype, + &CalendarListAltID, &CalendarListPID, + &CalendarListType, &CalendarListPref, + &CalendarListTokens, SaveData); + + // Process CALADRURI. + + SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype, + &CalendarRequestListAltID, &CalendarRequestListPID, + &CalendarRequestListType, &CalendarRequestListPref, + &CalendarRequestListTokens, SaveData); + + // Process FBURL. + + SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID, + &FreeBusyListPID, &FreeBusyListType, + &FreeBusyListMediatype, &FreeBusyListPref, + &FreeBusyListTokens, SaveData); + + // Process KEY. + + SaveKey(&KeyList, &KeyListAltID, + &KeyListPID, &KeyListType, + &KeyListKeyType, &KeyListDataEncType, + &KeyListDataType, &KeyListPref, + &KeyListTokens, SaveData); + + // Process VND-* + + 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"); + + SaveDataStatus = CONTACTSAVE_OK; + + return SaveDataStatus; + +} + +void ContactDataObject::SaveTitle(map *TitleList, map *TitleListLanguage, + map *TitleListAltID, map *TitleListPID, + map *TitleListType, map *TitleListPref, + map *TitleListTokens, wxString *SaveData, wxString DataType){ + + wxString ProcessData = ""; + + for (std::map::iterator TitleIter = TitleList->begin(); + TitleIter != TitleList->end(); TitleIter++){ + + ProcessData.Append("TITLE"); + + // Check if there is a value for TYPE. + + if (DataType.size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append(DataType); + + } + + // Check if there is a value for ALTID. + + if ((*TitleListAltID)[TitleIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*TitleListAltID)[TitleIter->first]); + + } + + // Check if there is a value for LANGUAGE. + + if ((*TitleListLanguage)[TitleIter->first].size() > 0){ + + ProcessData.Append(";LANGUAGE="); + ProcessData.Append((*TitleListLanguage)[TitleIter->first]); + + } + + // Check if there is a value for PID. + + if ((*TitleListPID)[TitleIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*TitleListPID)[TitleIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*TitleListPref)[TitleIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*TitleListTokens)[TitleIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*TitleListTokens)[TitleIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(TitleIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveSource(map *SourceList, map *SourceListAltID, + map *SourceListPID, map *SourceListType, + map *SourceListMediatype, map *SourceListPref, + map *SourceListTokens, wxString *SaveData){ + + wxString ProcessData = ""; + + for (std::map::iterator SourceIter = SourceList->begin(); + SourceIter != SourceList->end(); SourceIter++){ + + ProcessData.Append("SOURCE"); + + // Check if there is a value for TYPE. + + if ((*SourceListType)[SourceIter->first].size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append((*SourceListType)[SourceIter->first]); + + } + + // Check if there is a value for ALTID. + + if ((*SourceListAltID)[SourceIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*SourceListAltID)[SourceIter->first]); + + } + + // Check if there is a value for MEDIATYPE. + + if ((*SourceListMediatype)[SourceIter->first].size() > 0){ + + ProcessData.Append(";MEDIATYPE="); + ProcessData.Append((*SourceListMediatype)[SourceIter->first]); + + } + + // Check if there is a value for PID. + + if ((*SourceListPID)[SourceIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*SourceListPID)[SourceIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*SourceListPref)[SourceIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*SourceListTokens)[SourceIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*SourceListTokens)[SourceIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(SourceIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveMember(std::map *GroupsList, std::map *GroupsListAltID, + std::map *GroupsListPID, std::map *GroupsListType, + std::map *GroupsListMediaType, std::map *GroupsListPref, + std::map *GroupsListTokens, wxString *SaveData){ + + wxString ProcessData = ""; + + for (std::map::iterator GroupsIter = GroupsList->begin(); + GroupsIter != GroupsList->end(); GroupsIter++){ + + ProcessData.Append("MEMBER"); + + // Check if there is a value for TYPE. + + if ((*GroupsListType)[GroupsIter->first].size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append((*GroupsListType)[GroupsIter->first]); + + } + + // Check if there is a value for ALTID. + + if ((*GroupsListAltID)[GroupsIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*GroupsListAltID)[GroupsIter->first]); + + } + + // Check if there is a value for MEDIATYPE. + + if ((*GroupsListMediaType)[GroupsIter->first].size() > 0){ + + ProcessData.Append(";MEDIATYPE="); + ProcessData.Append((*GroupsListMediaType)[GroupsIter->first]); + + } + + // Check if there is a value for PID. + + if ((*GroupsListPID)[GroupsIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*GroupsListPID)[GroupsIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*GroupsListPref)[GroupsIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*GroupsListPref)[GroupsIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*GroupsListTokens)[GroupsIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*GroupsListTokens)[GroupsIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(GroupsIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveNickname(map *NicknameList, map *NicknameListAltID, + map *NicknameListPID, map *NicknameListType, + map *NicknameListLanguage, map *NicknameListPref, + map *NicknameListTokens, wxString *SaveData, wxString DataType){ + + wxString ProcessData = ""; + + for (std::map::iterator NicknameIter = NicknameList->begin(); + NicknameIter != NicknameList->end(); NicknameIter++){ + + ProcessData.Append("NICKNAME"); + + // Check if there is a value for TYPE. + + if (DataType.size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append(DataType); + + } + + // Check if there is a value for ALTID. + + if ((*NicknameListAltID)[NicknameIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*NicknameListAltID)[NicknameIter->first]); + + } + + // Check if there is a value for MEDIATYPE. + + if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){ + + ProcessData.Append(";LANGUAGE="); + ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]); + + } + + // Check if there is a value for PID. + + if ((*NicknameListPID)[NicknameIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*NicknameListPID)[NicknameIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*NicknameListPref)[NicknameIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*NicknameListTokens)[NicknameIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*NicknameListTokens)[NicknameIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(NicknameIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveTimezone(map *TZList, map *TZListAltID, + map *TZListPID, map *TZListType, + map *TZListMediatype, map *TZListPref, + map *TZListTokens, wxString *SaveData, wxString DataType){ + + wxString ProcessData = ""; + + for (std::map::iterator TZIter = TZList->begin(); + TZIter != TZList->end(); TZIter++){ + + ProcessData.Append("TZ"); + + // Check if there is a value for TYPE. + + if (DataType.size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append(DataType); + + } + + // Check if there is a value for ALTID. + + if ((*TZListAltID)[TZIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*TZListAltID)[TZIter->first]); + + } + + // Check if there is a value for MEDIATYPE. + + if ((*TZListMediatype)[TZIter->first].size() > 0){ + + ProcessData.Append(";MEDIATYPE="); + ProcessData.Append((*TZListMediatype)[TZIter->first]); + + } + + // Check if there is a value for PID. + + if ((*TZListPID)[TZIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*TZListPID)[TZIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*TZListPref)[TZIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*TZListTokens)[TZIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*TZListTokens)[TZIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(TZIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveAddress(map *AddressList, map *AddressListTown, + map *AddressListCounty, map *AddressListPostCode, + map *AddressListCountry, map *AddressListLabel, + map *AddressListLang, map *AddressListAltID, + map *AddressListPID, map *AddressListGeo, + map *AddressListTimezone, map *AddressListType, + map *AddressListMediatype, map *AddressListPref, + map *AddressListTokens, wxString *SaveData, wxString DataType){ + + wxString ProcessData = ""; + + for (std::map::iterator AddressIter = AddressList->begin(); + AddressIter != AddressList->end(); AddressIter++){ + + ProcessData.Append("ADR"); + + // Check if there is a value for TYPE. + + if (DataType.size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append(DataType); + + } + + // Check if there is a value for ALTID. + + if ((*AddressListAltID)[AddressIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*AddressListAltID)[AddressIter->first]); + + } + + // Check if there is a value for GEO. + + if ((*AddressListGeo)[AddressIter->first].size() > 0){ + + ProcessData.Append(";GEO=\""); + ProcessData.Append((*AddressListGeo)[AddressIter->first]); + ProcessData.Append("\""); + + } + + // Check if there is a value for LABEL. + + if ((*AddressListLabel)[AddressIter->first].size() > 0){ + + wxString AddressProcessed = ""; + AddressProcessed = (*AddressListLabel)[AddressIter->first]; + + AddressProcessed.Replace("\n", "\\n", true); + + ProcessData.Append(";LABEL="); + ProcessData.Append(AddressProcessed); + + } + + // Check if there is a value for LANGUAGE. + + if ((*AddressListLang)[AddressIter->first].size() > 0){ + + ProcessData.Append(";LANGUAGE="); + ProcessData.Append((*AddressListLang)[AddressIter->first]); + + } + + // Check if there is a value for MEDIATYPE. + + if ((*AddressListMediatype)[AddressIter->first].size() > 0){ + + ProcessData.Append(";MEDIATYPE="); + ProcessData.Append((*AddressListMediatype)[AddressIter->first]); + + } + + // Check if there is a value for PID. + + if ((*AddressListPID)[AddressIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*AddressListPID)[AddressIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*AddressListPref)[AddressIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first])); + + } + + // Check if there is a value for TZ. + + if ((*AddressListTimezone)[AddressIter->first].size() > 0){ + + ProcessData.Append(";TZ="); + ProcessData.Append((*AddressListTimezone)[AddressIter->first]); + + } + + // Check if there is a value for tokens. + + if ((*AddressListTokens)[AddressIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*AddressListTokens)[AddressIter->first]); + + } + + // Build the address. + + ProcessData.Append(":;;"); + ProcessData.Append((*AddressList)[AddressIter->first]); + ProcessData.Append(";"); + ProcessData.Append((*AddressListTown)[AddressIter->first]); + ProcessData.Append(";"); + ProcessData.Append((*AddressListCounty)[AddressIter->first]); + ProcessData.Append(";"); + ProcessData.Append((*AddressListPostCode)[AddressIter->first]); + ProcessData.Append(";"); + ProcessData.Append((*AddressListCountry)[AddressIter->first]); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveEmail(map *EmailList, map *EmailListAltID, + map *EmailListPID, map *EmailListType, + map *EmailListPref, map *EmailListTokens, + wxString *SaveData, wxString DataType){ + + wxString ProcessData = ""; + + for (std::map::iterator EmailIter = EmailList->begin(); + EmailIter != EmailList->end(); EmailIter++){ + + ProcessData.Append("EMAIL"); + + // Check if there is a value for TYPE. + + if (DataType.size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append(DataType); + + } + + // Check if there is a value for ALTID. + + if ((*EmailListAltID)[EmailIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*EmailListAltID)[EmailIter->first]); + + } + + // Check if there is a value for PID. + + if ((*EmailListPID)[EmailIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*EmailListPID)[EmailIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*EmailListPref)[EmailIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*EmailListTokens)[EmailIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*EmailListTokens)[EmailIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(EmailIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveIMPP(map *IMList, map *IMListAltID, + map *IMListPID, map *IMListType, + map *IMListTypeInfo, map *IMListMediatype, + map *IMListPref, map *IMListTokens, + wxString *SaveData, wxString DataType){ + + wxString ProcessData = ""; + + for (std::map::iterator IMIter = IMList->begin(); + IMIter != IMList->end(); IMIter++){ + + ProcessData.Append("IMPP"); + + // Check if there is a value for TYPE. + + if (DataType.size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append(DataType); + + } + + // Check if there is a value for ALTID. + + if ((*IMListAltID)[IMIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*IMListAltID)[IMIter->first]); + + } + + // Check if there is a value for MEDIATYPE. + + if ((*IMListMediatype)[IMIter->first].size() > 0){ + + ProcessData.Append(";MEDIATYPE="); + ProcessData.Append((*IMListMediatype)[IMIter->first]); + + } + + // Check if there is a value for PID. + + if ((*IMListPID)[IMIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*IMListPID)[IMIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*IMListPref)[IMIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*IMListPref)[IMIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*IMListTokens)[IMIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*IMListTokens)[IMIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append((*IMListTypeInfo)[IMIter->first]); + ProcessData.Append(":"); + ProcessData.Append(IMIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveTelephone(map *TelephoneList, map *TelephoneListAltID, + map *TelephoneListPID, map *TelephoneListType, + map *TelephoneListTypeInfo, map *TelephoneListDataType, + map *TelephoneListPref, map *TelephoneListTokens, + wxString *SaveData, wxString DataType){ + + wxString ProcessData = ""; + + for (std::map::iterator TelephoneIter = TelephoneList->begin(); + TelephoneIter != TelephoneList->end(); TelephoneIter++){ + + ProcessData.Append("TEL"); + + // Check if there is a value for TYPE. + + if (DataType.size() > 0 || (*TelephoneListAltID)[TelephoneIter->first].size() > 0){ + + ProcessData.Append(";TYPE=\""); + + bool ProcessedType = false; + + if (DataType.size() > 0){ + + ProcessData.Append(DataType); + ProcessedType = true; + + } + + if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){ + + if (ProcessedType == true){ + ProcessData.Append(","); + } + ProcessData.Append((*TelephoneListTypeInfo)[TelephoneIter->first]); + + } + + ProcessData.Append("\""); + + } + + // Check if there is a value for ALTID. + + if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*TelephoneListAltID)[TelephoneIter->first]); + + } + + // Check if there is a value for PID. + + if ((*TelephoneListPID)[TelephoneIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*TelephoneListPID)[TelephoneIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*TelephoneListPref)[TelephoneIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*TelephoneListPref)[TelephoneIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*TelephoneListTokens)[TelephoneIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*TelephoneListTokens)[TelephoneIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append((*TelephoneListDataType)[TelephoneIter->first]); + ProcessData.Append(":"); + ProcessData.Append(TelephoneIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveLanguage(map *LanguageList, map *LanguageListAltID, + map *LanguageListPID, map *LanguageListType, + map *LangaugeListPref, map *LanguageListTokens, + wxString *SaveData, wxString DataType){ + + wxString ProcessData = ""; + + for (std::map::iterator LanguageIter = LanguageList->begin(); + LanguageIter != LanguageList->end(); LanguageIter++){ + + ProcessData.Append("LANG"); + + // Check if there is a value for TYPE. + + if (DataType.size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append(DataType); + + } + + // Check if there is a value for ALTID. + + if ((*LanguageListAltID)[LanguageIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*LanguageListAltID)[LanguageIter->first]); + + } + + // Check if there is a value for PID. + + if ((*LanguageListPID)[LanguageIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*LanguageListPID)[LanguageIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*LangaugeListPref)[LanguageIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*LanguageListTokens)[LanguageIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*LanguageListTokens)[LanguageIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(LanguageIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveGeoposition(map *GeographyList, map *GeographyListAltID, + map *GeographyListPID, map *GeographyListType, + map *GeographyListMediatype, map *GeographyListDataType, + map *GeographyListPref, map *GeographyListTokens, + wxString *SaveData, wxString DataType){ + + wxString ProcessData = ""; + + for (std::map::iterator GeographyIter = GeographyList->begin(); + GeographyIter != GeographyList->end(); GeographyIter++){ + + ProcessData.Append("GEO"); + + // Check if there is a value for TYPE. + + if (DataType.size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append(DataType); + + } + + // Check if there is a value for ALTID. + + if ((*GeographyListAltID)[GeographyIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*GeographyListAltID)[GeographyIter->first]); + + } + + // Check if there is a value for MEDIATYPE. + + if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){ + + ProcessData.Append(";MEDIATYPE="); + ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]); + + } + + // Check if there is a value for PID. + + if ((*GeographyListPID)[GeographyIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*GeographyListPID)[GeographyIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*GeographyListPref)[GeographyIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*GeographyListTokens)[GeographyIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*GeographyListTokens)[GeographyIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append((*GeographyListDataType)[GeographyIter->first]); + ProcessData.Append(":"); + ProcessData.Append(GeographyIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveURL(map *WebsiteList, map *WebsiteListAltID, + map *WebsiteListPID, map *WebsiteListType, + map *WebsiteListMediatype, map *WebsiteListPref, + map *WebsiteListTokens, wxString *SaveData, wxString DataType){ + + wxString ProcessData = ""; + + for (std::map::iterator WebsiteIter = WebsiteList->begin(); + WebsiteIter != WebsiteList->end(); WebsiteIter++){ + + ProcessData.Append("URL"); + + // Check if there is a value for TYPE. + + if (DataType.size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append(DataType); + + } + + // Check if there is a value for ALTID. + + if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]); + + } + + // Check if there is a value for MEDIATYPE. + + if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){ + + ProcessData.Append(";MEDIATYPE="); + ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]); + + } + + // Check if there is a value for PID. + + if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*WebsiteListPref)[WebsiteIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(WebsiteIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveRole(map *RoleList, map *RoleListLanguage, + map *RoleListAltID, map *RoleListPID, + map *RoleListType, map *RoleListPref, + map *RoleListTokens, wxString *SaveData, wxString DataType){ + + wxString ProcessData = ""; + + for (std::map::iterator RoleIter = RoleList->begin(); + RoleIter != RoleList->end(); RoleIter++){ + + ProcessData.Append("ROLE"); + + // Check if there is a value for TYPE. + + if (DataType.size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append(DataType); + + } + + // Check if there is a value for ALTID. + + if ((*RoleListAltID)[RoleIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*RoleListAltID)[RoleIter->first]); + + } + + // Check if there is a value for LANGUAGE. + + if ((*RoleListLanguage)[RoleIter->first].size() > 0){ + + ProcessData.Append(";LANGUAGE="); + ProcessData.Append((*RoleListLanguage)[RoleIter->first]); + + } + + // Check if there is a value for PID. + + if ((*RoleListPID)[RoleIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*RoleListPID)[RoleIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*RoleListPref)[RoleIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*RoleListTokens)[RoleIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*RoleListTokens)[RoleIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(RoleIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveOrganisation(map *OrganisationList, map *OrganisationListAltID, + map *OrganisationListPID, map *OrganisationListLanguage, + map *OrganisationListSortAs, map *OrganisationListType, + map *OrganisationListPref, map *OrganisationListTokens, + wxString *SaveData, wxString DataType){ + + wxString ProcessData = ""; + + for (std::map::iterator OrganisationIter = OrganisationList->begin(); + OrganisationIter != OrganisationList->end(); OrganisationIter++){ + + ProcessData.Append("ORG"); + + // Check if there is a value for TYPE. + + if (DataType.size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append(DataType); + + } + + // Check if there is a value for ALTID. + + if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]); + + } + + // Check if there is a value for LANGUAGE. + + if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){ + + ProcessData.Append(";LANGUAGE="); + ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]); + + } + + // Check if there is a value for PID. + + if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*OrganisationListPref)[OrganisationIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first])); + + } + + // Check if there is a value for SORT-AS. + + if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){ + + ProcessData.Append(";SORT-AS=\""); + ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]); + ProcessData.Append("\""); + + } + + // Check if there is a value for tokens. + + if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(OrganisationIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveNote(map *NoteList, map *NoteListLanguage, + map *NoteListAltID, map *NoteListPID, + map *NoteListType, map *NoteListPref, + map *NoteListTokens, wxString *SaveData, wxString DataType){ + + wxString ProcessData = ""; + + for (std::map::iterator NoteIter = NoteList->begin(); + NoteIter != NoteList->end(); NoteIter++){ + + ProcessData.Append("NOTE"); + + // Check if there is a value for TYPE. + + if (DataType.size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append(DataType); + + } + + // Check if there is a value for ALTID. + + if ((*NoteListAltID)[NoteIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*NoteListAltID)[NoteIter->first]); + + } + + // Check if there is a value for LANGUAGE. + + if ((*NoteListLanguage)[NoteIter->first].size() > 0){ + + ProcessData.Append(";LANGUAGE="); + ProcessData.Append((*NoteListLanguage)[NoteIter->first]); + + } + + // Check if there is a value for PID. + + if ((*NoteListPID)[NoteIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*NoteListPID)[NoteIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*NoteListPref)[NoteIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*NoteListTokens)[NoteIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*NoteListTokens)[NoteIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(NoteIter->second); + ProcessData.Replace("\n", "\\n", true); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveCategory(map *CategoryList, map *CategoryListLanguage, + map *CategoryListAltID, map *CategoryListPID, + map *CategoryListType, map *CategoryListPref, + map *CategoryListTokens, wxString *SaveData){ + + wxString ProcessData = ""; + + for (std::map::iterator CategoryIter = CategoryList->begin(); + CategoryIter != CategoryList->end(); CategoryIter++){ + + ProcessData.Append("CATEGORIES"); + + // Check if there is a value for TYPE. + + if ((*CategoryListType)[CategoryIter->first].size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append((*CategoryListType)[CategoryIter->first]); + + } + + // Check if there is a value for ALTID. + + if ((*CategoryListAltID)[CategoryIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*CategoryListAltID)[CategoryIter->first]); + + } + + // Check if there is a value for LANGUAGE. + + if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){ + + ProcessData.Append(";LANGUAGE="); + ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]); + + } + + // Check if there is a value for PID. + + if ((*CategoryListPID)[CategoryIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*CategoryListPID)[CategoryIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*CategoryListPref)[CategoryIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*CategoryListTokens)[CategoryIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*CategoryListTokens)[CategoryIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(CategoryIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SavePhoto(map *PicturesList, map *PicturesListAltID, + map *PicturesListPID, map *PicturesListType, + map *PicturesListPicEncType, map *PicturesListPictureType, + map *PicturesListMediatype, map *PicturesListPref, + map *PicturesListTokens, wxString *SaveData){ + + wxString ProcessData = ""; + + for (std::map::iterator PicturesIter = PicturesList->begin(); + PicturesIter != PicturesList->end(); PicturesIter++){ + + ProcessData.Append("PHOTO"); + + // Check if there is a value for TYPE. + + if ((*PicturesListType)[PicturesIter->first].size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append((*PicturesListType)[PicturesIter->first]); + + } + + // Check if there is a value for ALTID. + + if ((*PicturesListAltID)[PicturesIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*PicturesListAltID)[PicturesIter->first]); + + } + + // Check if there is a value for MEDIATYPE.. + + if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){ + + ProcessData.Append(";MEDIATYPE="); + ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]); + + } + + // Check if there is a value for PID. + + if ((*PicturesListPID)[PicturesIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*PicturesListPID)[PicturesIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*PicturesListPref)[PicturesIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*PicturesListTokens)[PicturesIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*PicturesListTokens)[PicturesIter->first]); + + } + + ProcessData.Append(":data:"); + ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]); + ProcessData.Append(";"); + ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]); + ProcessData.Append(","); + ProcessData.Append(PicturesIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveLogo(map *LogosList, map *LogosListAltID, + map *LogosListPID, map *LogosListType, + map *LogosListPicEncType, map *LogosListPictureType, + map *LogosListMediatype, map *LogosListPref, + map *LogosListTokens, wxString *SaveData){ + + wxString ProcessData = ""; + + for (std::map::iterator LogosIter = LogosList->begin(); + LogosIter != LogosList->end(); LogosIter++){ + + ProcessData.Append("LOGO"); + + // Check if there is a value for TYPE. + + if ((*LogosListType)[LogosIter->first].size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append((*LogosListType)[LogosIter->first]); + + } + + // Check if there is a value for ALTID. + + if ((*LogosListAltID)[LogosIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*LogosListAltID)[LogosIter->first]); + + } + + // Check if there is a value for MEDIATYPE.. + + if ((*LogosListMediatype)[LogosIter->first].size() > 0){ + + ProcessData.Append(";MEDIATYPE="); + ProcessData.Append((*LogosListMediatype)[LogosIter->first]); + + } + + // Check if there is a value for PID. + + if ((*LogosListPID)[LogosIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*LogosListPID)[LogosIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*LogosListPref)[LogosIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*LogosListTokens)[LogosIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*LogosListTokens)[LogosIter->first]); + + } + + ProcessData.Append(":data:"); + ProcessData.Append((*LogosListPictureType)[LogosIter->first]); + ProcessData.Append(";"); + ProcessData.Append((*LogosListPicEncType)[LogosIter->first]); + ProcessData.Append(","); + ProcessData.Append(LogosIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveSound(map *SoundsList, map *SoundsListAltID, + map *SoundsListPID, map *SoundsListType, + map *SoundsListAudioEncType, map *SoundsListAudioType, + map *SoundsListMediatype, map *SoundsListLanguage, + map *SoundsListPref, map *SoundsListTokens, + wxString *SaveData){ + + wxString ProcessData = ""; + + for (std::map::iterator SoundsIter = SoundsList->begin(); + SoundsIter != SoundsList->end(); SoundsIter++){ + + ProcessData.Append("SOUND"); + + // Check if there is a value for TYPE. + + if ((*SoundsListType)[SoundsIter->first].size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append((*SoundsListType)[SoundsIter->first]); + + } + + // Check if there is a value for ALTID. + + if ((*SoundsListAltID)[SoundsIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*SoundsListAltID)[SoundsIter->first]); + + } + + // Check if there is a value for LANGUAGE. + + if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){ + + ProcessData.Append(";LANGUAGE="); + ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]); + + } + + // Check if there is a value for MEDIATYPE. + + if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){ + + ProcessData.Append(";MEDIATYPE="); + ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]); + + } + + // Check if there is a value for PID. + + if ((*SoundsListPID)[SoundsIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*SoundsListPID)[SoundsIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*SoundsListPref)[SoundsIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*SoundsListTokens)[SoundsIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*SoundsListTokens)[SoundsIter->first]); + + } + + ProcessData.Append(":data:"); + ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]); + ProcessData.Append(";"); + ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]); + ProcessData.Append(","); + ProcessData.Append(SoundsIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveCalendarURI(map *CalendarList, map *CalendarListMediatype, + map *CalendarListAltID, map *CalendarListPID, + map *CalendarListType, map *CalendarListPref, + map *CalendarListTokens, wxString *SaveData){ + + wxString ProcessData = ""; + + for (std::map::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(); + + } + +} + +void ContactDataObject::SaveCalendarRequestURI(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(); + + } + +} + +void ContactDataObject::SaveFreeBusyURI(std::map *FreeBusyList, std::map *FreeBusyListAltID, + std::map *FreeBusyListPID, std::map *FreeBusyListType, + std::map *FreeBusyListMediatype, std::map *FreeBusyListPref, + std::map *FreeBusyListTokens, wxString *SaveData){ + + wxString ProcessData = ""; + + for (std::map::iterator FreeBusyIter = FreeBusyList->begin(); + FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){ + + ProcessData.Append("FBURL"); + + // Check if there is a value for TYPE. + + if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]); + + } + + // Check if there is a value for ALTID. + + if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]); + + } + + // Check if there is a value for MEDIATYPE. + + if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){ + + ProcessData.Append(";MEDIATYPE="); + ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]); + + } + + // Check if there is a value for PID. + + if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(FreeBusyIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveKey(map *KeyList, map *KeyListAltID, + map *KeyListPID, map *KeyListType, + map *KeyListKeyType, map *KeyListDataEncType, + map *KeyListDataType, map *KeyListPref, + map *KeyListTokens, wxString *SaveData){ + + wxString ProcessData = ""; + + for (std::map::iterator KeyIter = KeyList->begin(); + KeyIter != KeyList->end(); KeyIter++){ + + ProcessData.Append("KEY"); + + // Check if there is a value for TYPE. + + if ((*KeyListType)[KeyIter->first].size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append((*KeyListType)[KeyIter->first]); + + } + + // Check if there is a value for ALTID. + + if ((*KeyListAltID)[KeyIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*KeyListAltID)[KeyIter->first]); + + } + + // Check if there is a value for PID. + + if ((*KeyListPID)[KeyIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*KeyListPID)[KeyIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*KeyListPref)[KeyIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*KeyListTokens)[KeyIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*KeyListTokens)[KeyIter->first]); + + } + + ProcessData.Append(":data:"); + ProcessData.Append((*KeyListDataType)[KeyIter->first]); + ProcessData.Append(";"); + ProcessData.Append((*KeyListDataEncType)[KeyIter->first]); + ProcessData.Append(","); + ProcessData.Append(KeyIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveVendor(map *VendorList, map *VendorListPEN, + map *VendorListElement, wxString *SaveData){ + + wxString ProcessData = ""; + + for (std::map::iterator VendorIter = VendorList->begin(); + VendorIter != VendorList->end(); VendorIter++){ + + ProcessData.Append("VND-"); + ProcessData.Append((*VendorListPEN)[VendorIter->first]); + ProcessData.Append("-"); + ProcessData.Append((*VendorListElement)[VendorIter->first]); + ProcessData.Append(":"); + ProcessData.Append(VendorIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + +void ContactDataObject::SaveXToken(map *XTokenList, map *XTokenListTokens, + wxString *SaveData){ + + wxString ProcessData = ""; + + for (std::map::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