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 SaveSound(&SoundsList, &SoundsListAltID,
589 &SoundsListPID, &SoundsListType,
590 &SoundsListAudioEncType, &SoundsListAudioType,
591 &SoundsListMediatype, &SoundsListLanguage,
592 &SoundsListPref, &SoundsListTokens,
597 SaveCalendarURI(&CalendarList, &CalendarListMediatype,
598 &CalendarListAltID, &CalendarListPID,
599 &CalendarListType, &CalendarListPref,
600 &CalendarListTokens, SaveData);
602 // Write the end part of the vCard data file.
604 SaveData->Append("END:VCARD");
606 SaveDataStatus = CONTACTSAVE_OK;
608 return SaveDataStatus;
612 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
613 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
614 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
615 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
617 wxString ProcessData = "";
619 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
620 TitleIter != TitleList->end(); TitleIter++){
622 ProcessData.Append("TITLE");
624 // Check if there is a value for TYPE.
626 if (DataType.size() > 0){
628 ProcessData.Append(";TYPE=");
629 ProcessData.Append(DataType);
633 // Check if there is a value for ALTID.
635 if ((*TitleListAltID)[TitleIter->first].size() > 0){
637 ProcessData.Append(";ALTID=");
638 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
642 // Check if there is a value for LANGUAGE.
644 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
646 ProcessData.Append(";LANGUAGE=");
647 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
651 // Check if there is a value for PID.
653 if ((*TitleListPID)[TitleIter->first].size() > 0){
655 ProcessData.Append(";PID=");
656 ProcessData.Append((*TitleListPID)[TitleIter->first]);
660 // Check if there is a value for PREF.
662 if ((*TitleListPref)[TitleIter->first] > 0){
664 ProcessData.Append(";PREF=");
665 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
669 // Check if there is a value for tokens.
671 if ((*TitleListTokens)[TitleIter->first].size() > 0){
673 ProcessData.Append(";");
674 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
678 ProcessData.Append(":");
679 ProcessData.Append(TitleIter->second);
680 ProcessData.Append("\n");
682 ProcessData = OutputText(&ProcessData);
684 SaveData->Append(ProcessData);
691 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
692 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
693 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
694 map<int, wxString> *SourceListTokens, wxString *SaveData){
696 wxString ProcessData = "";
698 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
699 SourceIter != SourceList->end(); SourceIter++){
701 ProcessData.Append("SOURCE");
703 // Check if there is a value for TYPE.
705 if ((*SourceListType)[SourceIter->first].size() > 0){
707 ProcessData.Append(";TYPE=");
708 ProcessData.Append((*SourceListType)[SourceIter->first]);
712 // Check if there is a value for ALTID.
714 if ((*SourceListAltID)[SourceIter->first].size() > 0){
716 ProcessData.Append(";ALTID=");
717 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
721 // Check if there is a value for MEDIATYPE.
723 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
725 ProcessData.Append(";MEDIATYPE=");
726 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
730 // Check if there is a value for PID.
732 if ((*SourceListPID)[SourceIter->first].size() > 0){
734 ProcessData.Append(";PID=");
735 ProcessData.Append((*SourceListPID)[SourceIter->first]);
739 // Check if there is a value for PREF.
741 if ((*SourceListPref)[SourceIter->first] > 0){
743 ProcessData.Append(";PREF=");
744 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
748 // Check if there is a value for tokens.
750 if ((*SourceListTokens)[SourceIter->first].size() > 0){
752 ProcessData.Append(";");
753 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
757 ProcessData.Append(":");
758 ProcessData.Append(SourceIter->second);
759 ProcessData.Append("\n");
761 ProcessData = OutputText(&ProcessData);
763 SaveData->Append(ProcessData);
770 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
771 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
772 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
773 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
775 wxString ProcessData = "";
777 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
778 NicknameIter != NicknameList->end(); NicknameIter++){
780 ProcessData.Append("NICKNAME");
782 // Check if there is a value for TYPE.
784 if (DataType.size() > 0){
786 ProcessData.Append(";TYPE=");
787 ProcessData.Append(DataType);
791 // Check if there is a value for ALTID.
793 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
795 ProcessData.Append(";ALTID=");
796 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
800 // Check if there is a value for MEDIATYPE.
802 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
804 ProcessData.Append(";LANGUAGE=");
805 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
809 // Check if there is a value for PID.
811 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
813 ProcessData.Append(";PID=");
814 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
818 // Check if there is a value for PREF.
820 if ((*NicknameListPref)[NicknameIter->first] > 0){
822 ProcessData.Append(";PREF=");
823 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
827 // Check if there is a value for tokens.
829 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
831 ProcessData.Append(";");
832 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
836 ProcessData.Append(":");
837 ProcessData.Append(NicknameIter->second);
838 ProcessData.Append("\n");
840 ProcessData = OutputText(&ProcessData);
842 SaveData->Append(ProcessData);
849 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
850 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
851 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
852 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
854 wxString ProcessData = "";
856 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
857 TZIter != TZList->end(); TZIter++){
859 ProcessData.Append("TZ");
861 // Check if there is a value for TYPE.
863 if (DataType.size() > 0){
865 ProcessData.Append(";TYPE=");
866 ProcessData.Append(DataType);
870 // Check if there is a value for ALTID.
872 if ((*TZListAltID)[TZIter->first].size() > 0){
874 ProcessData.Append(";ALTID=");
875 ProcessData.Append((*TZListAltID)[TZIter->first]);
879 // Check if there is a value for MEDIATYPE.
881 if ((*TZListMediatype)[TZIter->first].size() > 0){
883 ProcessData.Append(";MEDIATYPE=");
884 ProcessData.Append((*TZListMediatype)[TZIter->first]);
888 // Check if there is a value for PID.
890 if ((*TZListPID)[TZIter->first].size() > 0){
892 ProcessData.Append(";PID=");
893 ProcessData.Append((*TZListPID)[TZIter->first]);
897 // Check if there is a value for PREF.
899 if ((*TZListPref)[TZIter->first] > 0){
901 ProcessData.Append(";PREF=");
902 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
906 // Check if there is a value for tokens.
908 if ((*TZListTokens)[TZIter->first].size() > 0){
910 ProcessData.Append(";");
911 ProcessData.Append((*TZListTokens)[TZIter->first]);
915 ProcessData.Append(":");
916 ProcessData.Append(TZIter->second);
917 ProcessData.Append("\n");
919 ProcessData = OutputText(&ProcessData);
921 SaveData->Append(ProcessData);
928 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
929 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
930 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
931 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
932 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
933 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
934 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
935 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
937 wxString ProcessData = "";
939 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
940 AddressIter != AddressList->end(); AddressIter++){
942 ProcessData.Append("ADR");
944 // Check if there is a value for TYPE.
946 if (DataType.size() > 0){
948 ProcessData.Append(";TYPE=");
949 ProcessData.Append(DataType);
953 // Check if there is a value for ALTID.
955 if ((*AddressListAltID)[AddressIter->first].size() > 0){
957 ProcessData.Append(";ALTID=");
958 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
962 // Check if there is a value for GEO.
964 if ((*AddressListGeo)[AddressIter->first].size() > 0){
966 ProcessData.Append(";GEO=\"");
967 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
968 ProcessData.Append("\"");
972 // Check if there is a value for LABEL.
974 if ((*AddressListLabel)[AddressIter->first].size() > 0){
976 wxString AddressProcessed = "";
977 AddressProcessed = (*AddressListLabel)[AddressIter->first];
979 AddressProcessed.Replace("\n", "\\n", true);
981 ProcessData.Append(";LABEL=");
982 ProcessData.Append(AddressProcessed);
986 // Check if there is a value for LANGUAGE.
988 if ((*AddressListLang)[AddressIter->first].size() > 0){
990 ProcessData.Append(";LANGUAGE=");
991 ProcessData.Append((*AddressListLang)[AddressIter->first]);
995 // Check if there is a value for MEDIATYPE.
997 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
999 ProcessData.Append(";MEDIATYPE=");
1000 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1004 // Check if there is a value for PID.
1006 if ((*AddressListPID)[AddressIter->first].size() > 0){
1008 ProcessData.Append(";PID=");
1009 ProcessData.Append((*AddressListPID)[AddressIter->first]);
1013 // Check if there is a value for PREF.
1015 if ((*AddressListPref)[AddressIter->first] > 0){
1017 ProcessData.Append(";PREF=");
1018 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1022 // Check if there is a value for TZ.
1024 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1026 ProcessData.Append(";TZ=");
1027 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1031 // Check if there is a value for tokens.
1033 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1035 ProcessData.Append(";");
1036 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1040 // Build the address.
1042 ProcessData.Append(":;;");
1043 ProcessData.Append((*AddressList)[AddressIter->first]);
1044 ProcessData.Append(";");
1045 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1046 ProcessData.Append(";");
1047 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1048 ProcessData.Append(";");
1049 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1050 ProcessData.Append(";");
1051 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1052 ProcessData.Append("\n");
1054 ProcessData = OutputText(&ProcessData);
1056 SaveData->Append(ProcessData);
1057 ProcessData.clear();
1063 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1064 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1065 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1066 wxString *SaveData, wxString DataType){
1068 wxString ProcessData = "";
1070 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1071 EmailIter != EmailList->end(); EmailIter++){
1073 ProcessData.Append("EMAIL");
1075 // Check if there is a value for TYPE.
1077 if (DataType.size() > 0){
1079 ProcessData.Append(";TYPE=");
1080 ProcessData.Append(DataType);
1084 // Check if there is a value for ALTID.
1086 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1088 ProcessData.Append(";ALTID=");
1089 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1093 // Check if there is a value for PID.
1095 if ((*EmailListPID)[EmailIter->first].size() > 0){
1097 ProcessData.Append(";PID=");
1098 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1102 // Check if there is a value for PREF.
1104 if ((*EmailListPref)[EmailIter->first] > 0){
1106 ProcessData.Append(";PREF=");
1107 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1111 // Check if there is a value for tokens.
1113 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1115 ProcessData.Append(";");
1116 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1120 ProcessData.Append(":");
1121 ProcessData.Append(EmailIter->second);
1122 ProcessData.Append("\n");
1124 ProcessData = OutputText(&ProcessData);
1126 SaveData->Append(ProcessData);
1127 ProcessData.clear();
1133 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1134 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1135 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1136 wxString *SaveData, wxString DataType){
1138 wxString ProcessData = "";
1140 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1141 LanguageIter != LanguageList->end(); LanguageIter++){
1143 ProcessData.Append("LANG");
1145 // Check if there is a value for TYPE.
1147 if (DataType.size() > 0){
1149 ProcessData.Append(";TYPE=");
1150 ProcessData.Append(DataType);
1154 // Check if there is a value for ALTID.
1156 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1158 ProcessData.Append(";ALTID=");
1159 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1163 // Check if there is a value for PID.
1165 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1167 ProcessData.Append(";PID=");
1168 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1172 // Check if there is a value for PREF.
1174 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1176 ProcessData.Append(";PREF=");
1177 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1181 // Check if there is a value for tokens.
1183 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1185 ProcessData.Append(";");
1186 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1190 ProcessData.Append(":");
1191 ProcessData.Append(LanguageIter->second);
1192 ProcessData.Append("\n");
1194 ProcessData = OutputText(&ProcessData);
1196 SaveData->Append(ProcessData);
1197 ProcessData.clear();
1203 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1204 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1205 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1206 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1207 wxString *SaveData, wxString DataType){
1209 wxString ProcessData = "";
1211 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1212 GeographyIter != GeographyList->end(); GeographyIter++){
1214 ProcessData.Append("GEO");
1216 // Check if there is a value for TYPE.
1218 if (DataType.size() > 0){
1220 ProcessData.Append(";TYPE=");
1221 ProcessData.Append(DataType);
1225 // Check if there is a value for ALTID.
1227 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1229 ProcessData.Append(";ALTID=");
1230 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1234 // Check if there is a value for MEDIATYPE.
1236 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1238 ProcessData.Append(";MEDIATYPE=");
1239 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1243 // Check if there is a value for PID.
1245 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1247 ProcessData.Append(";PID=");
1248 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1252 // Check if there is a value for PREF.
1254 if ((*GeographyListPref)[GeographyIter->first] > 0){
1256 ProcessData.Append(";PREF=");
1257 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1261 // Check if there is a value for tokens.
1263 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1265 ProcessData.Append(";");
1266 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1270 ProcessData.Append(":");
1271 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1272 ProcessData.Append(":");
1273 ProcessData.Append(GeographyIter->second);
1274 ProcessData.Append("\n");
1276 ProcessData = OutputText(&ProcessData);
1278 SaveData->Append(ProcessData);
1279 ProcessData.clear();
1285 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1286 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1287 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1288 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1290 wxString ProcessData = "";
1292 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1293 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1295 ProcessData.Append("URL");
1297 // Check if there is a value for TYPE.
1299 if (DataType.size() > 0){
1301 ProcessData.Append(";TYPE=");
1302 ProcessData.Append(DataType);
1306 // Check if there is a value for ALTID.
1308 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1310 ProcessData.Append(";ALTID=");
1311 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1315 // Check if there is a value for MEDIATYPE.
1317 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1319 ProcessData.Append(";MEDIATYPE=");
1320 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1324 // Check if there is a value for PID.
1326 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1328 ProcessData.Append(";PID=");
1329 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1333 // Check if there is a value for PREF.
1335 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1337 ProcessData.Append(";PREF=");
1338 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1342 // Check if there is a value for tokens.
1344 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1346 ProcessData.Append(";");
1347 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1351 ProcessData.Append(":");
1352 ProcessData.Append(WebsiteIter->second);
1353 ProcessData.Append("\n");
1355 ProcessData = OutputText(&ProcessData);
1357 SaveData->Append(ProcessData);
1358 ProcessData.clear();
1364 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1365 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1366 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1367 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1369 wxString ProcessData = "";
1371 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1372 RoleIter != RoleList->end(); RoleIter++){
1374 ProcessData.Append("ROLE");
1376 // Check if there is a value for TYPE.
1378 if (DataType.size() > 0){
1380 ProcessData.Append(";TYPE=");
1381 ProcessData.Append(DataType);
1385 // Check if there is a value for ALTID.
1387 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1389 ProcessData.Append(";ALTID=");
1390 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1394 // Check if there is a value for LANGUAGE.
1396 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1398 ProcessData.Append(";LANGUAGE=");
1399 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1403 // Check if there is a value for PID.
1405 if ((*RoleListPID)[RoleIter->first].size() > 0){
1407 ProcessData.Append(";PID=");
1408 ProcessData.Append((*RoleListPID)[RoleIter->first]);
1412 // Check if there is a value for PREF.
1414 if ((*RoleListPref)[RoleIter->first] > 0){
1416 ProcessData.Append(";PREF=");
1417 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1421 // Check if there is a value for tokens.
1423 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1425 ProcessData.Append(";");
1426 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1430 ProcessData.Append(":");
1431 ProcessData.Append(RoleIter->second);
1432 ProcessData.Append("\n");
1434 ProcessData = OutputText(&ProcessData);
1436 SaveData->Append(ProcessData);
1437 ProcessData.clear();
1443 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1444 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
1445 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
1446 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
1447 wxString *SaveData, wxString DataType){
1449 wxString ProcessData = "";
1451 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1452 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1454 ProcessData.Append("ORG");
1456 // Check if there is a value for TYPE.
1458 if (DataType.size() > 0){
1460 ProcessData.Append(";TYPE=");
1461 ProcessData.Append(DataType);
1465 // Check if there is a value for ALTID.
1467 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1469 ProcessData.Append(";ALTID=");
1470 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1474 // Check if there is a value for LANGUAGE.
1476 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1478 ProcessData.Append(";LANGUAGE=");
1479 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1483 // Check if there is a value for PID.
1485 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1487 ProcessData.Append(";PID=");
1488 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1492 // Check if there is a value for PREF.
1494 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1496 ProcessData.Append(";PREF=");
1497 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1501 // Check if there is a value for SORT-AS.
1503 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1505 ProcessData.Append(";SORT-AS=\"");
1506 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1507 ProcessData.Append("\"");
1511 // Check if there is a value for tokens.
1513 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1515 ProcessData.Append(";");
1516 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1520 ProcessData.Append(":");
1521 ProcessData.Append(OrganisationIter->second);
1522 ProcessData.Append("\n");
1524 ProcessData = OutputText(&ProcessData);
1526 SaveData->Append(ProcessData);
1527 ProcessData.clear();
1533 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1534 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1535 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1536 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1538 wxString ProcessData = "";
1540 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1541 NoteIter != NoteList->end(); NoteIter++){
1543 ProcessData.Append("NOTE");
1545 // Check if there is a value for TYPE.
1547 if (DataType.size() > 0){
1549 ProcessData.Append(";TYPE=");
1550 ProcessData.Append(DataType);
1554 // Check if there is a value for ALTID.
1556 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1558 ProcessData.Append(";ALTID=");
1559 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1563 // Check if there is a value for LANGUAGE.
1565 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1567 ProcessData.Append(";LANGUAGE=");
1568 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1572 // Check if there is a value for PID.
1574 if ((*NoteListPID)[NoteIter->first].size() > 0){
1576 ProcessData.Append(";PID=");
1577 ProcessData.Append((*NoteListPID)[NoteIter->first]);
1581 // Check if there is a value for PREF.
1583 if ((*NoteListPref)[NoteIter->first] > 0){
1585 ProcessData.Append(";PREF=");
1586 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1590 // Check if there is a value for tokens.
1592 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1594 ProcessData.Append(";");
1595 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1599 ProcessData.Append(":");
1600 ProcessData.Append(NoteIter->second);
1601 ProcessData.Replace("\n", "\\n", true);
1602 ProcessData.Append("\n");
1604 ProcessData = OutputText(&ProcessData);
1606 SaveData->Append(ProcessData);
1607 ProcessData.clear();
1613 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1614 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1615 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1616 map<int, wxString> *CategoryListTokens, wxString *SaveData){
1618 wxString ProcessData = "";
1620 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1621 CategoryIter != CategoryList->end(); CategoryIter++){
1623 ProcessData.Append("CATEGORIES");
1625 // Check if there is a value for TYPE.
1627 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1629 ProcessData.Append(";TYPE=");
1630 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1634 // Check if there is a value for ALTID.
1636 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1638 ProcessData.Append(";ALTID=");
1639 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1643 // Check if there is a value for LANGUAGE.
1645 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1647 ProcessData.Append(";LANGUAGE=");
1648 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1652 // Check if there is a value for PID.
1654 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1656 ProcessData.Append(";PID=");
1657 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1661 // Check if there is a value for PREF.
1663 if ((*CategoryListPref)[CategoryIter->first] > 0){
1665 ProcessData.Append(";PREF=");
1666 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1670 // Check if there is a value for tokens.
1672 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1674 ProcessData.Append(";");
1675 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1679 ProcessData.Append(":");
1680 ProcessData.Append(CategoryIter->second);
1681 ProcessData.Append("\n");
1683 ProcessData = OutputText(&ProcessData);
1685 SaveData->Append(ProcessData);
1686 ProcessData.clear();
1692 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
1693 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1694 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1695 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1696 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1698 wxString ProcessData = "";
1700 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1701 PicturesIter != PicturesList->end(); PicturesIter++){
1703 ProcessData.Append("PHOTO");
1705 // Check if there is a value for TYPE.
1707 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1709 ProcessData.Append(";TYPE=");
1710 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1714 // Check if there is a value for ALTID.
1716 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1718 ProcessData.Append(";ALTID=");
1719 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1723 // Check if there is a value for MEDIATYPE..
1725 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1727 ProcessData.Append(";MEDIATYPE=");
1728 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1732 // Check if there is a value for PID.
1734 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1736 ProcessData.Append(";PID=");
1737 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1741 // Check if there is a value for PREF.
1743 if ((*PicturesListPref)[PicturesIter->first] > 0){
1745 ProcessData.Append(";PREF=");
1746 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1750 // Check if there is a value for tokens.
1752 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1754 ProcessData.Append(";");
1755 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1759 ProcessData.Append(":data:");
1760 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1761 ProcessData.Append(";");
1762 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1763 ProcessData.Append(",");
1764 ProcessData.Append(PicturesIter->second);
1765 ProcessData.Append("\n");
1767 ProcessData = OutputText(&ProcessData);
1769 SaveData->Append(ProcessData);
1770 ProcessData.clear();
1776 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID,
1777 map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
1778 map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
1779 map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
1780 map<int, wxString> *LogosListTokens, wxString *SaveData){
1782 wxString ProcessData = "";
1784 for (std::map<int, string>::iterator LogosIter = LogosList->begin();
1785 LogosIter != LogosList->end(); LogosIter++){
1787 ProcessData.Append("LOGO");
1789 // Check if there is a value for TYPE.
1791 if ((*LogosListType)[LogosIter->first].size() > 0){
1793 ProcessData.Append(";TYPE=");
1794 ProcessData.Append((*LogosListType)[LogosIter->first]);
1798 // Check if there is a value for ALTID.
1800 if ((*LogosListAltID)[LogosIter->first].size() > 0){
1802 ProcessData.Append(";ALTID=");
1803 ProcessData.Append((*LogosListAltID)[LogosIter->first]);
1807 // Check if there is a value for MEDIATYPE..
1809 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
1811 ProcessData.Append(";MEDIATYPE=");
1812 ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
1816 // Check if there is a value for PID.
1818 if ((*LogosListPID)[LogosIter->first].size() > 0){
1820 ProcessData.Append(";PID=");
1821 ProcessData.Append((*LogosListPID)[LogosIter->first]);
1825 // Check if there is a value for PREF.
1827 if ((*LogosListPref)[LogosIter->first] > 0){
1829 ProcessData.Append(";PREF=");
1830 ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
1834 // Check if there is a value for tokens.
1836 if ((*LogosListTokens)[LogosIter->first].size() > 0){
1838 ProcessData.Append(";");
1839 ProcessData.Append((*LogosListTokens)[LogosIter->first]);
1843 ProcessData.Append(":data:");
1844 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
1845 ProcessData.Append(";");
1846 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
1847 ProcessData.Append(",");
1848 ProcessData.Append(LogosIter->second);
1849 ProcessData.Append("\n");
1851 ProcessData = OutputText(&ProcessData);
1853 SaveData->Append(ProcessData);
1854 ProcessData.clear();
1860 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID,
1861 map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
1862 map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
1863 map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage,
1864 map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens,
1865 wxString *SaveData){
1867 wxString ProcessData = "";
1869 for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
1870 SoundsIter != SoundsList->end(); SoundsIter++){
1872 ProcessData.Append("SOUND");
1874 // Check if there is a value for TYPE.
1876 if ((*SoundsListType)[SoundsIter->first].size() > 0){
1878 ProcessData.Append(";TYPE=");
1879 ProcessData.Append((*SoundsListType)[SoundsIter->first]);
1883 // Check if there is a value for ALTID.
1885 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
1887 ProcessData.Append(";ALTID=");
1888 ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
1892 // Check if there is a value for LANGUAGE.
1894 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
1896 ProcessData.Append(";LANGUAGE=");
1897 ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
1901 // Check if there is a value for MEDIATYPE.
1903 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
1905 ProcessData.Append(";MEDIATYPE=");
1906 ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
1910 // Check if there is a value for PID.
1912 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
1914 ProcessData.Append(";PID=");
1915 ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
1919 // Check if there is a value for PREF.
1921 if ((*SoundsListPref)[SoundsIter->first] > 0){
1923 ProcessData.Append(";PREF=");
1924 ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
1928 // Check if there is a value for tokens.
1930 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
1932 ProcessData.Append(";");
1933 ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
1937 ProcessData.Append(":data:");
1938 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
1939 ProcessData.Append(";");
1940 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
1941 ProcessData.Append(",");
1942 ProcessData.Append(SoundsIter->second);
1943 ProcessData.Append("\n");
1945 ProcessData = OutputText(&ProcessData);
1947 SaveData->Append(ProcessData);
1948 ProcessData.clear();
1954 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
1955 map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
1956 map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
1957 map<int, wxString> *CalendarListTokens, wxString *SaveData){
1959 wxString ProcessData = "";
1961 for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
1962 CalendarIter != CalendarList->end(); CalendarIter++){
1964 ProcessData.Append("CALURI");
1966 // Check if there is a value for TYPE.
1968 if ((*CalendarListType)[CalendarIter->first].size() > 0){
1970 ProcessData.Append(";TYPE=");
1971 ProcessData.Append((*CalendarListType)[CalendarIter->first]);
1975 // Check if there is a value for ALTID.
1977 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
1979 ProcessData.Append(";ALTID=");
1980 ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
1984 // Check if there is a value for MEDIATYPE.
1986 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
1988 ProcessData.Append(";MEDIATYPE=");
1989 ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
1993 // Check if there is a value for PID.
1995 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
1997 ProcessData.Append(";PID=");
1998 ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2002 // Check if there is a value for PREF.
2004 if ((*CalendarListPref)[CalendarIter->first] > 0){
2006 ProcessData.Append(";PREF=");
2007 ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2011 // Check if there is a value for tokens.
2013 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2015 ProcessData.Append(";");
2016 ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2020 ProcessData.Append(":");
2021 ProcessData.Append(CalendarIter->second);
2022 ProcessData.Append("\n");
2024 ProcessData = OutputText(&ProcessData);
2026 SaveData->Append(ProcessData);
2027 ProcessData.clear();