#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;
}
- // TODO: Sortout REV.
+ // 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.
&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<int, wxString>::iterator CPIDIter = ClientPIDList.begin();
}
+ // 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");
+
+ ProcessData = OutputText(&ProcessData);
+
+ SaveData->Append(ProcessData);
+ ProcessData.clear();
+
+ }
+
// Process NICKNAME.
SaveNickname(&GeneralNicknamesList, &GeneralNicknamesListAltID,
&BusinessNicknamesListLanguage, &BusinessNicknamesListPref,
&BusinessNicknamesListTokens, SaveData, "work");
+ // Process GENDER.
+
+ 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,
&BusinessEmailListPref, &BusinessEmailListTokens,
SaveData, "work");
- // TODO: Process IMPP.
+ // Process IMPP.
- // TODO: Process TEL.
+ 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,
&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");
}
-void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
- map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
- map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
- map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
+void ContactDataObject::SaveMember(std::map<int, wxString> *GroupsList, std::map<int, wxString> *GroupsListAltID,
+ std::map<int, wxString> *GroupsListPID, std::map<int, wxString> *GroupsListType,
+ std::map<int, wxString> *GroupsListMediaType, std::map<int, int> *GroupsListPref,
+ std::map<int, wxString> *GroupsListTokens, wxString *SaveData){
wxString ProcessData = "";
-
- for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
- NicknameIter != NicknameList->end(); NicknameIter++){
+
+ for (std::map<int, wxString>::iterator GroupsIter = GroupsList->begin();
+ GroupsIter != GroupsList->end(); GroupsIter++){
- ProcessData.Append("NICKNAME");
+ ProcessData.Append("MEMBER");
// Check if there is a value for TYPE.
- if (DataType.size() > 0){
+ if ((*GroupsListType)[GroupsIter->first].size() > 0){
ProcessData.Append(";TYPE=");
- ProcessData.Append(DataType);
+ ProcessData.Append((*GroupsListType)[GroupsIter->first]);
}
// Check if there is a value for ALTID.
- if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
+ if ((*GroupsListAltID)[GroupsIter->first].size() > 0){
ProcessData.Append(";ALTID=");
- ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
+ ProcessData.Append((*GroupsListAltID)[GroupsIter->first]);
}
// Check if there is a value for MEDIATYPE.
- if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
+ if ((*GroupsListMediaType)[GroupsIter->first].size() > 0){
- ProcessData.Append(";LANGUAGE=");
- ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
+ ProcessData.Append(";MEDIATYPE=");
+ ProcessData.Append((*GroupsListMediaType)[GroupsIter->first]);
}
// Check if there is a value for PID.
- if ((*NicknameListPID)[NicknameIter->first].size() > 0){
+ if ((*GroupsListPID)[GroupsIter->first].size() > 0){
ProcessData.Append(";PID=");
- ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
+ ProcessData.Append((*GroupsListPID)[GroupsIter->first]);
}
// Check if there is a value for PREF.
- if ((*NicknameListPref)[NicknameIter->first] > 0){
+ if ((*GroupsListPref)[GroupsIter->first] > 0){
ProcessData.Append(";PREF=");
- ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
+ ProcessData.Append(wxString::Format("%i", (*GroupsListPref)[GroupsIter->first]));
}
// Check if there is a value for tokens.
- if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
+ if ((*GroupsListTokens)[GroupsIter->first].size() > 0){
ProcessData.Append(";");
- ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
+ ProcessData.Append((*GroupsListTokens)[GroupsIter->first]);
}
ProcessData.Append(":");
- ProcessData.Append(NicknameIter->second);
+ ProcessData.Append(GroupsIter->second);
ProcessData.Append("\n");
ProcessData = OutputText(&ProcessData);
-
+
SaveData->Append(ProcessData);
ProcessData.clear();
}
-void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
- map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
- map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
- map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
+void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
+ map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
+ map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
+ map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
wxString ProcessData = "";
- for (std::map<int, wxString>::iterator TZIter = TZList->begin();
- TZIter != TZList->end(); TZIter++){
+ for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
+ NicknameIter != NicknameList->end(); NicknameIter++){
- ProcessData.Append("TZ");
+ ProcessData.Append("NICKNAME");
// Check if there is a value for TYPE.
// Check if there is a value for ALTID.
- if ((*TZListAltID)[TZIter->first].size() > 0){
+ 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<int, wxString> *TZList, map<int, wxString> *TZListAltID,
+ map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
+ map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
+ map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, wxString>::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]);
}
+void ContactDataObject::SaveIMPP(map<int, wxString> *IMList, map<int, wxString> *IMListAltID,
+ map<int, wxString> *IMListPID, map<int, wxString> *IMListType,
+ map<int, wxString> *IMListTypeInfo, map<int, wxString> *IMListMediatype,
+ map<int, int> *IMListPref, map<int, wxString> *IMListTokens,
+ wxString *SaveData, wxString DataType){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, wxString>::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<int, wxString> *TelephoneList, map<int, wxString> *TelephoneListAltID,
+ map<int, wxString> *TelephoneListPID, map<int, wxString> *TelephoneListType,
+ map<int, wxString> *TelephoneListTypeInfo, map<int, wxString> *TelephoneListDataType,
+ map<int, int> *TelephoneListPref, map<int, wxString> *TelephoneListTokens,
+ wxString *SaveData, wxString DataType){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, wxString>::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<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
}
+}
+
+void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
+ map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
+ map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
+ map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
+ wxString *SaveData, wxString DataType){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, wxString>::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<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
+ map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
+ map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
+ map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, wxString>::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<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
+ map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
+ map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
+ map<int, wxString> *CategoryListTokens, wxString *SaveData){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, wxString>::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<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
+ map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
+ map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
+ map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
+ map<int, wxString> *PicturesListTokens, wxString *SaveData){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, string>::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<int, string> *LogosList, map<int, wxString> *LogosListAltID,
+ map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
+ map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
+ map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
+ map<int, wxString> *LogosListTokens, wxString *SaveData){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, string>::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<int, string> *SoundsList, map<int, wxString> *SoundsListAltID,
+ map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
+ map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
+ map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage,
+ map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens,
+ wxString *SaveData){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, string>::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<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();
+
+ }
+
+}
+
+void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
+ map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
+ map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
+ map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, wxString>::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<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID,
+ std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
+ std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref,
+ std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, wxString>::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<int, wxString> *KeyList, map<int, wxString> *KeyListAltID,
+ map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
+ map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType,
+ map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref,
+ map<int, wxString> *KeyListTokens, wxString *SaveData){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, wxString>::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<int, wxString> *VendorList, map<int, wxString> *VendorListPEN,
+ map<int, wxString> *VendorListElement, wxString *SaveData){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, wxString>::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<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