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::SaveFile(wxString SaveFilename){
24 // Get the data using SaveString.
26 wxString SaveData = "";
27 SaveString(&SaveData);
29 // Open a file and try to write into it.
33 if (!ContactFile.Open(SaveFilename, wxFile::write, wxS_DEFAULT)){
35 return CONTACTSAVE_FILEERROR;
39 if (ContactFile.Write(SaveData, wxConvUTF8) == false){
41 return CONTACTSAVE_WRITEERROR;
47 return CONTACTSAVE_OK;
51 ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
53 ContactSaveStatus SaveDataStatus = CONTACTSAVE_UNITTESTFAIL;
55 // Write the header for the vCard data file.
57 SaveData->Append("BEGIN:VCARD\n");
58 SaveData->Append("VERSION:4.0\n");
60 // Write the product ID.
64 SaveData->Append("PRODID:-//Xestia//Address Book Unit Testing//KW\n");
68 SaveData->Append(wxT("PRODID:-//Xestia//Address Book Version "));
69 SaveData->Append(wxT(XSDAB_VERSION));
70 SaveData->Append(wxT("//KW\n"));
74 wxString ProcessData = "";
78 if (UIDToken.size() > 0){
80 ProcessData.Append("UID:");
81 ProcessData.Append(UIDToken);
82 ProcessData.Append("\n");
83 SaveData->Append(ProcessData);
92 case CONTACTKIND_NONE:
94 case CONTACTKIND_INDIVIDUAL:
95 SaveData->Append("KIND:individual\n");
97 case CONTACTKIND_GROUP:
98 SaveData->Append("KIND:group\n");
100 case CONTACTKIND_ORGANISATION:
101 SaveData->Append("KIND:org\n");
103 case CONTACTKIND_LOCATION:
104 SaveData->Append("KIND:location\n");
113 wxDateTime DateTimeSave;
114 DateTimeSave = DateTimeSave.SetToCurrent();
115 wxString DateTimeSaveValue;
119 DateTimeSaveValue += "20160703T091000Z";
123 DateTimeSaveValue += wxString::Format("%04i", DateTimeSave.GetYear());
124 DateTimeSaveValue += wxString::Format("%02i", (DateTimeSave.GetMonth() + 1));
125 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetDay());
126 DateTimeSaveValue += "T";
127 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetHour());
128 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetMinute());
129 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetSecond());
130 DateTimeSaveValue += "Z";
134 if (!RevisionTokens.IsEmpty()){
136 ProcessData.Append("REV;");
137 ProcessData.Append(RevisionTokens);
138 ProcessData.Append(":");
139 ProcessData.Append(DateTimeSaveValue);
140 ProcessData.Append("\n");
142 ProcessData = OutputText(&ProcessData);
144 SaveData->Append(ProcessData);
149 ProcessData.Append("REV:");
150 ProcessData.Append(DateTimeSaveValue);
151 ProcessData.Append("\n");
153 ProcessData = OutputText(&ProcessData);
155 SaveData->Append(ProcessData);
162 for (std::map<int, wxString>::iterator XMLIter = XMLList.begin();
163 XMLIter != XMLList.end(); XMLIter++){
165 ProcessData.Append("XML");
167 if (XMLListAltID[XMLIter->first].size() > 0){
169 ProcessData.Append(";ALTID=");
170 ProcessData.Append(XMLListAltID[XMLIter->first]);
174 ProcessData.Append(":");
175 ProcessData.Append(XMLIter->second);
176 ProcessData.Append("\n");
178 ProcessData = OutputText(&ProcessData);
180 SaveData->Append(ProcessData);
187 SaveSource(&SourceList, &SourceListAltID,
188 &SourceListPID, &SourceListType,
189 &SourceListMediatype, &SourceListPref,
190 &SourceListTokens, SaveData);
192 // Process MEMBER (if contact kind is CONTACTKIND_GROUP).
194 if (ContactKind == CONTACTKIND_GROUP){
196 SaveMember(&GroupsList, &GroupsListAltID,
197 &GroupsListPID, &GroupsListType,
198 &GroupsListMediaType, &GroupsListPref,
199 &GroupsListTokens, SaveData);
203 // Process CLIENTPIDMAP.
205 for (std::map<int, wxString>::iterator CPIDIter = ClientPIDList.begin();
206 CPIDIter != ClientPIDList.end(); CPIDIter++){
208 ProcessData.Append("CLIENTPIDMAP");
210 if (ClientPIDListTokens[CPIDIter->first].size() > 0){
212 ProcessData.Append(";");
213 ProcessData.Append(ClientPIDListTokens[CPIDIter->first]);
217 ProcessData.Append(":");
218 ProcessData.Append(CPIDIter->second);
219 ProcessData.Append("\n");
221 ProcessData = OutputText(&ProcessData);
223 SaveData->Append(ProcessData);
230 for (std::map<int, wxString>::iterator FNIter = FullNamesList.begin();
231 FNIter != FullNamesList.end(); FNIter++){
233 ProcessData.Append("FN");
235 // Check if there is a value for TYPE.
237 if (FullNamesListType[FNIter->first].size() > 0){
239 ProcessData.Append(";TYPE=");
240 ProcessData.Append(FullNamesListType[FNIter->first]);
244 // Check if there is a value for LANGUAGE.
246 if (FullNamesListLanguage[FNIter->first].size() > 0){
248 ProcessData.Append(";LANGUAGE=");
249 ProcessData.Append(FullNamesListLanguage[FNIter->first]);
253 // Check if there is a value for ALTID.
255 if (FullNamesListAltID[FNIter->first].size() > 0){
257 ProcessData.Append(";ALTID=");
258 ProcessData.Append(FullNamesListAltID[FNIter->first]);
262 // Check if there is a value for PID.
264 if (FullNamesListPID[FNIter->first].size() > 0){
266 ProcessData.Append(";PID=");
267 ProcessData.Append(FullNamesListPID[FNIter->first]);
271 // Check if there is a value for PREF.
273 if (FullNamesListPref[FNIter->first] > 0){
275 ProcessData.Append(";PREF=");
276 ProcessData.Append(wxString::Format("%i", FullNamesListPref[FNIter->first]));
280 // Check if there is a value for tokens.
282 if (FullNamesListTokens[FNIter->first].size() > 0){
284 ProcessData.Append(";");
285 ProcessData.Append(FullNamesListTokens[FNIter->first]);
289 ProcessData.Append(":");
290 ProcessData.Append(FNIter->second);
291 ProcessData.Append("\n");
293 ProcessData = OutputText(&ProcessData);
295 SaveData->Append(ProcessData);
302 if (!NameTitle.IsEmpty() || !NameForename.IsEmpty() || !NameSurname.IsEmpty() ||
303 !NameOtherNames.IsEmpty() || !NameSuffix.IsEmpty()){
305 ProcessData.Append("N");
307 // Check if there is a value for ALTID.
309 if (NameAltID.size() > 0){
311 ProcessData.Append(";ALTID=");
312 ProcessData.Append(NameAltID);
316 // Check if there is a value for LANGUAGE.
318 if (NameLanguage.size() > 0){
320 ProcessData.Append(";LANGUAGE=");
321 ProcessData.Append(NameLanguage);
325 // Check if there is a value for SORT-AS.
327 if (NameDisplayAs.size() > 0){
329 ProcessData.Append(";SORT-AS=\"");
330 ProcessData.Append(NameDisplayAs);
331 ProcessData.Append("\"");
335 // Check if there is a value for tokens.
337 if (NameTokens.size() > 0){
339 ProcessData.Append(";");
340 ProcessData.Append(NameTokens);
344 ProcessData.Append(":");
345 ProcessData.Append(NameSurname);
346 ProcessData.Append(";");
347 ProcessData.Append(NameForename);
348 ProcessData.Append(";");
349 ProcessData.Append(NameOtherNames);
350 ProcessData.Append(";");
351 ProcessData.Append(NameTitle);
352 ProcessData.Append(";");
353 ProcessData.Append(NameSuffix);
355 ProcessData.Append("\n");
357 ProcessData = OutputText(&ProcessData);
359 SaveData->Append(ProcessData);
366 SaveNickname(&GeneralNicknamesList, &GeneralNicknamesListAltID,
367 &GeneralNicknamesListPID, &GeneralNicknamesListType,
368 &GeneralNicknamesListLanguage, &GeneralNicknamesListPref,
369 &GeneralNicknamesListTokens, SaveData, "");
370 SaveNickname(&HomeNicknamesList, &HomeNicknamesListAltID,
371 &HomeNicknamesListPID, &HomeNicknamesListType,
372 &HomeNicknamesListLanguage, &HomeNicknamesListPref,
373 &HomeNicknamesListTokens, SaveData, "home");
374 SaveNickname(&BusinessNicknamesList, &BusinessNicknamesListAltID,
375 &BusinessNicknamesListPID, &BusinessNicknamesListType,
376 &BusinessNicknamesListLanguage, &BusinessNicknamesListPref,
377 &BusinessNicknamesListTokens, SaveData, "work");
381 if (Gender.size() > 0){
383 ProcessData.Append("GENDER");
385 if (GenderTokens.size() > 0){
387 ProcessData.Append(";");
388 ProcessData.Append(GenderTokens);
392 ProcessData.Append(":");
393 ProcessData.Append(Gender);
395 if (GenderDetails.size() > 0){
397 ProcessData.Append(";");
398 ProcessData.Append(GenderDetails);
402 ProcessData.Append("\n");
404 ProcessData = OutputText(&ProcessData);
406 SaveData->Append(ProcessData);
411 // TODO: Process BDAY.
413 // TODO: Process ANNIVERSARY.
417 SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
418 &GeneralTitleListAltID, &GeneralTitleListPID,
419 &GeneralTitleListType, &GeneralTitleListPref,
420 &GeneralTitleListTokens, SaveData, "");
421 SaveTitle(&HomeTitleList, &HomeTitleListLanguage,
422 &HomeTitleListAltID, &HomeTitleListPID,
423 &HomeTitleListType, &HomeTitleListPref,
424 &HomeTitleListTokens, SaveData, "home");
425 SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage,
426 &BusinessTitleListAltID, &BusinessTitleListPID,
427 &BusinessTitleListType, &BusinessTitleListPref,
428 &BusinessTitleListTokens, SaveData, "work");
432 SaveTimezone(&GeneralTZList, &GeneralTZListAltID,
433 &GeneralTZListPID, &GeneralTZListType,
434 &GeneralTZListMediatype, &GeneralTZListPref,
435 &GeneralTZListTokens, SaveData, "");
436 SaveTimezone(&HomeTZList, &HomeTZListAltID,
437 &HomeTZListPID, &HomeTZListType,
438 &HomeTZListMediatype, &HomeTZListPref,
439 &HomeTZListTokens, SaveData, "home");
440 SaveTimezone(&BusinessTZList, &BusinessTZListAltID,
441 &BusinessTZListPID, &BusinessTZListType,
442 &BusinessTZListMediatype, &BusinessTZListPref,
443 &BusinessTZListTokens, SaveData, "work");
447 SaveAddress(&GeneralAddressList, &GeneralAddressListTown,
448 &GeneralAddressListCounty, &GeneralAddressListPostCode,
449 &GeneralAddressListCountry, &GeneralAddressListLabel,
450 &GeneralAddressListLang, &GeneralAddressListAltID,
451 &GeneralAddressListPID, &GeneralAddressListGeo,
452 &GeneralAddressListTimezone, &GeneralAddressListType,
453 &GeneralAddressListMediatype, &GeneralAddressListPref,
454 &GeneralAddressListTokens, SaveData, "");
455 SaveAddress(&HomeAddressList, &HomeAddressListTown,
456 &HomeAddressListCounty, &HomeAddressListPostCode,
457 &HomeAddressListCountry, &HomeAddressListLabel,
458 &HomeAddressListLang, &HomeAddressListAltID,
459 &HomeAddressListPID, &HomeAddressListGeo,
460 &HomeAddressListTimezone, &HomeAddressListType,
461 &HomeAddressListMediatype, &HomeAddressListPref,
462 &HomeAddressListTokens, SaveData, "home");
463 SaveAddress(&BusinessAddressList, &BusinessAddressListTown,
464 &BusinessAddressListCounty, &BusinessAddressListPostCode,
465 &BusinessAddressListCountry, &BusinessAddressListLabel,
466 &BusinessAddressListLang, &BusinessAddressListAltID,
467 &BusinessAddressListPID, &BusinessAddressListGeo,
468 &BusinessAddressListTimezone, &BusinessAddressListType,
469 &BusinessAddressListMediatype, &BusinessAddressListPref,
470 &BusinessAddressListTokens, SaveData, "work");
474 SaveEmail(&GeneralEmailList, &GeneralEmailListAltID,
475 &GeneralEmailListPID, &GeneralEmailListType,
476 &GeneralEmailListPref, &GeneralEmailListTokens,
478 SaveEmail(&HomeEmailList, &HomeEmailListAltID,
479 &HomeEmailListPID, &HomeEmailListType,
480 &HomeEmailListPref, &HomeEmailListTokens,
482 SaveEmail(&BusinessEmailList, &BusinessEmailListAltID,
483 &BusinessEmailListPID, &BusinessEmailListType,
484 &BusinessEmailListPref, &BusinessEmailListTokens,
489 SaveIMPP(&GeneralIMList, &GeneralIMListAltID,
490 &GeneralIMListPID, &GeneralIMListType,
491 &GeneralIMListTypeInfo, &GeneralIMListMediatype,
492 &GeneralIMListPref, &GeneralIMListTokens,
494 SaveIMPP(&HomeIMList, &HomeIMListAltID,
495 &HomeIMListPID, &HomeIMListType,
496 &HomeIMListTypeInfo, &HomeIMListMediatype,
497 &HomeIMListPref, &HomeIMListTokens,
499 SaveIMPP(&BusinessIMList, &BusinessIMListAltID,
500 &BusinessIMListPID, &BusinessIMListType,
501 &BusinessIMListTypeInfo, &BusinessIMListMediatype,
502 &BusinessIMListPref, &BusinessIMListTokens,
507 SaveTelephone(&GeneralTelephoneList, &GeneralTelephoneListAltID,
508 &GeneralTelephoneListPID, &GeneralTelephoneListType,
509 &GeneralTelephoneListTypeInfo, &GeneralTelephoneListDataType,
510 &GeneralTelephoneListPref, &GeneralTelephoneListTokens,
512 SaveTelephone(&HomeTelephoneList, &HomeTelephoneListAltID,
513 &HomeTelephoneListPID, &HomeTelephoneListType,
514 &HomeTelephoneListTypeInfo, &HomeTelephoneListDataType,
515 &HomeTelephoneListPref, &HomeTelephoneListTokens,
517 SaveTelephone(&BusinessTelephoneList, &BusinessTelephoneListAltID,
518 &BusinessTelephoneListPID, &BusinessTelephoneListType,
519 &BusinessTelephoneListTypeInfo, &BusinessTelephoneListDataType,
520 &BusinessTelephoneListPref, &BusinessTelephoneListTokens,
525 SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID,
526 &GeneralLanguageListPID, &GeneralLanguageListType,
527 &GeneralLanguageListPref, &GeneralLanguageListTokens,
529 SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID,
530 &HomeLanguageListPID, &HomeLanguageListType,
531 &HomeLanguageListPref, &HomeLanguageListTokens,
533 SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID,
534 &BusinessLanguageListPID, &BusinessLanguageListType,
535 &BusinessLanguageListPref, &BusinessLanguageListTokens,
540 SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID,
541 &GeneralGeographyListPID, &GeneralGeographyListType,
542 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
543 &GeneralGeographyListPref, &GeneralGeographyListTokens,
545 SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID,
546 &HomeGeographyListPID, &HomeGeographyListType,
547 &HomeGeographyListMediatype, &HomeGeographyListDataType,
548 &HomeGeographyListPref, &HomeGeographyListTokens,
550 SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID,
551 &BusinessGeographyListPID, &BusinessGeographyListType,
552 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
553 &BusinessGeographyListPref, &BusinessGeographyListTokens,
560 for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
561 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
563 ProcessData.Append("RELATED");
565 // Check if there is a value for TYPE.
567 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
569 wxString RelatedType = "";
571 ProcessData.Append(";TYPE=");
573 if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
575 RelatedType = wxT("contact");
577 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
579 RelatedType = wxT("acquaintance");
581 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
583 RelatedType = wxT("friend");
585 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
587 RelatedType = wxT("met");
589 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
591 RelatedType = wxT("co-worker");
593 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
595 RelatedType = wxT("colleague");
597 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
599 RelatedType = wxT("co-resident");
601 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
603 RelatedType = wxT("neighbor");
605 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
607 RelatedType = wxT("child");
609 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
611 RelatedType = wxT("parent");
613 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
615 RelatedType = wxT("sibling");
617 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
619 RelatedType = wxT("spouse");
621 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
623 RelatedType = wxT("kin");
625 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
627 RelatedType = wxT("muse");
629 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
631 RelatedType = wxT("crush");
633 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
635 RelatedType = wxT("date");
637 } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
639 RelatedType = wxT("sweetheart");
641 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
643 RelatedType = wxT("me");
645 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
647 RelatedType = wxT("agent");
649 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
651 RelatedType = wxT("emergency");
655 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
659 ProcessData.Append(RelatedType);
663 // Check if there is a value for LANGUAGE.
665 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
667 ProcessData.Append(";LANGUAGE=");
668 ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
672 // Check if there is a value for ALTID.
674 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
676 ProcessData.Append(";ALTID=");
677 ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
681 // Check if there is a value for PID.
683 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
685 ProcessData.Append(";PID=");
686 ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
690 // Check if there is a value for PREF.
692 if (GeneralRelatedListPref[RelatedIter->first] > 0){
694 ProcessData.Append(";PREF=");
695 ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
699 // Check if there is a value for tokens.
701 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
703 ProcessData.Append(";");
704 ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
708 ProcessData.Append(":");
709 ProcessData.Append(RelatedIter->second);
710 ProcessData.Append("\n");
712 ProcessData = OutputText(&ProcessData);
714 SaveData->Append(ProcessData);
721 SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID,
722 &GeneralWebsiteListPID, &GeneralWebsiteListType,
723 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref,
724 &GeneralWebsiteListTokens, SaveData, "");
725 SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID,
726 &HomeWebsiteListPID, &HomeWebsiteListType,
727 &HomeWebsiteListMediatype, &HomeWebsiteListPref,
728 &HomeWebsiteListTokens, SaveData, "home");
729 SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID,
730 &BusinessWebsiteListPID, &BusinessWebsiteListType,
731 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref,
732 &BusinessWebsiteListTokens, SaveData, "work");
736 SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
737 &GeneralRoleListAltID, &GeneralRoleListPID,
738 &GeneralRoleListType, &GeneralRoleListPref,
739 &GeneralRoleListTokens, SaveData, "");
740 SaveRole(&HomeRoleList, &HomeRoleListLanguage,
741 &HomeRoleListAltID, &HomeRoleListPID,
742 &HomeRoleListType, &HomeRoleListPref,
743 &HomeRoleListTokens, SaveData, "home");
744 SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
745 &BusinessRoleListAltID, &BusinessRoleListPID,
746 &BusinessRoleListType, &BusinessRoleListPref,
747 &BusinessRoleListTokens, SaveData, "work");
751 SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
752 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage,
753 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType,
754 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens,
756 SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
757 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage,
758 &HomeOrganisationsListSortAs, &HomeOrganisationsListType,
759 &HomeOrganisationsListPref, &HomeOrganisationsListTokens,
761 SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
762 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage,
763 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType,
764 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens,
769 SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
770 &GeneralNoteListAltID, &GeneralNoteListPID,
771 &GeneralNoteListType, &GeneralNoteListPref,
772 &GeneralNoteListTokens, SaveData, "");
773 SaveNote(&HomeNoteList, &HomeNoteListLanguage,
774 &HomeNoteListAltID, &HomeNoteListPID,
775 &HomeNoteListType, &HomeNoteListPref,
776 &HomeNoteListTokens, SaveData, "home");
777 SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
778 &BusinessNoteListAltID, &BusinessNoteListPID,
779 &BusinessNoteListType, &BusinessNoteListPref,
780 &BusinessNoteListTokens, SaveData, "work");
782 // Process CATEGORIES.
784 SaveCategory(&CategoriesList, &CategoriesListLanguage,
785 &CategoriesListAltID, &CategoriesListPID,
786 &CategoriesListType, &CategoriesListPref,
787 &CategoriesListTokens, SaveData);
791 SavePhoto(&PicturesList, &PicturesListAltID,
792 &PicturesListPID, &PicturesListType,
793 &PicturesListPicEncType, &PicturesListPictureType,
794 &PicturesListMediatype, &PicturesListPref,
795 &PicturesListTokens, SaveData);
799 SaveLogo(&LogosList, &LogosListAltID,
800 &LogosListPID, &LogosListType,
801 &LogosListPicEncType, &LogosListPictureType,
802 &LogosListMediatype, &LogosListPref,
803 &LogosListTokens, SaveData);
807 SaveSound(&SoundsList, &SoundsListAltID,
808 &SoundsListPID, &SoundsListType,
809 &SoundsListAudioEncType, &SoundsListAudioType,
810 &SoundsListMediatype, &SoundsListLanguage,
811 &SoundsListPref, &SoundsListTokens,
816 SaveCalendarURI(&CalendarList, &CalendarListMediatype,
817 &CalendarListAltID, &CalendarListPID,
818 &CalendarListType, &CalendarListPref,
819 &CalendarListTokens, SaveData);
821 // Process CALADRURI.
823 SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
824 &CalendarRequestListAltID, &CalendarRequestListPID,
825 &CalendarRequestListType, &CalendarRequestListPref,
826 &CalendarRequestListTokens, SaveData);
830 SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID,
831 &FreeBusyListPID, &FreeBusyListType,
832 &FreeBusyListMediatype, &FreeBusyListPref,
833 &FreeBusyListTokens, SaveData);
837 SaveKey(&KeyList, &KeyListAltID,
838 &KeyListPID, &KeyListType,
839 &KeyListKeyType, &KeyListDataEncType,
840 &KeyListDataType, &KeyListPref,
841 &KeyListTokens, SaveData);
845 SaveVendor(&VendorList, &VendorListPEN,
846 &VendorListElement, SaveData);
850 SaveXToken(&XTokenList, &XTokenListTokens,
853 // Write the end part of the vCard data file.
855 SaveData->Append("END:VCARD");
857 SaveDataStatus = CONTACTSAVE_OK;
859 return SaveDataStatus;
863 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
864 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
865 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
866 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
868 wxString ProcessData = "";
870 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
871 TitleIter != TitleList->end(); TitleIter++){
873 ProcessData.Append("TITLE");
875 // Check if there is a value for TYPE.
877 if (DataType.size() > 0){
879 ProcessData.Append(";TYPE=");
880 ProcessData.Append(DataType);
884 // Check if there is a value for ALTID.
886 if ((*TitleListAltID)[TitleIter->first].size() > 0){
888 ProcessData.Append(";ALTID=");
889 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
893 // Check if there is a value for LANGUAGE.
895 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
897 ProcessData.Append(";LANGUAGE=");
898 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
902 // Check if there is a value for PID.
904 if ((*TitleListPID)[TitleIter->first].size() > 0){
906 ProcessData.Append(";PID=");
907 ProcessData.Append((*TitleListPID)[TitleIter->first]);
911 // Check if there is a value for PREF.
913 if ((*TitleListPref)[TitleIter->first] > 0){
915 ProcessData.Append(";PREF=");
916 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
920 // Check if there is a value for tokens.
922 if ((*TitleListTokens)[TitleIter->first].size() > 0){
924 ProcessData.Append(";");
925 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
929 ProcessData.Append(":");
930 ProcessData.Append(TitleIter->second);
931 ProcessData.Append("\n");
933 ProcessData = OutputText(&ProcessData);
935 SaveData->Append(ProcessData);
942 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
943 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
944 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
945 map<int, wxString> *SourceListTokens, wxString *SaveData){
947 wxString ProcessData = "";
949 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
950 SourceIter != SourceList->end(); SourceIter++){
952 ProcessData.Append("SOURCE");
954 // Check if there is a value for TYPE.
956 if ((*SourceListType)[SourceIter->first].size() > 0){
958 ProcessData.Append(";TYPE=");
959 ProcessData.Append((*SourceListType)[SourceIter->first]);
963 // Check if there is a value for ALTID.
965 if ((*SourceListAltID)[SourceIter->first].size() > 0){
967 ProcessData.Append(";ALTID=");
968 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
972 // Check if there is a value for MEDIATYPE.
974 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
976 ProcessData.Append(";MEDIATYPE=");
977 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
981 // Check if there is a value for PID.
983 if ((*SourceListPID)[SourceIter->first].size() > 0){
985 ProcessData.Append(";PID=");
986 ProcessData.Append((*SourceListPID)[SourceIter->first]);
990 // Check if there is a value for PREF.
992 if ((*SourceListPref)[SourceIter->first] > 0){
994 ProcessData.Append(";PREF=");
995 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
999 // Check if there is a value for tokens.
1001 if ((*SourceListTokens)[SourceIter->first].size() > 0){
1003 ProcessData.Append(";");
1004 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
1008 ProcessData.Append(":");
1009 ProcessData.Append(SourceIter->second);
1010 ProcessData.Append("\n");
1012 ProcessData = OutputText(&ProcessData);
1014 SaveData->Append(ProcessData);
1015 ProcessData.clear();
1021 void ContactDataObject::SaveMember(std::map<int, wxString> *GroupsList, std::map<int, wxString> *GroupsListAltID,
1022 std::map<int, wxString> *GroupsListPID, std::map<int, wxString> *GroupsListType,
1023 std::map<int, wxString> *GroupsListMediaType, std::map<int, int> *GroupsListPref,
1024 std::map<int, wxString> *GroupsListTokens, wxString *SaveData){
1026 wxString ProcessData = "";
1028 for (std::map<int, wxString>::iterator GroupsIter = GroupsList->begin();
1029 GroupsIter != GroupsList->end(); GroupsIter++){
1031 ProcessData.Append("MEMBER");
1033 // Check if there is a value for TYPE.
1035 if ((*GroupsListType)[GroupsIter->first].size() > 0){
1037 ProcessData.Append(";TYPE=");
1038 ProcessData.Append((*GroupsListType)[GroupsIter->first]);
1042 // Check if there is a value for ALTID.
1044 if ((*GroupsListAltID)[GroupsIter->first].size() > 0){
1046 ProcessData.Append(";ALTID=");
1047 ProcessData.Append((*GroupsListAltID)[GroupsIter->first]);
1051 // Check if there is a value for MEDIATYPE.
1053 if ((*GroupsListMediaType)[GroupsIter->first].size() > 0){
1055 ProcessData.Append(";MEDIATYPE=");
1056 ProcessData.Append((*GroupsListMediaType)[GroupsIter->first]);
1060 // Check if there is a value for PID.
1062 if ((*GroupsListPID)[GroupsIter->first].size() > 0){
1064 ProcessData.Append(";PID=");
1065 ProcessData.Append((*GroupsListPID)[GroupsIter->first]);
1069 // Check if there is a value for PREF.
1071 if ((*GroupsListPref)[GroupsIter->first] > 0){
1073 ProcessData.Append(";PREF=");
1074 ProcessData.Append(wxString::Format("%i", (*GroupsListPref)[GroupsIter->first]));
1078 // Check if there is a value for tokens.
1080 if ((*GroupsListTokens)[GroupsIter->first].size() > 0){
1082 ProcessData.Append(";");
1083 ProcessData.Append((*GroupsListTokens)[GroupsIter->first]);
1087 ProcessData.Append(":");
1088 ProcessData.Append(GroupsIter->second);
1089 ProcessData.Append("\n");
1091 ProcessData = OutputText(&ProcessData);
1093 SaveData->Append(ProcessData);
1094 ProcessData.clear();
1100 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
1101 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
1102 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
1103 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
1105 wxString ProcessData = "";
1107 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
1108 NicknameIter != NicknameList->end(); NicknameIter++){
1110 ProcessData.Append("NICKNAME");
1112 // Check if there is a value for TYPE.
1114 if (DataType.size() > 0){
1116 ProcessData.Append(";TYPE=");
1117 ProcessData.Append(DataType);
1121 // Check if there is a value for ALTID.
1123 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
1125 ProcessData.Append(";ALTID=");
1126 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
1130 // Check if there is a value for MEDIATYPE.
1132 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
1134 ProcessData.Append(";LANGUAGE=");
1135 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
1139 // Check if there is a value for PID.
1141 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
1143 ProcessData.Append(";PID=");
1144 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
1148 // Check if there is a value for PREF.
1150 if ((*NicknameListPref)[NicknameIter->first] > 0){
1152 ProcessData.Append(";PREF=");
1153 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
1157 // Check if there is a value for tokens.
1159 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
1161 ProcessData.Append(";");
1162 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
1166 ProcessData.Append(":");
1167 ProcessData.Append(NicknameIter->second);
1168 ProcessData.Append("\n");
1170 ProcessData = OutputText(&ProcessData);
1172 SaveData->Append(ProcessData);
1173 ProcessData.clear();
1179 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
1180 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
1181 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
1182 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
1184 wxString ProcessData = "";
1186 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
1187 TZIter != TZList->end(); TZIter++){
1189 ProcessData.Append("TZ");
1191 // Check if there is a value for TYPE.
1193 if (DataType.size() > 0){
1195 ProcessData.Append(";TYPE=");
1196 ProcessData.Append(DataType);
1200 // Check if there is a value for ALTID.
1202 if ((*TZListAltID)[TZIter->first].size() > 0){
1204 ProcessData.Append(";ALTID=");
1205 ProcessData.Append((*TZListAltID)[TZIter->first]);
1209 // Check if there is a value for MEDIATYPE.
1211 if ((*TZListMediatype)[TZIter->first].size() > 0){
1213 ProcessData.Append(";MEDIATYPE=");
1214 ProcessData.Append((*TZListMediatype)[TZIter->first]);
1218 // Check if there is a value for PID.
1220 if ((*TZListPID)[TZIter->first].size() > 0){
1222 ProcessData.Append(";PID=");
1223 ProcessData.Append((*TZListPID)[TZIter->first]);
1227 // Check if there is a value for PREF.
1229 if ((*TZListPref)[TZIter->first] > 0){
1231 ProcessData.Append(";PREF=");
1232 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
1236 // Check if there is a value for tokens.
1238 if ((*TZListTokens)[TZIter->first].size() > 0){
1240 ProcessData.Append(";");
1241 ProcessData.Append((*TZListTokens)[TZIter->first]);
1245 ProcessData.Append(":");
1246 ProcessData.Append(TZIter->second);
1247 ProcessData.Append("\n");
1249 ProcessData = OutputText(&ProcessData);
1251 SaveData->Append(ProcessData);
1252 ProcessData.clear();
1258 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
1259 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
1260 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
1261 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
1262 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
1263 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
1264 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
1265 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
1267 wxString ProcessData = "";
1269 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
1270 AddressIter != AddressList->end(); AddressIter++){
1272 ProcessData.Append("ADR");
1274 // Check if there is a value for TYPE.
1276 if (DataType.size() > 0){
1278 ProcessData.Append(";TYPE=");
1279 ProcessData.Append(DataType);
1283 // Check if there is a value for ALTID.
1285 if ((*AddressListAltID)[AddressIter->first].size() > 0){
1287 ProcessData.Append(";ALTID=");
1288 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
1292 // Check if there is a value for GEO.
1294 if ((*AddressListGeo)[AddressIter->first].size() > 0){
1296 ProcessData.Append(";GEO=\"");
1297 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
1298 ProcessData.Append("\"");
1302 // Check if there is a value for LABEL.
1304 if ((*AddressListLabel)[AddressIter->first].size() > 0){
1306 wxString AddressProcessed = "";
1307 AddressProcessed = (*AddressListLabel)[AddressIter->first];
1309 AddressProcessed.Replace("\n", "\\n", true);
1311 ProcessData.Append(";LABEL=");
1312 ProcessData.Append(AddressProcessed);
1316 // Check if there is a value for LANGUAGE.
1318 if ((*AddressListLang)[AddressIter->first].size() > 0){
1320 ProcessData.Append(";LANGUAGE=");
1321 ProcessData.Append((*AddressListLang)[AddressIter->first]);
1325 // Check if there is a value for MEDIATYPE.
1327 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1329 ProcessData.Append(";MEDIATYPE=");
1330 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1334 // Check if there is a value for PID.
1336 if ((*AddressListPID)[AddressIter->first].size() > 0){
1338 ProcessData.Append(";PID=");
1339 ProcessData.Append((*AddressListPID)[AddressIter->first]);
1343 // Check if there is a value for PREF.
1345 if ((*AddressListPref)[AddressIter->first] > 0){
1347 ProcessData.Append(";PREF=");
1348 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1352 // Check if there is a value for TZ.
1354 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1356 ProcessData.Append(";TZ=");
1357 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1361 // Check if there is a value for tokens.
1363 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1365 ProcessData.Append(";");
1366 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1370 // Build the address.
1372 ProcessData.Append(":;;");
1373 ProcessData.Append((*AddressList)[AddressIter->first]);
1374 ProcessData.Append(";");
1375 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1376 ProcessData.Append(";");
1377 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1378 ProcessData.Append(";");
1379 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1380 ProcessData.Append(";");
1381 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1382 ProcessData.Append("\n");
1384 ProcessData = OutputText(&ProcessData);
1386 SaveData->Append(ProcessData);
1387 ProcessData.clear();
1393 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1394 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1395 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1396 wxString *SaveData, wxString DataType){
1398 wxString ProcessData = "";
1400 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1401 EmailIter != EmailList->end(); EmailIter++){
1403 ProcessData.Append("EMAIL");
1405 // Check if there is a value for TYPE.
1407 if (DataType.size() > 0){
1409 ProcessData.Append(";TYPE=");
1410 ProcessData.Append(DataType);
1414 // Check if there is a value for ALTID.
1416 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1418 ProcessData.Append(";ALTID=");
1419 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1423 // Check if there is a value for PID.
1425 if ((*EmailListPID)[EmailIter->first].size() > 0){
1427 ProcessData.Append(";PID=");
1428 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1432 // Check if there is a value for PREF.
1434 if ((*EmailListPref)[EmailIter->first] > 0){
1436 ProcessData.Append(";PREF=");
1437 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1441 // Check if there is a value for tokens.
1443 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1445 ProcessData.Append(";");
1446 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1450 ProcessData.Append(":");
1451 ProcessData.Append(EmailIter->second);
1452 ProcessData.Append("\n");
1454 ProcessData = OutputText(&ProcessData);
1456 SaveData->Append(ProcessData);
1457 ProcessData.clear();
1463 void ContactDataObject::SaveIMPP(map<int, wxString> *IMList, map<int, wxString> *IMListAltID,
1464 map<int, wxString> *IMListPID, map<int, wxString> *IMListType,
1465 map<int, wxString> *IMListTypeInfo, map<int, wxString> *IMListMediatype,
1466 map<int, int> *IMListPref, map<int, wxString> *IMListTokens,
1467 wxString *SaveData, wxString DataType){
1469 wxString ProcessData = "";
1471 for (std::map<int, wxString>::iterator IMIter = IMList->begin();
1472 IMIter != IMList->end(); IMIter++){
1474 ProcessData.Append("IMPP");
1476 // Check if there is a value for TYPE.
1478 if (DataType.size() > 0){
1480 ProcessData.Append(";TYPE=");
1481 ProcessData.Append(DataType);
1485 // Check if there is a value for ALTID.
1487 if ((*IMListAltID)[IMIter->first].size() > 0){
1489 ProcessData.Append(";ALTID=");
1490 ProcessData.Append((*IMListAltID)[IMIter->first]);
1494 // Check if there is a value for MEDIATYPE.
1496 if ((*IMListMediatype)[IMIter->first].size() > 0){
1498 ProcessData.Append(";MEDIATYPE=");
1499 ProcessData.Append((*IMListMediatype)[IMIter->first]);
1503 // Check if there is a value for PID.
1505 if ((*IMListPID)[IMIter->first].size() > 0){
1507 ProcessData.Append(";PID=");
1508 ProcessData.Append((*IMListPID)[IMIter->first]);
1512 // Check if there is a value for PREF.
1514 if ((*IMListPref)[IMIter->first] > 0){
1516 ProcessData.Append(";PREF=");
1517 ProcessData.Append(wxString::Format("%i", (*IMListPref)[IMIter->first]));
1521 // Check if there is a value for tokens.
1523 if ((*IMListTokens)[IMIter->first].size() > 0){
1525 ProcessData.Append(";");
1526 ProcessData.Append((*IMListTokens)[IMIter->first]);
1530 ProcessData.Append(":");
1531 ProcessData.Append((*IMListTypeInfo)[IMIter->first]);
1532 ProcessData.Append(":");
1533 ProcessData.Append(IMIter->second);
1534 ProcessData.Append("\n");
1536 ProcessData = OutputText(&ProcessData);
1538 SaveData->Append(ProcessData);
1539 ProcessData.clear();
1545 void ContactDataObject::SaveTelephone(map<int, wxString> *TelephoneList, map<int, wxString> *TelephoneListAltID,
1546 map<int, wxString> *TelephoneListPID, map<int, wxString> *TelephoneListType,
1547 map<int, wxString> *TelephoneListTypeInfo, map<int, wxString> *TelephoneListDataType,
1548 map<int, int> *TelephoneListPref, map<int, wxString> *TelephoneListTokens,
1549 wxString *SaveData, wxString DataType){
1551 wxString ProcessData = "";
1553 for (std::map<int, wxString>::iterator TelephoneIter = TelephoneList->begin();
1554 TelephoneIter != TelephoneList->end(); TelephoneIter++){
1556 ProcessData.Append("TEL");
1558 // Check if there is a value for TYPE.
1560 if (DataType.size() > 0 || (*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1562 ProcessData.Append(";TYPE=\"");
1564 bool ProcessedType = false;
1566 if (DataType.size() > 0){
1568 ProcessData.Append(DataType);
1569 ProcessedType = true;
1573 if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1575 if (ProcessedType == true){
1576 ProcessData.Append(",");
1578 ProcessData.Append((*TelephoneListTypeInfo)[TelephoneIter->first]);
1582 ProcessData.Append("\"");
1586 // Check if there is a value for ALTID.
1588 if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1590 ProcessData.Append(";ALTID=");
1591 ProcessData.Append((*TelephoneListAltID)[TelephoneIter->first]);
1595 // Check if there is a value for PID.
1597 if ((*TelephoneListPID)[TelephoneIter->first].size() > 0){
1599 ProcessData.Append(";PID=");
1600 ProcessData.Append((*TelephoneListPID)[TelephoneIter->first]);
1604 // Check if there is a value for PREF.
1606 if ((*TelephoneListPref)[TelephoneIter->first] > 0){
1608 ProcessData.Append(";PREF=");
1609 ProcessData.Append(wxString::Format("%i", (*TelephoneListPref)[TelephoneIter->first]));
1613 // Check if there is a value for tokens.
1615 if ((*TelephoneListTokens)[TelephoneIter->first].size() > 0){
1617 ProcessData.Append(";");
1618 ProcessData.Append((*TelephoneListTokens)[TelephoneIter->first]);
1622 ProcessData.Append(":");
1623 ProcessData.Append((*TelephoneListDataType)[TelephoneIter->first]);
1624 ProcessData.Append(":");
1625 ProcessData.Append(TelephoneIter->second);
1626 ProcessData.Append("\n");
1628 ProcessData = OutputText(&ProcessData);
1630 SaveData->Append(ProcessData);
1631 ProcessData.clear();
1637 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1638 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1639 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1640 wxString *SaveData, wxString DataType){
1642 wxString ProcessData = "";
1644 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1645 LanguageIter != LanguageList->end(); LanguageIter++){
1647 ProcessData.Append("LANG");
1649 // Check if there is a value for TYPE.
1651 if (DataType.size() > 0){
1653 ProcessData.Append(";TYPE=");
1654 ProcessData.Append(DataType);
1658 // Check if there is a value for ALTID.
1660 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1662 ProcessData.Append(";ALTID=");
1663 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1667 // Check if there is a value for PID.
1669 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1671 ProcessData.Append(";PID=");
1672 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1676 // Check if there is a value for PREF.
1678 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1680 ProcessData.Append(";PREF=");
1681 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1685 // Check if there is a value for tokens.
1687 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1689 ProcessData.Append(";");
1690 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1694 ProcessData.Append(":");
1695 ProcessData.Append(LanguageIter->second);
1696 ProcessData.Append("\n");
1698 ProcessData = OutputText(&ProcessData);
1700 SaveData->Append(ProcessData);
1701 ProcessData.clear();
1707 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1708 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1709 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1710 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1711 wxString *SaveData, wxString DataType){
1713 wxString ProcessData = "";
1715 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1716 GeographyIter != GeographyList->end(); GeographyIter++){
1718 ProcessData.Append("GEO");
1720 // Check if there is a value for TYPE.
1722 if (DataType.size() > 0){
1724 ProcessData.Append(";TYPE=");
1725 ProcessData.Append(DataType);
1729 // Check if there is a value for ALTID.
1731 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1733 ProcessData.Append(";ALTID=");
1734 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1738 // Check if there is a value for MEDIATYPE.
1740 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1742 ProcessData.Append(";MEDIATYPE=");
1743 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1747 // Check if there is a value for PID.
1749 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1751 ProcessData.Append(";PID=");
1752 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1756 // Check if there is a value for PREF.
1758 if ((*GeographyListPref)[GeographyIter->first] > 0){
1760 ProcessData.Append(";PREF=");
1761 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1765 // Check if there is a value for tokens.
1767 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1769 ProcessData.Append(";");
1770 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1774 ProcessData.Append(":");
1775 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1776 ProcessData.Append(":");
1777 ProcessData.Append(GeographyIter->second);
1778 ProcessData.Append("\n");
1780 ProcessData = OutputText(&ProcessData);
1782 SaveData->Append(ProcessData);
1783 ProcessData.clear();
1789 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1790 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1791 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1792 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1794 wxString ProcessData = "";
1796 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1797 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1799 ProcessData.Append("URL");
1801 // Check if there is a value for TYPE.
1803 if (DataType.size() > 0){
1805 ProcessData.Append(";TYPE=");
1806 ProcessData.Append(DataType);
1810 // Check if there is a value for ALTID.
1812 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1814 ProcessData.Append(";ALTID=");
1815 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1819 // Check if there is a value for MEDIATYPE.
1821 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1823 ProcessData.Append(";MEDIATYPE=");
1824 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1828 // Check if there is a value for PID.
1830 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1832 ProcessData.Append(";PID=");
1833 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1837 // Check if there is a value for PREF.
1839 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1841 ProcessData.Append(";PREF=");
1842 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1846 // Check if there is a value for tokens.
1848 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1850 ProcessData.Append(";");
1851 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1855 ProcessData.Append(":");
1856 ProcessData.Append(WebsiteIter->second);
1857 ProcessData.Append("\n");
1859 ProcessData = OutputText(&ProcessData);
1861 SaveData->Append(ProcessData);
1862 ProcessData.clear();
1868 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1869 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1870 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1871 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1873 wxString ProcessData = "";
1875 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1876 RoleIter != RoleList->end(); RoleIter++){
1878 ProcessData.Append("ROLE");
1880 // Check if there is a value for TYPE.
1882 if (DataType.size() > 0){
1884 ProcessData.Append(";TYPE=");
1885 ProcessData.Append(DataType);
1889 // Check if there is a value for ALTID.
1891 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1893 ProcessData.Append(";ALTID=");
1894 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1898 // Check if there is a value for LANGUAGE.
1900 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1902 ProcessData.Append(";LANGUAGE=");
1903 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1907 // Check if there is a value for PID.
1909 if ((*RoleListPID)[RoleIter->first].size() > 0){
1911 ProcessData.Append(";PID=");
1912 ProcessData.Append((*RoleListPID)[RoleIter->first]);
1916 // Check if there is a value for PREF.
1918 if ((*RoleListPref)[RoleIter->first] > 0){
1920 ProcessData.Append(";PREF=");
1921 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1925 // Check if there is a value for tokens.
1927 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1929 ProcessData.Append(";");
1930 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1934 ProcessData.Append(":");
1935 ProcessData.Append(RoleIter->second);
1936 ProcessData.Append("\n");
1938 ProcessData = OutputText(&ProcessData);
1940 SaveData->Append(ProcessData);
1941 ProcessData.clear();
1947 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1948 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
1949 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
1950 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
1951 wxString *SaveData, wxString DataType){
1953 wxString ProcessData = "";
1955 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1956 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1958 ProcessData.Append("ORG");
1960 // Check if there is a value for TYPE.
1962 if (DataType.size() > 0){
1964 ProcessData.Append(";TYPE=");
1965 ProcessData.Append(DataType);
1969 // Check if there is a value for ALTID.
1971 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1973 ProcessData.Append(";ALTID=");
1974 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1978 // Check if there is a value for LANGUAGE.
1980 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1982 ProcessData.Append(";LANGUAGE=");
1983 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1987 // Check if there is a value for PID.
1989 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1991 ProcessData.Append(";PID=");
1992 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1996 // Check if there is a value for PREF.
1998 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
2000 ProcessData.Append(";PREF=");
2001 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
2005 // Check if there is a value for SORT-AS.
2007 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
2009 ProcessData.Append(";SORT-AS=\"");
2010 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
2011 ProcessData.Append("\"");
2015 // Check if there is a value for tokens.
2017 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
2019 ProcessData.Append(";");
2020 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
2024 ProcessData.Append(":");
2025 ProcessData.Append(OrganisationIter->second);
2026 ProcessData.Append("\n");
2028 ProcessData = OutputText(&ProcessData);
2030 SaveData->Append(ProcessData);
2031 ProcessData.clear();
2037 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
2038 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
2039 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
2040 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
2042 wxString ProcessData = "";
2044 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
2045 NoteIter != NoteList->end(); NoteIter++){
2047 ProcessData.Append("NOTE");
2049 // Check if there is a value for TYPE.
2051 if (DataType.size() > 0){
2053 ProcessData.Append(";TYPE=");
2054 ProcessData.Append(DataType);
2058 // Check if there is a value for ALTID.
2060 if ((*NoteListAltID)[NoteIter->first].size() > 0){
2062 ProcessData.Append(";ALTID=");
2063 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
2067 // Check if there is a value for LANGUAGE.
2069 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
2071 ProcessData.Append(";LANGUAGE=");
2072 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
2076 // Check if there is a value for PID.
2078 if ((*NoteListPID)[NoteIter->first].size() > 0){
2080 ProcessData.Append(";PID=");
2081 ProcessData.Append((*NoteListPID)[NoteIter->first]);
2085 // Check if there is a value for PREF.
2087 if ((*NoteListPref)[NoteIter->first] > 0){
2089 ProcessData.Append(";PREF=");
2090 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
2094 // Check if there is a value for tokens.
2096 if ((*NoteListTokens)[NoteIter->first].size() > 0){
2098 ProcessData.Append(";");
2099 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
2103 ProcessData.Append(":");
2104 ProcessData.Append(NoteIter->second);
2105 ProcessData.Replace("\n", "\\n", true);
2106 ProcessData.Append("\n");
2108 ProcessData = OutputText(&ProcessData);
2110 SaveData->Append(ProcessData);
2111 ProcessData.clear();
2117 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
2118 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
2119 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
2120 map<int, wxString> *CategoryListTokens, wxString *SaveData){
2122 wxString ProcessData = "";
2124 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
2125 CategoryIter != CategoryList->end(); CategoryIter++){
2127 ProcessData.Append("CATEGORIES");
2129 // Check if there is a value for TYPE.
2131 if ((*CategoryListType)[CategoryIter->first].size() > 0){
2133 ProcessData.Append(";TYPE=");
2134 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
2138 // Check if there is a value for ALTID.
2140 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
2142 ProcessData.Append(";ALTID=");
2143 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
2147 // Check if there is a value for LANGUAGE.
2149 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
2151 ProcessData.Append(";LANGUAGE=");
2152 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
2156 // Check if there is a value for PID.
2158 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
2160 ProcessData.Append(";PID=");
2161 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
2165 // Check if there is a value for PREF.
2167 if ((*CategoryListPref)[CategoryIter->first] > 0){
2169 ProcessData.Append(";PREF=");
2170 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
2174 // Check if there is a value for tokens.
2176 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
2178 ProcessData.Append(";");
2179 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
2183 ProcessData.Append(":");
2184 ProcessData.Append(CategoryIter->second);
2185 ProcessData.Append("\n");
2187 ProcessData = OutputText(&ProcessData);
2189 SaveData->Append(ProcessData);
2190 ProcessData.clear();
2196 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
2197 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
2198 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
2199 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
2200 map<int, wxString> *PicturesListTokens, wxString *SaveData){
2202 wxString ProcessData = "";
2204 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
2205 PicturesIter != PicturesList->end(); PicturesIter++){
2207 ProcessData.Append("PHOTO");
2209 // Check if there is a value for TYPE.
2211 if ((*PicturesListType)[PicturesIter->first].size() > 0){
2213 ProcessData.Append(";TYPE=");
2214 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
2218 // Check if there is a value for ALTID.
2220 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
2222 ProcessData.Append(";ALTID=");
2223 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
2227 // Check if there is a value for MEDIATYPE..
2229 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
2231 ProcessData.Append(";MEDIATYPE=");
2232 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
2236 // Check if there is a value for PID.
2238 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
2240 ProcessData.Append(";PID=");
2241 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
2245 // Check if there is a value for PREF.
2247 if ((*PicturesListPref)[PicturesIter->first] > 0){
2249 ProcessData.Append(";PREF=");
2250 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
2254 // Check if there is a value for tokens.
2256 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
2258 ProcessData.Append(";");
2259 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
2263 ProcessData.Append(":data:");
2264 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
2265 ProcessData.Append(";");
2266 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
2267 ProcessData.Append(",");
2268 ProcessData.Append(PicturesIter->second);
2269 ProcessData.Append("\n");
2271 ProcessData = OutputText(&ProcessData);
2273 SaveData->Append(ProcessData);
2274 ProcessData.clear();
2280 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID,
2281 map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
2282 map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
2283 map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
2284 map<int, wxString> *LogosListTokens, wxString *SaveData){
2286 wxString ProcessData = "";
2288 for (std::map<int, string>::iterator LogosIter = LogosList->begin();
2289 LogosIter != LogosList->end(); LogosIter++){
2291 ProcessData.Append("LOGO");
2293 // Check if there is a value for TYPE.
2295 if ((*LogosListType)[LogosIter->first].size() > 0){
2297 ProcessData.Append(";TYPE=");
2298 ProcessData.Append((*LogosListType)[LogosIter->first]);
2302 // Check if there is a value for ALTID.
2304 if ((*LogosListAltID)[LogosIter->first].size() > 0){
2306 ProcessData.Append(";ALTID=");
2307 ProcessData.Append((*LogosListAltID)[LogosIter->first]);
2311 // Check if there is a value for MEDIATYPE..
2313 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
2315 ProcessData.Append(";MEDIATYPE=");
2316 ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
2320 // Check if there is a value for PID.
2322 if ((*LogosListPID)[LogosIter->first].size() > 0){
2324 ProcessData.Append(";PID=");
2325 ProcessData.Append((*LogosListPID)[LogosIter->first]);
2329 // Check if there is a value for PREF.
2331 if ((*LogosListPref)[LogosIter->first] > 0){
2333 ProcessData.Append(";PREF=");
2334 ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
2338 // Check if there is a value for tokens.
2340 if ((*LogosListTokens)[LogosIter->first].size() > 0){
2342 ProcessData.Append(";");
2343 ProcessData.Append((*LogosListTokens)[LogosIter->first]);
2347 ProcessData.Append(":data:");
2348 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
2349 ProcessData.Append(";");
2350 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
2351 ProcessData.Append(",");
2352 ProcessData.Append(LogosIter->second);
2353 ProcessData.Append("\n");
2355 ProcessData = OutputText(&ProcessData);
2357 SaveData->Append(ProcessData);
2358 ProcessData.clear();
2364 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID,
2365 map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
2366 map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
2367 map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage,
2368 map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens,
2369 wxString *SaveData){
2371 wxString ProcessData = "";
2373 for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
2374 SoundsIter != SoundsList->end(); SoundsIter++){
2376 ProcessData.Append("SOUND");
2378 // Check if there is a value for TYPE.
2380 if ((*SoundsListType)[SoundsIter->first].size() > 0){
2382 ProcessData.Append(";TYPE=");
2383 ProcessData.Append((*SoundsListType)[SoundsIter->first]);
2387 // Check if there is a value for ALTID.
2389 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
2391 ProcessData.Append(";ALTID=");
2392 ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
2396 // Check if there is a value for LANGUAGE.
2398 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
2400 ProcessData.Append(";LANGUAGE=");
2401 ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
2405 // Check if there is a value for MEDIATYPE.
2407 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
2409 ProcessData.Append(";MEDIATYPE=");
2410 ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
2414 // Check if there is a value for PID.
2416 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
2418 ProcessData.Append(";PID=");
2419 ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
2423 // Check if there is a value for PREF.
2425 if ((*SoundsListPref)[SoundsIter->first] > 0){
2427 ProcessData.Append(";PREF=");
2428 ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
2432 // Check if there is a value for tokens.
2434 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
2436 ProcessData.Append(";");
2437 ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
2441 ProcessData.Append(":data:");
2442 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
2443 ProcessData.Append(";");
2444 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
2445 ProcessData.Append(",");
2446 ProcessData.Append(SoundsIter->second);
2447 ProcessData.Append("\n");
2449 ProcessData = OutputText(&ProcessData);
2451 SaveData->Append(ProcessData);
2452 ProcessData.clear();
2458 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
2459 map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
2460 map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
2461 map<int, wxString> *CalendarListTokens, wxString *SaveData){
2463 wxString ProcessData = "";
2465 for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
2466 CalendarIter != CalendarList->end(); CalendarIter++){
2468 ProcessData.Append("CALURI");
2470 // Check if there is a value for TYPE.
2472 if ((*CalendarListType)[CalendarIter->first].size() > 0){
2474 ProcessData.Append(";TYPE=");
2475 ProcessData.Append((*CalendarListType)[CalendarIter->first]);
2479 // Check if there is a value for ALTID.
2481 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2483 ProcessData.Append(";ALTID=");
2484 ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2488 // Check if there is a value for MEDIATYPE.
2490 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2492 ProcessData.Append(";MEDIATYPE=");
2493 ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2497 // Check if there is a value for PID.
2499 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2501 ProcessData.Append(";PID=");
2502 ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2506 // Check if there is a value for PREF.
2508 if ((*CalendarListPref)[CalendarIter->first] > 0){
2510 ProcessData.Append(";PREF=");
2511 ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2515 // Check if there is a value for tokens.
2517 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2519 ProcessData.Append(";");
2520 ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2524 ProcessData.Append(":");
2525 ProcessData.Append(CalendarIter->second);
2526 ProcessData.Append("\n");
2528 ProcessData = OutputText(&ProcessData);
2530 SaveData->Append(ProcessData);
2531 ProcessData.clear();
2537 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2538 map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2539 map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2540 map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2542 wxString ProcessData = "";
2544 for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2545 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2547 ProcessData.Append("CALADRURI");
2549 // Check if there is a value for TYPE.
2551 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2553 ProcessData.Append(";TYPE=");
2554 ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2558 // Check if there is a value for ALTID.
2560 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2562 ProcessData.Append(";ALTID=");
2563 ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2567 // Check if there is a value for MEDIATYPE.
2569 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2571 ProcessData.Append(";MEDIATYPE=");
2572 ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2576 // Check if there is a value for PID.
2578 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2580 ProcessData.Append(";PID=");
2581 ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2585 // Check if there is a value for PREF.
2587 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2589 ProcessData.Append(";PREF=");
2590 ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2594 // Check if there is a value for tokens.
2596 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2598 ProcessData.Append(";");
2599 ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2603 ProcessData.Append(":");
2604 ProcessData.Append(CalendarRequestIter->second);
2605 ProcessData.Append("\n");
2607 ProcessData = OutputText(&ProcessData);
2609 SaveData->Append(ProcessData);
2610 ProcessData.clear();
2616 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID,
2617 std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2618 std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref,
2619 std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2621 wxString ProcessData = "";
2623 for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2624 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2626 ProcessData.Append("FBURL");
2628 // Check if there is a value for TYPE.
2630 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2632 ProcessData.Append(";TYPE=");
2633 ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2637 // Check if there is a value for ALTID.
2639 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2641 ProcessData.Append(";ALTID=");
2642 ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2646 // Check if there is a value for MEDIATYPE.
2648 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2650 ProcessData.Append(";MEDIATYPE=");
2651 ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2655 // Check if there is a value for PID.
2657 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2659 ProcessData.Append(";PID=");
2660 ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2664 // Check if there is a value for PREF.
2666 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2668 ProcessData.Append(";PREF=");
2669 ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2673 // Check if there is a value for tokens.
2675 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2677 ProcessData.Append(";");
2678 ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2682 ProcessData.Append(":");
2683 ProcessData.Append(FreeBusyIter->second);
2684 ProcessData.Append("\n");
2686 ProcessData = OutputText(&ProcessData);
2688 SaveData->Append(ProcessData);
2689 ProcessData.clear();
2695 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID,
2696 map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2697 map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType,
2698 map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref,
2699 map<int, wxString> *KeyListTokens, wxString *SaveData){
2701 wxString ProcessData = "";
2703 for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2704 KeyIter != KeyList->end(); KeyIter++){
2706 ProcessData.Append("KEY");
2708 // Check if there is a value for TYPE.
2710 if ((*KeyListType)[KeyIter->first].size() > 0){
2712 ProcessData.Append(";TYPE=");
2713 ProcessData.Append((*KeyListType)[KeyIter->first]);
2717 // Check if there is a value for ALTID.
2719 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2721 ProcessData.Append(";ALTID=");
2722 ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2726 // Check if there is a value for PID.
2728 if ((*KeyListPID)[KeyIter->first].size() > 0){
2730 ProcessData.Append(";PID=");
2731 ProcessData.Append((*KeyListPID)[KeyIter->first]);
2735 // Check if there is a value for PREF.
2737 if ((*KeyListPref)[KeyIter->first] > 0){
2739 ProcessData.Append(";PREF=");
2740 ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2744 // Check if there is a value for tokens.
2746 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2748 ProcessData.Append(";");
2749 ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2753 ProcessData.Append(":data:");
2754 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2755 ProcessData.Append(";");
2756 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2757 ProcessData.Append(",");
2758 ProcessData.Append(KeyIter->second);
2759 ProcessData.Append("\n");
2761 ProcessData = OutputText(&ProcessData);
2763 SaveData->Append(ProcessData);
2764 ProcessData.clear();
2770 void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN,
2771 map<int, wxString> *VendorListElement, wxString *SaveData){
2773 wxString ProcessData = "";
2775 for (std::map<int, wxString>::iterator VendorIter = VendorList->begin();
2776 VendorIter != VendorList->end(); VendorIter++){
2778 ProcessData.Append("VND-");
2779 ProcessData.Append((*VendorListPEN)[VendorIter->first]);
2780 ProcessData.Append("-");
2781 ProcessData.Append((*VendorListElement)[VendorIter->first]);
2782 ProcessData.Append(":");
2783 ProcessData.Append(VendorIter->second);
2784 ProcessData.Append("\n");
2786 ProcessData = OutputText(&ProcessData);
2788 SaveData->Append(ProcessData);
2789 ProcessData.clear();
2795 void ContactDataObject::SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens,
2796 wxString *SaveData){
2798 wxString ProcessData = "";
2800 for (std::map<int, wxString>::iterator XTokenIter = XTokenList->begin();
2801 XTokenIter != XTokenList->end(); XTokenIter++){
2803 ProcessData.Append("X-");
2804 ProcessData.Append((*XTokenListTokens)[XTokenIter->first]);
2805 ProcessData.Append(":");
2806 ProcessData.Append(XTokenIter->second);
2807 ProcessData.Append("\n");
2809 ProcessData = OutputText(&ProcessData);
2811 SaveData->Append(ProcessData);
2812 ProcessData.clear();