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);
455 // Process ANNIVERSARY.
457 if (Anniversary.size() > 0){
459 ProcessData.Append("ANNIVERSARY");
461 // Check if there is a value for ALTID.
463 if (AnniversaryAltID.size() > 0){
465 ProcessData.Append(";ALTID=");
466 ProcessData.Append(AnniversaryAltID);
470 // Check if there is a value for CALSCALE.
472 if (AnniversaryAltID.size() > 0){
474 ProcessData.Append(";CALSCALE=");
475 ProcessData.Append(AnniversaryCalScale);
479 // Check if there is a value for tokens.
481 if (AnniversaryTokens.size() > 0){
483 ProcessData.Append(";");
484 ProcessData.Append(AnniversaryTokens);
488 ProcessData.Append(":");
489 ProcessData.Append(Anniversary);
490 ProcessData.Append("\n");
492 ProcessData = OutputText(&ProcessData);
494 SaveData->Append(ProcessData);
501 SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
502 &GeneralTitleListAltID, &GeneralTitleListPID,
503 &GeneralTitleListType, &GeneralTitleListPref,
504 &GeneralTitleListTokens, SaveData, "");
505 SaveTitle(&HomeTitleList, &HomeTitleListLanguage,
506 &HomeTitleListAltID, &HomeTitleListPID,
507 &HomeTitleListType, &HomeTitleListPref,
508 &HomeTitleListTokens, SaveData, "home");
509 SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage,
510 &BusinessTitleListAltID, &BusinessTitleListPID,
511 &BusinessTitleListType, &BusinessTitleListPref,
512 &BusinessTitleListTokens, SaveData, "work");
516 SaveTimezone(&GeneralTZList, &GeneralTZListAltID,
517 &GeneralTZListPID, &GeneralTZListType,
518 &GeneralTZListMediatype, &GeneralTZListPref,
519 &GeneralTZListTokens, SaveData, "");
520 SaveTimezone(&HomeTZList, &HomeTZListAltID,
521 &HomeTZListPID, &HomeTZListType,
522 &HomeTZListMediatype, &HomeTZListPref,
523 &HomeTZListTokens, SaveData, "home");
524 SaveTimezone(&BusinessTZList, &BusinessTZListAltID,
525 &BusinessTZListPID, &BusinessTZListType,
526 &BusinessTZListMediatype, &BusinessTZListPref,
527 &BusinessTZListTokens, SaveData, "work");
531 SaveAddress(&GeneralAddressList, &GeneralAddressListTown,
532 &GeneralAddressListCounty, &GeneralAddressListPostCode,
533 &GeneralAddressListCountry, &GeneralAddressListLabel,
534 &GeneralAddressListLang, &GeneralAddressListAltID,
535 &GeneralAddressListPID, &GeneralAddressListGeo,
536 &GeneralAddressListTimezone, &GeneralAddressListType,
537 &GeneralAddressListMediatype, &GeneralAddressListPref,
538 &GeneralAddressListTokens, SaveData, "");
539 SaveAddress(&HomeAddressList, &HomeAddressListTown,
540 &HomeAddressListCounty, &HomeAddressListPostCode,
541 &HomeAddressListCountry, &HomeAddressListLabel,
542 &HomeAddressListLang, &HomeAddressListAltID,
543 &HomeAddressListPID, &HomeAddressListGeo,
544 &HomeAddressListTimezone, &HomeAddressListType,
545 &HomeAddressListMediatype, &HomeAddressListPref,
546 &HomeAddressListTokens, SaveData, "home");
547 SaveAddress(&BusinessAddressList, &BusinessAddressListTown,
548 &BusinessAddressListCounty, &BusinessAddressListPostCode,
549 &BusinessAddressListCountry, &BusinessAddressListLabel,
550 &BusinessAddressListLang, &BusinessAddressListAltID,
551 &BusinessAddressListPID, &BusinessAddressListGeo,
552 &BusinessAddressListTimezone, &BusinessAddressListType,
553 &BusinessAddressListMediatype, &BusinessAddressListPref,
554 &BusinessAddressListTokens, SaveData, "work");
558 SaveEmail(&GeneralEmailList, &GeneralEmailListAltID,
559 &GeneralEmailListPID, &GeneralEmailListType,
560 &GeneralEmailListPref, &GeneralEmailListTokens,
562 SaveEmail(&HomeEmailList, &HomeEmailListAltID,
563 &HomeEmailListPID, &HomeEmailListType,
564 &HomeEmailListPref, &HomeEmailListTokens,
566 SaveEmail(&BusinessEmailList, &BusinessEmailListAltID,
567 &BusinessEmailListPID, &BusinessEmailListType,
568 &BusinessEmailListPref, &BusinessEmailListTokens,
573 SaveIMPP(&GeneralIMList, &GeneralIMListAltID,
574 &GeneralIMListPID, &GeneralIMListType,
575 &GeneralIMListTypeInfo, &GeneralIMListMediatype,
576 &GeneralIMListPref, &GeneralIMListTokens,
578 SaveIMPP(&HomeIMList, &HomeIMListAltID,
579 &HomeIMListPID, &HomeIMListType,
580 &HomeIMListTypeInfo, &HomeIMListMediatype,
581 &HomeIMListPref, &HomeIMListTokens,
583 SaveIMPP(&BusinessIMList, &BusinessIMListAltID,
584 &BusinessIMListPID, &BusinessIMListType,
585 &BusinessIMListTypeInfo, &BusinessIMListMediatype,
586 &BusinessIMListPref, &BusinessIMListTokens,
591 SaveTelephone(&GeneralTelephoneList, &GeneralTelephoneListAltID,
592 &GeneralTelephoneListPID, &GeneralTelephoneListType,
593 &GeneralTelephoneListTypeInfo, &GeneralTelephoneListDataType,
594 &GeneralTelephoneListPref, &GeneralTelephoneListTokens,
596 SaveTelephone(&HomeTelephoneList, &HomeTelephoneListAltID,
597 &HomeTelephoneListPID, &HomeTelephoneListType,
598 &HomeTelephoneListTypeInfo, &HomeTelephoneListDataType,
599 &HomeTelephoneListPref, &HomeTelephoneListTokens,
601 SaveTelephone(&BusinessTelephoneList, &BusinessTelephoneListAltID,
602 &BusinessTelephoneListPID, &BusinessTelephoneListType,
603 &BusinessTelephoneListTypeInfo, &BusinessTelephoneListDataType,
604 &BusinessTelephoneListPref, &BusinessTelephoneListTokens,
609 SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID,
610 &GeneralLanguageListPID, &GeneralLanguageListType,
611 &GeneralLanguageListPref, &GeneralLanguageListTokens,
613 SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID,
614 &HomeLanguageListPID, &HomeLanguageListType,
615 &HomeLanguageListPref, &HomeLanguageListTokens,
617 SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID,
618 &BusinessLanguageListPID, &BusinessLanguageListType,
619 &BusinessLanguageListPref, &BusinessLanguageListTokens,
624 SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID,
625 &GeneralGeographyListPID, &GeneralGeographyListType,
626 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
627 &GeneralGeographyListPref, &GeneralGeographyListTokens,
629 SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID,
630 &HomeGeographyListPID, &HomeGeographyListType,
631 &HomeGeographyListMediatype, &HomeGeographyListDataType,
632 &HomeGeographyListPref, &HomeGeographyListTokens,
634 SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID,
635 &BusinessGeographyListPID, &BusinessGeographyListType,
636 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
637 &BusinessGeographyListPref, &BusinessGeographyListTokens,
644 for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
645 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
647 ProcessData.Append("RELATED");
649 // Check if there is a value for TYPE.
651 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
653 wxString RelatedType = "";
655 ProcessData.Append(";TYPE=");
657 if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
659 RelatedType = wxT("contact");
661 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
663 RelatedType = wxT("acquaintance");
665 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
667 RelatedType = wxT("friend");
669 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
671 RelatedType = wxT("met");
673 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
675 RelatedType = wxT("co-worker");
677 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
679 RelatedType = wxT("colleague");
681 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
683 RelatedType = wxT("co-resident");
685 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
687 RelatedType = wxT("neighbor");
689 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
691 RelatedType = wxT("child");
693 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
695 RelatedType = wxT("parent");
697 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
699 RelatedType = wxT("sibling");
701 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
703 RelatedType = wxT("spouse");
705 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
707 RelatedType = wxT("kin");
709 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
711 RelatedType = wxT("muse");
713 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
715 RelatedType = wxT("crush");
717 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
719 RelatedType = wxT("date");
721 } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
723 RelatedType = wxT("sweetheart");
725 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
727 RelatedType = wxT("me");
729 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
731 RelatedType = wxT("agent");
733 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
735 RelatedType = wxT("emergency");
739 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
743 ProcessData.Append(RelatedType);
747 // Check if there is a value for LANGUAGE.
749 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
751 ProcessData.Append(";LANGUAGE=");
752 ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
756 // Check if there is a value for ALTID.
758 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
760 ProcessData.Append(";ALTID=");
761 ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
765 // Check if there is a value for PID.
767 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
769 ProcessData.Append(";PID=");
770 ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
774 // Check if there is a value for PREF.
776 if (GeneralRelatedListPref[RelatedIter->first] > 0){
778 ProcessData.Append(";PREF=");
779 ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
783 // Check if there is a value for tokens.
785 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
787 ProcessData.Append(";");
788 ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
792 ProcessData.Append(":");
793 ProcessData.Append(RelatedIter->second);
794 ProcessData.Append("\n");
796 ProcessData = OutputText(&ProcessData);
798 SaveData->Append(ProcessData);
805 SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID,
806 &GeneralWebsiteListPID, &GeneralWebsiteListType,
807 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref,
808 &GeneralWebsiteListTokens, SaveData, "");
809 SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID,
810 &HomeWebsiteListPID, &HomeWebsiteListType,
811 &HomeWebsiteListMediatype, &HomeWebsiteListPref,
812 &HomeWebsiteListTokens, SaveData, "home");
813 SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID,
814 &BusinessWebsiteListPID, &BusinessWebsiteListType,
815 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref,
816 &BusinessWebsiteListTokens, SaveData, "work");
820 SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
821 &GeneralRoleListAltID, &GeneralRoleListPID,
822 &GeneralRoleListType, &GeneralRoleListPref,
823 &GeneralRoleListTokens, SaveData, "");
824 SaveRole(&HomeRoleList, &HomeRoleListLanguage,
825 &HomeRoleListAltID, &HomeRoleListPID,
826 &HomeRoleListType, &HomeRoleListPref,
827 &HomeRoleListTokens, SaveData, "home");
828 SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
829 &BusinessRoleListAltID, &BusinessRoleListPID,
830 &BusinessRoleListType, &BusinessRoleListPref,
831 &BusinessRoleListTokens, SaveData, "work");
835 SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
836 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage,
837 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType,
838 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens,
840 SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
841 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage,
842 &HomeOrganisationsListSortAs, &HomeOrganisationsListType,
843 &HomeOrganisationsListPref, &HomeOrganisationsListTokens,
845 SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
846 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage,
847 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType,
848 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens,
853 SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
854 &GeneralNoteListAltID, &GeneralNoteListPID,
855 &GeneralNoteListType, &GeneralNoteListPref,
856 &GeneralNoteListTokens, SaveData, "");
857 SaveNote(&HomeNoteList, &HomeNoteListLanguage,
858 &HomeNoteListAltID, &HomeNoteListPID,
859 &HomeNoteListType, &HomeNoteListPref,
860 &HomeNoteListTokens, SaveData, "home");
861 SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
862 &BusinessNoteListAltID, &BusinessNoteListPID,
863 &BusinessNoteListType, &BusinessNoteListPref,
864 &BusinessNoteListTokens, SaveData, "work");
866 // Process CATEGORIES.
868 SaveCategory(&CategoriesList, &CategoriesListLanguage,
869 &CategoriesListAltID, &CategoriesListPID,
870 &CategoriesListType, &CategoriesListPref,
871 &CategoriesListTokens, SaveData);
875 SavePhoto(&PicturesList, &PicturesListAltID,
876 &PicturesListPID, &PicturesListType,
877 &PicturesListPicEncType, &PicturesListPictureType,
878 &PicturesListMediatype, &PicturesListPref,
879 &PicturesListTokens, SaveData);
883 SaveLogo(&LogosList, &LogosListAltID,
884 &LogosListPID, &LogosListType,
885 &LogosListPicEncType, &LogosListPictureType,
886 &LogosListMediatype, &LogosListPref,
887 &LogosListTokens, SaveData);
891 SaveSound(&SoundsList, &SoundsListAltID,
892 &SoundsListPID, &SoundsListType,
893 &SoundsListAudioEncType, &SoundsListAudioType,
894 &SoundsListMediatype, &SoundsListLanguage,
895 &SoundsListPref, &SoundsListTokens,
900 SaveCalendarURI(&CalendarList, &CalendarListMediatype,
901 &CalendarListAltID, &CalendarListPID,
902 &CalendarListType, &CalendarListPref,
903 &CalendarListTokens, SaveData);
905 // Process CALADRURI.
907 SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
908 &CalendarRequestListAltID, &CalendarRequestListPID,
909 &CalendarRequestListType, &CalendarRequestListPref,
910 &CalendarRequestListTokens, SaveData);
914 SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID,
915 &FreeBusyListPID, &FreeBusyListType,
916 &FreeBusyListMediatype, &FreeBusyListPref,
917 &FreeBusyListTokens, SaveData);
921 SaveKey(&KeyList, &KeyListAltID,
922 &KeyListPID, &KeyListType,
923 &KeyListKeyType, &KeyListDataEncType,
924 &KeyListDataType, &KeyListPref,
925 &KeyListTokens, SaveData);
929 SaveVendor(&VendorList, &VendorListPEN,
930 &VendorListElement, SaveData);
934 SaveXToken(&XTokenList, &XTokenListTokens,
937 // Write the end part of the vCard data file.
939 SaveData->Append("END:VCARD");
941 SaveDataStatus = CONTACTSAVE_OK;
943 return SaveDataStatus;
947 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
948 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
949 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
950 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
952 wxString ProcessData = "";
954 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
955 TitleIter != TitleList->end(); TitleIter++){
957 ProcessData.Append("TITLE");
959 // Check if there is a value for TYPE.
961 if (DataType.size() > 0){
963 ProcessData.Append(";TYPE=");
964 ProcessData.Append(DataType);
968 // Check if there is a value for ALTID.
970 if ((*TitleListAltID)[TitleIter->first].size() > 0){
972 ProcessData.Append(";ALTID=");
973 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
977 // Check if there is a value for LANGUAGE.
979 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
981 ProcessData.Append(";LANGUAGE=");
982 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
986 // Check if there is a value for PID.
988 if ((*TitleListPID)[TitleIter->first].size() > 0){
990 ProcessData.Append(";PID=");
991 ProcessData.Append((*TitleListPID)[TitleIter->first]);
995 // Check if there is a value for PREF.
997 if ((*TitleListPref)[TitleIter->first] > 0){
999 ProcessData.Append(";PREF=");
1000 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
1004 // Check if there is a value for tokens.
1006 if ((*TitleListTokens)[TitleIter->first].size() > 0){
1008 ProcessData.Append(";");
1009 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
1013 ProcessData.Append(":");
1014 ProcessData.Append(TitleIter->second);
1015 ProcessData.Append("\n");
1017 ProcessData = OutputText(&ProcessData);
1019 SaveData->Append(ProcessData);
1020 ProcessData.clear();
1026 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
1027 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
1028 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
1029 map<int, wxString> *SourceListTokens, wxString *SaveData){
1031 wxString ProcessData = "";
1033 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
1034 SourceIter != SourceList->end(); SourceIter++){
1036 ProcessData.Append("SOURCE");
1038 // Check if there is a value for TYPE.
1040 if ((*SourceListType)[SourceIter->first].size() > 0){
1042 ProcessData.Append(";TYPE=");
1043 ProcessData.Append((*SourceListType)[SourceIter->first]);
1047 // Check if there is a value for ALTID.
1049 if ((*SourceListAltID)[SourceIter->first].size() > 0){
1051 ProcessData.Append(";ALTID=");
1052 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
1056 // Check if there is a value for MEDIATYPE.
1058 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
1060 ProcessData.Append(";MEDIATYPE=");
1061 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
1065 // Check if there is a value for PID.
1067 if ((*SourceListPID)[SourceIter->first].size() > 0){
1069 ProcessData.Append(";PID=");
1070 ProcessData.Append((*SourceListPID)[SourceIter->first]);
1074 // Check if there is a value for PREF.
1076 if ((*SourceListPref)[SourceIter->first] > 0){
1078 ProcessData.Append(";PREF=");
1079 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
1083 // Check if there is a value for tokens.
1085 if ((*SourceListTokens)[SourceIter->first].size() > 0){
1087 ProcessData.Append(";");
1088 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
1092 ProcessData.Append(":");
1093 ProcessData.Append(SourceIter->second);
1094 ProcessData.Append("\n");
1096 ProcessData = OutputText(&ProcessData);
1098 SaveData->Append(ProcessData);
1099 ProcessData.clear();
1105 void ContactDataObject::SaveMember(std::map<int, wxString> *GroupsList, std::map<int, wxString> *GroupsListAltID,
1106 std::map<int, wxString> *GroupsListPID, std::map<int, wxString> *GroupsListType,
1107 std::map<int, wxString> *GroupsListMediaType, std::map<int, int> *GroupsListPref,
1108 std::map<int, wxString> *GroupsListTokens, wxString *SaveData){
1110 wxString ProcessData = "";
1112 for (std::map<int, wxString>::iterator GroupsIter = GroupsList->begin();
1113 GroupsIter != GroupsList->end(); GroupsIter++){
1115 ProcessData.Append("MEMBER");
1117 // Check if there is a value for TYPE.
1119 if ((*GroupsListType)[GroupsIter->first].size() > 0){
1121 ProcessData.Append(";TYPE=");
1122 ProcessData.Append((*GroupsListType)[GroupsIter->first]);
1126 // Check if there is a value for ALTID.
1128 if ((*GroupsListAltID)[GroupsIter->first].size() > 0){
1130 ProcessData.Append(";ALTID=");
1131 ProcessData.Append((*GroupsListAltID)[GroupsIter->first]);
1135 // Check if there is a value for MEDIATYPE.
1137 if ((*GroupsListMediaType)[GroupsIter->first].size() > 0){
1139 ProcessData.Append(";MEDIATYPE=");
1140 ProcessData.Append((*GroupsListMediaType)[GroupsIter->first]);
1144 // Check if there is a value for PID.
1146 if ((*GroupsListPID)[GroupsIter->first].size() > 0){
1148 ProcessData.Append(";PID=");
1149 ProcessData.Append((*GroupsListPID)[GroupsIter->first]);
1153 // Check if there is a value for PREF.
1155 if ((*GroupsListPref)[GroupsIter->first] > 0){
1157 ProcessData.Append(";PREF=");
1158 ProcessData.Append(wxString::Format("%i", (*GroupsListPref)[GroupsIter->first]));
1162 // Check if there is a value for tokens.
1164 if ((*GroupsListTokens)[GroupsIter->first].size() > 0){
1166 ProcessData.Append(";");
1167 ProcessData.Append((*GroupsListTokens)[GroupsIter->first]);
1171 ProcessData.Append(":");
1172 ProcessData.Append(GroupsIter->second);
1173 ProcessData.Append("\n");
1175 ProcessData = OutputText(&ProcessData);
1177 SaveData->Append(ProcessData);
1178 ProcessData.clear();
1184 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
1185 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
1186 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
1187 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
1189 wxString ProcessData = "";
1191 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
1192 NicknameIter != NicknameList->end(); NicknameIter++){
1194 ProcessData.Append("NICKNAME");
1196 // Check if there is a value for TYPE.
1198 if (DataType.size() > 0){
1200 ProcessData.Append(";TYPE=");
1201 ProcessData.Append(DataType);
1205 // Check if there is a value for ALTID.
1207 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
1209 ProcessData.Append(";ALTID=");
1210 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
1214 // Check if there is a value for MEDIATYPE.
1216 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
1218 ProcessData.Append(";LANGUAGE=");
1219 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
1223 // Check if there is a value for PID.
1225 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
1227 ProcessData.Append(";PID=");
1228 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
1232 // Check if there is a value for PREF.
1234 if ((*NicknameListPref)[NicknameIter->first] > 0){
1236 ProcessData.Append(";PREF=");
1237 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
1241 // Check if there is a value for tokens.
1243 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
1245 ProcessData.Append(";");
1246 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
1250 ProcessData.Append(":");
1251 ProcessData.Append(NicknameIter->second);
1252 ProcessData.Append("\n");
1254 ProcessData = OutputText(&ProcessData);
1256 SaveData->Append(ProcessData);
1257 ProcessData.clear();
1263 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
1264 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
1265 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
1266 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
1268 wxString ProcessData = "";
1270 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
1271 TZIter != TZList->end(); TZIter++){
1273 ProcessData.Append("TZ");
1275 // Check if there is a value for TYPE.
1277 if (DataType.size() > 0){
1279 ProcessData.Append(";TYPE=");
1280 ProcessData.Append(DataType);
1284 // Check if there is a value for ALTID.
1286 if ((*TZListAltID)[TZIter->first].size() > 0){
1288 ProcessData.Append(";ALTID=");
1289 ProcessData.Append((*TZListAltID)[TZIter->first]);
1293 // Check if there is a value for MEDIATYPE.
1295 if ((*TZListMediatype)[TZIter->first].size() > 0){
1297 ProcessData.Append(";MEDIATYPE=");
1298 ProcessData.Append((*TZListMediatype)[TZIter->first]);
1302 // Check if there is a value for PID.
1304 if ((*TZListPID)[TZIter->first].size() > 0){
1306 ProcessData.Append(";PID=");
1307 ProcessData.Append((*TZListPID)[TZIter->first]);
1311 // Check if there is a value for PREF.
1313 if ((*TZListPref)[TZIter->first] > 0){
1315 ProcessData.Append(";PREF=");
1316 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
1320 // Check if there is a value for tokens.
1322 if ((*TZListTokens)[TZIter->first].size() > 0){
1324 ProcessData.Append(";");
1325 ProcessData.Append((*TZListTokens)[TZIter->first]);
1329 ProcessData.Append(":");
1330 ProcessData.Append(TZIter->second);
1331 ProcessData.Append("\n");
1333 ProcessData = OutputText(&ProcessData);
1335 SaveData->Append(ProcessData);
1336 ProcessData.clear();
1342 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
1343 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
1344 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
1345 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
1346 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
1347 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
1348 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
1349 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
1351 wxString ProcessData = "";
1353 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
1354 AddressIter != AddressList->end(); AddressIter++){
1356 ProcessData.Append("ADR");
1358 // Check if there is a value for TYPE.
1360 if (DataType.size() > 0){
1362 ProcessData.Append(";TYPE=");
1363 ProcessData.Append(DataType);
1367 // Check if there is a value for ALTID.
1369 if ((*AddressListAltID)[AddressIter->first].size() > 0){
1371 ProcessData.Append(";ALTID=");
1372 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
1376 // Check if there is a value for GEO.
1378 if ((*AddressListGeo)[AddressIter->first].size() > 0){
1380 ProcessData.Append(";GEO=\"");
1381 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
1382 ProcessData.Append("\"");
1386 // Check if there is a value for LABEL.
1388 if ((*AddressListLabel)[AddressIter->first].size() > 0){
1390 wxString AddressProcessed = "";
1391 AddressProcessed = (*AddressListLabel)[AddressIter->first];
1393 AddressProcessed.Replace("\n", "\\n", true);
1395 ProcessData.Append(";LABEL=");
1396 ProcessData.Append(AddressProcessed);
1400 // Check if there is a value for LANGUAGE.
1402 if ((*AddressListLang)[AddressIter->first].size() > 0){
1404 ProcessData.Append(";LANGUAGE=");
1405 ProcessData.Append((*AddressListLang)[AddressIter->first]);
1409 // Check if there is a value for MEDIATYPE.
1411 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1413 ProcessData.Append(";MEDIATYPE=");
1414 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1418 // Check if there is a value for PID.
1420 if ((*AddressListPID)[AddressIter->first].size() > 0){
1422 ProcessData.Append(";PID=");
1423 ProcessData.Append((*AddressListPID)[AddressIter->first]);
1427 // Check if there is a value for PREF.
1429 if ((*AddressListPref)[AddressIter->first] > 0){
1431 ProcessData.Append(";PREF=");
1432 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1436 // Check if there is a value for TZ.
1438 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1440 ProcessData.Append(";TZ=");
1441 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1445 // Check if there is a value for tokens.
1447 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1449 ProcessData.Append(";");
1450 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1454 // Build the address.
1456 ProcessData.Append(":;;");
1457 ProcessData.Append((*AddressList)[AddressIter->first]);
1458 ProcessData.Append(";");
1459 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1460 ProcessData.Append(";");
1461 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1462 ProcessData.Append(";");
1463 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1464 ProcessData.Append(";");
1465 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1466 ProcessData.Append("\n");
1468 ProcessData = OutputText(&ProcessData);
1470 SaveData->Append(ProcessData);
1471 ProcessData.clear();
1477 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1478 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1479 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1480 wxString *SaveData, wxString DataType){
1482 wxString ProcessData = "";
1484 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1485 EmailIter != EmailList->end(); EmailIter++){
1487 ProcessData.Append("EMAIL");
1489 // Check if there is a value for TYPE.
1491 if (DataType.size() > 0){
1493 ProcessData.Append(";TYPE=");
1494 ProcessData.Append(DataType);
1498 // Check if there is a value for ALTID.
1500 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1502 ProcessData.Append(";ALTID=");
1503 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1507 // Check if there is a value for PID.
1509 if ((*EmailListPID)[EmailIter->first].size() > 0){
1511 ProcessData.Append(";PID=");
1512 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1516 // Check if there is a value for PREF.
1518 if ((*EmailListPref)[EmailIter->first] > 0){
1520 ProcessData.Append(";PREF=");
1521 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1525 // Check if there is a value for tokens.
1527 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1529 ProcessData.Append(";");
1530 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1534 ProcessData.Append(":");
1535 ProcessData.Append(EmailIter->second);
1536 ProcessData.Append("\n");
1538 ProcessData = OutputText(&ProcessData);
1540 SaveData->Append(ProcessData);
1541 ProcessData.clear();
1547 void ContactDataObject::SaveIMPP(map<int, wxString> *IMList, map<int, wxString> *IMListAltID,
1548 map<int, wxString> *IMListPID, map<int, wxString> *IMListType,
1549 map<int, wxString> *IMListTypeInfo, map<int, wxString> *IMListMediatype,
1550 map<int, int> *IMListPref, map<int, wxString> *IMListTokens,
1551 wxString *SaveData, wxString DataType){
1553 wxString ProcessData = "";
1555 for (std::map<int, wxString>::iterator IMIter = IMList->begin();
1556 IMIter != IMList->end(); IMIter++){
1558 ProcessData.Append("IMPP");
1560 // Check if there is a value for TYPE.
1562 if (DataType.size() > 0){
1564 ProcessData.Append(";TYPE=");
1565 ProcessData.Append(DataType);
1569 // Check if there is a value for ALTID.
1571 if ((*IMListAltID)[IMIter->first].size() > 0){
1573 ProcessData.Append(";ALTID=");
1574 ProcessData.Append((*IMListAltID)[IMIter->first]);
1578 // Check if there is a value for MEDIATYPE.
1580 if ((*IMListMediatype)[IMIter->first].size() > 0){
1582 ProcessData.Append(";MEDIATYPE=");
1583 ProcessData.Append((*IMListMediatype)[IMIter->first]);
1587 // Check if there is a value for PID.
1589 if ((*IMListPID)[IMIter->first].size() > 0){
1591 ProcessData.Append(";PID=");
1592 ProcessData.Append((*IMListPID)[IMIter->first]);
1596 // Check if there is a value for PREF.
1598 if ((*IMListPref)[IMIter->first] > 0){
1600 ProcessData.Append(";PREF=");
1601 ProcessData.Append(wxString::Format("%i", (*IMListPref)[IMIter->first]));
1605 // Check if there is a value for tokens.
1607 if ((*IMListTokens)[IMIter->first].size() > 0){
1609 ProcessData.Append(";");
1610 ProcessData.Append((*IMListTokens)[IMIter->first]);
1614 ProcessData.Append(":");
1615 ProcessData.Append((*IMListTypeInfo)[IMIter->first]);
1616 ProcessData.Append(":");
1617 ProcessData.Append(IMIter->second);
1618 ProcessData.Append("\n");
1620 ProcessData = OutputText(&ProcessData);
1622 SaveData->Append(ProcessData);
1623 ProcessData.clear();
1629 void ContactDataObject::SaveTelephone(map<int, wxString> *TelephoneList, map<int, wxString> *TelephoneListAltID,
1630 map<int, wxString> *TelephoneListPID, map<int, wxString> *TelephoneListType,
1631 map<int, wxString> *TelephoneListTypeInfo, map<int, wxString> *TelephoneListDataType,
1632 map<int, int> *TelephoneListPref, map<int, wxString> *TelephoneListTokens,
1633 wxString *SaveData, wxString DataType){
1635 wxString ProcessData = "";
1637 for (std::map<int, wxString>::iterator TelephoneIter = TelephoneList->begin();
1638 TelephoneIter != TelephoneList->end(); TelephoneIter++){
1640 ProcessData.Append("TEL");
1642 // Check if there is a value for TYPE.
1644 if (DataType.size() > 0 || (*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1646 ProcessData.Append(";TYPE=\"");
1648 bool ProcessedType = false;
1650 if (DataType.size() > 0){
1652 ProcessData.Append(DataType);
1653 ProcessedType = true;
1657 if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1659 if (ProcessedType == true){
1660 ProcessData.Append(",");
1662 ProcessData.Append((*TelephoneListTypeInfo)[TelephoneIter->first]);
1666 ProcessData.Append("\"");
1670 // Check if there is a value for ALTID.
1672 if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1674 ProcessData.Append(";ALTID=");
1675 ProcessData.Append((*TelephoneListAltID)[TelephoneIter->first]);
1679 // Check if there is a value for PID.
1681 if ((*TelephoneListPID)[TelephoneIter->first].size() > 0){
1683 ProcessData.Append(";PID=");
1684 ProcessData.Append((*TelephoneListPID)[TelephoneIter->first]);
1688 // Check if there is a value for PREF.
1690 if ((*TelephoneListPref)[TelephoneIter->first] > 0){
1692 ProcessData.Append(";PREF=");
1693 ProcessData.Append(wxString::Format("%i", (*TelephoneListPref)[TelephoneIter->first]));
1697 // Check if there is a value for tokens.
1699 if ((*TelephoneListTokens)[TelephoneIter->first].size() > 0){
1701 ProcessData.Append(";");
1702 ProcessData.Append((*TelephoneListTokens)[TelephoneIter->first]);
1706 ProcessData.Append(":");
1707 ProcessData.Append((*TelephoneListDataType)[TelephoneIter->first]);
1708 ProcessData.Append(":");
1709 ProcessData.Append(TelephoneIter->second);
1710 ProcessData.Append("\n");
1712 ProcessData = OutputText(&ProcessData);
1714 SaveData->Append(ProcessData);
1715 ProcessData.clear();
1721 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1722 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1723 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1724 wxString *SaveData, wxString DataType){
1726 wxString ProcessData = "";
1728 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1729 LanguageIter != LanguageList->end(); LanguageIter++){
1731 ProcessData.Append("LANG");
1733 // Check if there is a value for TYPE.
1735 if (DataType.size() > 0){
1737 ProcessData.Append(";TYPE=");
1738 ProcessData.Append(DataType);
1742 // Check if there is a value for ALTID.
1744 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1746 ProcessData.Append(";ALTID=");
1747 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1751 // Check if there is a value for PID.
1753 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1755 ProcessData.Append(";PID=");
1756 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1760 // Check if there is a value for PREF.
1762 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1764 ProcessData.Append(";PREF=");
1765 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1769 // Check if there is a value for tokens.
1771 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1773 ProcessData.Append(";");
1774 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1778 ProcessData.Append(":");
1779 ProcessData.Append(LanguageIter->second);
1780 ProcessData.Append("\n");
1782 ProcessData = OutputText(&ProcessData);
1784 SaveData->Append(ProcessData);
1785 ProcessData.clear();
1791 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1792 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1793 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1794 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1795 wxString *SaveData, wxString DataType){
1797 wxString ProcessData = "";
1799 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1800 GeographyIter != GeographyList->end(); GeographyIter++){
1802 ProcessData.Append("GEO");
1804 // Check if there is a value for TYPE.
1806 if (DataType.size() > 0){
1808 ProcessData.Append(";TYPE=");
1809 ProcessData.Append(DataType);
1813 // Check if there is a value for ALTID.
1815 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1817 ProcessData.Append(";ALTID=");
1818 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1822 // Check if there is a value for MEDIATYPE.
1824 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1826 ProcessData.Append(";MEDIATYPE=");
1827 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1831 // Check if there is a value for PID.
1833 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1835 ProcessData.Append(";PID=");
1836 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1840 // Check if there is a value for PREF.
1842 if ((*GeographyListPref)[GeographyIter->first] > 0){
1844 ProcessData.Append(";PREF=");
1845 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1849 // Check if there is a value for tokens.
1851 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1853 ProcessData.Append(";");
1854 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1858 ProcessData.Append(":");
1859 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1860 ProcessData.Append(":");
1861 ProcessData.Append(GeographyIter->second);
1862 ProcessData.Append("\n");
1864 ProcessData = OutputText(&ProcessData);
1866 SaveData->Append(ProcessData);
1867 ProcessData.clear();
1873 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1874 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1875 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1876 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1878 wxString ProcessData = "";
1880 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1881 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1883 ProcessData.Append("URL");
1885 // Check if there is a value for TYPE.
1887 if (DataType.size() > 0){
1889 ProcessData.Append(";TYPE=");
1890 ProcessData.Append(DataType);
1894 // Check if there is a value for ALTID.
1896 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1898 ProcessData.Append(";ALTID=");
1899 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1903 // Check if there is a value for MEDIATYPE.
1905 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1907 ProcessData.Append(";MEDIATYPE=");
1908 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1912 // Check if there is a value for PID.
1914 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1916 ProcessData.Append(";PID=");
1917 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1921 // Check if there is a value for PREF.
1923 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1925 ProcessData.Append(";PREF=");
1926 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1930 // Check if there is a value for tokens.
1932 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1934 ProcessData.Append(";");
1935 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1939 ProcessData.Append(":");
1940 ProcessData.Append(WebsiteIter->second);
1941 ProcessData.Append("\n");
1943 ProcessData = OutputText(&ProcessData);
1945 SaveData->Append(ProcessData);
1946 ProcessData.clear();
1952 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1953 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1954 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1955 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1957 wxString ProcessData = "";
1959 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1960 RoleIter != RoleList->end(); RoleIter++){
1962 ProcessData.Append("ROLE");
1964 // Check if there is a value for TYPE.
1966 if (DataType.size() > 0){
1968 ProcessData.Append(";TYPE=");
1969 ProcessData.Append(DataType);
1973 // Check if there is a value for ALTID.
1975 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1977 ProcessData.Append(";ALTID=");
1978 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1982 // Check if there is a value for LANGUAGE.
1984 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1986 ProcessData.Append(";LANGUAGE=");
1987 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1991 // Check if there is a value for PID.
1993 if ((*RoleListPID)[RoleIter->first].size() > 0){
1995 ProcessData.Append(";PID=");
1996 ProcessData.Append((*RoleListPID)[RoleIter->first]);
2000 // Check if there is a value for PREF.
2002 if ((*RoleListPref)[RoleIter->first] > 0){
2004 ProcessData.Append(";PREF=");
2005 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
2009 // Check if there is a value for tokens.
2011 if ((*RoleListTokens)[RoleIter->first].size() > 0){
2013 ProcessData.Append(";");
2014 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
2018 ProcessData.Append(":");
2019 ProcessData.Append(RoleIter->second);
2020 ProcessData.Append("\n");
2022 ProcessData = OutputText(&ProcessData);
2024 SaveData->Append(ProcessData);
2025 ProcessData.clear();
2031 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
2032 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
2033 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
2034 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
2035 wxString *SaveData, wxString DataType){
2037 wxString ProcessData = "";
2039 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
2040 OrganisationIter != OrganisationList->end(); OrganisationIter++){
2042 ProcessData.Append("ORG");
2044 // Check if there is a value for TYPE.
2046 if (DataType.size() > 0){
2048 ProcessData.Append(";TYPE=");
2049 ProcessData.Append(DataType);
2053 // Check if there is a value for ALTID.
2055 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
2057 ProcessData.Append(";ALTID=");
2058 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
2062 // Check if there is a value for LANGUAGE.
2064 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
2066 ProcessData.Append(";LANGUAGE=");
2067 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
2071 // Check if there is a value for PID.
2073 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
2075 ProcessData.Append(";PID=");
2076 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
2080 // Check if there is a value for PREF.
2082 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
2084 ProcessData.Append(";PREF=");
2085 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
2089 // Check if there is a value for SORT-AS.
2091 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
2093 ProcessData.Append(";SORT-AS=\"");
2094 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
2095 ProcessData.Append("\"");
2099 // Check if there is a value for tokens.
2101 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
2103 ProcessData.Append(";");
2104 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
2108 ProcessData.Append(":");
2109 ProcessData.Append(OrganisationIter->second);
2110 ProcessData.Append("\n");
2112 ProcessData = OutputText(&ProcessData);
2114 SaveData->Append(ProcessData);
2115 ProcessData.clear();
2121 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
2122 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
2123 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
2124 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
2126 wxString ProcessData = "";
2128 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
2129 NoteIter != NoteList->end(); NoteIter++){
2131 ProcessData.Append("NOTE");
2133 // Check if there is a value for TYPE.
2135 if (DataType.size() > 0){
2137 ProcessData.Append(";TYPE=");
2138 ProcessData.Append(DataType);
2142 // Check if there is a value for ALTID.
2144 if ((*NoteListAltID)[NoteIter->first].size() > 0){
2146 ProcessData.Append(";ALTID=");
2147 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
2151 // Check if there is a value for LANGUAGE.
2153 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
2155 ProcessData.Append(";LANGUAGE=");
2156 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
2160 // Check if there is a value for PID.
2162 if ((*NoteListPID)[NoteIter->first].size() > 0){
2164 ProcessData.Append(";PID=");
2165 ProcessData.Append((*NoteListPID)[NoteIter->first]);
2169 // Check if there is a value for PREF.
2171 if ((*NoteListPref)[NoteIter->first] > 0){
2173 ProcessData.Append(";PREF=");
2174 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
2178 // Check if there is a value for tokens.
2180 if ((*NoteListTokens)[NoteIter->first].size() > 0){
2182 ProcessData.Append(";");
2183 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
2187 ProcessData.Append(":");
2188 ProcessData.Append(NoteIter->second);
2189 ProcessData.Replace("\n", "\\n", true);
2190 ProcessData.Append("\n");
2192 ProcessData = OutputText(&ProcessData);
2194 SaveData->Append(ProcessData);
2195 ProcessData.clear();
2201 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
2202 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
2203 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
2204 map<int, wxString> *CategoryListTokens, wxString *SaveData){
2206 wxString ProcessData = "";
2208 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
2209 CategoryIter != CategoryList->end(); CategoryIter++){
2211 ProcessData.Append("CATEGORIES");
2213 // Check if there is a value for TYPE.
2215 if ((*CategoryListType)[CategoryIter->first].size() > 0){
2217 ProcessData.Append(";TYPE=");
2218 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
2222 // Check if there is a value for ALTID.
2224 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
2226 ProcessData.Append(";ALTID=");
2227 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
2231 // Check if there is a value for LANGUAGE.
2233 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
2235 ProcessData.Append(";LANGUAGE=");
2236 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
2240 // Check if there is a value for PID.
2242 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
2244 ProcessData.Append(";PID=");
2245 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
2249 // Check if there is a value for PREF.
2251 if ((*CategoryListPref)[CategoryIter->first] > 0){
2253 ProcessData.Append(";PREF=");
2254 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
2258 // Check if there is a value for tokens.
2260 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
2262 ProcessData.Append(";");
2263 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
2267 ProcessData.Append(":");
2268 ProcessData.Append(CategoryIter->second);
2269 ProcessData.Append("\n");
2271 ProcessData = OutputText(&ProcessData);
2273 SaveData->Append(ProcessData);
2274 ProcessData.clear();
2280 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
2281 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
2282 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
2283 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
2284 map<int, wxString> *PicturesListTokens, wxString *SaveData){
2286 wxString ProcessData = "";
2288 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
2289 PicturesIter != PicturesList->end(); PicturesIter++){
2291 ProcessData.Append("PHOTO");
2293 // Check if there is a value for TYPE.
2295 if ((*PicturesListType)[PicturesIter->first].size() > 0){
2297 ProcessData.Append(";TYPE=");
2298 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
2302 // Check if there is a value for ALTID.
2304 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
2306 ProcessData.Append(";ALTID=");
2307 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
2311 // Check if there is a value for MEDIATYPE..
2313 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
2315 ProcessData.Append(";MEDIATYPE=");
2316 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
2320 // Check if there is a value for PID.
2322 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
2324 ProcessData.Append(";PID=");
2325 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
2329 // Check if there is a value for PREF.
2331 if ((*PicturesListPref)[PicturesIter->first] > 0){
2333 ProcessData.Append(";PREF=");
2334 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
2338 // Check if there is a value for tokens.
2340 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
2342 ProcessData.Append(";");
2343 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
2347 ProcessData.Append(":data:");
2348 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
2349 ProcessData.Append(";");
2350 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
2351 ProcessData.Append(",");
2352 ProcessData.Append(PicturesIter->second);
2353 ProcessData.Append("\n");
2355 ProcessData = OutputText(&ProcessData);
2357 SaveData->Append(ProcessData);
2358 ProcessData.clear();
2364 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID,
2365 map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
2366 map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
2367 map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
2368 map<int, wxString> *LogosListTokens, wxString *SaveData){
2370 wxString ProcessData = "";
2372 for (std::map<int, string>::iterator LogosIter = LogosList->begin();
2373 LogosIter != LogosList->end(); LogosIter++){
2375 ProcessData.Append("LOGO");
2377 // Check if there is a value for TYPE.
2379 if ((*LogosListType)[LogosIter->first].size() > 0){
2381 ProcessData.Append(";TYPE=");
2382 ProcessData.Append((*LogosListType)[LogosIter->first]);
2386 // Check if there is a value for ALTID.
2388 if ((*LogosListAltID)[LogosIter->first].size() > 0){
2390 ProcessData.Append(";ALTID=");
2391 ProcessData.Append((*LogosListAltID)[LogosIter->first]);
2395 // Check if there is a value for MEDIATYPE..
2397 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
2399 ProcessData.Append(";MEDIATYPE=");
2400 ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
2404 // Check if there is a value for PID.
2406 if ((*LogosListPID)[LogosIter->first].size() > 0){
2408 ProcessData.Append(";PID=");
2409 ProcessData.Append((*LogosListPID)[LogosIter->first]);
2413 // Check if there is a value for PREF.
2415 if ((*LogosListPref)[LogosIter->first] > 0){
2417 ProcessData.Append(";PREF=");
2418 ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
2422 // Check if there is a value for tokens.
2424 if ((*LogosListTokens)[LogosIter->first].size() > 0){
2426 ProcessData.Append(";");
2427 ProcessData.Append((*LogosListTokens)[LogosIter->first]);
2431 ProcessData.Append(":data:");
2432 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
2433 ProcessData.Append(";");
2434 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
2435 ProcessData.Append(",");
2436 ProcessData.Append(LogosIter->second);
2437 ProcessData.Append("\n");
2439 ProcessData = OutputText(&ProcessData);
2441 SaveData->Append(ProcessData);
2442 ProcessData.clear();
2448 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID,
2449 map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
2450 map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
2451 map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage,
2452 map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens,
2453 wxString *SaveData){
2455 wxString ProcessData = "";
2457 for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
2458 SoundsIter != SoundsList->end(); SoundsIter++){
2460 ProcessData.Append("SOUND");
2462 // Check if there is a value for TYPE.
2464 if ((*SoundsListType)[SoundsIter->first].size() > 0){
2466 ProcessData.Append(";TYPE=");
2467 ProcessData.Append((*SoundsListType)[SoundsIter->first]);
2471 // Check if there is a value for ALTID.
2473 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
2475 ProcessData.Append(";ALTID=");
2476 ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
2480 // Check if there is a value for LANGUAGE.
2482 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
2484 ProcessData.Append(";LANGUAGE=");
2485 ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
2489 // Check if there is a value for MEDIATYPE.
2491 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
2493 ProcessData.Append(";MEDIATYPE=");
2494 ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
2498 // Check if there is a value for PID.
2500 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
2502 ProcessData.Append(";PID=");
2503 ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
2507 // Check if there is a value for PREF.
2509 if ((*SoundsListPref)[SoundsIter->first] > 0){
2511 ProcessData.Append(";PREF=");
2512 ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
2516 // Check if there is a value for tokens.
2518 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
2520 ProcessData.Append(";");
2521 ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
2525 ProcessData.Append(":data:");
2526 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
2527 ProcessData.Append(";");
2528 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
2529 ProcessData.Append(",");
2530 ProcessData.Append(SoundsIter->second);
2531 ProcessData.Append("\n");
2533 ProcessData = OutputText(&ProcessData);
2535 SaveData->Append(ProcessData);
2536 ProcessData.clear();
2542 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
2543 map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
2544 map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
2545 map<int, wxString> *CalendarListTokens, wxString *SaveData){
2547 wxString ProcessData = "";
2549 for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
2550 CalendarIter != CalendarList->end(); CalendarIter++){
2552 ProcessData.Append("CALURI");
2554 // Check if there is a value for TYPE.
2556 if ((*CalendarListType)[CalendarIter->first].size() > 0){
2558 ProcessData.Append(";TYPE=");
2559 ProcessData.Append((*CalendarListType)[CalendarIter->first]);
2563 // Check if there is a value for ALTID.
2565 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2567 ProcessData.Append(";ALTID=");
2568 ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2572 // Check if there is a value for MEDIATYPE.
2574 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2576 ProcessData.Append(";MEDIATYPE=");
2577 ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2581 // Check if there is a value for PID.
2583 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2585 ProcessData.Append(";PID=");
2586 ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2590 // Check if there is a value for PREF.
2592 if ((*CalendarListPref)[CalendarIter->first] > 0){
2594 ProcessData.Append(";PREF=");
2595 ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2599 // Check if there is a value for tokens.
2601 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2603 ProcessData.Append(";");
2604 ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2608 ProcessData.Append(":");
2609 ProcessData.Append(CalendarIter->second);
2610 ProcessData.Append("\n");
2612 ProcessData = OutputText(&ProcessData);
2614 SaveData->Append(ProcessData);
2615 ProcessData.clear();
2621 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2622 map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2623 map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2624 map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2626 wxString ProcessData = "";
2628 for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2629 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2631 ProcessData.Append("CALADRURI");
2633 // Check if there is a value for TYPE.
2635 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2637 ProcessData.Append(";TYPE=");
2638 ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2642 // Check if there is a value for ALTID.
2644 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2646 ProcessData.Append(";ALTID=");
2647 ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2651 // Check if there is a value for MEDIATYPE.
2653 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2655 ProcessData.Append(";MEDIATYPE=");
2656 ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2660 // Check if there is a value for PID.
2662 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2664 ProcessData.Append(";PID=");
2665 ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2669 // Check if there is a value for PREF.
2671 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2673 ProcessData.Append(";PREF=");
2674 ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2678 // Check if there is a value for tokens.
2680 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2682 ProcessData.Append(";");
2683 ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2687 ProcessData.Append(":");
2688 ProcessData.Append(CalendarRequestIter->second);
2689 ProcessData.Append("\n");
2691 ProcessData = OutputText(&ProcessData);
2693 SaveData->Append(ProcessData);
2694 ProcessData.clear();
2700 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID,
2701 std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2702 std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref,
2703 std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2705 wxString ProcessData = "";
2707 for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2708 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2710 ProcessData.Append("FBURL");
2712 // Check if there is a value for TYPE.
2714 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2716 ProcessData.Append(";TYPE=");
2717 ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2721 // Check if there is a value for ALTID.
2723 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2725 ProcessData.Append(";ALTID=");
2726 ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2730 // Check if there is a value for MEDIATYPE.
2732 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2734 ProcessData.Append(";MEDIATYPE=");
2735 ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2739 // Check if there is a value for PID.
2741 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2743 ProcessData.Append(";PID=");
2744 ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2748 // Check if there is a value for PREF.
2750 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2752 ProcessData.Append(";PREF=");
2753 ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2757 // Check if there is a value for tokens.
2759 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2761 ProcessData.Append(";");
2762 ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2766 ProcessData.Append(":");
2767 ProcessData.Append(FreeBusyIter->second);
2768 ProcessData.Append("\n");
2770 ProcessData = OutputText(&ProcessData);
2772 SaveData->Append(ProcessData);
2773 ProcessData.clear();
2779 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID,
2780 map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2781 map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType,
2782 map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref,
2783 map<int, wxString> *KeyListTokens, wxString *SaveData){
2785 wxString ProcessData = "";
2787 for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2788 KeyIter != KeyList->end(); KeyIter++){
2790 ProcessData.Append("KEY");
2792 // Check if there is a value for TYPE.
2794 if ((*KeyListType)[KeyIter->first].size() > 0){
2796 ProcessData.Append(";TYPE=");
2797 ProcessData.Append((*KeyListType)[KeyIter->first]);
2801 // Check if there is a value for ALTID.
2803 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2805 ProcessData.Append(";ALTID=");
2806 ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2810 // Check if there is a value for PID.
2812 if ((*KeyListPID)[KeyIter->first].size() > 0){
2814 ProcessData.Append(";PID=");
2815 ProcessData.Append((*KeyListPID)[KeyIter->first]);
2819 // Check if there is a value for PREF.
2821 if ((*KeyListPref)[KeyIter->first] > 0){
2823 ProcessData.Append(";PREF=");
2824 ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2828 // Check if there is a value for tokens.
2830 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2832 ProcessData.Append(";");
2833 ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2837 ProcessData.Append(":data:");
2838 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2839 ProcessData.Append(";");
2840 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2841 ProcessData.Append(",");
2842 ProcessData.Append(KeyIter->second);
2843 ProcessData.Append("\n");
2845 ProcessData = OutputText(&ProcessData);
2847 SaveData->Append(ProcessData);
2848 ProcessData.clear();
2854 void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN,
2855 map<int, wxString> *VendorListElement, wxString *SaveData){
2857 wxString ProcessData = "";
2859 for (std::map<int, wxString>::iterator VendorIter = VendorList->begin();
2860 VendorIter != VendorList->end(); VendorIter++){
2862 ProcessData.Append("VND-");
2863 ProcessData.Append((*VendorListPEN)[VendorIter->first]);
2864 ProcessData.Append("-");
2865 ProcessData.Append((*VendorListElement)[VendorIter->first]);
2866 ProcessData.Append(":");
2867 ProcessData.Append(VendorIter->second);
2868 ProcessData.Append("\n");
2870 ProcessData = OutputText(&ProcessData);
2872 SaveData->Append(ProcessData);
2873 ProcessData.clear();
2879 void ContactDataObject::SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens,
2880 wxString *SaveData){
2882 wxString ProcessData = "";
2884 for (std::map<int, wxString>::iterator XTokenIter = XTokenList->begin();
2885 XTokenIter != XTokenList->end(); XTokenIter++){
2887 ProcessData.Append("X-");
2888 ProcessData.Append((*XTokenListTokens)[XTokenIter->first]);
2889 ProcessData.Append(":");
2890 ProcessData.Append(XTokenIter->second);
2891 ProcessData.Append("\n");
2893 ProcessData = OutputText(&ProcessData);
2895 SaveData->Append(ProcessData);
2896 ProcessData.clear();