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);
// Write the end part of the vCard data file.
}
+}
+
+void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
+ map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
+ map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
+ map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, wxString>::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<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
+ map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
+ map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
+ map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, wxString>::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<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();
+
+ }
+
}
\ No newline at end of file