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);
413 if (Birthday.size() > 0){
415 ProcessData.Append("BDAY");
417 // Check if there is a value for ALTID.
419 if (BirthdayAltID.size() > 0){
421 ProcessData.Append(";ALTID=");
422 ProcessData.Append(BirthdayAltID);
426 // Check if there is a value for CALSCALE.
428 if (BirthdayAltID.size() > 0){
430 ProcessData.Append(";CALSCALE=");
431 ProcessData.Append(BirthdayCalScale);
435 // Check if there is a value for tokens.
437 if (BirthdayTokens.size() > 0){
439 ProcessData.Append(";");
440 ProcessData.Append(BirthdayTokens);
444 ProcessData.Append(":");
445 ProcessData.Append(Birthday);
446 ProcessData.Append("\n");
448 ProcessData = OutputText(&ProcessData);
450 SaveData->Append(ProcessData);
457 SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
458 &GeneralTitleListAltID, &GeneralTitleListPID,
459 &GeneralTitleListType, &GeneralTitleListPref,
460 &GeneralTitleListTokens, SaveData, "");
461 SaveTitle(&HomeTitleList, &HomeTitleListLanguage,
462 &HomeTitleListAltID, &HomeTitleListPID,
463 &HomeTitleListType, &HomeTitleListPref,
464 &HomeTitleListTokens, SaveData, "home");
465 SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage,
466 &BusinessTitleListAltID, &BusinessTitleListPID,
467 &BusinessTitleListType, &BusinessTitleListPref,
468 &BusinessTitleListTokens, SaveData, "work");
472 SaveTimezone(&GeneralTZList, &GeneralTZListAltID,
473 &GeneralTZListPID, &GeneralTZListType,
474 &GeneralTZListMediatype, &GeneralTZListPref,
475 &GeneralTZListTokens, SaveData, "");
476 SaveTimezone(&HomeTZList, &HomeTZListAltID,
477 &HomeTZListPID, &HomeTZListType,
478 &HomeTZListMediatype, &HomeTZListPref,
479 &HomeTZListTokens, SaveData, "home");
480 SaveTimezone(&BusinessTZList, &BusinessTZListAltID,
481 &BusinessTZListPID, &BusinessTZListType,
482 &BusinessTZListMediatype, &BusinessTZListPref,
483 &BusinessTZListTokens, SaveData, "work");
487 SaveAddress(&GeneralAddressList, &GeneralAddressListTown,
488 &GeneralAddressListCounty, &GeneralAddressListPostCode,
489 &GeneralAddressListCountry, &GeneralAddressListLabel,
490 &GeneralAddressListLang, &GeneralAddressListAltID,
491 &GeneralAddressListPID, &GeneralAddressListGeo,
492 &GeneralAddressListTimezone, &GeneralAddressListType,
493 &GeneralAddressListMediatype, &GeneralAddressListPref,
494 &GeneralAddressListTokens, SaveData, "");
495 SaveAddress(&HomeAddressList, &HomeAddressListTown,
496 &HomeAddressListCounty, &HomeAddressListPostCode,
497 &HomeAddressListCountry, &HomeAddressListLabel,
498 &HomeAddressListLang, &HomeAddressListAltID,
499 &HomeAddressListPID, &HomeAddressListGeo,
500 &HomeAddressListTimezone, &HomeAddressListType,
501 &HomeAddressListMediatype, &HomeAddressListPref,
502 &HomeAddressListTokens, SaveData, "home");
503 SaveAddress(&BusinessAddressList, &BusinessAddressListTown,
504 &BusinessAddressListCounty, &BusinessAddressListPostCode,
505 &BusinessAddressListCountry, &BusinessAddressListLabel,
506 &BusinessAddressListLang, &BusinessAddressListAltID,
507 &BusinessAddressListPID, &BusinessAddressListGeo,
508 &BusinessAddressListTimezone, &BusinessAddressListType,
509 &BusinessAddressListMediatype, &BusinessAddressListPref,
510 &BusinessAddressListTokens, SaveData, "work");
514 SaveEmail(&GeneralEmailList, &GeneralEmailListAltID,
515 &GeneralEmailListPID, &GeneralEmailListType,
516 &GeneralEmailListPref, &GeneralEmailListTokens,
518 SaveEmail(&HomeEmailList, &HomeEmailListAltID,
519 &HomeEmailListPID, &HomeEmailListType,
520 &HomeEmailListPref, &HomeEmailListTokens,
522 SaveEmail(&BusinessEmailList, &BusinessEmailListAltID,
523 &BusinessEmailListPID, &BusinessEmailListType,
524 &BusinessEmailListPref, &BusinessEmailListTokens,
529 SaveIMPP(&GeneralIMList, &GeneralIMListAltID,
530 &GeneralIMListPID, &GeneralIMListType,
531 &GeneralIMListTypeInfo, &GeneralIMListMediatype,
532 &GeneralIMListPref, &GeneralIMListTokens,
534 SaveIMPP(&HomeIMList, &HomeIMListAltID,
535 &HomeIMListPID, &HomeIMListType,
536 &HomeIMListTypeInfo, &HomeIMListMediatype,
537 &HomeIMListPref, &HomeIMListTokens,
539 SaveIMPP(&BusinessIMList, &BusinessIMListAltID,
540 &BusinessIMListPID, &BusinessIMListType,
541 &BusinessIMListTypeInfo, &BusinessIMListMediatype,
542 &BusinessIMListPref, &BusinessIMListTokens,
547 SaveTelephone(&GeneralTelephoneList, &GeneralTelephoneListAltID,
548 &GeneralTelephoneListPID, &GeneralTelephoneListType,
549 &GeneralTelephoneListTypeInfo, &GeneralTelephoneListDataType,
550 &GeneralTelephoneListPref, &GeneralTelephoneListTokens,
552 SaveTelephone(&HomeTelephoneList, &HomeTelephoneListAltID,
553 &HomeTelephoneListPID, &HomeTelephoneListType,
554 &HomeTelephoneListTypeInfo, &HomeTelephoneListDataType,
555 &HomeTelephoneListPref, &HomeTelephoneListTokens,
557 SaveTelephone(&BusinessTelephoneList, &BusinessTelephoneListAltID,
558 &BusinessTelephoneListPID, &BusinessTelephoneListType,
559 &BusinessTelephoneListTypeInfo, &BusinessTelephoneListDataType,
560 &BusinessTelephoneListPref, &BusinessTelephoneListTokens,
565 SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID,
566 &GeneralLanguageListPID, &GeneralLanguageListType,
567 &GeneralLanguageListPref, &GeneralLanguageListTokens,
569 SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID,
570 &HomeLanguageListPID, &HomeLanguageListType,
571 &HomeLanguageListPref, &HomeLanguageListTokens,
573 SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID,
574 &BusinessLanguageListPID, &BusinessLanguageListType,
575 &BusinessLanguageListPref, &BusinessLanguageListTokens,
580 SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID,
581 &GeneralGeographyListPID, &GeneralGeographyListType,
582 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
583 &GeneralGeographyListPref, &GeneralGeographyListTokens,
585 SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID,
586 &HomeGeographyListPID, &HomeGeographyListType,
587 &HomeGeographyListMediatype, &HomeGeographyListDataType,
588 &HomeGeographyListPref, &HomeGeographyListTokens,
590 SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID,
591 &BusinessGeographyListPID, &BusinessGeographyListType,
592 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
593 &BusinessGeographyListPref, &BusinessGeographyListTokens,
600 for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
601 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
603 ProcessData.Append("RELATED");
605 // Check if there is a value for TYPE.
607 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
609 wxString RelatedType = "";
611 ProcessData.Append(";TYPE=");
613 if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
615 RelatedType = wxT("contact");
617 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
619 RelatedType = wxT("acquaintance");
621 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
623 RelatedType = wxT("friend");
625 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
627 RelatedType = wxT("met");
629 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
631 RelatedType = wxT("co-worker");
633 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
635 RelatedType = wxT("colleague");
637 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
639 RelatedType = wxT("co-resident");
641 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
643 RelatedType = wxT("neighbor");
645 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
647 RelatedType = wxT("child");
649 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
651 RelatedType = wxT("parent");
653 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
655 RelatedType = wxT("sibling");
657 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
659 RelatedType = wxT("spouse");
661 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
663 RelatedType = wxT("kin");
665 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
667 RelatedType = wxT("muse");
669 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
671 RelatedType = wxT("crush");
673 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
675 RelatedType = wxT("date");
677 } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
679 RelatedType = wxT("sweetheart");
681 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
683 RelatedType = wxT("me");
685 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
687 RelatedType = wxT("agent");
689 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
691 RelatedType = wxT("emergency");
695 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
699 ProcessData.Append(RelatedType);
703 // Check if there is a value for LANGUAGE.
705 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
707 ProcessData.Append(";LANGUAGE=");
708 ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
712 // Check if there is a value for ALTID.
714 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
716 ProcessData.Append(";ALTID=");
717 ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
721 // Check if there is a value for PID.
723 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
725 ProcessData.Append(";PID=");
726 ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
730 // Check if there is a value for PREF.
732 if (GeneralRelatedListPref[RelatedIter->first] > 0){
734 ProcessData.Append(";PREF=");
735 ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
739 // Check if there is a value for tokens.
741 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
743 ProcessData.Append(";");
744 ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
748 ProcessData.Append(":");
749 ProcessData.Append(RelatedIter->second);
750 ProcessData.Append("\n");
752 ProcessData = OutputText(&ProcessData);
754 SaveData->Append(ProcessData);
761 SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID,
762 &GeneralWebsiteListPID, &GeneralWebsiteListType,
763 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref,
764 &GeneralWebsiteListTokens, SaveData, "");
765 SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID,
766 &HomeWebsiteListPID, &HomeWebsiteListType,
767 &HomeWebsiteListMediatype, &HomeWebsiteListPref,
768 &HomeWebsiteListTokens, SaveData, "home");
769 SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID,
770 &BusinessWebsiteListPID, &BusinessWebsiteListType,
771 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref,
772 &BusinessWebsiteListTokens, SaveData, "work");
776 SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
777 &GeneralRoleListAltID, &GeneralRoleListPID,
778 &GeneralRoleListType, &GeneralRoleListPref,
779 &GeneralRoleListTokens, SaveData, "");
780 SaveRole(&HomeRoleList, &HomeRoleListLanguage,
781 &HomeRoleListAltID, &HomeRoleListPID,
782 &HomeRoleListType, &HomeRoleListPref,
783 &HomeRoleListTokens, SaveData, "home");
784 SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
785 &BusinessRoleListAltID, &BusinessRoleListPID,
786 &BusinessRoleListType, &BusinessRoleListPref,
787 &BusinessRoleListTokens, SaveData, "work");
791 SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
792 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage,
793 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType,
794 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens,
796 SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
797 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage,
798 &HomeOrganisationsListSortAs, &HomeOrganisationsListType,
799 &HomeOrganisationsListPref, &HomeOrganisationsListTokens,
801 SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
802 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage,
803 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType,
804 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens,
809 SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
810 &GeneralNoteListAltID, &GeneralNoteListPID,
811 &GeneralNoteListType, &GeneralNoteListPref,
812 &GeneralNoteListTokens, SaveData, "");
813 SaveNote(&HomeNoteList, &HomeNoteListLanguage,
814 &HomeNoteListAltID, &HomeNoteListPID,
815 &HomeNoteListType, &HomeNoteListPref,
816 &HomeNoteListTokens, SaveData, "home");
817 SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
818 &BusinessNoteListAltID, &BusinessNoteListPID,
819 &BusinessNoteListType, &BusinessNoteListPref,
820 &BusinessNoteListTokens, SaveData, "work");
822 // Process CATEGORIES.
824 SaveCategory(&CategoriesList, &CategoriesListLanguage,
825 &CategoriesListAltID, &CategoriesListPID,
826 &CategoriesListType, &CategoriesListPref,
827 &CategoriesListTokens, SaveData);
831 SavePhoto(&PicturesList, &PicturesListAltID,
832 &PicturesListPID, &PicturesListType,
833 &PicturesListPicEncType, &PicturesListPictureType,
834 &PicturesListMediatype, &PicturesListPref,
835 &PicturesListTokens, SaveData);
839 SaveLogo(&LogosList, &LogosListAltID,
840 &LogosListPID, &LogosListType,
841 &LogosListPicEncType, &LogosListPictureType,
842 &LogosListMediatype, &LogosListPref,
843 &LogosListTokens, SaveData);
847 SaveSound(&SoundsList, &SoundsListAltID,
848 &SoundsListPID, &SoundsListType,
849 &SoundsListAudioEncType, &SoundsListAudioType,
850 &SoundsListMediatype, &SoundsListLanguage,
851 &SoundsListPref, &SoundsListTokens,
856 SaveCalendarURI(&CalendarList, &CalendarListMediatype,
857 &CalendarListAltID, &CalendarListPID,
858 &CalendarListType, &CalendarListPref,
859 &CalendarListTokens, SaveData);
861 // Process CALADRURI.
863 SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
864 &CalendarRequestListAltID, &CalendarRequestListPID,
865 &CalendarRequestListType, &CalendarRequestListPref,
866 &CalendarRequestListTokens, SaveData);
870 SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID,
871 &FreeBusyListPID, &FreeBusyListType,
872 &FreeBusyListMediatype, &FreeBusyListPref,
873 &FreeBusyListTokens, SaveData);
877 SaveKey(&KeyList, &KeyListAltID,
878 &KeyListPID, &KeyListType,
879 &KeyListKeyType, &KeyListDataEncType,
880 &KeyListDataType, &KeyListPref,
881 &KeyListTokens, SaveData);
885 SaveVendor(&VendorList, &VendorListPEN,
886 &VendorListElement, SaveData);
890 SaveXToken(&XTokenList, &XTokenListTokens,
893 // Write the end part of the vCard data file.
895 SaveData->Append("END:VCARD");
897 SaveDataStatus = CONTACTSAVE_OK;
899 return SaveDataStatus;
903 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
904 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
905 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
906 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
908 wxString ProcessData = "";
910 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
911 TitleIter != TitleList->end(); TitleIter++){
913 ProcessData.Append("TITLE");
915 // Check if there is a value for TYPE.
917 if (DataType.size() > 0){
919 ProcessData.Append(";TYPE=");
920 ProcessData.Append(DataType);
924 // Check if there is a value for ALTID.
926 if ((*TitleListAltID)[TitleIter->first].size() > 0){
928 ProcessData.Append(";ALTID=");
929 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
933 // Check if there is a value for LANGUAGE.
935 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
937 ProcessData.Append(";LANGUAGE=");
938 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
942 // Check if there is a value for PID.
944 if ((*TitleListPID)[TitleIter->first].size() > 0){
946 ProcessData.Append(";PID=");
947 ProcessData.Append((*TitleListPID)[TitleIter->first]);
951 // Check if there is a value for PREF.
953 if ((*TitleListPref)[TitleIter->first] > 0){
955 ProcessData.Append(";PREF=");
956 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
960 // Check if there is a value for tokens.
962 if ((*TitleListTokens)[TitleIter->first].size() > 0){
964 ProcessData.Append(";");
965 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
969 ProcessData.Append(":");
970 ProcessData.Append(TitleIter->second);
971 ProcessData.Append("\n");
973 ProcessData = OutputText(&ProcessData);
975 SaveData->Append(ProcessData);
982 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
983 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
984 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
985 map<int, wxString> *SourceListTokens, wxString *SaveData){
987 wxString ProcessData = "";
989 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
990 SourceIter != SourceList->end(); SourceIter++){
992 ProcessData.Append("SOURCE");
994 // Check if there is a value for TYPE.
996 if ((*SourceListType)[SourceIter->first].size() > 0){
998 ProcessData.Append(";TYPE=");
999 ProcessData.Append((*SourceListType)[SourceIter->first]);
1003 // Check if there is a value for ALTID.
1005 if ((*SourceListAltID)[SourceIter->first].size() > 0){
1007 ProcessData.Append(";ALTID=");
1008 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
1012 // Check if there is a value for MEDIATYPE.
1014 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
1016 ProcessData.Append(";MEDIATYPE=");
1017 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
1021 // Check if there is a value for PID.
1023 if ((*SourceListPID)[SourceIter->first].size() > 0){
1025 ProcessData.Append(";PID=");
1026 ProcessData.Append((*SourceListPID)[SourceIter->first]);
1030 // Check if there is a value for PREF.
1032 if ((*SourceListPref)[SourceIter->first] > 0){
1034 ProcessData.Append(";PREF=");
1035 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
1039 // Check if there is a value for tokens.
1041 if ((*SourceListTokens)[SourceIter->first].size() > 0){
1043 ProcessData.Append(";");
1044 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
1048 ProcessData.Append(":");
1049 ProcessData.Append(SourceIter->second);
1050 ProcessData.Append("\n");
1052 ProcessData = OutputText(&ProcessData);
1054 SaveData->Append(ProcessData);
1055 ProcessData.clear();
1061 void ContactDataObject::SaveMember(std::map<int, wxString> *GroupsList, std::map<int, wxString> *GroupsListAltID,
1062 std::map<int, wxString> *GroupsListPID, std::map<int, wxString> *GroupsListType,
1063 std::map<int, wxString> *GroupsListMediaType, std::map<int, int> *GroupsListPref,
1064 std::map<int, wxString> *GroupsListTokens, wxString *SaveData){
1066 wxString ProcessData = "";
1068 for (std::map<int, wxString>::iterator GroupsIter = GroupsList->begin();
1069 GroupsIter != GroupsList->end(); GroupsIter++){
1071 ProcessData.Append("MEMBER");
1073 // Check if there is a value for TYPE.
1075 if ((*GroupsListType)[GroupsIter->first].size() > 0){
1077 ProcessData.Append(";TYPE=");
1078 ProcessData.Append((*GroupsListType)[GroupsIter->first]);
1082 // Check if there is a value for ALTID.
1084 if ((*GroupsListAltID)[GroupsIter->first].size() > 0){
1086 ProcessData.Append(";ALTID=");
1087 ProcessData.Append((*GroupsListAltID)[GroupsIter->first]);
1091 // Check if there is a value for MEDIATYPE.
1093 if ((*GroupsListMediaType)[GroupsIter->first].size() > 0){
1095 ProcessData.Append(";MEDIATYPE=");
1096 ProcessData.Append((*GroupsListMediaType)[GroupsIter->first]);
1100 // Check if there is a value for PID.
1102 if ((*GroupsListPID)[GroupsIter->first].size() > 0){
1104 ProcessData.Append(";PID=");
1105 ProcessData.Append((*GroupsListPID)[GroupsIter->first]);
1109 // Check if there is a value for PREF.
1111 if ((*GroupsListPref)[GroupsIter->first] > 0){
1113 ProcessData.Append(";PREF=");
1114 ProcessData.Append(wxString::Format("%i", (*GroupsListPref)[GroupsIter->first]));
1118 // Check if there is a value for tokens.
1120 if ((*GroupsListTokens)[GroupsIter->first].size() > 0){
1122 ProcessData.Append(";");
1123 ProcessData.Append((*GroupsListTokens)[GroupsIter->first]);
1127 ProcessData.Append(":");
1128 ProcessData.Append(GroupsIter->second);
1129 ProcessData.Append("\n");
1131 ProcessData = OutputText(&ProcessData);
1133 SaveData->Append(ProcessData);
1134 ProcessData.clear();
1140 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
1141 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
1142 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
1143 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
1145 wxString ProcessData = "";
1147 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
1148 NicknameIter != NicknameList->end(); NicknameIter++){
1150 ProcessData.Append("NICKNAME");
1152 // Check if there is a value for TYPE.
1154 if (DataType.size() > 0){
1156 ProcessData.Append(";TYPE=");
1157 ProcessData.Append(DataType);
1161 // Check if there is a value for ALTID.
1163 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
1165 ProcessData.Append(";ALTID=");
1166 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
1170 // Check if there is a value for MEDIATYPE.
1172 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
1174 ProcessData.Append(";LANGUAGE=");
1175 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
1179 // Check if there is a value for PID.
1181 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
1183 ProcessData.Append(";PID=");
1184 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
1188 // Check if there is a value for PREF.
1190 if ((*NicknameListPref)[NicknameIter->first] > 0){
1192 ProcessData.Append(";PREF=");
1193 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
1197 // Check if there is a value for tokens.
1199 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
1201 ProcessData.Append(";");
1202 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
1206 ProcessData.Append(":");
1207 ProcessData.Append(NicknameIter->second);
1208 ProcessData.Append("\n");
1210 ProcessData = OutputText(&ProcessData);
1212 SaveData->Append(ProcessData);
1213 ProcessData.clear();
1219 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
1220 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
1221 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
1222 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
1224 wxString ProcessData = "";
1226 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
1227 TZIter != TZList->end(); TZIter++){
1229 ProcessData.Append("TZ");
1231 // Check if there is a value for TYPE.
1233 if (DataType.size() > 0){
1235 ProcessData.Append(";TYPE=");
1236 ProcessData.Append(DataType);
1240 // Check if there is a value for ALTID.
1242 if ((*TZListAltID)[TZIter->first].size() > 0){
1244 ProcessData.Append(";ALTID=");
1245 ProcessData.Append((*TZListAltID)[TZIter->first]);
1249 // Check if there is a value for MEDIATYPE.
1251 if ((*TZListMediatype)[TZIter->first].size() > 0){
1253 ProcessData.Append(";MEDIATYPE=");
1254 ProcessData.Append((*TZListMediatype)[TZIter->first]);
1258 // Check if there is a value for PID.
1260 if ((*TZListPID)[TZIter->first].size() > 0){
1262 ProcessData.Append(";PID=");
1263 ProcessData.Append((*TZListPID)[TZIter->first]);
1267 // Check if there is a value for PREF.
1269 if ((*TZListPref)[TZIter->first] > 0){
1271 ProcessData.Append(";PREF=");
1272 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
1276 // Check if there is a value for tokens.
1278 if ((*TZListTokens)[TZIter->first].size() > 0){
1280 ProcessData.Append(";");
1281 ProcessData.Append((*TZListTokens)[TZIter->first]);
1285 ProcessData.Append(":");
1286 ProcessData.Append(TZIter->second);
1287 ProcessData.Append("\n");
1289 ProcessData = OutputText(&ProcessData);
1291 SaveData->Append(ProcessData);
1292 ProcessData.clear();
1298 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
1299 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
1300 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
1301 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
1302 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
1303 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
1304 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
1305 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
1307 wxString ProcessData = "";
1309 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
1310 AddressIter != AddressList->end(); AddressIter++){
1312 ProcessData.Append("ADR");
1314 // Check if there is a value for TYPE.
1316 if (DataType.size() > 0){
1318 ProcessData.Append(";TYPE=");
1319 ProcessData.Append(DataType);
1323 // Check if there is a value for ALTID.
1325 if ((*AddressListAltID)[AddressIter->first].size() > 0){
1327 ProcessData.Append(";ALTID=");
1328 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
1332 // Check if there is a value for GEO.
1334 if ((*AddressListGeo)[AddressIter->first].size() > 0){
1336 ProcessData.Append(";GEO=\"");
1337 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
1338 ProcessData.Append("\"");
1342 // Check if there is a value for LABEL.
1344 if ((*AddressListLabel)[AddressIter->first].size() > 0){
1346 wxString AddressProcessed = "";
1347 AddressProcessed = (*AddressListLabel)[AddressIter->first];
1349 AddressProcessed.Replace("\n", "\\n", true);
1351 ProcessData.Append(";LABEL=");
1352 ProcessData.Append(AddressProcessed);
1356 // Check if there is a value for LANGUAGE.
1358 if ((*AddressListLang)[AddressIter->first].size() > 0){
1360 ProcessData.Append(";LANGUAGE=");
1361 ProcessData.Append((*AddressListLang)[AddressIter->first]);
1365 // Check if there is a value for MEDIATYPE.
1367 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1369 ProcessData.Append(";MEDIATYPE=");
1370 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1374 // Check if there is a value for PID.
1376 if ((*AddressListPID)[AddressIter->first].size() > 0){
1378 ProcessData.Append(";PID=");
1379 ProcessData.Append((*AddressListPID)[AddressIter->first]);
1383 // Check if there is a value for PREF.
1385 if ((*AddressListPref)[AddressIter->first] > 0){
1387 ProcessData.Append(";PREF=");
1388 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1392 // Check if there is a value for TZ.
1394 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1396 ProcessData.Append(";TZ=");
1397 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1401 // Check if there is a value for tokens.
1403 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1405 ProcessData.Append(";");
1406 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1410 // Build the address.
1412 ProcessData.Append(":;;");
1413 ProcessData.Append((*AddressList)[AddressIter->first]);
1414 ProcessData.Append(";");
1415 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1416 ProcessData.Append(";");
1417 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1418 ProcessData.Append(";");
1419 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1420 ProcessData.Append(";");
1421 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1422 ProcessData.Append("\n");
1424 ProcessData = OutputText(&ProcessData);
1426 SaveData->Append(ProcessData);
1427 ProcessData.clear();
1433 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1434 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1435 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1436 wxString *SaveData, wxString DataType){
1438 wxString ProcessData = "";
1440 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1441 EmailIter != EmailList->end(); EmailIter++){
1443 ProcessData.Append("EMAIL");
1445 // Check if there is a value for TYPE.
1447 if (DataType.size() > 0){
1449 ProcessData.Append(";TYPE=");
1450 ProcessData.Append(DataType);
1454 // Check if there is a value for ALTID.
1456 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1458 ProcessData.Append(";ALTID=");
1459 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1463 // Check if there is a value for PID.
1465 if ((*EmailListPID)[EmailIter->first].size() > 0){
1467 ProcessData.Append(";PID=");
1468 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1472 // Check if there is a value for PREF.
1474 if ((*EmailListPref)[EmailIter->first] > 0){
1476 ProcessData.Append(";PREF=");
1477 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1481 // Check if there is a value for tokens.
1483 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1485 ProcessData.Append(";");
1486 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1490 ProcessData.Append(":");
1491 ProcessData.Append(EmailIter->second);
1492 ProcessData.Append("\n");
1494 ProcessData = OutputText(&ProcessData);
1496 SaveData->Append(ProcessData);
1497 ProcessData.clear();
1503 void ContactDataObject::SaveIMPP(map<int, wxString> *IMList, map<int, wxString> *IMListAltID,
1504 map<int, wxString> *IMListPID, map<int, wxString> *IMListType,
1505 map<int, wxString> *IMListTypeInfo, map<int, wxString> *IMListMediatype,
1506 map<int, int> *IMListPref, map<int, wxString> *IMListTokens,
1507 wxString *SaveData, wxString DataType){
1509 wxString ProcessData = "";
1511 for (std::map<int, wxString>::iterator IMIter = IMList->begin();
1512 IMIter != IMList->end(); IMIter++){
1514 ProcessData.Append("IMPP");
1516 // Check if there is a value for TYPE.
1518 if (DataType.size() > 0){
1520 ProcessData.Append(";TYPE=");
1521 ProcessData.Append(DataType);
1525 // Check if there is a value for ALTID.
1527 if ((*IMListAltID)[IMIter->first].size() > 0){
1529 ProcessData.Append(";ALTID=");
1530 ProcessData.Append((*IMListAltID)[IMIter->first]);
1534 // Check if there is a value for MEDIATYPE.
1536 if ((*IMListMediatype)[IMIter->first].size() > 0){
1538 ProcessData.Append(";MEDIATYPE=");
1539 ProcessData.Append((*IMListMediatype)[IMIter->first]);
1543 // Check if there is a value for PID.
1545 if ((*IMListPID)[IMIter->first].size() > 0){
1547 ProcessData.Append(";PID=");
1548 ProcessData.Append((*IMListPID)[IMIter->first]);
1552 // Check if there is a value for PREF.
1554 if ((*IMListPref)[IMIter->first] > 0){
1556 ProcessData.Append(";PREF=");
1557 ProcessData.Append(wxString::Format("%i", (*IMListPref)[IMIter->first]));
1561 // Check if there is a value for tokens.
1563 if ((*IMListTokens)[IMIter->first].size() > 0){
1565 ProcessData.Append(";");
1566 ProcessData.Append((*IMListTokens)[IMIter->first]);
1570 ProcessData.Append(":");
1571 ProcessData.Append((*IMListTypeInfo)[IMIter->first]);
1572 ProcessData.Append(":");
1573 ProcessData.Append(IMIter->second);
1574 ProcessData.Append("\n");
1576 ProcessData = OutputText(&ProcessData);
1578 SaveData->Append(ProcessData);
1579 ProcessData.clear();
1585 void ContactDataObject::SaveTelephone(map<int, wxString> *TelephoneList, map<int, wxString> *TelephoneListAltID,
1586 map<int, wxString> *TelephoneListPID, map<int, wxString> *TelephoneListType,
1587 map<int, wxString> *TelephoneListTypeInfo, map<int, wxString> *TelephoneListDataType,
1588 map<int, int> *TelephoneListPref, map<int, wxString> *TelephoneListTokens,
1589 wxString *SaveData, wxString DataType){
1591 wxString ProcessData = "";
1593 for (std::map<int, wxString>::iterator TelephoneIter = TelephoneList->begin();
1594 TelephoneIter != TelephoneList->end(); TelephoneIter++){
1596 ProcessData.Append("TEL");
1598 // Check if there is a value for TYPE.
1600 if (DataType.size() > 0 || (*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1602 ProcessData.Append(";TYPE=\"");
1604 bool ProcessedType = false;
1606 if (DataType.size() > 0){
1608 ProcessData.Append(DataType);
1609 ProcessedType = true;
1613 if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1615 if (ProcessedType == true){
1616 ProcessData.Append(",");
1618 ProcessData.Append((*TelephoneListTypeInfo)[TelephoneIter->first]);
1622 ProcessData.Append("\"");
1626 // Check if there is a value for ALTID.
1628 if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1630 ProcessData.Append(";ALTID=");
1631 ProcessData.Append((*TelephoneListAltID)[TelephoneIter->first]);
1635 // Check if there is a value for PID.
1637 if ((*TelephoneListPID)[TelephoneIter->first].size() > 0){
1639 ProcessData.Append(";PID=");
1640 ProcessData.Append((*TelephoneListPID)[TelephoneIter->first]);
1644 // Check if there is a value for PREF.
1646 if ((*TelephoneListPref)[TelephoneIter->first] > 0){
1648 ProcessData.Append(";PREF=");
1649 ProcessData.Append(wxString::Format("%i", (*TelephoneListPref)[TelephoneIter->first]));
1653 // Check if there is a value for tokens.
1655 if ((*TelephoneListTokens)[TelephoneIter->first].size() > 0){
1657 ProcessData.Append(";");
1658 ProcessData.Append((*TelephoneListTokens)[TelephoneIter->first]);
1662 ProcessData.Append(":");
1663 ProcessData.Append((*TelephoneListDataType)[TelephoneIter->first]);
1664 ProcessData.Append(":");
1665 ProcessData.Append(TelephoneIter->second);
1666 ProcessData.Append("\n");
1668 ProcessData = OutputText(&ProcessData);
1670 SaveData->Append(ProcessData);
1671 ProcessData.clear();
1677 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1678 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1679 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1680 wxString *SaveData, wxString DataType){
1682 wxString ProcessData = "";
1684 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1685 LanguageIter != LanguageList->end(); LanguageIter++){
1687 ProcessData.Append("LANG");
1689 // Check if there is a value for TYPE.
1691 if (DataType.size() > 0){
1693 ProcessData.Append(";TYPE=");
1694 ProcessData.Append(DataType);
1698 // Check if there is a value for ALTID.
1700 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1702 ProcessData.Append(";ALTID=");
1703 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1707 // Check if there is a value for PID.
1709 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1711 ProcessData.Append(";PID=");
1712 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1716 // Check if there is a value for PREF.
1718 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1720 ProcessData.Append(";PREF=");
1721 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1725 // Check if there is a value for tokens.
1727 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1729 ProcessData.Append(";");
1730 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1734 ProcessData.Append(":");
1735 ProcessData.Append(LanguageIter->second);
1736 ProcessData.Append("\n");
1738 ProcessData = OutputText(&ProcessData);
1740 SaveData->Append(ProcessData);
1741 ProcessData.clear();
1747 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1748 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1749 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1750 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1751 wxString *SaveData, wxString DataType){
1753 wxString ProcessData = "";
1755 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1756 GeographyIter != GeographyList->end(); GeographyIter++){
1758 ProcessData.Append("GEO");
1760 // Check if there is a value for TYPE.
1762 if (DataType.size() > 0){
1764 ProcessData.Append(";TYPE=");
1765 ProcessData.Append(DataType);
1769 // Check if there is a value for ALTID.
1771 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1773 ProcessData.Append(";ALTID=");
1774 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1778 // Check if there is a value for MEDIATYPE.
1780 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1782 ProcessData.Append(";MEDIATYPE=");
1783 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1787 // Check if there is a value for PID.
1789 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1791 ProcessData.Append(";PID=");
1792 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1796 // Check if there is a value for PREF.
1798 if ((*GeographyListPref)[GeographyIter->first] > 0){
1800 ProcessData.Append(";PREF=");
1801 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1805 // Check if there is a value for tokens.
1807 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1809 ProcessData.Append(";");
1810 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1814 ProcessData.Append(":");
1815 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1816 ProcessData.Append(":");
1817 ProcessData.Append(GeographyIter->second);
1818 ProcessData.Append("\n");
1820 ProcessData = OutputText(&ProcessData);
1822 SaveData->Append(ProcessData);
1823 ProcessData.clear();
1829 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1830 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1831 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1832 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1834 wxString ProcessData = "";
1836 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1837 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1839 ProcessData.Append("URL");
1841 // Check if there is a value for TYPE.
1843 if (DataType.size() > 0){
1845 ProcessData.Append(";TYPE=");
1846 ProcessData.Append(DataType);
1850 // Check if there is a value for ALTID.
1852 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1854 ProcessData.Append(";ALTID=");
1855 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1859 // Check if there is a value for MEDIATYPE.
1861 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1863 ProcessData.Append(";MEDIATYPE=");
1864 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1868 // Check if there is a value for PID.
1870 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1872 ProcessData.Append(";PID=");
1873 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1877 // Check if there is a value for PREF.
1879 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1881 ProcessData.Append(";PREF=");
1882 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1886 // Check if there is a value for tokens.
1888 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1890 ProcessData.Append(";");
1891 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1895 ProcessData.Append(":");
1896 ProcessData.Append(WebsiteIter->second);
1897 ProcessData.Append("\n");
1899 ProcessData = OutputText(&ProcessData);
1901 SaveData->Append(ProcessData);
1902 ProcessData.clear();
1908 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1909 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1910 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1911 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1913 wxString ProcessData = "";
1915 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1916 RoleIter != RoleList->end(); RoleIter++){
1918 ProcessData.Append("ROLE");
1920 // Check if there is a value for TYPE.
1922 if (DataType.size() > 0){
1924 ProcessData.Append(";TYPE=");
1925 ProcessData.Append(DataType);
1929 // Check if there is a value for ALTID.
1931 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1933 ProcessData.Append(";ALTID=");
1934 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1938 // Check if there is a value for LANGUAGE.
1940 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1942 ProcessData.Append(";LANGUAGE=");
1943 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1947 // Check if there is a value for PID.
1949 if ((*RoleListPID)[RoleIter->first].size() > 0){
1951 ProcessData.Append(";PID=");
1952 ProcessData.Append((*RoleListPID)[RoleIter->first]);
1956 // Check if there is a value for PREF.
1958 if ((*RoleListPref)[RoleIter->first] > 0){
1960 ProcessData.Append(";PREF=");
1961 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1965 // Check if there is a value for tokens.
1967 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1969 ProcessData.Append(";");
1970 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1974 ProcessData.Append(":");
1975 ProcessData.Append(RoleIter->second);
1976 ProcessData.Append("\n");
1978 ProcessData = OutputText(&ProcessData);
1980 SaveData->Append(ProcessData);
1981 ProcessData.clear();
1987 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1988 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
1989 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
1990 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
1991 wxString *SaveData, wxString DataType){
1993 wxString ProcessData = "";
1995 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1996 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1998 ProcessData.Append("ORG");
2000 // Check if there is a value for TYPE.
2002 if (DataType.size() > 0){
2004 ProcessData.Append(";TYPE=");
2005 ProcessData.Append(DataType);
2009 // Check if there is a value for ALTID.
2011 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
2013 ProcessData.Append(";ALTID=");
2014 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
2018 // Check if there is a value for LANGUAGE.
2020 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
2022 ProcessData.Append(";LANGUAGE=");
2023 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
2027 // Check if there is a value for PID.
2029 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
2031 ProcessData.Append(";PID=");
2032 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
2036 // Check if there is a value for PREF.
2038 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
2040 ProcessData.Append(";PREF=");
2041 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
2045 // Check if there is a value for SORT-AS.
2047 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
2049 ProcessData.Append(";SORT-AS=\"");
2050 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
2051 ProcessData.Append("\"");
2055 // Check if there is a value for tokens.
2057 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
2059 ProcessData.Append(";");
2060 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
2064 ProcessData.Append(":");
2065 ProcessData.Append(OrganisationIter->second);
2066 ProcessData.Append("\n");
2068 ProcessData = OutputText(&ProcessData);
2070 SaveData->Append(ProcessData);
2071 ProcessData.clear();
2077 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
2078 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
2079 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
2080 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
2082 wxString ProcessData = "";
2084 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
2085 NoteIter != NoteList->end(); NoteIter++){
2087 ProcessData.Append("NOTE");
2089 // Check if there is a value for TYPE.
2091 if (DataType.size() > 0){
2093 ProcessData.Append(";TYPE=");
2094 ProcessData.Append(DataType);
2098 // Check if there is a value for ALTID.
2100 if ((*NoteListAltID)[NoteIter->first].size() > 0){
2102 ProcessData.Append(";ALTID=");
2103 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
2107 // Check if there is a value for LANGUAGE.
2109 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
2111 ProcessData.Append(";LANGUAGE=");
2112 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
2116 // Check if there is a value for PID.
2118 if ((*NoteListPID)[NoteIter->first].size() > 0){
2120 ProcessData.Append(";PID=");
2121 ProcessData.Append((*NoteListPID)[NoteIter->first]);
2125 // Check if there is a value for PREF.
2127 if ((*NoteListPref)[NoteIter->first] > 0){
2129 ProcessData.Append(";PREF=");
2130 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
2134 // Check if there is a value for tokens.
2136 if ((*NoteListTokens)[NoteIter->first].size() > 0){
2138 ProcessData.Append(";");
2139 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
2143 ProcessData.Append(":");
2144 ProcessData.Append(NoteIter->second);
2145 ProcessData.Replace("\n", "\\n", true);
2146 ProcessData.Append("\n");
2148 ProcessData = OutputText(&ProcessData);
2150 SaveData->Append(ProcessData);
2151 ProcessData.clear();
2157 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
2158 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
2159 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
2160 map<int, wxString> *CategoryListTokens, wxString *SaveData){
2162 wxString ProcessData = "";
2164 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
2165 CategoryIter != CategoryList->end(); CategoryIter++){
2167 ProcessData.Append("CATEGORIES");
2169 // Check if there is a value for TYPE.
2171 if ((*CategoryListType)[CategoryIter->first].size() > 0){
2173 ProcessData.Append(";TYPE=");
2174 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
2178 // Check if there is a value for ALTID.
2180 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
2182 ProcessData.Append(";ALTID=");
2183 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
2187 // Check if there is a value for LANGUAGE.
2189 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
2191 ProcessData.Append(";LANGUAGE=");
2192 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
2196 // Check if there is a value for PID.
2198 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
2200 ProcessData.Append(";PID=");
2201 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
2205 // Check if there is a value for PREF.
2207 if ((*CategoryListPref)[CategoryIter->first] > 0){
2209 ProcessData.Append(";PREF=");
2210 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
2214 // Check if there is a value for tokens.
2216 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
2218 ProcessData.Append(";");
2219 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
2223 ProcessData.Append(":");
2224 ProcessData.Append(CategoryIter->second);
2225 ProcessData.Append("\n");
2227 ProcessData = OutputText(&ProcessData);
2229 SaveData->Append(ProcessData);
2230 ProcessData.clear();
2236 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
2237 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
2238 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
2239 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
2240 map<int, wxString> *PicturesListTokens, wxString *SaveData){
2242 wxString ProcessData = "";
2244 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
2245 PicturesIter != PicturesList->end(); PicturesIter++){
2247 ProcessData.Append("PHOTO");
2249 // Check if there is a value for TYPE.
2251 if ((*PicturesListType)[PicturesIter->first].size() > 0){
2253 ProcessData.Append(";TYPE=");
2254 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
2258 // Check if there is a value for ALTID.
2260 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
2262 ProcessData.Append(";ALTID=");
2263 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
2267 // Check if there is a value for MEDIATYPE..
2269 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
2271 ProcessData.Append(";MEDIATYPE=");
2272 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
2276 // Check if there is a value for PID.
2278 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
2280 ProcessData.Append(";PID=");
2281 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
2285 // Check if there is a value for PREF.
2287 if ((*PicturesListPref)[PicturesIter->first] > 0){
2289 ProcessData.Append(";PREF=");
2290 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
2294 // Check if there is a value for tokens.
2296 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
2298 ProcessData.Append(";");
2299 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
2303 ProcessData.Append(":data:");
2304 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
2305 ProcessData.Append(";");
2306 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
2307 ProcessData.Append(",");
2308 ProcessData.Append(PicturesIter->second);
2309 ProcessData.Append("\n");
2311 ProcessData = OutputText(&ProcessData);
2313 SaveData->Append(ProcessData);
2314 ProcessData.clear();
2320 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID,
2321 map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
2322 map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
2323 map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
2324 map<int, wxString> *LogosListTokens, wxString *SaveData){
2326 wxString ProcessData = "";
2328 for (std::map<int, string>::iterator LogosIter = LogosList->begin();
2329 LogosIter != LogosList->end(); LogosIter++){
2331 ProcessData.Append("LOGO");
2333 // Check if there is a value for TYPE.
2335 if ((*LogosListType)[LogosIter->first].size() > 0){
2337 ProcessData.Append(";TYPE=");
2338 ProcessData.Append((*LogosListType)[LogosIter->first]);
2342 // Check if there is a value for ALTID.
2344 if ((*LogosListAltID)[LogosIter->first].size() > 0){
2346 ProcessData.Append(";ALTID=");
2347 ProcessData.Append((*LogosListAltID)[LogosIter->first]);
2351 // Check if there is a value for MEDIATYPE..
2353 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
2355 ProcessData.Append(";MEDIATYPE=");
2356 ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
2360 // Check if there is a value for PID.
2362 if ((*LogosListPID)[LogosIter->first].size() > 0){
2364 ProcessData.Append(";PID=");
2365 ProcessData.Append((*LogosListPID)[LogosIter->first]);
2369 // Check if there is a value for PREF.
2371 if ((*LogosListPref)[LogosIter->first] > 0){
2373 ProcessData.Append(";PREF=");
2374 ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
2378 // Check if there is a value for tokens.
2380 if ((*LogosListTokens)[LogosIter->first].size() > 0){
2382 ProcessData.Append(";");
2383 ProcessData.Append((*LogosListTokens)[LogosIter->first]);
2387 ProcessData.Append(":data:");
2388 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
2389 ProcessData.Append(";");
2390 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
2391 ProcessData.Append(",");
2392 ProcessData.Append(LogosIter->second);
2393 ProcessData.Append("\n");
2395 ProcessData = OutputText(&ProcessData);
2397 SaveData->Append(ProcessData);
2398 ProcessData.clear();
2404 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID,
2405 map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
2406 map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
2407 map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage,
2408 map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens,
2409 wxString *SaveData){
2411 wxString ProcessData = "";
2413 for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
2414 SoundsIter != SoundsList->end(); SoundsIter++){
2416 ProcessData.Append("SOUND");
2418 // Check if there is a value for TYPE.
2420 if ((*SoundsListType)[SoundsIter->first].size() > 0){
2422 ProcessData.Append(";TYPE=");
2423 ProcessData.Append((*SoundsListType)[SoundsIter->first]);
2427 // Check if there is a value for ALTID.
2429 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
2431 ProcessData.Append(";ALTID=");
2432 ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
2436 // Check if there is a value for LANGUAGE.
2438 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
2440 ProcessData.Append(";LANGUAGE=");
2441 ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
2445 // Check if there is a value for MEDIATYPE.
2447 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
2449 ProcessData.Append(";MEDIATYPE=");
2450 ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
2454 // Check if there is a value for PID.
2456 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
2458 ProcessData.Append(";PID=");
2459 ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
2463 // Check if there is a value for PREF.
2465 if ((*SoundsListPref)[SoundsIter->first] > 0){
2467 ProcessData.Append(";PREF=");
2468 ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
2472 // Check if there is a value for tokens.
2474 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
2476 ProcessData.Append(";");
2477 ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
2481 ProcessData.Append(":data:");
2482 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
2483 ProcessData.Append(";");
2484 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
2485 ProcessData.Append(",");
2486 ProcessData.Append(SoundsIter->second);
2487 ProcessData.Append("\n");
2489 ProcessData = OutputText(&ProcessData);
2491 SaveData->Append(ProcessData);
2492 ProcessData.clear();
2498 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
2499 map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
2500 map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
2501 map<int, wxString> *CalendarListTokens, wxString *SaveData){
2503 wxString ProcessData = "";
2505 for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
2506 CalendarIter != CalendarList->end(); CalendarIter++){
2508 ProcessData.Append("CALURI");
2510 // Check if there is a value for TYPE.
2512 if ((*CalendarListType)[CalendarIter->first].size() > 0){
2514 ProcessData.Append(";TYPE=");
2515 ProcessData.Append((*CalendarListType)[CalendarIter->first]);
2519 // Check if there is a value for ALTID.
2521 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2523 ProcessData.Append(";ALTID=");
2524 ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2528 // Check if there is a value for MEDIATYPE.
2530 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2532 ProcessData.Append(";MEDIATYPE=");
2533 ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2537 // Check if there is a value for PID.
2539 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2541 ProcessData.Append(";PID=");
2542 ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2546 // Check if there is a value for PREF.
2548 if ((*CalendarListPref)[CalendarIter->first] > 0){
2550 ProcessData.Append(";PREF=");
2551 ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2555 // Check if there is a value for tokens.
2557 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2559 ProcessData.Append(";");
2560 ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2564 ProcessData.Append(":");
2565 ProcessData.Append(CalendarIter->second);
2566 ProcessData.Append("\n");
2568 ProcessData = OutputText(&ProcessData);
2570 SaveData->Append(ProcessData);
2571 ProcessData.clear();
2577 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2578 map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2579 map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2580 map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2582 wxString ProcessData = "";
2584 for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2585 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2587 ProcessData.Append("CALADRURI");
2589 // Check if there is a value for TYPE.
2591 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2593 ProcessData.Append(";TYPE=");
2594 ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2598 // Check if there is a value for ALTID.
2600 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2602 ProcessData.Append(";ALTID=");
2603 ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2607 // Check if there is a value for MEDIATYPE.
2609 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2611 ProcessData.Append(";MEDIATYPE=");
2612 ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2616 // Check if there is a value for PID.
2618 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2620 ProcessData.Append(";PID=");
2621 ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2625 // Check if there is a value for PREF.
2627 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2629 ProcessData.Append(";PREF=");
2630 ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2634 // Check if there is a value for tokens.
2636 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2638 ProcessData.Append(";");
2639 ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2643 ProcessData.Append(":");
2644 ProcessData.Append(CalendarRequestIter->second);
2645 ProcessData.Append("\n");
2647 ProcessData = OutputText(&ProcessData);
2649 SaveData->Append(ProcessData);
2650 ProcessData.clear();
2656 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID,
2657 std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2658 std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref,
2659 std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2661 wxString ProcessData = "";
2663 for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2664 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2666 ProcessData.Append("FBURL");
2668 // Check if there is a value for TYPE.
2670 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2672 ProcessData.Append(";TYPE=");
2673 ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2677 // Check if there is a value for ALTID.
2679 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2681 ProcessData.Append(";ALTID=");
2682 ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2686 // Check if there is a value for MEDIATYPE.
2688 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2690 ProcessData.Append(";MEDIATYPE=");
2691 ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2695 // Check if there is a value for PID.
2697 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2699 ProcessData.Append(";PID=");
2700 ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2704 // Check if there is a value for PREF.
2706 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2708 ProcessData.Append(";PREF=");
2709 ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2713 // Check if there is a value for tokens.
2715 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2717 ProcessData.Append(";");
2718 ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2722 ProcessData.Append(":");
2723 ProcessData.Append(FreeBusyIter->second);
2724 ProcessData.Append("\n");
2726 ProcessData = OutputText(&ProcessData);
2728 SaveData->Append(ProcessData);
2729 ProcessData.clear();
2735 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID,
2736 map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2737 map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType,
2738 map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref,
2739 map<int, wxString> *KeyListTokens, wxString *SaveData){
2741 wxString ProcessData = "";
2743 for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2744 KeyIter != KeyList->end(); KeyIter++){
2746 ProcessData.Append("KEY");
2748 // Check if there is a value for TYPE.
2750 if ((*KeyListType)[KeyIter->first].size() > 0){
2752 ProcessData.Append(";TYPE=");
2753 ProcessData.Append((*KeyListType)[KeyIter->first]);
2757 // Check if there is a value for ALTID.
2759 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2761 ProcessData.Append(";ALTID=");
2762 ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2766 // Check if there is a value for PID.
2768 if ((*KeyListPID)[KeyIter->first].size() > 0){
2770 ProcessData.Append(";PID=");
2771 ProcessData.Append((*KeyListPID)[KeyIter->first]);
2775 // Check if there is a value for PREF.
2777 if ((*KeyListPref)[KeyIter->first] > 0){
2779 ProcessData.Append(";PREF=");
2780 ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2784 // Check if there is a value for tokens.
2786 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2788 ProcessData.Append(";");
2789 ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2793 ProcessData.Append(":data:");
2794 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2795 ProcessData.Append(";");
2796 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2797 ProcessData.Append(",");
2798 ProcessData.Append(KeyIter->second);
2799 ProcessData.Append("\n");
2801 ProcessData = OutputText(&ProcessData);
2803 SaveData->Append(ProcessData);
2804 ProcessData.clear();
2810 void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN,
2811 map<int, wxString> *VendorListElement, wxString *SaveData){
2813 wxString ProcessData = "";
2815 for (std::map<int, wxString>::iterator VendorIter = VendorList->begin();
2816 VendorIter != VendorList->end(); VendorIter++){
2818 ProcessData.Append("VND-");
2819 ProcessData.Append((*VendorListPEN)[VendorIter->first]);
2820 ProcessData.Append("-");
2821 ProcessData.Append((*VendorListElement)[VendorIter->first]);
2822 ProcessData.Append(":");
2823 ProcessData.Append(VendorIter->second);
2824 ProcessData.Append("\n");
2826 ProcessData = OutputText(&ProcessData);
2828 SaveData->Append(ProcessData);
2829 ProcessData.clear();
2835 void ContactDataObject::SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens,
2836 wxString *SaveData){
2838 wxString ProcessData = "";
2840 for (std::map<int, wxString>::iterator XTokenIter = XTokenList->begin();
2841 XTokenIter != XTokenList->end(); XTokenIter++){
2843 ProcessData.Append("X-");
2844 ProcessData.Append((*XTokenListTokens)[XTokenIter->first]);
2845 ProcessData.Append(":");
2846 ProcessData.Append(XTokenIter->second);
2847 ProcessData.Append("\n");
2849 ProcessData = OutputText(&ProcessData);
2851 SaveData->Append(ProcessData);
2852 ProcessData.clear();