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 // Process CALADRURI.
604 SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
605 &CalendarRequestListAltID, &CalendarRequestListPID,
606 &CalendarRequestListType, &CalendarRequestListPref,
607 &CalendarRequestListTokens, SaveData);
611 SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID,
612 &FreeBusyListPID, &FreeBusyListType,
613 &FreeBusyListMediatype, &FreeBusyListPref,
614 &FreeBusyListTokens, SaveData);
618 SaveKey(&KeyList, &KeyListAltID,
619 &KeyListPID, &KeyListType,
620 &KeyListKeyType, &KeyListDataEncType,
621 &KeyListDataType, &KeyListPref,
622 &KeyListTokens, SaveData);
624 // Write the end part of the vCard data file.
626 SaveData->Append("END:VCARD");
628 SaveDataStatus = CONTACTSAVE_OK;
630 return SaveDataStatus;
634 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
635 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
636 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
637 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
639 wxString ProcessData = "";
641 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
642 TitleIter != TitleList->end(); TitleIter++){
644 ProcessData.Append("TITLE");
646 // Check if there is a value for TYPE.
648 if (DataType.size() > 0){
650 ProcessData.Append(";TYPE=");
651 ProcessData.Append(DataType);
655 // Check if there is a value for ALTID.
657 if ((*TitleListAltID)[TitleIter->first].size() > 0){
659 ProcessData.Append(";ALTID=");
660 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
664 // Check if there is a value for LANGUAGE.
666 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
668 ProcessData.Append(";LANGUAGE=");
669 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
673 // Check if there is a value for PID.
675 if ((*TitleListPID)[TitleIter->first].size() > 0){
677 ProcessData.Append(";PID=");
678 ProcessData.Append((*TitleListPID)[TitleIter->first]);
682 // Check if there is a value for PREF.
684 if ((*TitleListPref)[TitleIter->first] > 0){
686 ProcessData.Append(";PREF=");
687 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
691 // Check if there is a value for tokens.
693 if ((*TitleListTokens)[TitleIter->first].size() > 0){
695 ProcessData.Append(";");
696 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
700 ProcessData.Append(":");
701 ProcessData.Append(TitleIter->second);
702 ProcessData.Append("\n");
704 ProcessData = OutputText(&ProcessData);
706 SaveData->Append(ProcessData);
713 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
714 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
715 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
716 map<int, wxString> *SourceListTokens, wxString *SaveData){
718 wxString ProcessData = "";
720 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
721 SourceIter != SourceList->end(); SourceIter++){
723 ProcessData.Append("SOURCE");
725 // Check if there is a value for TYPE.
727 if ((*SourceListType)[SourceIter->first].size() > 0){
729 ProcessData.Append(";TYPE=");
730 ProcessData.Append((*SourceListType)[SourceIter->first]);
734 // Check if there is a value for ALTID.
736 if ((*SourceListAltID)[SourceIter->first].size() > 0){
738 ProcessData.Append(";ALTID=");
739 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
743 // Check if there is a value for MEDIATYPE.
745 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
747 ProcessData.Append(";MEDIATYPE=");
748 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
752 // Check if there is a value for PID.
754 if ((*SourceListPID)[SourceIter->first].size() > 0){
756 ProcessData.Append(";PID=");
757 ProcessData.Append((*SourceListPID)[SourceIter->first]);
761 // Check if there is a value for PREF.
763 if ((*SourceListPref)[SourceIter->first] > 0){
765 ProcessData.Append(";PREF=");
766 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
770 // Check if there is a value for tokens.
772 if ((*SourceListTokens)[SourceIter->first].size() > 0){
774 ProcessData.Append(";");
775 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
779 ProcessData.Append(":");
780 ProcessData.Append(SourceIter->second);
781 ProcessData.Append("\n");
783 ProcessData = OutputText(&ProcessData);
785 SaveData->Append(ProcessData);
792 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
793 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
794 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
795 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
797 wxString ProcessData = "";
799 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
800 NicknameIter != NicknameList->end(); NicknameIter++){
802 ProcessData.Append("NICKNAME");
804 // Check if there is a value for TYPE.
806 if (DataType.size() > 0){
808 ProcessData.Append(";TYPE=");
809 ProcessData.Append(DataType);
813 // Check if there is a value for ALTID.
815 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
817 ProcessData.Append(";ALTID=");
818 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
822 // Check if there is a value for MEDIATYPE.
824 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
826 ProcessData.Append(";LANGUAGE=");
827 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
831 // Check if there is a value for PID.
833 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
835 ProcessData.Append(";PID=");
836 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
840 // Check if there is a value for PREF.
842 if ((*NicknameListPref)[NicknameIter->first] > 0){
844 ProcessData.Append(";PREF=");
845 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
849 // Check if there is a value for tokens.
851 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
853 ProcessData.Append(";");
854 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
858 ProcessData.Append(":");
859 ProcessData.Append(NicknameIter->second);
860 ProcessData.Append("\n");
862 ProcessData = OutputText(&ProcessData);
864 SaveData->Append(ProcessData);
871 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
872 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
873 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
874 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
876 wxString ProcessData = "";
878 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
879 TZIter != TZList->end(); TZIter++){
881 ProcessData.Append("TZ");
883 // Check if there is a value for TYPE.
885 if (DataType.size() > 0){
887 ProcessData.Append(";TYPE=");
888 ProcessData.Append(DataType);
892 // Check if there is a value for ALTID.
894 if ((*TZListAltID)[TZIter->first].size() > 0){
896 ProcessData.Append(";ALTID=");
897 ProcessData.Append((*TZListAltID)[TZIter->first]);
901 // Check if there is a value for MEDIATYPE.
903 if ((*TZListMediatype)[TZIter->first].size() > 0){
905 ProcessData.Append(";MEDIATYPE=");
906 ProcessData.Append((*TZListMediatype)[TZIter->first]);
910 // Check if there is a value for PID.
912 if ((*TZListPID)[TZIter->first].size() > 0){
914 ProcessData.Append(";PID=");
915 ProcessData.Append((*TZListPID)[TZIter->first]);
919 // Check if there is a value for PREF.
921 if ((*TZListPref)[TZIter->first] > 0){
923 ProcessData.Append(";PREF=");
924 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
928 // Check if there is a value for tokens.
930 if ((*TZListTokens)[TZIter->first].size() > 0){
932 ProcessData.Append(";");
933 ProcessData.Append((*TZListTokens)[TZIter->first]);
937 ProcessData.Append(":");
938 ProcessData.Append(TZIter->second);
939 ProcessData.Append("\n");
941 ProcessData = OutputText(&ProcessData);
943 SaveData->Append(ProcessData);
950 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
951 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
952 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
953 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
954 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
955 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
956 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
957 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
959 wxString ProcessData = "";
961 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
962 AddressIter != AddressList->end(); AddressIter++){
964 ProcessData.Append("ADR");
966 // Check if there is a value for TYPE.
968 if (DataType.size() > 0){
970 ProcessData.Append(";TYPE=");
971 ProcessData.Append(DataType);
975 // Check if there is a value for ALTID.
977 if ((*AddressListAltID)[AddressIter->first].size() > 0){
979 ProcessData.Append(";ALTID=");
980 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
984 // Check if there is a value for GEO.
986 if ((*AddressListGeo)[AddressIter->first].size() > 0){
988 ProcessData.Append(";GEO=\"");
989 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
990 ProcessData.Append("\"");
994 // Check if there is a value for LABEL.
996 if ((*AddressListLabel)[AddressIter->first].size() > 0){
998 wxString AddressProcessed = "";
999 AddressProcessed = (*AddressListLabel)[AddressIter->first];
1001 AddressProcessed.Replace("\n", "\\n", true);
1003 ProcessData.Append(";LABEL=");
1004 ProcessData.Append(AddressProcessed);
1008 // Check if there is a value for LANGUAGE.
1010 if ((*AddressListLang)[AddressIter->first].size() > 0){
1012 ProcessData.Append(";LANGUAGE=");
1013 ProcessData.Append((*AddressListLang)[AddressIter->first]);
1017 // Check if there is a value for MEDIATYPE.
1019 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1021 ProcessData.Append(";MEDIATYPE=");
1022 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1026 // Check if there is a value for PID.
1028 if ((*AddressListPID)[AddressIter->first].size() > 0){
1030 ProcessData.Append(";PID=");
1031 ProcessData.Append((*AddressListPID)[AddressIter->first]);
1035 // Check if there is a value for PREF.
1037 if ((*AddressListPref)[AddressIter->first] > 0){
1039 ProcessData.Append(";PREF=");
1040 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1044 // Check if there is a value for TZ.
1046 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1048 ProcessData.Append(";TZ=");
1049 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1053 // Check if there is a value for tokens.
1055 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1057 ProcessData.Append(";");
1058 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1062 // Build the address.
1064 ProcessData.Append(":;;");
1065 ProcessData.Append((*AddressList)[AddressIter->first]);
1066 ProcessData.Append(";");
1067 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1068 ProcessData.Append(";");
1069 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1070 ProcessData.Append(";");
1071 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1072 ProcessData.Append(";");
1073 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1074 ProcessData.Append("\n");
1076 ProcessData = OutputText(&ProcessData);
1078 SaveData->Append(ProcessData);
1079 ProcessData.clear();
1085 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1086 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1087 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1088 wxString *SaveData, wxString DataType){
1090 wxString ProcessData = "";
1092 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1093 EmailIter != EmailList->end(); EmailIter++){
1095 ProcessData.Append("EMAIL");
1097 // Check if there is a value for TYPE.
1099 if (DataType.size() > 0){
1101 ProcessData.Append(";TYPE=");
1102 ProcessData.Append(DataType);
1106 // Check if there is a value for ALTID.
1108 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1110 ProcessData.Append(";ALTID=");
1111 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1115 // Check if there is a value for PID.
1117 if ((*EmailListPID)[EmailIter->first].size() > 0){
1119 ProcessData.Append(";PID=");
1120 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1124 // Check if there is a value for PREF.
1126 if ((*EmailListPref)[EmailIter->first] > 0){
1128 ProcessData.Append(";PREF=");
1129 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1133 // Check if there is a value for tokens.
1135 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1137 ProcessData.Append(";");
1138 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1142 ProcessData.Append(":");
1143 ProcessData.Append(EmailIter->second);
1144 ProcessData.Append("\n");
1146 ProcessData = OutputText(&ProcessData);
1148 SaveData->Append(ProcessData);
1149 ProcessData.clear();
1155 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1156 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1157 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1158 wxString *SaveData, wxString DataType){
1160 wxString ProcessData = "";
1162 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1163 LanguageIter != LanguageList->end(); LanguageIter++){
1165 ProcessData.Append("LANG");
1167 // Check if there is a value for TYPE.
1169 if (DataType.size() > 0){
1171 ProcessData.Append(";TYPE=");
1172 ProcessData.Append(DataType);
1176 // Check if there is a value for ALTID.
1178 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1180 ProcessData.Append(";ALTID=");
1181 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1185 // Check if there is a value for PID.
1187 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1189 ProcessData.Append(";PID=");
1190 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1194 // Check if there is a value for PREF.
1196 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1198 ProcessData.Append(";PREF=");
1199 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1203 // Check if there is a value for tokens.
1205 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1207 ProcessData.Append(";");
1208 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1212 ProcessData.Append(":");
1213 ProcessData.Append(LanguageIter->second);
1214 ProcessData.Append("\n");
1216 ProcessData = OutputText(&ProcessData);
1218 SaveData->Append(ProcessData);
1219 ProcessData.clear();
1225 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1226 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1227 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1228 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1229 wxString *SaveData, wxString DataType){
1231 wxString ProcessData = "";
1233 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1234 GeographyIter != GeographyList->end(); GeographyIter++){
1236 ProcessData.Append("GEO");
1238 // Check if there is a value for TYPE.
1240 if (DataType.size() > 0){
1242 ProcessData.Append(";TYPE=");
1243 ProcessData.Append(DataType);
1247 // Check if there is a value for ALTID.
1249 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1251 ProcessData.Append(";ALTID=");
1252 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1256 // Check if there is a value for MEDIATYPE.
1258 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1260 ProcessData.Append(";MEDIATYPE=");
1261 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1265 // Check if there is a value for PID.
1267 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1269 ProcessData.Append(";PID=");
1270 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1274 // Check if there is a value for PREF.
1276 if ((*GeographyListPref)[GeographyIter->first] > 0){
1278 ProcessData.Append(";PREF=");
1279 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1283 // Check if there is a value for tokens.
1285 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1287 ProcessData.Append(";");
1288 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1292 ProcessData.Append(":");
1293 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1294 ProcessData.Append(":");
1295 ProcessData.Append(GeographyIter->second);
1296 ProcessData.Append("\n");
1298 ProcessData = OutputText(&ProcessData);
1300 SaveData->Append(ProcessData);
1301 ProcessData.clear();
1307 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1308 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1309 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1310 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1312 wxString ProcessData = "";
1314 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1315 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1317 ProcessData.Append("URL");
1319 // Check if there is a value for TYPE.
1321 if (DataType.size() > 0){
1323 ProcessData.Append(";TYPE=");
1324 ProcessData.Append(DataType);
1328 // Check if there is a value for ALTID.
1330 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1332 ProcessData.Append(";ALTID=");
1333 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1337 // Check if there is a value for MEDIATYPE.
1339 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1341 ProcessData.Append(";MEDIATYPE=");
1342 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1346 // Check if there is a value for PID.
1348 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1350 ProcessData.Append(";PID=");
1351 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1355 // Check if there is a value for PREF.
1357 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1359 ProcessData.Append(";PREF=");
1360 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1364 // Check if there is a value for tokens.
1366 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1368 ProcessData.Append(";");
1369 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1373 ProcessData.Append(":");
1374 ProcessData.Append(WebsiteIter->second);
1375 ProcessData.Append("\n");
1377 ProcessData = OutputText(&ProcessData);
1379 SaveData->Append(ProcessData);
1380 ProcessData.clear();
1386 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1387 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1388 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1389 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1391 wxString ProcessData = "";
1393 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1394 RoleIter != RoleList->end(); RoleIter++){
1396 ProcessData.Append("ROLE");
1398 // Check if there is a value for TYPE.
1400 if (DataType.size() > 0){
1402 ProcessData.Append(";TYPE=");
1403 ProcessData.Append(DataType);
1407 // Check if there is a value for ALTID.
1409 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1411 ProcessData.Append(";ALTID=");
1412 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1416 // Check if there is a value for LANGUAGE.
1418 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1420 ProcessData.Append(";LANGUAGE=");
1421 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1425 // Check if there is a value for PID.
1427 if ((*RoleListPID)[RoleIter->first].size() > 0){
1429 ProcessData.Append(";PID=");
1430 ProcessData.Append((*RoleListPID)[RoleIter->first]);
1434 // Check if there is a value for PREF.
1436 if ((*RoleListPref)[RoleIter->first] > 0){
1438 ProcessData.Append(";PREF=");
1439 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1443 // Check if there is a value for tokens.
1445 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1447 ProcessData.Append(";");
1448 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1452 ProcessData.Append(":");
1453 ProcessData.Append(RoleIter->second);
1454 ProcessData.Append("\n");
1456 ProcessData = OutputText(&ProcessData);
1458 SaveData->Append(ProcessData);
1459 ProcessData.clear();
1465 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1466 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
1467 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
1468 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
1469 wxString *SaveData, wxString DataType){
1471 wxString ProcessData = "";
1473 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1474 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1476 ProcessData.Append("ORG");
1478 // Check if there is a value for TYPE.
1480 if (DataType.size() > 0){
1482 ProcessData.Append(";TYPE=");
1483 ProcessData.Append(DataType);
1487 // Check if there is a value for ALTID.
1489 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1491 ProcessData.Append(";ALTID=");
1492 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1496 // Check if there is a value for LANGUAGE.
1498 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1500 ProcessData.Append(";LANGUAGE=");
1501 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1505 // Check if there is a value for PID.
1507 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1509 ProcessData.Append(";PID=");
1510 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1514 // Check if there is a value for PREF.
1516 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1518 ProcessData.Append(";PREF=");
1519 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1523 // Check if there is a value for SORT-AS.
1525 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1527 ProcessData.Append(";SORT-AS=\"");
1528 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1529 ProcessData.Append("\"");
1533 // Check if there is a value for tokens.
1535 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1537 ProcessData.Append(";");
1538 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1542 ProcessData.Append(":");
1543 ProcessData.Append(OrganisationIter->second);
1544 ProcessData.Append("\n");
1546 ProcessData = OutputText(&ProcessData);
1548 SaveData->Append(ProcessData);
1549 ProcessData.clear();
1555 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1556 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1557 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1558 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1560 wxString ProcessData = "";
1562 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1563 NoteIter != NoteList->end(); NoteIter++){
1565 ProcessData.Append("NOTE");
1567 // Check if there is a value for TYPE.
1569 if (DataType.size() > 0){
1571 ProcessData.Append(";TYPE=");
1572 ProcessData.Append(DataType);
1576 // Check if there is a value for ALTID.
1578 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1580 ProcessData.Append(";ALTID=");
1581 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1585 // Check if there is a value for LANGUAGE.
1587 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1589 ProcessData.Append(";LANGUAGE=");
1590 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1594 // Check if there is a value for PID.
1596 if ((*NoteListPID)[NoteIter->first].size() > 0){
1598 ProcessData.Append(";PID=");
1599 ProcessData.Append((*NoteListPID)[NoteIter->first]);
1603 // Check if there is a value for PREF.
1605 if ((*NoteListPref)[NoteIter->first] > 0){
1607 ProcessData.Append(";PREF=");
1608 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1612 // Check if there is a value for tokens.
1614 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1616 ProcessData.Append(";");
1617 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1621 ProcessData.Append(":");
1622 ProcessData.Append(NoteIter->second);
1623 ProcessData.Replace("\n", "\\n", true);
1624 ProcessData.Append("\n");
1626 ProcessData = OutputText(&ProcessData);
1628 SaveData->Append(ProcessData);
1629 ProcessData.clear();
1635 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1636 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1637 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1638 map<int, wxString> *CategoryListTokens, wxString *SaveData){
1640 wxString ProcessData = "";
1642 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1643 CategoryIter != CategoryList->end(); CategoryIter++){
1645 ProcessData.Append("CATEGORIES");
1647 // Check if there is a value for TYPE.
1649 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1651 ProcessData.Append(";TYPE=");
1652 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1656 // Check if there is a value for ALTID.
1658 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1660 ProcessData.Append(";ALTID=");
1661 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1665 // Check if there is a value for LANGUAGE.
1667 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1669 ProcessData.Append(";LANGUAGE=");
1670 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1674 // Check if there is a value for PID.
1676 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1678 ProcessData.Append(";PID=");
1679 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1683 // Check if there is a value for PREF.
1685 if ((*CategoryListPref)[CategoryIter->first] > 0){
1687 ProcessData.Append(";PREF=");
1688 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1692 // Check if there is a value for tokens.
1694 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1696 ProcessData.Append(";");
1697 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1701 ProcessData.Append(":");
1702 ProcessData.Append(CategoryIter->second);
1703 ProcessData.Append("\n");
1705 ProcessData = OutputText(&ProcessData);
1707 SaveData->Append(ProcessData);
1708 ProcessData.clear();
1714 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
1715 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1716 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1717 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1718 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1720 wxString ProcessData = "";
1722 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1723 PicturesIter != PicturesList->end(); PicturesIter++){
1725 ProcessData.Append("PHOTO");
1727 // Check if there is a value for TYPE.
1729 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1731 ProcessData.Append(";TYPE=");
1732 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1736 // Check if there is a value for ALTID.
1738 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1740 ProcessData.Append(";ALTID=");
1741 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1745 // Check if there is a value for MEDIATYPE..
1747 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1749 ProcessData.Append(";MEDIATYPE=");
1750 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1754 // Check if there is a value for PID.
1756 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1758 ProcessData.Append(";PID=");
1759 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1763 // Check if there is a value for PREF.
1765 if ((*PicturesListPref)[PicturesIter->first] > 0){
1767 ProcessData.Append(";PREF=");
1768 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1772 // Check if there is a value for tokens.
1774 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1776 ProcessData.Append(";");
1777 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1781 ProcessData.Append(":data:");
1782 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1783 ProcessData.Append(";");
1784 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1785 ProcessData.Append(",");
1786 ProcessData.Append(PicturesIter->second);
1787 ProcessData.Append("\n");
1789 ProcessData = OutputText(&ProcessData);
1791 SaveData->Append(ProcessData);
1792 ProcessData.clear();
1798 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID,
1799 map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
1800 map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
1801 map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
1802 map<int, wxString> *LogosListTokens, wxString *SaveData){
1804 wxString ProcessData = "";
1806 for (std::map<int, string>::iterator LogosIter = LogosList->begin();
1807 LogosIter != LogosList->end(); LogosIter++){
1809 ProcessData.Append("LOGO");
1811 // Check if there is a value for TYPE.
1813 if ((*LogosListType)[LogosIter->first].size() > 0){
1815 ProcessData.Append(";TYPE=");
1816 ProcessData.Append((*LogosListType)[LogosIter->first]);
1820 // Check if there is a value for ALTID.
1822 if ((*LogosListAltID)[LogosIter->first].size() > 0){
1824 ProcessData.Append(";ALTID=");
1825 ProcessData.Append((*LogosListAltID)[LogosIter->first]);
1829 // Check if there is a value for MEDIATYPE..
1831 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
1833 ProcessData.Append(";MEDIATYPE=");
1834 ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
1838 // Check if there is a value for PID.
1840 if ((*LogosListPID)[LogosIter->first].size() > 0){
1842 ProcessData.Append(";PID=");
1843 ProcessData.Append((*LogosListPID)[LogosIter->first]);
1847 // Check if there is a value for PREF.
1849 if ((*LogosListPref)[LogosIter->first] > 0){
1851 ProcessData.Append(";PREF=");
1852 ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
1856 // Check if there is a value for tokens.
1858 if ((*LogosListTokens)[LogosIter->first].size() > 0){
1860 ProcessData.Append(";");
1861 ProcessData.Append((*LogosListTokens)[LogosIter->first]);
1865 ProcessData.Append(":data:");
1866 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
1867 ProcessData.Append(";");
1868 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
1869 ProcessData.Append(",");
1870 ProcessData.Append(LogosIter->second);
1871 ProcessData.Append("\n");
1873 ProcessData = OutputText(&ProcessData);
1875 SaveData->Append(ProcessData);
1876 ProcessData.clear();
1882 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID,
1883 map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
1884 map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
1885 map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage,
1886 map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens,
1887 wxString *SaveData){
1889 wxString ProcessData = "";
1891 for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
1892 SoundsIter != SoundsList->end(); SoundsIter++){
1894 ProcessData.Append("SOUND");
1896 // Check if there is a value for TYPE.
1898 if ((*SoundsListType)[SoundsIter->first].size() > 0){
1900 ProcessData.Append(";TYPE=");
1901 ProcessData.Append((*SoundsListType)[SoundsIter->first]);
1905 // Check if there is a value for ALTID.
1907 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
1909 ProcessData.Append(";ALTID=");
1910 ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
1914 // Check if there is a value for LANGUAGE.
1916 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
1918 ProcessData.Append(";LANGUAGE=");
1919 ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
1923 // Check if there is a value for MEDIATYPE.
1925 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
1927 ProcessData.Append(";MEDIATYPE=");
1928 ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
1932 // Check if there is a value for PID.
1934 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
1936 ProcessData.Append(";PID=");
1937 ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
1941 // Check if there is a value for PREF.
1943 if ((*SoundsListPref)[SoundsIter->first] > 0){
1945 ProcessData.Append(";PREF=");
1946 ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
1950 // Check if there is a value for tokens.
1952 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
1954 ProcessData.Append(";");
1955 ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
1959 ProcessData.Append(":data:");
1960 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
1961 ProcessData.Append(";");
1962 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
1963 ProcessData.Append(",");
1964 ProcessData.Append(SoundsIter->second);
1965 ProcessData.Append("\n");
1967 ProcessData = OutputText(&ProcessData);
1969 SaveData->Append(ProcessData);
1970 ProcessData.clear();
1976 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
1977 map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
1978 map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
1979 map<int, wxString> *CalendarListTokens, wxString *SaveData){
1981 wxString ProcessData = "";
1983 for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
1984 CalendarIter != CalendarList->end(); CalendarIter++){
1986 ProcessData.Append("CALURI");
1988 // Check if there is a value for TYPE.
1990 if ((*CalendarListType)[CalendarIter->first].size() > 0){
1992 ProcessData.Append(";TYPE=");
1993 ProcessData.Append((*CalendarListType)[CalendarIter->first]);
1997 // Check if there is a value for ALTID.
1999 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2001 ProcessData.Append(";ALTID=");
2002 ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2006 // Check if there is a value for MEDIATYPE.
2008 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2010 ProcessData.Append(";MEDIATYPE=");
2011 ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2015 // Check if there is a value for PID.
2017 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2019 ProcessData.Append(";PID=");
2020 ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2024 // Check if there is a value for PREF.
2026 if ((*CalendarListPref)[CalendarIter->first] > 0){
2028 ProcessData.Append(";PREF=");
2029 ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2033 // Check if there is a value for tokens.
2035 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2037 ProcessData.Append(";");
2038 ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2042 ProcessData.Append(":");
2043 ProcessData.Append(CalendarIter->second);
2044 ProcessData.Append("\n");
2046 ProcessData = OutputText(&ProcessData);
2048 SaveData->Append(ProcessData);
2049 ProcessData.clear();
2055 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2056 map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2057 map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2058 map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2060 wxString ProcessData = "";
2062 for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2063 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2065 ProcessData.Append("CALADRURI");
2067 // Check if there is a value for TYPE.
2069 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2071 ProcessData.Append(";TYPE=");
2072 ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2076 // Check if there is a value for ALTID.
2078 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2080 ProcessData.Append(";ALTID=");
2081 ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2085 // Check if there is a value for MEDIATYPE.
2087 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2089 ProcessData.Append(";MEDIATYPE=");
2090 ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2094 // Check if there is a value for PID.
2096 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2098 ProcessData.Append(";PID=");
2099 ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2103 // Check if there is a value for PREF.
2105 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2107 ProcessData.Append(";PREF=");
2108 ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2112 // Check if there is a value for tokens.
2114 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2116 ProcessData.Append(";");
2117 ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2121 ProcessData.Append(":");
2122 ProcessData.Append(CalendarRequestIter->second);
2123 ProcessData.Append("\n");
2125 ProcessData = OutputText(&ProcessData);
2127 SaveData->Append(ProcessData);
2128 ProcessData.clear();
2134 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID,
2135 std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2136 std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref,
2137 std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2139 wxString ProcessData = "";
2141 for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2142 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2144 ProcessData.Append("FBURL");
2146 // Check if there is a value for TYPE.
2148 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2150 ProcessData.Append(";TYPE=");
2151 ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2155 // Check if there is a value for ALTID.
2157 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2159 ProcessData.Append(";ALTID=");
2160 ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2164 // Check if there is a value for MEDIATYPE.
2166 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2168 ProcessData.Append(";MEDIATYPE=");
2169 ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2173 // Check if there is a value for PID.
2175 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2177 ProcessData.Append(";PID=");
2178 ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2182 // Check if there is a value for PREF.
2184 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2186 ProcessData.Append(";PREF=");
2187 ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2191 // Check if there is a value for tokens.
2193 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2195 ProcessData.Append(";");
2196 ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2200 ProcessData.Append(":");
2201 ProcessData.Append(FreeBusyIter->second);
2202 ProcessData.Append("\n");
2204 ProcessData = OutputText(&ProcessData);
2206 SaveData->Append(ProcessData);
2207 ProcessData.clear();
2213 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID,
2214 map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2215 map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType,
2216 map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref,
2217 map<int, wxString> *KeyListTokens, wxString *SaveData){
2219 wxString ProcessData = "";
2221 for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2222 KeyIter != KeyList->end(); KeyIter++){
2224 ProcessData.Append("KEY");
2226 // Check if there is a value for TYPE.
2228 if ((*KeyListType)[KeyIter->first].size() > 0){
2230 ProcessData.Append(";TYPE=");
2231 ProcessData.Append((*KeyListType)[KeyIter->first]);
2235 // Check if there is a value for ALTID.
2237 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2239 ProcessData.Append(";ALTID=");
2240 ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2244 // Check if there is a value for PID.
2246 if ((*KeyListPID)[KeyIter->first].size() > 0){
2248 ProcessData.Append(";PID=");
2249 ProcessData.Append((*KeyListPID)[KeyIter->first]);
2253 // Check if there is a value for PREF.
2255 if ((*KeyListPref)[KeyIter->first] > 0){
2257 ProcessData.Append(";PREF=");
2258 ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2262 // Check if there is a value for tokens.
2264 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2266 ProcessData.Append(";");
2267 ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2271 ProcessData.Append(":data:");
2272 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2273 ProcessData.Append(";");
2274 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2275 ProcessData.Append(",");
2276 ProcessData.Append(KeyIter->second);
2277 ProcessData.Append("\n");
2279 ProcessData = OutputText(&ProcessData);
2281 SaveData->Append(ProcessData);
2282 ProcessData.clear();