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);
582 // Write the end part of the vCard data file.
584 SaveData->Append("END:VCARD");
586 SaveDataStatus = CONTACTSAVE_OK;
588 return SaveDataStatus;
592 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
593 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
594 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
595 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
597 wxString ProcessData = "";
599 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
600 TitleIter != TitleList->end(); TitleIter++){
602 ProcessData.Append("TITLE");
604 // Check if there is a value for TYPE.
606 if (DataType.size() > 0){
608 ProcessData.Append(";TYPE=");
609 ProcessData.Append(DataType);
613 // Check if there is a value for ALTID.
615 if ((*TitleListAltID)[TitleIter->first].size() > 0){
617 ProcessData.Append(";ALTID=");
618 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
622 // Check if there is a value for LANGUAGE.
624 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
626 ProcessData.Append(";LANGUAGE=");
627 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
631 // Check if there is a value for PID.
633 if ((*TitleListPID)[TitleIter->first].size() > 0){
635 ProcessData.Append(";PID=");
636 ProcessData.Append((*TitleListPID)[TitleIter->first]);
640 // Check if there is a value for PREF.
642 if ((*TitleListPref)[TitleIter->first] > 0){
644 ProcessData.Append(";PREF=");
645 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
649 // Check if there is a value for tokens.
651 if ((*TitleListTokens)[TitleIter->first].size() > 0){
653 ProcessData.Append(";");
654 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
658 ProcessData.Append(":");
659 ProcessData.Append(TitleIter->second);
660 ProcessData.Append("\n");
662 ProcessData = OutputText(&ProcessData);
664 SaveData->Append(ProcessData);
671 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
672 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
673 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
674 map<int, wxString> *SourceListTokens, wxString *SaveData){
676 wxString ProcessData = "";
678 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
679 SourceIter != SourceList->end(); SourceIter++){
681 ProcessData.Append("SOURCE");
683 // Check if there is a value for TYPE.
685 if ((*SourceListType)[SourceIter->first].size() > 0){
687 ProcessData.Append(";TYPE=");
688 ProcessData.Append((*SourceListType)[SourceIter->first]);
692 // Check if there is a value for ALTID.
694 if ((*SourceListAltID)[SourceIter->first].size() > 0){
696 ProcessData.Append(";ALTID=");
697 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
701 // Check if there is a value for MEDIATYPE.
703 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
705 ProcessData.Append(";MEDIATYPE=");
706 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
710 // Check if there is a value for PID.
712 if ((*SourceListPID)[SourceIter->first].size() > 0){
714 ProcessData.Append(";PID=");
715 ProcessData.Append((*SourceListPID)[SourceIter->first]);
719 // Check if there is a value for PREF.
721 if ((*SourceListPref)[SourceIter->first] > 0){
723 ProcessData.Append(";PREF=");
724 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
728 // Check if there is a value for tokens.
730 if ((*SourceListTokens)[SourceIter->first].size() > 0){
732 ProcessData.Append(";");
733 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
737 ProcessData.Append(":");
738 ProcessData.Append(SourceIter->second);
739 ProcessData.Append("\n");
741 ProcessData = OutputText(&ProcessData);
743 SaveData->Append(ProcessData);
750 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
751 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
752 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
753 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
755 wxString ProcessData = "";
757 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
758 NicknameIter != NicknameList->end(); NicknameIter++){
760 ProcessData.Append("NICKNAME");
762 // Check if there is a value for TYPE.
764 if (DataType.size() > 0){
766 ProcessData.Append(";TYPE=");
767 ProcessData.Append(DataType);
771 // Check if there is a value for ALTID.
773 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
775 ProcessData.Append(";ALTID=");
776 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
780 // Check if there is a value for MEDIATYPE.
782 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
784 ProcessData.Append(";LANGUAGE=");
785 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
789 // Check if there is a value for PID.
791 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
793 ProcessData.Append(";PID=");
794 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
798 // Check if there is a value for PREF.
800 if ((*NicknameListPref)[NicknameIter->first] > 0){
802 ProcessData.Append(";PREF=");
803 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
807 // Check if there is a value for tokens.
809 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
811 ProcessData.Append(";");
812 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
816 ProcessData.Append(":");
817 ProcessData.Append(NicknameIter->second);
818 ProcessData.Append("\n");
820 ProcessData = OutputText(&ProcessData);
822 SaveData->Append(ProcessData);
829 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
830 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
831 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
832 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
834 wxString ProcessData = "";
836 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
837 TZIter != TZList->end(); TZIter++){
839 ProcessData.Append("TZ");
841 // Check if there is a value for TYPE.
843 if (DataType.size() > 0){
845 ProcessData.Append(";TYPE=");
846 ProcessData.Append(DataType);
850 // Check if there is a value for ALTID.
852 if ((*TZListAltID)[TZIter->first].size() > 0){
854 ProcessData.Append(";ALTID=");
855 ProcessData.Append((*TZListAltID)[TZIter->first]);
859 // Check if there is a value for MEDIATYPE.
861 if ((*TZListMediatype)[TZIter->first].size() > 0){
863 ProcessData.Append(";MEDIATYPE=");
864 ProcessData.Append((*TZListMediatype)[TZIter->first]);
868 // Check if there is a value for PID.
870 if ((*TZListPID)[TZIter->first].size() > 0){
872 ProcessData.Append(";PID=");
873 ProcessData.Append((*TZListPID)[TZIter->first]);
877 // Check if there is a value for PREF.
879 if ((*TZListPref)[TZIter->first] > 0){
881 ProcessData.Append(";PREF=");
882 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
886 // Check if there is a value for tokens.
888 if ((*TZListTokens)[TZIter->first].size() > 0){
890 ProcessData.Append(";");
891 ProcessData.Append((*TZListTokens)[TZIter->first]);
895 ProcessData.Append(":");
896 ProcessData.Append(TZIter->second);
897 ProcessData.Append("\n");
899 ProcessData = OutputText(&ProcessData);
901 SaveData->Append(ProcessData);
908 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
909 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
910 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
911 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
912 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
913 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
914 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
915 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
917 wxString ProcessData = "";
919 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
920 AddressIter != AddressList->end(); AddressIter++){
922 ProcessData.Append("ADR");
924 // Check if there is a value for TYPE.
926 if (DataType.size() > 0){
928 ProcessData.Append(";TYPE=");
929 ProcessData.Append(DataType);
933 // Check if there is a value for ALTID.
935 if ((*AddressListAltID)[AddressIter->first].size() > 0){
937 ProcessData.Append(";ALTID=");
938 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
942 // Check if there is a value for GEO.
944 if ((*AddressListGeo)[AddressIter->first].size() > 0){
946 ProcessData.Append(";GEO=\"");
947 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
948 ProcessData.Append("\"");
952 // Check if there is a value for LABEL.
954 if ((*AddressListLabel)[AddressIter->first].size() > 0){
956 wxString AddressProcessed = "";
957 AddressProcessed = (*AddressListLabel)[AddressIter->first];
959 AddressProcessed.Replace("\n", "\\n", true);
961 ProcessData.Append(";LABEL=");
962 ProcessData.Append(AddressProcessed);
966 // Check if there is a value for LANGUAGE.
968 if ((*AddressListLang)[AddressIter->first].size() > 0){
970 ProcessData.Append(";LANGUAGE=");
971 ProcessData.Append((*AddressListLang)[AddressIter->first]);
975 // Check if there is a value for MEDIATYPE.
977 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
979 ProcessData.Append(";MEDIATYPE=");
980 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
984 // Check if there is a value for PID.
986 if ((*AddressListPID)[AddressIter->first].size() > 0){
988 ProcessData.Append(";PID=");
989 ProcessData.Append((*AddressListPID)[AddressIter->first]);
993 // Check if there is a value for PREF.
995 if ((*AddressListPref)[AddressIter->first] > 0){
997 ProcessData.Append(";PREF=");
998 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1002 // Check if there is a value for TZ.
1004 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1006 ProcessData.Append(";TZ=");
1007 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1011 // Check if there is a value for tokens.
1013 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1015 ProcessData.Append(";");
1016 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1020 // Build the address.
1022 ProcessData.Append(":;;");
1023 ProcessData.Append((*AddressList)[AddressIter->first]);
1024 ProcessData.Append(";");
1025 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1026 ProcessData.Append(";");
1027 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1028 ProcessData.Append(";");
1029 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1030 ProcessData.Append(";");
1031 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1032 ProcessData.Append("\n");
1034 ProcessData = OutputText(&ProcessData);
1036 SaveData->Append(ProcessData);
1037 ProcessData.clear();
1043 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1044 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1045 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1046 wxString *SaveData, wxString DataType){
1048 wxString ProcessData = "";
1050 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1051 EmailIter != EmailList->end(); EmailIter++){
1053 ProcessData.Append("EMAIL");
1055 // Check if there is a value for TYPE.
1057 if (DataType.size() > 0){
1059 ProcessData.Append(";TYPE=");
1060 ProcessData.Append(DataType);
1064 // Check if there is a value for ALTID.
1066 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1068 ProcessData.Append(";ALTID=");
1069 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1073 // Check if there is a value for PID.
1075 if ((*EmailListPID)[EmailIter->first].size() > 0){
1077 ProcessData.Append(";PID=");
1078 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1082 // Check if there is a value for PREF.
1084 if ((*EmailListPref)[EmailIter->first] > 0){
1086 ProcessData.Append(";PREF=");
1087 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1091 // Check if there is a value for tokens.
1093 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1095 ProcessData.Append(";");
1096 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1100 ProcessData.Append(":");
1101 ProcessData.Append(EmailIter->second);
1102 ProcessData.Append("\n");
1104 ProcessData = OutputText(&ProcessData);
1106 SaveData->Append(ProcessData);
1107 ProcessData.clear();
1113 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1114 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1115 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1116 wxString *SaveData, wxString DataType){
1118 wxString ProcessData = "";
1120 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1121 LanguageIter != LanguageList->end(); LanguageIter++){
1123 ProcessData.Append("LANG");
1125 // Check if there is a value for TYPE.
1127 if (DataType.size() > 0){
1129 ProcessData.Append(";TYPE=");
1130 ProcessData.Append(DataType);
1134 // Check if there is a value for ALTID.
1136 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1138 ProcessData.Append(";ALTID=");
1139 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1143 // Check if there is a value for PID.
1145 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1147 ProcessData.Append(";PID=");
1148 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1152 // Check if there is a value for PREF.
1154 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1156 ProcessData.Append(";PREF=");
1157 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1161 // Check if there is a value for tokens.
1163 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1165 ProcessData.Append(";");
1166 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1170 ProcessData.Append(":");
1171 ProcessData.Append(LanguageIter->second);
1172 ProcessData.Append("\n");
1174 ProcessData = OutputText(&ProcessData);
1176 SaveData->Append(ProcessData);
1177 ProcessData.clear();
1183 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1184 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1185 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1186 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1187 wxString *SaveData, wxString DataType){
1189 wxString ProcessData = "";
1191 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1192 GeographyIter != GeographyList->end(); GeographyIter++){
1194 ProcessData.Append("GEO");
1196 // Check if there is a value for TYPE.
1198 if (DataType.size() > 0){
1200 ProcessData.Append(";TYPE=");
1201 ProcessData.Append(DataType);
1205 // Check if there is a value for ALTID.
1207 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1209 ProcessData.Append(";ALTID=");
1210 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1214 // Check if there is a value for MEDIATYPE.
1216 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1218 ProcessData.Append(";MEDIATYPE=");
1219 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1223 // Check if there is a value for PID.
1225 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1227 ProcessData.Append(";PID=");
1228 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1232 // Check if there is a value for PREF.
1234 if ((*GeographyListPref)[GeographyIter->first] > 0){
1236 ProcessData.Append(";PREF=");
1237 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1241 // Check if there is a value for tokens.
1243 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1245 ProcessData.Append(";");
1246 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1250 ProcessData.Append(":");
1251 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1252 ProcessData.Append(":");
1253 ProcessData.Append(GeographyIter->second);
1254 ProcessData.Append("\n");
1256 ProcessData = OutputText(&ProcessData);
1258 SaveData->Append(ProcessData);
1259 ProcessData.clear();
1265 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1266 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1267 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1268 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1270 wxString ProcessData = "";
1272 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1273 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1275 ProcessData.Append("URL");
1277 // Check if there is a value for TYPE.
1279 if (DataType.size() > 0){
1281 ProcessData.Append(";TYPE=");
1282 ProcessData.Append(DataType);
1286 // Check if there is a value for ALTID.
1288 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1290 ProcessData.Append(";ALTID=");
1291 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1295 // Check if there is a value for MEDIATYPE.
1297 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1299 ProcessData.Append(";MEDIATYPE=");
1300 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1304 // Check if there is a value for PID.
1306 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1308 ProcessData.Append(";PID=");
1309 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1313 // Check if there is a value for PREF.
1315 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1317 ProcessData.Append(";PREF=");
1318 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1322 // Check if there is a value for tokens.
1324 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1326 ProcessData.Append(";");
1327 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1331 ProcessData.Append(":");
1332 ProcessData.Append(WebsiteIter->second);
1333 ProcessData.Append("\n");
1335 ProcessData = OutputText(&ProcessData);
1337 SaveData->Append(ProcessData);
1338 ProcessData.clear();
1344 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1345 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1346 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1347 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1349 wxString ProcessData = "";
1351 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1352 RoleIter != RoleList->end(); RoleIter++){
1354 ProcessData.Append("ROLE");
1356 // Check if there is a value for TYPE.
1358 if (DataType.size() > 0){
1360 ProcessData.Append(";TYPE=");
1361 ProcessData.Append(DataType);
1365 // Check if there is a value for ALTID.
1367 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1369 ProcessData.Append(";ALTID=");
1370 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1374 // Check if there is a value for LANGUAGE.
1376 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1378 ProcessData.Append(";LANGUAGE=");
1379 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1383 // Check if there is a value for PID.
1385 if ((*RoleListPID)[RoleIter->first].size() > 0){
1387 ProcessData.Append(";PID=");
1388 ProcessData.Append((*RoleListPID)[RoleIter->first]);
1392 // Check if there is a value for PREF.
1394 if ((*RoleListPref)[RoleIter->first] > 0){
1396 ProcessData.Append(";PREF=");
1397 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1401 // Check if there is a value for tokens.
1403 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1405 ProcessData.Append(";");
1406 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1410 ProcessData.Append(":");
1411 ProcessData.Append(RoleIter->second);
1412 ProcessData.Append("\n");
1414 ProcessData = OutputText(&ProcessData);
1416 SaveData->Append(ProcessData);
1417 ProcessData.clear();
1423 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1424 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
1425 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
1426 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
1427 wxString *SaveData, wxString DataType){
1429 wxString ProcessData = "";
1431 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1432 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1434 ProcessData.Append("ORG");
1436 // Check if there is a value for TYPE.
1438 if (DataType.size() > 0){
1440 ProcessData.Append(";TYPE=");
1441 ProcessData.Append(DataType);
1445 // Check if there is a value for ALTID.
1447 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1449 ProcessData.Append(";ALTID=");
1450 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1454 // Check if there is a value for LANGUAGE.
1456 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1458 ProcessData.Append(";LANGUAGE=");
1459 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1463 // Check if there is a value for PID.
1465 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1467 ProcessData.Append(";PID=");
1468 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1472 // Check if there is a value for PREF.
1474 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1476 ProcessData.Append(";PREF=");
1477 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1481 // Check if there is a value for SORT-AS.
1483 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1485 ProcessData.Append(";SORT-AS=\"");
1486 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1487 ProcessData.Append("\"");
1491 // Check if there is a value for tokens.
1493 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1495 ProcessData.Append(";");
1496 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1500 ProcessData.Append(":");
1501 ProcessData.Append(OrganisationIter->second);
1502 ProcessData.Append("\n");
1504 ProcessData = OutputText(&ProcessData);
1506 SaveData->Append(ProcessData);
1507 ProcessData.clear();
1513 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1514 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1515 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1516 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1518 wxString ProcessData = "";
1520 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1521 NoteIter != NoteList->end(); NoteIter++){
1523 ProcessData.Append("NOTE");
1525 // Check if there is a value for TYPE.
1527 if (DataType.size() > 0){
1529 ProcessData.Append(";TYPE=");
1530 ProcessData.Append(DataType);
1534 // Check if there is a value for ALTID.
1536 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1538 ProcessData.Append(";ALTID=");
1539 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1543 // Check if there is a value for LANGUAGE.
1545 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1547 ProcessData.Append(";LANGUAGE=");
1548 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1552 // Check if there is a value for PID.
1554 if ((*NoteListPID)[NoteIter->first].size() > 0){
1556 ProcessData.Append(";PID=");
1557 ProcessData.Append((*NoteListPID)[NoteIter->first]);
1561 // Check if there is a value for PREF.
1563 if ((*NoteListPref)[NoteIter->first] > 0){
1565 ProcessData.Append(";PREF=");
1566 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1570 // Check if there is a value for tokens.
1572 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1574 ProcessData.Append(";");
1575 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1579 ProcessData.Append(":");
1580 ProcessData.Append(NoteIter->second);
1581 ProcessData.Replace("\n", "\\n", true);
1582 ProcessData.Append("\n");
1584 ProcessData = OutputText(&ProcessData);
1586 SaveData->Append(ProcessData);
1587 ProcessData.clear();
1593 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1594 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1595 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1596 map<int, wxString> *CategoryListTokens, wxString *SaveData){
1598 wxString ProcessData = "";
1600 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1601 CategoryIter != CategoryList->end(); CategoryIter++){
1603 ProcessData.Append("CATEGORIES");
1605 // Check if there is a value for TYPE.
1607 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1609 ProcessData.Append(";TYPE=");
1610 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1614 // Check if there is a value for ALTID.
1616 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1618 ProcessData.Append(";ALTID=");
1619 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1623 // Check if there is a value for LANGUAGE.
1625 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1627 ProcessData.Append(";LANGUAGE=");
1628 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1632 // Check if there is a value for PID.
1634 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1636 ProcessData.Append(";PID=");
1637 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1641 // Check if there is a value for PREF.
1643 if ((*CategoryListPref)[CategoryIter->first] > 0){
1645 ProcessData.Append(";PREF=");
1646 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1650 // Check if there is a value for tokens.
1652 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1654 ProcessData.Append(";");
1655 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1659 ProcessData.Append(":");
1660 ProcessData.Append(CategoryIter->second);
1661 ProcessData.Append("\n");
1663 ProcessData = OutputText(&ProcessData);
1665 SaveData->Append(ProcessData);
1666 ProcessData.clear();
1672 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
1673 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1674 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1675 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1676 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1678 wxString ProcessData = "";
1680 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1681 PicturesIter != PicturesList->end(); PicturesIter++){
1683 ProcessData.Append("PHOTO");
1685 // Check if there is a value for TYPE.
1687 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1689 ProcessData.Append(";TYPE=");
1690 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1694 // Check if there is a value for ALTID.
1696 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1698 ProcessData.Append(";ALTID=");
1699 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1703 // Check if there is a value for MEDIATYPE..
1705 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1707 ProcessData.Append(";MEDIATYPE=");
1708 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1712 // Check if there is a value for PID.
1714 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1716 ProcessData.Append(";PID=");
1717 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1721 // Check if there is a value for PREF.
1723 if ((*PicturesListPref)[PicturesIter->first] > 0){
1725 ProcessData.Append(";PREF=");
1726 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1730 // Check if there is a value for tokens.
1732 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1734 ProcessData.Append(";");
1735 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1739 ProcessData.Append(":data:");
1740 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1741 ProcessData.Append(";");
1742 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1743 ProcessData.Append(",");
1744 ProcessData.Append(PicturesIter->second);
1745 ProcessData.Append("\n");
1747 ProcessData = OutputText(&ProcessData);
1749 SaveData->Append(ProcessData);
1750 ProcessData.clear();