1 // ContactDataObject-Save.cpp - Client Data Object.
3 // (c) 2012-2016 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "ContactDataObject.h"
20 #include "../../version.h"
22 ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
24 ContactSaveStatus SaveDataStatus = CONTACTSAVE_UNITTESTFAIL;
26 // Write the header for the vCard data file.
28 SaveData->Append("BEGIN:VCARD\n");
29 SaveData->Append("VERSION:4.0\n");
31 // Write the product ID.
35 SaveData->Append("PRODID:-//Xestia//Address Book Unit Testing//KW\n");
39 SaveData->Append(wxT("PRODID:-//Xestia//Address Book Version "));
40 SaveData->Append(wxT(XSDAB_VERSION));
41 SaveData->Append(wxT("//KW\n"));
45 wxString ProcessData = "";
49 if (UIDToken.size() > 0){
51 ProcessData.Append("UID:");
52 ProcessData.Append(UIDToken);
53 ProcessData.Append("\n");
54 SaveData->Append(ProcessData);
63 case CONTACTKIND_NONE:
65 case CONTACTKIND_INDIVIDUAL:
66 SaveData->Append("KIND:individual\n");
68 case CONTACTKIND_GROUP:
69 SaveData->Append("KIND:group\n");
71 case CONTACTKIND_ORGANISATION:
72 SaveData->Append("KIND:org\n");
74 case CONTACTKIND_LOCATION:
75 SaveData->Append("KIND:location\n");
86 for (std::map<int, wxString>::iterator XMLIter = XMLList.begin();
87 XMLIter != XMLList.end(); XMLIter++){
89 ProcessData.Append("XML");
91 if (XMLListAltID[XMLIter->first].size() > 0){
93 ProcessData.Append(";ALTID=");
94 ProcessData.Append(XMLListAltID[XMLIter->first]);
98 ProcessData.Append(":");
99 ProcessData.Append(XMLIter->second);
100 ProcessData.Append("\n");
102 ProcessData = OutputText(&ProcessData);
104 SaveData->Append(ProcessData);
111 SaveSource(&SourceList, &SourceListAltID,
112 &SourceListPID, &SourceListType,
113 &SourceListMediatype, &SourceListPref,
114 &SourceListTokens, SaveData);
116 // Process CLIENTPIDMAP.
118 for (std::map<int, wxString>::iterator CPIDIter = ClientPIDList.begin();
119 CPIDIter != ClientPIDList.end(); CPIDIter++){
121 ProcessData.Append("CLIENTPIDMAP");
123 if (ClientPIDListTokens[CPIDIter->first].size() > 0){
125 ProcessData.Append(";");
126 ProcessData.Append(ClientPIDListTokens[CPIDIter->first]);
130 ProcessData.Append(":");
131 ProcessData.Append(CPIDIter->second);
132 ProcessData.Append("\n");
134 ProcessData = OutputText(&ProcessData);
136 SaveData->Append(ProcessData);
143 for (std::map<int, wxString>::iterator FNIter = FullNamesList.begin();
144 FNIter != FullNamesList.end(); FNIter++){
146 ProcessData.Append("FN");
148 // Check if there is a value for TYPE.
150 if (FullNamesListType[FNIter->first].size() > 0){
152 ProcessData.Append(";TYPE=");
153 ProcessData.Append(FullNamesListType[FNIter->first]);
157 // Check if there is a value for LANGUAGE.
159 if (FullNamesListLanguage[FNIter->first].size() > 0){
161 ProcessData.Append(";LANGUAGE=");
162 ProcessData.Append(FullNamesListLanguage[FNIter->first]);
166 // Check if there is a value for ALTID.
168 if (FullNamesListAltID[FNIter->first].size() > 0){
170 ProcessData.Append(";ALTID=");
171 ProcessData.Append(FullNamesListAltID[FNIter->first]);
175 // Check if there is a value for PID.
177 if (FullNamesListPID[FNIter->first].size() > 0){
179 ProcessData.Append(";PID=");
180 ProcessData.Append(FullNamesListPID[FNIter->first]);
184 // Check if there is a value for PREF.
186 if (FullNamesListPref[FNIter->first] > 0){
188 ProcessData.Append(";PREF=");
189 ProcessData.Append(wxString::Format("%i", FullNamesListPref[FNIter->first]));
193 // Check if there is a value for tokens.
195 if (FullNamesListTokens[FNIter->first].size() > 0){
197 ProcessData.Append(";");
198 ProcessData.Append(FullNamesListTokens[FNIter->first]);
202 ProcessData.Append(":");
203 ProcessData.Append(FNIter->second);
204 ProcessData.Append("\n");
206 ProcessData = OutputText(&ProcessData);
208 SaveData->Append(ProcessData);
215 SaveNickname(&GeneralNicknamesList, &GeneralNicknamesListAltID,
216 &GeneralNicknamesListPID, &GeneralNicknamesListType,
217 &GeneralNicknamesListLanguage, &GeneralNicknamesListPref,
218 &GeneralNicknamesListTokens, SaveData, "");
219 SaveNickname(&HomeNicknamesList, &HomeNicknamesListAltID,
220 &HomeNicknamesListPID, &HomeNicknamesListType,
221 &HomeNicknamesListLanguage, &HomeNicknamesListPref,
222 &HomeNicknamesListTokens, SaveData, "home");
223 SaveNickname(&BusinessNicknamesList, &BusinessNicknamesListAltID,
224 &BusinessNicknamesListPID, &BusinessNicknamesListType,
225 &BusinessNicknamesListLanguage, &BusinessNicknamesListPref,
226 &BusinessNicknamesListTokens, SaveData, "work");
230 SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
231 &GeneralTitleListAltID, &GeneralTitleListPID,
232 &GeneralTitleListType, &GeneralTitleListPref,
233 &GeneralTitleListTokens, SaveData, "");
234 SaveTitle(&HomeTitleList, &HomeTitleListLanguage,
235 &HomeTitleListAltID, &HomeTitleListPID,
236 &HomeTitleListType, &HomeTitleListPref,
237 &HomeTitleListTokens, SaveData, "home");
238 SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage,
239 &BusinessTitleListAltID, &BusinessTitleListPID,
240 &BusinessTitleListType, &BusinessTitleListPref,
241 &BusinessTitleListTokens, SaveData, "work");
245 SaveTimezone(&GeneralTZList, &GeneralTZListAltID,
246 &GeneralTZListPID, &GeneralTZListType,
247 &GeneralTZListMediatype, &GeneralTZListPref,
248 &GeneralTZListTokens, SaveData, "");
249 SaveTimezone(&HomeTZList, &HomeTZListAltID,
250 &HomeTZListPID, &HomeTZListType,
251 &HomeTZListMediatype, &HomeTZListPref,
252 &HomeTZListTokens, SaveData, "home");
253 SaveTimezone(&BusinessTZList, &BusinessTZListAltID,
254 &BusinessTZListPID, &BusinessTZListType,
255 &BusinessTZListMediatype, &BusinessTZListPref,
256 &BusinessTZListTokens, SaveData, "work");
260 SaveAddress(&GeneralAddressList, &GeneralAddressListTown,
261 &GeneralAddressListCounty, &GeneralAddressListPostCode,
262 &GeneralAddressListCountry, &GeneralAddressListLabel,
263 &GeneralAddressListLang, &GeneralAddressListAltID,
264 &GeneralAddressListPID, &GeneralAddressListGeo,
265 &GeneralAddressListTimezone, &GeneralAddressListType,
266 &GeneralAddressListMediatype, &GeneralAddressListPref,
267 &GeneralAddressListTokens, SaveData, "");
268 SaveAddress(&HomeAddressList, &HomeAddressListTown,
269 &HomeAddressListCounty, &HomeAddressListPostCode,
270 &HomeAddressListCountry, &HomeAddressListLabel,
271 &HomeAddressListLang, &HomeAddressListAltID,
272 &HomeAddressListPID, &HomeAddressListGeo,
273 &HomeAddressListTimezone, &HomeAddressListType,
274 &HomeAddressListMediatype, &HomeAddressListPref,
275 &HomeAddressListTokens, SaveData, "home");
276 SaveAddress(&BusinessAddressList, &BusinessAddressListTown,
277 &BusinessAddressListCounty, &BusinessAddressListPostCode,
278 &BusinessAddressListCountry, &BusinessAddressListLabel,
279 &BusinessAddressListLang, &BusinessAddressListAltID,
280 &BusinessAddressListPID, &BusinessAddressListGeo,
281 &BusinessAddressListTimezone, &BusinessAddressListType,
282 &BusinessAddressListMediatype, &BusinessAddressListPref,
283 &BusinessAddressListTokens, SaveData, "work");
287 SaveEmail(&GeneralEmailList, &GeneralEmailListAltID,
288 &GeneralEmailListPID, &GeneralEmailListType,
289 &GeneralEmailListPref, &GeneralEmailListTokens,
291 SaveEmail(&HomeEmailList, &HomeEmailListAltID,
292 &HomeEmailListPID, &HomeEmailListType,
293 &HomeEmailListPref, &HomeEmailListTokens,
295 SaveEmail(&BusinessEmailList, &BusinessEmailListAltID,
296 &BusinessEmailListPID, &BusinessEmailListType,
297 &BusinessEmailListPref, &BusinessEmailListTokens,
300 // TODO: Process IMPP.
302 // TODO: Process TEL.
306 SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID,
307 &GeneralLanguageListPID, &GeneralLanguageListType,
308 &GeneralLanguageListPref, &GeneralLanguageListTokens,
310 SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID,
311 &HomeLanguageListPID, &HomeLanguageListType,
312 &HomeLanguageListPref, &HomeLanguageListTokens,
314 SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID,
315 &BusinessLanguageListPID, &BusinessLanguageListType,
316 &BusinessLanguageListPref, &BusinessLanguageListTokens,
321 SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID,
322 &GeneralGeographyListPID, &GeneralGeographyListType,
323 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
324 &GeneralGeographyListPref, &GeneralGeographyListTokens,
326 SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID,
327 &HomeGeographyListPID, &HomeGeographyListType,
328 &HomeGeographyListMediatype, &HomeGeographyListDataType,
329 &HomeGeographyListPref, &HomeGeographyListTokens,
331 SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID,
332 &BusinessGeographyListPID, &BusinessGeographyListType,
333 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
334 &BusinessGeographyListPref, &BusinessGeographyListTokens,
341 for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
342 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
344 ProcessData.Append("RELATED");
346 // Check if there is a value for TYPE.
348 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
350 wxString RelatedType = "";
352 ProcessData.Append(";TYPE=");
354 if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
356 RelatedType = wxT("contact");
358 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
360 RelatedType = wxT("acquaintance");
362 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
364 RelatedType = wxT("friend");
366 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
368 RelatedType = wxT("met");
370 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
372 RelatedType = wxT("co-worker");
374 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
376 RelatedType = wxT("colleague");
378 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
380 RelatedType = wxT("co-resident");
382 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
384 RelatedType = wxT("neighbor");
386 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
388 RelatedType = wxT("child");
390 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
392 RelatedType = wxT("parent");
394 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
396 RelatedType = wxT("sibling");
398 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
400 RelatedType = wxT("spouse");
402 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
404 RelatedType = wxT("kin");
406 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
408 RelatedType = wxT("muse");
410 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
412 RelatedType = wxT("crush");
414 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
416 RelatedType = wxT("date");
418 } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
420 RelatedType = wxT("sweetheart");
422 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
424 RelatedType = wxT("me");
426 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
428 RelatedType = wxT("agent");
430 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
432 RelatedType = wxT("emergency");
436 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
440 ProcessData.Append(RelatedType);
444 // Check if there is a value for LANGUAGE.
446 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
448 ProcessData.Append(";LANGUAGE=");
449 ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
453 // Check if there is a value for ALTID.
455 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
457 ProcessData.Append(";ALTID=");
458 ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
462 // Check if there is a value for PID.
464 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
466 ProcessData.Append(";PID=");
467 ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
471 // Check if there is a value for PREF.
473 if (GeneralRelatedListPref[RelatedIter->first] > 0){
475 ProcessData.Append(";PREF=");
476 ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
480 // Check if there is a value for tokens.
482 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
484 ProcessData.Append(";");
485 ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
489 ProcessData.Append(":");
490 ProcessData.Append(RelatedIter->second);
491 ProcessData.Append("\n");
493 ProcessData = OutputText(&ProcessData);
495 SaveData->Append(ProcessData);
502 SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID,
503 &GeneralWebsiteListPID, &GeneralWebsiteListType,
504 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref,
505 &GeneralWebsiteListTokens, SaveData, "");
506 SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID,
507 &HomeWebsiteListPID, &HomeWebsiteListType,
508 &HomeWebsiteListMediatype, &HomeWebsiteListPref,
509 &HomeWebsiteListTokens, SaveData, "home");
510 SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID,
511 &BusinessWebsiteListPID, &BusinessWebsiteListType,
512 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref,
513 &BusinessWebsiteListTokens, SaveData, "work");
517 SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
518 &GeneralRoleListAltID, &GeneralRoleListPID,
519 &GeneralRoleListType, &GeneralRoleListPref,
520 &GeneralRoleListTokens, SaveData, "");
521 SaveRole(&HomeRoleList, &HomeRoleListLanguage,
522 &HomeRoleListAltID, &HomeRoleListPID,
523 &HomeRoleListType, &HomeRoleListPref,
524 &HomeRoleListTokens, SaveData, "home");
525 SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
526 &BusinessRoleListAltID, &BusinessRoleListPID,
527 &BusinessRoleListType, &BusinessRoleListPref,
528 &BusinessRoleListTokens, SaveData, "work");
532 SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
533 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage,
534 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType,
535 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens,
537 SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
538 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage,
539 &HomeOrganisationsListSortAs, &HomeOrganisationsListType,
540 &HomeOrganisationsListPref, &HomeOrganisationsListTokens,
542 SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
543 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage,
544 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType,
545 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens,
550 SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
551 &GeneralNoteListAltID, &GeneralNoteListPID,
552 &GeneralNoteListType, &GeneralNoteListPref,
553 &GeneralNoteListTokens, SaveData, "");
554 SaveNote(&HomeNoteList, &HomeNoteListLanguage,
555 &HomeNoteListAltID, &HomeNoteListPID,
556 &HomeNoteListType, &HomeNoteListPref,
557 &HomeNoteListTokens, SaveData, "home");
558 SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
559 &BusinessNoteListAltID, &BusinessNoteListPID,
560 &BusinessNoteListType, &BusinessNoteListPref,
561 &BusinessNoteListTokens, SaveData, "work");
563 // Process CATEGORIES.
565 SaveCategory(&CategoriesList, &CategoriesListLanguage,
566 &CategoriesListAltID, &CategoriesListPID,
567 &CategoriesListType, &CategoriesListPref,
568 &CategoriesListTokens, SaveData);
572 SavePhoto(&PicturesList, &PicturesListAltID,
573 &PicturesListPID, &PicturesListType,
574 &PicturesListPicEncType, &PicturesListPictureType,
575 &PicturesListMediatype, &PicturesListPref,
576 &PicturesListTokens, SaveData);
580 SaveLogo(&LogosList, &LogosListAltID,
581 &LogosListPID, &LogosListType,
582 &LogosListPicEncType, &LogosListPictureType,
583 &LogosListMediatype, &LogosListPref,
584 &LogosListTokens, SaveData);
588 // Write the end part of the vCard data file.
590 SaveData->Append("END:VCARD");
592 SaveDataStatus = CONTACTSAVE_OK;
594 return SaveDataStatus;
598 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
599 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
600 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
601 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
603 wxString ProcessData = "";
605 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
606 TitleIter != TitleList->end(); TitleIter++){
608 ProcessData.Append("TITLE");
610 // Check if there is a value for TYPE.
612 if (DataType.size() > 0){
614 ProcessData.Append(";TYPE=");
615 ProcessData.Append(DataType);
619 // Check if there is a value for ALTID.
621 if ((*TitleListAltID)[TitleIter->first].size() > 0){
623 ProcessData.Append(";ALTID=");
624 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
628 // Check if there is a value for LANGUAGE.
630 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
632 ProcessData.Append(";LANGUAGE=");
633 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
637 // Check if there is a value for PID.
639 if ((*TitleListPID)[TitleIter->first].size() > 0){
641 ProcessData.Append(";PID=");
642 ProcessData.Append((*TitleListPID)[TitleIter->first]);
646 // Check if there is a value for PREF.
648 if ((*TitleListPref)[TitleIter->first] > 0){
650 ProcessData.Append(";PREF=");
651 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
655 // Check if there is a value for tokens.
657 if ((*TitleListTokens)[TitleIter->first].size() > 0){
659 ProcessData.Append(";");
660 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
664 ProcessData.Append(":");
665 ProcessData.Append(TitleIter->second);
666 ProcessData.Append("\n");
668 ProcessData = OutputText(&ProcessData);
670 SaveData->Append(ProcessData);
677 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
678 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
679 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
680 map<int, wxString> *SourceListTokens, wxString *SaveData){
682 wxString ProcessData = "";
684 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
685 SourceIter != SourceList->end(); SourceIter++){
687 ProcessData.Append("SOURCE");
689 // Check if there is a value for TYPE.
691 if ((*SourceListType)[SourceIter->first].size() > 0){
693 ProcessData.Append(";TYPE=");
694 ProcessData.Append((*SourceListType)[SourceIter->first]);
698 // Check if there is a value for ALTID.
700 if ((*SourceListAltID)[SourceIter->first].size() > 0){
702 ProcessData.Append(";ALTID=");
703 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
707 // Check if there is a value for MEDIATYPE.
709 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
711 ProcessData.Append(";MEDIATYPE=");
712 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
716 // Check if there is a value for PID.
718 if ((*SourceListPID)[SourceIter->first].size() > 0){
720 ProcessData.Append(";PID=");
721 ProcessData.Append((*SourceListPID)[SourceIter->first]);
725 // Check if there is a value for PREF.
727 if ((*SourceListPref)[SourceIter->first] > 0){
729 ProcessData.Append(";PREF=");
730 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
734 // Check if there is a value for tokens.
736 if ((*SourceListTokens)[SourceIter->first].size() > 0){
738 ProcessData.Append(";");
739 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
743 ProcessData.Append(":");
744 ProcessData.Append(SourceIter->second);
745 ProcessData.Append("\n");
747 ProcessData = OutputText(&ProcessData);
749 SaveData->Append(ProcessData);
756 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
757 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
758 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
759 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
761 wxString ProcessData = "";
763 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
764 NicknameIter != NicknameList->end(); NicknameIter++){
766 ProcessData.Append("NICKNAME");
768 // Check if there is a value for TYPE.
770 if (DataType.size() > 0){
772 ProcessData.Append(";TYPE=");
773 ProcessData.Append(DataType);
777 // Check if there is a value for ALTID.
779 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
781 ProcessData.Append(";ALTID=");
782 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
786 // Check if there is a value for MEDIATYPE.
788 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
790 ProcessData.Append(";LANGUAGE=");
791 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
795 // Check if there is a value for PID.
797 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
799 ProcessData.Append(";PID=");
800 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
804 // Check if there is a value for PREF.
806 if ((*NicknameListPref)[NicknameIter->first] > 0){
808 ProcessData.Append(";PREF=");
809 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
813 // Check if there is a value for tokens.
815 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
817 ProcessData.Append(";");
818 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
822 ProcessData.Append(":");
823 ProcessData.Append(NicknameIter->second);
824 ProcessData.Append("\n");
826 ProcessData = OutputText(&ProcessData);
828 SaveData->Append(ProcessData);
835 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
836 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
837 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
838 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
840 wxString ProcessData = "";
842 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
843 TZIter != TZList->end(); TZIter++){
845 ProcessData.Append("TZ");
847 // Check if there is a value for TYPE.
849 if (DataType.size() > 0){
851 ProcessData.Append(";TYPE=");
852 ProcessData.Append(DataType);
856 // Check if there is a value for ALTID.
858 if ((*TZListAltID)[TZIter->first].size() > 0){
860 ProcessData.Append(";ALTID=");
861 ProcessData.Append((*TZListAltID)[TZIter->first]);
865 // Check if there is a value for MEDIATYPE.
867 if ((*TZListMediatype)[TZIter->first].size() > 0){
869 ProcessData.Append(";MEDIATYPE=");
870 ProcessData.Append((*TZListMediatype)[TZIter->first]);
874 // Check if there is a value for PID.
876 if ((*TZListPID)[TZIter->first].size() > 0){
878 ProcessData.Append(";PID=");
879 ProcessData.Append((*TZListPID)[TZIter->first]);
883 // Check if there is a value for PREF.
885 if ((*TZListPref)[TZIter->first] > 0){
887 ProcessData.Append(";PREF=");
888 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
892 // Check if there is a value for tokens.
894 if ((*TZListTokens)[TZIter->first].size() > 0){
896 ProcessData.Append(";");
897 ProcessData.Append((*TZListTokens)[TZIter->first]);
901 ProcessData.Append(":");
902 ProcessData.Append(TZIter->second);
903 ProcessData.Append("\n");
905 ProcessData = OutputText(&ProcessData);
907 SaveData->Append(ProcessData);
914 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
915 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
916 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
917 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
918 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
919 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
920 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
921 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
923 wxString ProcessData = "";
925 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
926 AddressIter != AddressList->end(); AddressIter++){
928 ProcessData.Append("ADR");
930 // Check if there is a value for TYPE.
932 if (DataType.size() > 0){
934 ProcessData.Append(";TYPE=");
935 ProcessData.Append(DataType);
939 // Check if there is a value for ALTID.
941 if ((*AddressListAltID)[AddressIter->first].size() > 0){
943 ProcessData.Append(";ALTID=");
944 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
948 // Check if there is a value for GEO.
950 if ((*AddressListGeo)[AddressIter->first].size() > 0){
952 ProcessData.Append(";GEO=\"");
953 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
954 ProcessData.Append("\"");
958 // Check if there is a value for LABEL.
960 if ((*AddressListLabel)[AddressIter->first].size() > 0){
962 wxString AddressProcessed = "";
963 AddressProcessed = (*AddressListLabel)[AddressIter->first];
965 AddressProcessed.Replace("\n", "\\n", true);
967 ProcessData.Append(";LABEL=");
968 ProcessData.Append(AddressProcessed);
972 // Check if there is a value for LANGUAGE.
974 if ((*AddressListLang)[AddressIter->first].size() > 0){
976 ProcessData.Append(";LANGUAGE=");
977 ProcessData.Append((*AddressListLang)[AddressIter->first]);
981 // Check if there is a value for MEDIATYPE.
983 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
985 ProcessData.Append(";MEDIATYPE=");
986 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
990 // Check if there is a value for PID.
992 if ((*AddressListPID)[AddressIter->first].size() > 0){
994 ProcessData.Append(";PID=");
995 ProcessData.Append((*AddressListPID)[AddressIter->first]);
999 // Check if there is a value for PREF.
1001 if ((*AddressListPref)[AddressIter->first] > 0){
1003 ProcessData.Append(";PREF=");
1004 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1008 // Check if there is a value for TZ.
1010 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1012 ProcessData.Append(";TZ=");
1013 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1017 // Check if there is a value for tokens.
1019 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1021 ProcessData.Append(";");
1022 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1026 // Build the address.
1028 ProcessData.Append(":;;");
1029 ProcessData.Append((*AddressList)[AddressIter->first]);
1030 ProcessData.Append(";");
1031 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1032 ProcessData.Append(";");
1033 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1034 ProcessData.Append(";");
1035 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1036 ProcessData.Append(";");
1037 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1038 ProcessData.Append("\n");
1040 ProcessData = OutputText(&ProcessData);
1042 SaveData->Append(ProcessData);
1043 ProcessData.clear();
1049 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1050 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1051 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1052 wxString *SaveData, wxString DataType){
1054 wxString ProcessData = "";
1056 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1057 EmailIter != EmailList->end(); EmailIter++){
1059 ProcessData.Append("EMAIL");
1061 // Check if there is a value for TYPE.
1063 if (DataType.size() > 0){
1065 ProcessData.Append(";TYPE=");
1066 ProcessData.Append(DataType);
1070 // Check if there is a value for ALTID.
1072 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1074 ProcessData.Append(";ALTID=");
1075 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1079 // Check if there is a value for PID.
1081 if ((*EmailListPID)[EmailIter->first].size() > 0){
1083 ProcessData.Append(";PID=");
1084 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1088 // Check if there is a value for PREF.
1090 if ((*EmailListPref)[EmailIter->first] > 0){
1092 ProcessData.Append(";PREF=");
1093 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1097 // Check if there is a value for tokens.
1099 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1101 ProcessData.Append(";");
1102 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1106 ProcessData.Append(":");
1107 ProcessData.Append(EmailIter->second);
1108 ProcessData.Append("\n");
1110 ProcessData = OutputText(&ProcessData);
1112 SaveData->Append(ProcessData);
1113 ProcessData.clear();
1119 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1120 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1121 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1122 wxString *SaveData, wxString DataType){
1124 wxString ProcessData = "";
1126 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1127 LanguageIter != LanguageList->end(); LanguageIter++){
1129 ProcessData.Append("LANG");
1131 // Check if there is a value for TYPE.
1133 if (DataType.size() > 0){
1135 ProcessData.Append(";TYPE=");
1136 ProcessData.Append(DataType);
1140 // Check if there is a value for ALTID.
1142 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1144 ProcessData.Append(";ALTID=");
1145 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1149 // Check if there is a value for PID.
1151 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1153 ProcessData.Append(";PID=");
1154 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1158 // Check if there is a value for PREF.
1160 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1162 ProcessData.Append(";PREF=");
1163 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1167 // Check if there is a value for tokens.
1169 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1171 ProcessData.Append(";");
1172 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1176 ProcessData.Append(":");
1177 ProcessData.Append(LanguageIter->second);
1178 ProcessData.Append("\n");
1180 ProcessData = OutputText(&ProcessData);
1182 SaveData->Append(ProcessData);
1183 ProcessData.clear();
1189 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1190 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1191 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1192 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1193 wxString *SaveData, wxString DataType){
1195 wxString ProcessData = "";
1197 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1198 GeographyIter != GeographyList->end(); GeographyIter++){
1200 ProcessData.Append("GEO");
1202 // Check if there is a value for TYPE.
1204 if (DataType.size() > 0){
1206 ProcessData.Append(";TYPE=");
1207 ProcessData.Append(DataType);
1211 // Check if there is a value for ALTID.
1213 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1215 ProcessData.Append(";ALTID=");
1216 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1220 // Check if there is a value for MEDIATYPE.
1222 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1224 ProcessData.Append(";MEDIATYPE=");
1225 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1229 // Check if there is a value for PID.
1231 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1233 ProcessData.Append(";PID=");
1234 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1238 // Check if there is a value for PREF.
1240 if ((*GeographyListPref)[GeographyIter->first] > 0){
1242 ProcessData.Append(";PREF=");
1243 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1247 // Check if there is a value for tokens.
1249 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1251 ProcessData.Append(";");
1252 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1256 ProcessData.Append(":");
1257 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1258 ProcessData.Append(":");
1259 ProcessData.Append(GeographyIter->second);
1260 ProcessData.Append("\n");
1262 ProcessData = OutputText(&ProcessData);
1264 SaveData->Append(ProcessData);
1265 ProcessData.clear();
1271 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1272 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1273 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1274 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1276 wxString ProcessData = "";
1278 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1279 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1281 ProcessData.Append("URL");
1283 // Check if there is a value for TYPE.
1285 if (DataType.size() > 0){
1287 ProcessData.Append(";TYPE=");
1288 ProcessData.Append(DataType);
1292 // Check if there is a value for ALTID.
1294 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1296 ProcessData.Append(";ALTID=");
1297 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1301 // Check if there is a value for MEDIATYPE.
1303 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1305 ProcessData.Append(";MEDIATYPE=");
1306 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1310 // Check if there is a value for PID.
1312 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1314 ProcessData.Append(";PID=");
1315 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1319 // Check if there is a value for PREF.
1321 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1323 ProcessData.Append(";PREF=");
1324 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1328 // Check if there is a value for tokens.
1330 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1332 ProcessData.Append(";");
1333 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1337 ProcessData.Append(":");
1338 ProcessData.Append(WebsiteIter->second);
1339 ProcessData.Append("\n");
1341 ProcessData = OutputText(&ProcessData);
1343 SaveData->Append(ProcessData);
1344 ProcessData.clear();
1350 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1351 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1352 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1353 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1355 wxString ProcessData = "";
1357 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1358 RoleIter != RoleList->end(); RoleIter++){
1360 ProcessData.Append("ROLE");
1362 // Check if there is a value for TYPE.
1364 if (DataType.size() > 0){
1366 ProcessData.Append(";TYPE=");
1367 ProcessData.Append(DataType);
1371 // Check if there is a value for ALTID.
1373 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1375 ProcessData.Append(";ALTID=");
1376 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1380 // Check if there is a value for LANGUAGE.
1382 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1384 ProcessData.Append(";LANGUAGE=");
1385 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1389 // Check if there is a value for PID.
1391 if ((*RoleListPID)[RoleIter->first].size() > 0){
1393 ProcessData.Append(";PID=");
1394 ProcessData.Append((*RoleListPID)[RoleIter->first]);
1398 // Check if there is a value for PREF.
1400 if ((*RoleListPref)[RoleIter->first] > 0){
1402 ProcessData.Append(";PREF=");
1403 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1407 // Check if there is a value for tokens.
1409 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1411 ProcessData.Append(";");
1412 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1416 ProcessData.Append(":");
1417 ProcessData.Append(RoleIter->second);
1418 ProcessData.Append("\n");
1420 ProcessData = OutputText(&ProcessData);
1422 SaveData->Append(ProcessData);
1423 ProcessData.clear();
1429 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1430 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
1431 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
1432 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
1433 wxString *SaveData, wxString DataType){
1435 wxString ProcessData = "";
1437 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1438 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1440 ProcessData.Append("ORG");
1442 // Check if there is a value for TYPE.
1444 if (DataType.size() > 0){
1446 ProcessData.Append(";TYPE=");
1447 ProcessData.Append(DataType);
1451 // Check if there is a value for ALTID.
1453 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1455 ProcessData.Append(";ALTID=");
1456 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1460 // Check if there is a value for LANGUAGE.
1462 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1464 ProcessData.Append(";LANGUAGE=");
1465 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1469 // Check if there is a value for PID.
1471 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1473 ProcessData.Append(";PID=");
1474 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1478 // Check if there is a value for PREF.
1480 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1482 ProcessData.Append(";PREF=");
1483 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1487 // Check if there is a value for SORT-AS.
1489 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1491 ProcessData.Append(";SORT-AS=\"");
1492 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1493 ProcessData.Append("\"");
1497 // Check if there is a value for tokens.
1499 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1501 ProcessData.Append(";");
1502 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1506 ProcessData.Append(":");
1507 ProcessData.Append(OrganisationIter->second);
1508 ProcessData.Append("\n");
1510 ProcessData = OutputText(&ProcessData);
1512 SaveData->Append(ProcessData);
1513 ProcessData.clear();
1519 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1520 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1521 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1522 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1524 wxString ProcessData = "";
1526 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1527 NoteIter != NoteList->end(); NoteIter++){
1529 ProcessData.Append("NOTE");
1531 // Check if there is a value for TYPE.
1533 if (DataType.size() > 0){
1535 ProcessData.Append(";TYPE=");
1536 ProcessData.Append(DataType);
1540 // Check if there is a value for ALTID.
1542 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1544 ProcessData.Append(";ALTID=");
1545 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1549 // Check if there is a value for LANGUAGE.
1551 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1553 ProcessData.Append(";LANGUAGE=");
1554 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1558 // Check if there is a value for PID.
1560 if ((*NoteListPID)[NoteIter->first].size() > 0){
1562 ProcessData.Append(";PID=");
1563 ProcessData.Append((*NoteListPID)[NoteIter->first]);
1567 // Check if there is a value for PREF.
1569 if ((*NoteListPref)[NoteIter->first] > 0){
1571 ProcessData.Append(";PREF=");
1572 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1576 // Check if there is a value for tokens.
1578 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1580 ProcessData.Append(";");
1581 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1585 ProcessData.Append(":");
1586 ProcessData.Append(NoteIter->second);
1587 ProcessData.Replace("\n", "\\n", true);
1588 ProcessData.Append("\n");
1590 ProcessData = OutputText(&ProcessData);
1592 SaveData->Append(ProcessData);
1593 ProcessData.clear();
1599 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1600 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1601 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1602 map<int, wxString> *CategoryListTokens, wxString *SaveData){
1604 wxString ProcessData = "";
1606 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1607 CategoryIter != CategoryList->end(); CategoryIter++){
1609 ProcessData.Append("CATEGORIES");
1611 // Check if there is a value for TYPE.
1613 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1615 ProcessData.Append(";TYPE=");
1616 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1620 // Check if there is a value for ALTID.
1622 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1624 ProcessData.Append(";ALTID=");
1625 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1629 // Check if there is a value for LANGUAGE.
1631 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1633 ProcessData.Append(";LANGUAGE=");
1634 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1638 // Check if there is a value for PID.
1640 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1642 ProcessData.Append(";PID=");
1643 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1647 // Check if there is a value for PREF.
1649 if ((*CategoryListPref)[CategoryIter->first] > 0){
1651 ProcessData.Append(";PREF=");
1652 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1656 // Check if there is a value for tokens.
1658 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1660 ProcessData.Append(";");
1661 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1665 ProcessData.Append(":");
1666 ProcessData.Append(CategoryIter->second);
1667 ProcessData.Append("\n");
1669 ProcessData = OutputText(&ProcessData);
1671 SaveData->Append(ProcessData);
1672 ProcessData.clear();
1678 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
1679 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1680 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1681 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1682 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1684 wxString ProcessData = "";
1686 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1687 PicturesIter != PicturesList->end(); PicturesIter++){
1689 ProcessData.Append("PHOTO");
1691 // Check if there is a value for TYPE.
1693 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1695 ProcessData.Append(";TYPE=");
1696 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1700 // Check if there is a value for ALTID.
1702 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1704 ProcessData.Append(";ALTID=");
1705 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1709 // Check if there is a value for MEDIATYPE..
1711 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1713 ProcessData.Append(";MEDIATYPE=");
1714 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1718 // Check if there is a value for PID.
1720 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1722 ProcessData.Append(";PID=");
1723 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1727 // Check if there is a value for PREF.
1729 if ((*PicturesListPref)[PicturesIter->first] > 0){
1731 ProcessData.Append(";PREF=");
1732 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1736 // Check if there is a value for tokens.
1738 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1740 ProcessData.Append(";");
1741 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1745 ProcessData.Append(":data:");
1746 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1747 ProcessData.Append(";");
1748 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1749 ProcessData.Append(",");
1750 ProcessData.Append(PicturesIter->second);
1751 ProcessData.Append("\n");
1753 ProcessData = OutputText(&ProcessData);
1755 SaveData->Append(ProcessData);
1756 ProcessData.clear();
1762 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID,
1763 map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
1764 map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
1765 map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
1766 map<int, wxString> *LogosListTokens, wxString *SaveData){
1768 wxString ProcessData = "";
1770 for (std::map<int, string>::iterator LogosIter = LogosList->begin();
1771 LogosIter != LogosList->end(); LogosIter++){
1773 ProcessData.Append("LOGO");
1775 // Check if there is a value for TYPE.
1777 if ((*LogosListType)[LogosIter->first].size() > 0){
1779 ProcessData.Append(";TYPE=");
1780 ProcessData.Append((*LogosListType)[LogosIter->first]);
1784 // Check if there is a value for ALTID.
1786 if ((*LogosListAltID)[LogosIter->first].size() > 0){
1788 ProcessData.Append(";ALTID=");
1789 ProcessData.Append((*LogosListAltID)[LogosIter->first]);
1793 // Check if there is a value for MEDIATYPE..
1795 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
1797 ProcessData.Append(";MEDIATYPE=");
1798 ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
1802 // Check if there is a value for PID.
1804 if ((*LogosListPID)[LogosIter->first].size() > 0){
1806 ProcessData.Append(";PID=");
1807 ProcessData.Append((*LogosListPID)[LogosIter->first]);
1811 // Check if there is a value for PREF.
1813 if ((*LogosListPref)[LogosIter->first] > 0){
1815 ProcessData.Append(";PREF=");
1816 ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
1820 // Check if there is a value for tokens.
1822 if ((*LogosListTokens)[LogosIter->first].size() > 0){
1824 ProcessData.Append(";");
1825 ProcessData.Append((*LogosListTokens)[LogosIter->first]);
1829 ProcessData.Append(":data:");
1830 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
1831 ProcessData.Append(";");
1832 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
1833 ProcessData.Append(",");
1834 ProcessData.Append(LogosIter->second);
1835 ProcessData.Append("\n");
1837 ProcessData = OutputText(&ProcessData);
1839 SaveData->Append(ProcessData);
1840 ProcessData.clear();