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");
379 // TODO: Process GENDER.
381 // TODO: Process BDAY.
383 // TODO: Process ANNIVERSARY.
387 SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
388 &GeneralTitleListAltID, &GeneralTitleListPID,
389 &GeneralTitleListType, &GeneralTitleListPref,
390 &GeneralTitleListTokens, SaveData, "");
391 SaveTitle(&HomeTitleList, &HomeTitleListLanguage,
392 &HomeTitleListAltID, &HomeTitleListPID,
393 &HomeTitleListType, &HomeTitleListPref,
394 &HomeTitleListTokens, SaveData, "home");
395 SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage,
396 &BusinessTitleListAltID, &BusinessTitleListPID,
397 &BusinessTitleListType, &BusinessTitleListPref,
398 &BusinessTitleListTokens, SaveData, "work");
402 SaveTimezone(&GeneralTZList, &GeneralTZListAltID,
403 &GeneralTZListPID, &GeneralTZListType,
404 &GeneralTZListMediatype, &GeneralTZListPref,
405 &GeneralTZListTokens, SaveData, "");
406 SaveTimezone(&HomeTZList, &HomeTZListAltID,
407 &HomeTZListPID, &HomeTZListType,
408 &HomeTZListMediatype, &HomeTZListPref,
409 &HomeTZListTokens, SaveData, "home");
410 SaveTimezone(&BusinessTZList, &BusinessTZListAltID,
411 &BusinessTZListPID, &BusinessTZListType,
412 &BusinessTZListMediatype, &BusinessTZListPref,
413 &BusinessTZListTokens, SaveData, "work");
417 SaveAddress(&GeneralAddressList, &GeneralAddressListTown,
418 &GeneralAddressListCounty, &GeneralAddressListPostCode,
419 &GeneralAddressListCountry, &GeneralAddressListLabel,
420 &GeneralAddressListLang, &GeneralAddressListAltID,
421 &GeneralAddressListPID, &GeneralAddressListGeo,
422 &GeneralAddressListTimezone, &GeneralAddressListType,
423 &GeneralAddressListMediatype, &GeneralAddressListPref,
424 &GeneralAddressListTokens, SaveData, "");
425 SaveAddress(&HomeAddressList, &HomeAddressListTown,
426 &HomeAddressListCounty, &HomeAddressListPostCode,
427 &HomeAddressListCountry, &HomeAddressListLabel,
428 &HomeAddressListLang, &HomeAddressListAltID,
429 &HomeAddressListPID, &HomeAddressListGeo,
430 &HomeAddressListTimezone, &HomeAddressListType,
431 &HomeAddressListMediatype, &HomeAddressListPref,
432 &HomeAddressListTokens, SaveData, "home");
433 SaveAddress(&BusinessAddressList, &BusinessAddressListTown,
434 &BusinessAddressListCounty, &BusinessAddressListPostCode,
435 &BusinessAddressListCountry, &BusinessAddressListLabel,
436 &BusinessAddressListLang, &BusinessAddressListAltID,
437 &BusinessAddressListPID, &BusinessAddressListGeo,
438 &BusinessAddressListTimezone, &BusinessAddressListType,
439 &BusinessAddressListMediatype, &BusinessAddressListPref,
440 &BusinessAddressListTokens, SaveData, "work");
444 SaveEmail(&GeneralEmailList, &GeneralEmailListAltID,
445 &GeneralEmailListPID, &GeneralEmailListType,
446 &GeneralEmailListPref, &GeneralEmailListTokens,
448 SaveEmail(&HomeEmailList, &HomeEmailListAltID,
449 &HomeEmailListPID, &HomeEmailListType,
450 &HomeEmailListPref, &HomeEmailListTokens,
452 SaveEmail(&BusinessEmailList, &BusinessEmailListAltID,
453 &BusinessEmailListPID, &BusinessEmailListType,
454 &BusinessEmailListPref, &BusinessEmailListTokens,
459 SaveIMPP(&GeneralIMList, &GeneralIMListAltID,
460 &GeneralIMListPID, &GeneralIMListType,
461 &GeneralIMListTypeInfo, &GeneralIMListMediatype,
462 &GeneralIMListPref, &GeneralIMListTokens,
464 SaveIMPP(&HomeIMList, &HomeIMListAltID,
465 &HomeIMListPID, &HomeIMListType,
466 &HomeIMListTypeInfo, &HomeIMListMediatype,
467 &HomeIMListPref, &HomeIMListTokens,
469 SaveIMPP(&BusinessIMList, &BusinessIMListAltID,
470 &BusinessIMListPID, &BusinessIMListType,
471 &BusinessIMListTypeInfo, &BusinessIMListMediatype,
472 &BusinessIMListPref, &BusinessIMListTokens,
477 SaveTelephone(&GeneralTelephoneList, &GeneralTelephoneListAltID,
478 &GeneralTelephoneListPID, &GeneralTelephoneListType,
479 &GeneralTelephoneListTypeInfo, &GeneralTelephoneListDataType,
480 &GeneralTelephoneListPref, &GeneralTelephoneListTokens,
482 SaveTelephone(&HomeTelephoneList, &HomeTelephoneListAltID,
483 &HomeTelephoneListPID, &HomeTelephoneListType,
484 &HomeTelephoneListTypeInfo, &HomeTelephoneListDataType,
485 &HomeTelephoneListPref, &HomeTelephoneListTokens,
487 SaveTelephone(&BusinessTelephoneList, &BusinessTelephoneListAltID,
488 &BusinessTelephoneListPID, &BusinessTelephoneListType,
489 &BusinessTelephoneListTypeInfo, &BusinessTelephoneListDataType,
490 &BusinessTelephoneListPref, &BusinessTelephoneListTokens,
495 SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID,
496 &GeneralLanguageListPID, &GeneralLanguageListType,
497 &GeneralLanguageListPref, &GeneralLanguageListTokens,
499 SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID,
500 &HomeLanguageListPID, &HomeLanguageListType,
501 &HomeLanguageListPref, &HomeLanguageListTokens,
503 SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID,
504 &BusinessLanguageListPID, &BusinessLanguageListType,
505 &BusinessLanguageListPref, &BusinessLanguageListTokens,
510 SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID,
511 &GeneralGeographyListPID, &GeneralGeographyListType,
512 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
513 &GeneralGeographyListPref, &GeneralGeographyListTokens,
515 SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID,
516 &HomeGeographyListPID, &HomeGeographyListType,
517 &HomeGeographyListMediatype, &HomeGeographyListDataType,
518 &HomeGeographyListPref, &HomeGeographyListTokens,
520 SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID,
521 &BusinessGeographyListPID, &BusinessGeographyListType,
522 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
523 &BusinessGeographyListPref, &BusinessGeographyListTokens,
530 for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
531 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
533 ProcessData.Append("RELATED");
535 // Check if there is a value for TYPE.
537 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
539 wxString RelatedType = "";
541 ProcessData.Append(";TYPE=");
543 if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
545 RelatedType = wxT("contact");
547 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
549 RelatedType = wxT("acquaintance");
551 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
553 RelatedType = wxT("friend");
555 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
557 RelatedType = wxT("met");
559 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
561 RelatedType = wxT("co-worker");
563 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
565 RelatedType = wxT("colleague");
567 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
569 RelatedType = wxT("co-resident");
571 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
573 RelatedType = wxT("neighbor");
575 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
577 RelatedType = wxT("child");
579 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
581 RelatedType = wxT("parent");
583 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
585 RelatedType = wxT("sibling");
587 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
589 RelatedType = wxT("spouse");
591 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
593 RelatedType = wxT("kin");
595 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
597 RelatedType = wxT("muse");
599 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
601 RelatedType = wxT("crush");
603 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
605 RelatedType = wxT("date");
607 } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
609 RelatedType = wxT("sweetheart");
611 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
613 RelatedType = wxT("me");
615 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
617 RelatedType = wxT("agent");
619 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
621 RelatedType = wxT("emergency");
625 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
629 ProcessData.Append(RelatedType);
633 // Check if there is a value for LANGUAGE.
635 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
637 ProcessData.Append(";LANGUAGE=");
638 ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
642 // Check if there is a value for ALTID.
644 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
646 ProcessData.Append(";ALTID=");
647 ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
651 // Check if there is a value for PID.
653 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
655 ProcessData.Append(";PID=");
656 ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
660 // Check if there is a value for PREF.
662 if (GeneralRelatedListPref[RelatedIter->first] > 0){
664 ProcessData.Append(";PREF=");
665 ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
669 // Check if there is a value for tokens.
671 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
673 ProcessData.Append(";");
674 ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
678 ProcessData.Append(":");
679 ProcessData.Append(RelatedIter->second);
680 ProcessData.Append("\n");
682 ProcessData = OutputText(&ProcessData);
684 SaveData->Append(ProcessData);
691 SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID,
692 &GeneralWebsiteListPID, &GeneralWebsiteListType,
693 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref,
694 &GeneralWebsiteListTokens, SaveData, "");
695 SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID,
696 &HomeWebsiteListPID, &HomeWebsiteListType,
697 &HomeWebsiteListMediatype, &HomeWebsiteListPref,
698 &HomeWebsiteListTokens, SaveData, "home");
699 SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID,
700 &BusinessWebsiteListPID, &BusinessWebsiteListType,
701 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref,
702 &BusinessWebsiteListTokens, SaveData, "work");
706 SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
707 &GeneralRoleListAltID, &GeneralRoleListPID,
708 &GeneralRoleListType, &GeneralRoleListPref,
709 &GeneralRoleListTokens, SaveData, "");
710 SaveRole(&HomeRoleList, &HomeRoleListLanguage,
711 &HomeRoleListAltID, &HomeRoleListPID,
712 &HomeRoleListType, &HomeRoleListPref,
713 &HomeRoleListTokens, SaveData, "home");
714 SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
715 &BusinessRoleListAltID, &BusinessRoleListPID,
716 &BusinessRoleListType, &BusinessRoleListPref,
717 &BusinessRoleListTokens, SaveData, "work");
721 SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
722 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage,
723 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType,
724 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens,
726 SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
727 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage,
728 &HomeOrganisationsListSortAs, &HomeOrganisationsListType,
729 &HomeOrganisationsListPref, &HomeOrganisationsListTokens,
731 SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
732 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage,
733 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType,
734 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens,
739 SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
740 &GeneralNoteListAltID, &GeneralNoteListPID,
741 &GeneralNoteListType, &GeneralNoteListPref,
742 &GeneralNoteListTokens, SaveData, "");
743 SaveNote(&HomeNoteList, &HomeNoteListLanguage,
744 &HomeNoteListAltID, &HomeNoteListPID,
745 &HomeNoteListType, &HomeNoteListPref,
746 &HomeNoteListTokens, SaveData, "home");
747 SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
748 &BusinessNoteListAltID, &BusinessNoteListPID,
749 &BusinessNoteListType, &BusinessNoteListPref,
750 &BusinessNoteListTokens, SaveData, "work");
752 // Process CATEGORIES.
754 SaveCategory(&CategoriesList, &CategoriesListLanguage,
755 &CategoriesListAltID, &CategoriesListPID,
756 &CategoriesListType, &CategoriesListPref,
757 &CategoriesListTokens, SaveData);
761 SavePhoto(&PicturesList, &PicturesListAltID,
762 &PicturesListPID, &PicturesListType,
763 &PicturesListPicEncType, &PicturesListPictureType,
764 &PicturesListMediatype, &PicturesListPref,
765 &PicturesListTokens, SaveData);
769 SaveLogo(&LogosList, &LogosListAltID,
770 &LogosListPID, &LogosListType,
771 &LogosListPicEncType, &LogosListPictureType,
772 &LogosListMediatype, &LogosListPref,
773 &LogosListTokens, SaveData);
777 SaveSound(&SoundsList, &SoundsListAltID,
778 &SoundsListPID, &SoundsListType,
779 &SoundsListAudioEncType, &SoundsListAudioType,
780 &SoundsListMediatype, &SoundsListLanguage,
781 &SoundsListPref, &SoundsListTokens,
786 SaveCalendarURI(&CalendarList, &CalendarListMediatype,
787 &CalendarListAltID, &CalendarListPID,
788 &CalendarListType, &CalendarListPref,
789 &CalendarListTokens, SaveData);
791 // Process CALADRURI.
793 SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
794 &CalendarRequestListAltID, &CalendarRequestListPID,
795 &CalendarRequestListType, &CalendarRequestListPref,
796 &CalendarRequestListTokens, SaveData);
800 SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID,
801 &FreeBusyListPID, &FreeBusyListType,
802 &FreeBusyListMediatype, &FreeBusyListPref,
803 &FreeBusyListTokens, SaveData);
807 SaveKey(&KeyList, &KeyListAltID,
808 &KeyListPID, &KeyListType,
809 &KeyListKeyType, &KeyListDataEncType,
810 &KeyListDataType, &KeyListPref,
811 &KeyListTokens, SaveData);
815 SaveVendor(&VendorList, &VendorListPEN,
816 &VendorListElement, SaveData);
820 SaveXToken(&XTokenList, &XTokenListTokens,
823 // Write the end part of the vCard data file.
825 SaveData->Append("END:VCARD");
827 SaveDataStatus = CONTACTSAVE_OK;
829 return SaveDataStatus;
833 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
834 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
835 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
836 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
838 wxString ProcessData = "";
840 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
841 TitleIter != TitleList->end(); TitleIter++){
843 ProcessData.Append("TITLE");
845 // Check if there is a value for TYPE.
847 if (DataType.size() > 0){
849 ProcessData.Append(";TYPE=");
850 ProcessData.Append(DataType);
854 // Check if there is a value for ALTID.
856 if ((*TitleListAltID)[TitleIter->first].size() > 0){
858 ProcessData.Append(";ALTID=");
859 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
863 // Check if there is a value for LANGUAGE.
865 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
867 ProcessData.Append(";LANGUAGE=");
868 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
872 // Check if there is a value for PID.
874 if ((*TitleListPID)[TitleIter->first].size() > 0){
876 ProcessData.Append(";PID=");
877 ProcessData.Append((*TitleListPID)[TitleIter->first]);
881 // Check if there is a value for PREF.
883 if ((*TitleListPref)[TitleIter->first] > 0){
885 ProcessData.Append(";PREF=");
886 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
890 // Check if there is a value for tokens.
892 if ((*TitleListTokens)[TitleIter->first].size() > 0){
894 ProcessData.Append(";");
895 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
899 ProcessData.Append(":");
900 ProcessData.Append(TitleIter->second);
901 ProcessData.Append("\n");
903 ProcessData = OutputText(&ProcessData);
905 SaveData->Append(ProcessData);
912 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
913 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
914 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
915 map<int, wxString> *SourceListTokens, wxString *SaveData){
917 wxString ProcessData = "";
919 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
920 SourceIter != SourceList->end(); SourceIter++){
922 ProcessData.Append("SOURCE");
924 // Check if there is a value for TYPE.
926 if ((*SourceListType)[SourceIter->first].size() > 0){
928 ProcessData.Append(";TYPE=");
929 ProcessData.Append((*SourceListType)[SourceIter->first]);
933 // Check if there is a value for ALTID.
935 if ((*SourceListAltID)[SourceIter->first].size() > 0){
937 ProcessData.Append(";ALTID=");
938 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
942 // Check if there is a value for MEDIATYPE.
944 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
946 ProcessData.Append(";MEDIATYPE=");
947 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
951 // Check if there is a value for PID.
953 if ((*SourceListPID)[SourceIter->first].size() > 0){
955 ProcessData.Append(";PID=");
956 ProcessData.Append((*SourceListPID)[SourceIter->first]);
960 // Check if there is a value for PREF.
962 if ((*SourceListPref)[SourceIter->first] > 0){
964 ProcessData.Append(";PREF=");
965 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
969 // Check if there is a value for tokens.
971 if ((*SourceListTokens)[SourceIter->first].size() > 0){
973 ProcessData.Append(";");
974 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
978 ProcessData.Append(":");
979 ProcessData.Append(SourceIter->second);
980 ProcessData.Append("\n");
982 ProcessData = OutputText(&ProcessData);
984 SaveData->Append(ProcessData);
991 void ContactDataObject::SaveMember(std::map<int, wxString> *GroupsList, std::map<int, wxString> *GroupsListAltID,
992 std::map<int, wxString> *GroupsListPID, std::map<int, wxString> *GroupsListType,
993 std::map<int, wxString> *GroupsListMediaType, std::map<int, int> *GroupsListPref,
994 std::map<int, wxString> *GroupsListTokens, wxString *SaveData){
996 wxString ProcessData = "";
998 for (std::map<int, wxString>::iterator GroupsIter = GroupsList->begin();
999 GroupsIter != GroupsList->end(); GroupsIter++){
1001 ProcessData.Append("MEMBER");
1003 // Check if there is a value for TYPE.
1005 if ((*GroupsListType)[GroupsIter->first].size() > 0){
1007 ProcessData.Append(";TYPE=");
1008 ProcessData.Append((*GroupsListType)[GroupsIter->first]);
1012 // Check if there is a value for ALTID.
1014 if ((*GroupsListAltID)[GroupsIter->first].size() > 0){
1016 ProcessData.Append(";ALTID=");
1017 ProcessData.Append((*GroupsListAltID)[GroupsIter->first]);
1021 // Check if there is a value for MEDIATYPE.
1023 if ((*GroupsListMediaType)[GroupsIter->first].size() > 0){
1025 ProcessData.Append(";MEDIATYPE=");
1026 ProcessData.Append((*GroupsListMediaType)[GroupsIter->first]);
1030 // Check if there is a value for PID.
1032 if ((*GroupsListPID)[GroupsIter->first].size() > 0){
1034 ProcessData.Append(";PID=");
1035 ProcessData.Append((*GroupsListPID)[GroupsIter->first]);
1039 // Check if there is a value for PREF.
1041 if ((*GroupsListPref)[GroupsIter->first] > 0){
1043 ProcessData.Append(";PREF=");
1044 ProcessData.Append(wxString::Format("%i", (*GroupsListPref)[GroupsIter->first]));
1048 // Check if there is a value for tokens.
1050 if ((*GroupsListTokens)[GroupsIter->first].size() > 0){
1052 ProcessData.Append(";");
1053 ProcessData.Append((*GroupsListTokens)[GroupsIter->first]);
1057 ProcessData.Append(":");
1058 ProcessData.Append(GroupsIter->second);
1059 ProcessData.Append("\n");
1061 ProcessData = OutputText(&ProcessData);
1063 SaveData->Append(ProcessData);
1064 ProcessData.clear();
1070 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
1071 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
1072 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
1073 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
1075 wxString ProcessData = "";
1077 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
1078 NicknameIter != NicknameList->end(); NicknameIter++){
1080 ProcessData.Append("NICKNAME");
1082 // Check if there is a value for TYPE.
1084 if (DataType.size() > 0){
1086 ProcessData.Append(";TYPE=");
1087 ProcessData.Append(DataType);
1091 // Check if there is a value for ALTID.
1093 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
1095 ProcessData.Append(";ALTID=");
1096 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
1100 // Check if there is a value for MEDIATYPE.
1102 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
1104 ProcessData.Append(";LANGUAGE=");
1105 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
1109 // Check if there is a value for PID.
1111 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
1113 ProcessData.Append(";PID=");
1114 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
1118 // Check if there is a value for PREF.
1120 if ((*NicknameListPref)[NicknameIter->first] > 0){
1122 ProcessData.Append(";PREF=");
1123 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
1127 // Check if there is a value for tokens.
1129 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
1131 ProcessData.Append(";");
1132 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
1136 ProcessData.Append(":");
1137 ProcessData.Append(NicknameIter->second);
1138 ProcessData.Append("\n");
1140 ProcessData = OutputText(&ProcessData);
1142 SaveData->Append(ProcessData);
1143 ProcessData.clear();
1149 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
1150 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
1151 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
1152 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
1154 wxString ProcessData = "";
1156 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
1157 TZIter != TZList->end(); TZIter++){
1159 ProcessData.Append("TZ");
1161 // Check if there is a value for TYPE.
1163 if (DataType.size() > 0){
1165 ProcessData.Append(";TYPE=");
1166 ProcessData.Append(DataType);
1170 // Check if there is a value for ALTID.
1172 if ((*TZListAltID)[TZIter->first].size() > 0){
1174 ProcessData.Append(";ALTID=");
1175 ProcessData.Append((*TZListAltID)[TZIter->first]);
1179 // Check if there is a value for MEDIATYPE.
1181 if ((*TZListMediatype)[TZIter->first].size() > 0){
1183 ProcessData.Append(";MEDIATYPE=");
1184 ProcessData.Append((*TZListMediatype)[TZIter->first]);
1188 // Check if there is a value for PID.
1190 if ((*TZListPID)[TZIter->first].size() > 0){
1192 ProcessData.Append(";PID=");
1193 ProcessData.Append((*TZListPID)[TZIter->first]);
1197 // Check if there is a value for PREF.
1199 if ((*TZListPref)[TZIter->first] > 0){
1201 ProcessData.Append(";PREF=");
1202 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
1206 // Check if there is a value for tokens.
1208 if ((*TZListTokens)[TZIter->first].size() > 0){
1210 ProcessData.Append(";");
1211 ProcessData.Append((*TZListTokens)[TZIter->first]);
1215 ProcessData.Append(":");
1216 ProcessData.Append(TZIter->second);
1217 ProcessData.Append("\n");
1219 ProcessData = OutputText(&ProcessData);
1221 SaveData->Append(ProcessData);
1222 ProcessData.clear();
1228 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
1229 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
1230 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
1231 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
1232 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
1233 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
1234 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
1235 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
1237 wxString ProcessData = "";
1239 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
1240 AddressIter != AddressList->end(); AddressIter++){
1242 ProcessData.Append("ADR");
1244 // Check if there is a value for TYPE.
1246 if (DataType.size() > 0){
1248 ProcessData.Append(";TYPE=");
1249 ProcessData.Append(DataType);
1253 // Check if there is a value for ALTID.
1255 if ((*AddressListAltID)[AddressIter->first].size() > 0){
1257 ProcessData.Append(";ALTID=");
1258 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
1262 // Check if there is a value for GEO.
1264 if ((*AddressListGeo)[AddressIter->first].size() > 0){
1266 ProcessData.Append(";GEO=\"");
1267 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
1268 ProcessData.Append("\"");
1272 // Check if there is a value for LABEL.
1274 if ((*AddressListLabel)[AddressIter->first].size() > 0){
1276 wxString AddressProcessed = "";
1277 AddressProcessed = (*AddressListLabel)[AddressIter->first];
1279 AddressProcessed.Replace("\n", "\\n", true);
1281 ProcessData.Append(";LABEL=");
1282 ProcessData.Append(AddressProcessed);
1286 // Check if there is a value for LANGUAGE.
1288 if ((*AddressListLang)[AddressIter->first].size() > 0){
1290 ProcessData.Append(";LANGUAGE=");
1291 ProcessData.Append((*AddressListLang)[AddressIter->first]);
1295 // Check if there is a value for MEDIATYPE.
1297 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1299 ProcessData.Append(";MEDIATYPE=");
1300 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1304 // Check if there is a value for PID.
1306 if ((*AddressListPID)[AddressIter->first].size() > 0){
1308 ProcessData.Append(";PID=");
1309 ProcessData.Append((*AddressListPID)[AddressIter->first]);
1313 // Check if there is a value for PREF.
1315 if ((*AddressListPref)[AddressIter->first] > 0){
1317 ProcessData.Append(";PREF=");
1318 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1322 // Check if there is a value for TZ.
1324 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1326 ProcessData.Append(";TZ=");
1327 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1331 // Check if there is a value for tokens.
1333 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1335 ProcessData.Append(";");
1336 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1340 // Build the address.
1342 ProcessData.Append(":;;");
1343 ProcessData.Append((*AddressList)[AddressIter->first]);
1344 ProcessData.Append(";");
1345 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1346 ProcessData.Append(";");
1347 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1348 ProcessData.Append(";");
1349 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1350 ProcessData.Append(";");
1351 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1352 ProcessData.Append("\n");
1354 ProcessData = OutputText(&ProcessData);
1356 SaveData->Append(ProcessData);
1357 ProcessData.clear();
1363 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1364 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1365 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1366 wxString *SaveData, wxString DataType){
1368 wxString ProcessData = "";
1370 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1371 EmailIter != EmailList->end(); EmailIter++){
1373 ProcessData.Append("EMAIL");
1375 // Check if there is a value for TYPE.
1377 if (DataType.size() > 0){
1379 ProcessData.Append(";TYPE=");
1380 ProcessData.Append(DataType);
1384 // Check if there is a value for ALTID.
1386 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1388 ProcessData.Append(";ALTID=");
1389 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1393 // Check if there is a value for PID.
1395 if ((*EmailListPID)[EmailIter->first].size() > 0){
1397 ProcessData.Append(";PID=");
1398 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1402 // Check if there is a value for PREF.
1404 if ((*EmailListPref)[EmailIter->first] > 0){
1406 ProcessData.Append(";PREF=");
1407 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1411 // Check if there is a value for tokens.
1413 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1415 ProcessData.Append(";");
1416 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1420 ProcessData.Append(":");
1421 ProcessData.Append(EmailIter->second);
1422 ProcessData.Append("\n");
1424 ProcessData = OutputText(&ProcessData);
1426 SaveData->Append(ProcessData);
1427 ProcessData.clear();
1433 void ContactDataObject::SaveIMPP(map<int, wxString> *IMList, map<int, wxString> *IMListAltID,
1434 map<int, wxString> *IMListPID, map<int, wxString> *IMListType,
1435 map<int, wxString> *IMListTypeInfo, map<int, wxString> *IMListMediatype,
1436 map<int, int> *IMListPref, map<int, wxString> *IMListTokens,
1437 wxString *SaveData, wxString DataType){
1439 wxString ProcessData = "";
1441 for (std::map<int, wxString>::iterator IMIter = IMList->begin();
1442 IMIter != IMList->end(); IMIter++){
1444 ProcessData.Append("IMPP");
1446 // Check if there is a value for TYPE.
1448 if (DataType.size() > 0){
1450 ProcessData.Append(";TYPE=");
1451 ProcessData.Append(DataType);
1455 // Check if there is a value for ALTID.
1457 if ((*IMListAltID)[IMIter->first].size() > 0){
1459 ProcessData.Append(";ALTID=");
1460 ProcessData.Append((*IMListAltID)[IMIter->first]);
1464 // Check if there is a value for MEDIATYPE.
1466 if ((*IMListMediatype)[IMIter->first].size() > 0){
1468 ProcessData.Append(";MEDIATYPE=");
1469 ProcessData.Append((*IMListMediatype)[IMIter->first]);
1473 // Check if there is a value for PID.
1475 if ((*IMListPID)[IMIter->first].size() > 0){
1477 ProcessData.Append(";PID=");
1478 ProcessData.Append((*IMListPID)[IMIter->first]);
1482 // Check if there is a value for PREF.
1484 if ((*IMListPref)[IMIter->first] > 0){
1486 ProcessData.Append(";PREF=");
1487 ProcessData.Append(wxString::Format("%i", (*IMListPref)[IMIter->first]));
1491 // Check if there is a value for tokens.
1493 if ((*IMListTokens)[IMIter->first].size() > 0){
1495 ProcessData.Append(";");
1496 ProcessData.Append((*IMListTokens)[IMIter->first]);
1500 ProcessData.Append(":");
1501 ProcessData.Append((*IMListTypeInfo)[IMIter->first]);
1502 ProcessData.Append(":");
1503 ProcessData.Append(IMIter->second);
1504 ProcessData.Append("\n");
1506 ProcessData = OutputText(&ProcessData);
1508 SaveData->Append(ProcessData);
1509 ProcessData.clear();
1515 void ContactDataObject::SaveTelephone(map<int, wxString> *TelephoneList, map<int, wxString> *TelephoneListAltID,
1516 map<int, wxString> *TelephoneListPID, map<int, wxString> *TelephoneListType,
1517 map<int, wxString> *TelephoneListTypeInfo, map<int, wxString> *TelephoneListDataType,
1518 map<int, int> *TelephoneListPref, map<int, wxString> *TelephoneListTokens,
1519 wxString *SaveData, wxString DataType){
1521 wxString ProcessData = "";
1523 for (std::map<int, wxString>::iterator TelephoneIter = TelephoneList->begin();
1524 TelephoneIter != TelephoneList->end(); TelephoneIter++){
1526 ProcessData.Append("TEL");
1528 // Check if there is a value for TYPE.
1530 if (DataType.size() > 0 || (*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1532 ProcessData.Append(";TYPE=\"");
1534 bool ProcessedType = false;
1536 if (DataType.size() > 0){
1538 ProcessData.Append(DataType);
1539 ProcessedType = true;
1543 if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1545 if (ProcessedType == true){
1546 ProcessData.Append(",");
1548 ProcessData.Append((*TelephoneListTypeInfo)[TelephoneIter->first]);
1552 ProcessData.Append("\"");
1556 // Check if there is a value for ALTID.
1558 if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1560 ProcessData.Append(";ALTID=");
1561 ProcessData.Append((*TelephoneListAltID)[TelephoneIter->first]);
1565 // Check if there is a value for PID.
1567 if ((*TelephoneListPID)[TelephoneIter->first].size() > 0){
1569 ProcessData.Append(";PID=");
1570 ProcessData.Append((*TelephoneListPID)[TelephoneIter->first]);
1574 // Check if there is a value for PREF.
1576 if ((*TelephoneListPref)[TelephoneIter->first] > 0){
1578 ProcessData.Append(";PREF=");
1579 ProcessData.Append(wxString::Format("%i", (*TelephoneListPref)[TelephoneIter->first]));
1583 // Check if there is a value for tokens.
1585 if ((*TelephoneListTokens)[TelephoneIter->first].size() > 0){
1587 ProcessData.Append(";");
1588 ProcessData.Append((*TelephoneListTokens)[TelephoneIter->first]);
1592 ProcessData.Append(":");
1593 ProcessData.Append((*TelephoneListDataType)[TelephoneIter->first]);
1594 ProcessData.Append(":");
1595 ProcessData.Append(TelephoneIter->second);
1596 ProcessData.Append("\n");
1598 ProcessData = OutputText(&ProcessData);
1600 SaveData->Append(ProcessData);
1601 ProcessData.clear();
1607 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1608 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1609 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1610 wxString *SaveData, wxString DataType){
1612 wxString ProcessData = "";
1614 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1615 LanguageIter != LanguageList->end(); LanguageIter++){
1617 ProcessData.Append("LANG");
1619 // Check if there is a value for TYPE.
1621 if (DataType.size() > 0){
1623 ProcessData.Append(";TYPE=");
1624 ProcessData.Append(DataType);
1628 // Check if there is a value for ALTID.
1630 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1632 ProcessData.Append(";ALTID=");
1633 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1637 // Check if there is a value for PID.
1639 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1641 ProcessData.Append(";PID=");
1642 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1646 // Check if there is a value for PREF.
1648 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1650 ProcessData.Append(";PREF=");
1651 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1655 // Check if there is a value for tokens.
1657 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1659 ProcessData.Append(";");
1660 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1664 ProcessData.Append(":");
1665 ProcessData.Append(LanguageIter->second);
1666 ProcessData.Append("\n");
1668 ProcessData = OutputText(&ProcessData);
1670 SaveData->Append(ProcessData);
1671 ProcessData.clear();
1677 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1678 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1679 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1680 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1681 wxString *SaveData, wxString DataType){
1683 wxString ProcessData = "";
1685 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1686 GeographyIter != GeographyList->end(); GeographyIter++){
1688 ProcessData.Append("GEO");
1690 // Check if there is a value for TYPE.
1692 if (DataType.size() > 0){
1694 ProcessData.Append(";TYPE=");
1695 ProcessData.Append(DataType);
1699 // Check if there is a value for ALTID.
1701 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1703 ProcessData.Append(";ALTID=");
1704 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1708 // Check if there is a value for MEDIATYPE.
1710 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1712 ProcessData.Append(";MEDIATYPE=");
1713 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1717 // Check if there is a value for PID.
1719 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1721 ProcessData.Append(";PID=");
1722 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1726 // Check if there is a value for PREF.
1728 if ((*GeographyListPref)[GeographyIter->first] > 0){
1730 ProcessData.Append(";PREF=");
1731 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1735 // Check if there is a value for tokens.
1737 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1739 ProcessData.Append(";");
1740 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1744 ProcessData.Append(":");
1745 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1746 ProcessData.Append(":");
1747 ProcessData.Append(GeographyIter->second);
1748 ProcessData.Append("\n");
1750 ProcessData = OutputText(&ProcessData);
1752 SaveData->Append(ProcessData);
1753 ProcessData.clear();
1759 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1760 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1761 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1762 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1764 wxString ProcessData = "";
1766 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1767 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1769 ProcessData.Append("URL");
1771 // Check if there is a value for TYPE.
1773 if (DataType.size() > 0){
1775 ProcessData.Append(";TYPE=");
1776 ProcessData.Append(DataType);
1780 // Check if there is a value for ALTID.
1782 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1784 ProcessData.Append(";ALTID=");
1785 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1789 // Check if there is a value for MEDIATYPE.
1791 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1793 ProcessData.Append(";MEDIATYPE=");
1794 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1798 // Check if there is a value for PID.
1800 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1802 ProcessData.Append(";PID=");
1803 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1807 // Check if there is a value for PREF.
1809 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1811 ProcessData.Append(";PREF=");
1812 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1816 // Check if there is a value for tokens.
1818 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1820 ProcessData.Append(";");
1821 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1825 ProcessData.Append(":");
1826 ProcessData.Append(WebsiteIter->second);
1827 ProcessData.Append("\n");
1829 ProcessData = OutputText(&ProcessData);
1831 SaveData->Append(ProcessData);
1832 ProcessData.clear();
1838 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1839 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1840 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1841 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1843 wxString ProcessData = "";
1845 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1846 RoleIter != RoleList->end(); RoleIter++){
1848 ProcessData.Append("ROLE");
1850 // Check if there is a value for TYPE.
1852 if (DataType.size() > 0){
1854 ProcessData.Append(";TYPE=");
1855 ProcessData.Append(DataType);
1859 // Check if there is a value for ALTID.
1861 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1863 ProcessData.Append(";ALTID=");
1864 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1868 // Check if there is a value for LANGUAGE.
1870 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1872 ProcessData.Append(";LANGUAGE=");
1873 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1877 // Check if there is a value for PID.
1879 if ((*RoleListPID)[RoleIter->first].size() > 0){
1881 ProcessData.Append(";PID=");
1882 ProcessData.Append((*RoleListPID)[RoleIter->first]);
1886 // Check if there is a value for PREF.
1888 if ((*RoleListPref)[RoleIter->first] > 0){
1890 ProcessData.Append(";PREF=");
1891 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1895 // Check if there is a value for tokens.
1897 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1899 ProcessData.Append(";");
1900 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1904 ProcessData.Append(":");
1905 ProcessData.Append(RoleIter->second);
1906 ProcessData.Append("\n");
1908 ProcessData = OutputText(&ProcessData);
1910 SaveData->Append(ProcessData);
1911 ProcessData.clear();
1917 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1918 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
1919 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
1920 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
1921 wxString *SaveData, wxString DataType){
1923 wxString ProcessData = "";
1925 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1926 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1928 ProcessData.Append("ORG");
1930 // Check if there is a value for TYPE.
1932 if (DataType.size() > 0){
1934 ProcessData.Append(";TYPE=");
1935 ProcessData.Append(DataType);
1939 // Check if there is a value for ALTID.
1941 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1943 ProcessData.Append(";ALTID=");
1944 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1948 // Check if there is a value for LANGUAGE.
1950 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1952 ProcessData.Append(";LANGUAGE=");
1953 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1957 // Check if there is a value for PID.
1959 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1961 ProcessData.Append(";PID=");
1962 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1966 // Check if there is a value for PREF.
1968 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1970 ProcessData.Append(";PREF=");
1971 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1975 // Check if there is a value for SORT-AS.
1977 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1979 ProcessData.Append(";SORT-AS=\"");
1980 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1981 ProcessData.Append("\"");
1985 // Check if there is a value for tokens.
1987 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1989 ProcessData.Append(";");
1990 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1994 ProcessData.Append(":");
1995 ProcessData.Append(OrganisationIter->second);
1996 ProcessData.Append("\n");
1998 ProcessData = OutputText(&ProcessData);
2000 SaveData->Append(ProcessData);
2001 ProcessData.clear();
2007 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
2008 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
2009 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
2010 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
2012 wxString ProcessData = "";
2014 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
2015 NoteIter != NoteList->end(); NoteIter++){
2017 ProcessData.Append("NOTE");
2019 // Check if there is a value for TYPE.
2021 if (DataType.size() > 0){
2023 ProcessData.Append(";TYPE=");
2024 ProcessData.Append(DataType);
2028 // Check if there is a value for ALTID.
2030 if ((*NoteListAltID)[NoteIter->first].size() > 0){
2032 ProcessData.Append(";ALTID=");
2033 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
2037 // Check if there is a value for LANGUAGE.
2039 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
2041 ProcessData.Append(";LANGUAGE=");
2042 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
2046 // Check if there is a value for PID.
2048 if ((*NoteListPID)[NoteIter->first].size() > 0){
2050 ProcessData.Append(";PID=");
2051 ProcessData.Append((*NoteListPID)[NoteIter->first]);
2055 // Check if there is a value for PREF.
2057 if ((*NoteListPref)[NoteIter->first] > 0){
2059 ProcessData.Append(";PREF=");
2060 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
2064 // Check if there is a value for tokens.
2066 if ((*NoteListTokens)[NoteIter->first].size() > 0){
2068 ProcessData.Append(";");
2069 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
2073 ProcessData.Append(":");
2074 ProcessData.Append(NoteIter->second);
2075 ProcessData.Replace("\n", "\\n", true);
2076 ProcessData.Append("\n");
2078 ProcessData = OutputText(&ProcessData);
2080 SaveData->Append(ProcessData);
2081 ProcessData.clear();
2087 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
2088 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
2089 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
2090 map<int, wxString> *CategoryListTokens, wxString *SaveData){
2092 wxString ProcessData = "";
2094 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
2095 CategoryIter != CategoryList->end(); CategoryIter++){
2097 ProcessData.Append("CATEGORIES");
2099 // Check if there is a value for TYPE.
2101 if ((*CategoryListType)[CategoryIter->first].size() > 0){
2103 ProcessData.Append(";TYPE=");
2104 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
2108 // Check if there is a value for ALTID.
2110 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
2112 ProcessData.Append(";ALTID=");
2113 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
2117 // Check if there is a value for LANGUAGE.
2119 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
2121 ProcessData.Append(";LANGUAGE=");
2122 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
2126 // Check if there is a value for PID.
2128 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
2130 ProcessData.Append(";PID=");
2131 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
2135 // Check if there is a value for PREF.
2137 if ((*CategoryListPref)[CategoryIter->first] > 0){
2139 ProcessData.Append(";PREF=");
2140 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
2144 // Check if there is a value for tokens.
2146 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
2148 ProcessData.Append(";");
2149 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
2153 ProcessData.Append(":");
2154 ProcessData.Append(CategoryIter->second);
2155 ProcessData.Append("\n");
2157 ProcessData = OutputText(&ProcessData);
2159 SaveData->Append(ProcessData);
2160 ProcessData.clear();
2166 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
2167 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
2168 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
2169 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
2170 map<int, wxString> *PicturesListTokens, wxString *SaveData){
2172 wxString ProcessData = "";
2174 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
2175 PicturesIter != PicturesList->end(); PicturesIter++){
2177 ProcessData.Append("PHOTO");
2179 // Check if there is a value for TYPE.
2181 if ((*PicturesListType)[PicturesIter->first].size() > 0){
2183 ProcessData.Append(";TYPE=");
2184 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
2188 // Check if there is a value for ALTID.
2190 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
2192 ProcessData.Append(";ALTID=");
2193 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
2197 // Check if there is a value for MEDIATYPE..
2199 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
2201 ProcessData.Append(";MEDIATYPE=");
2202 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
2206 // Check if there is a value for PID.
2208 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
2210 ProcessData.Append(";PID=");
2211 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
2215 // Check if there is a value for PREF.
2217 if ((*PicturesListPref)[PicturesIter->first] > 0){
2219 ProcessData.Append(";PREF=");
2220 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
2224 // Check if there is a value for tokens.
2226 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
2228 ProcessData.Append(";");
2229 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
2233 ProcessData.Append(":data:");
2234 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
2235 ProcessData.Append(";");
2236 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
2237 ProcessData.Append(",");
2238 ProcessData.Append(PicturesIter->second);
2239 ProcessData.Append("\n");
2241 ProcessData = OutputText(&ProcessData);
2243 SaveData->Append(ProcessData);
2244 ProcessData.clear();
2250 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID,
2251 map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
2252 map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
2253 map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
2254 map<int, wxString> *LogosListTokens, wxString *SaveData){
2256 wxString ProcessData = "";
2258 for (std::map<int, string>::iterator LogosIter = LogosList->begin();
2259 LogosIter != LogosList->end(); LogosIter++){
2261 ProcessData.Append("LOGO");
2263 // Check if there is a value for TYPE.
2265 if ((*LogosListType)[LogosIter->first].size() > 0){
2267 ProcessData.Append(";TYPE=");
2268 ProcessData.Append((*LogosListType)[LogosIter->first]);
2272 // Check if there is a value for ALTID.
2274 if ((*LogosListAltID)[LogosIter->first].size() > 0){
2276 ProcessData.Append(";ALTID=");
2277 ProcessData.Append((*LogosListAltID)[LogosIter->first]);
2281 // Check if there is a value for MEDIATYPE..
2283 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
2285 ProcessData.Append(";MEDIATYPE=");
2286 ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
2290 // Check if there is a value for PID.
2292 if ((*LogosListPID)[LogosIter->first].size() > 0){
2294 ProcessData.Append(";PID=");
2295 ProcessData.Append((*LogosListPID)[LogosIter->first]);
2299 // Check if there is a value for PREF.
2301 if ((*LogosListPref)[LogosIter->first] > 0){
2303 ProcessData.Append(";PREF=");
2304 ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
2308 // Check if there is a value for tokens.
2310 if ((*LogosListTokens)[LogosIter->first].size() > 0){
2312 ProcessData.Append(";");
2313 ProcessData.Append((*LogosListTokens)[LogosIter->first]);
2317 ProcessData.Append(":data:");
2318 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
2319 ProcessData.Append(";");
2320 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
2321 ProcessData.Append(",");
2322 ProcessData.Append(LogosIter->second);
2323 ProcessData.Append("\n");
2325 ProcessData = OutputText(&ProcessData);
2327 SaveData->Append(ProcessData);
2328 ProcessData.clear();
2334 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID,
2335 map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
2336 map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
2337 map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage,
2338 map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens,
2339 wxString *SaveData){
2341 wxString ProcessData = "";
2343 for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
2344 SoundsIter != SoundsList->end(); SoundsIter++){
2346 ProcessData.Append("SOUND");
2348 // Check if there is a value for TYPE.
2350 if ((*SoundsListType)[SoundsIter->first].size() > 0){
2352 ProcessData.Append(";TYPE=");
2353 ProcessData.Append((*SoundsListType)[SoundsIter->first]);
2357 // Check if there is a value for ALTID.
2359 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
2361 ProcessData.Append(";ALTID=");
2362 ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
2366 // Check if there is a value for LANGUAGE.
2368 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
2370 ProcessData.Append(";LANGUAGE=");
2371 ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
2375 // Check if there is a value for MEDIATYPE.
2377 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
2379 ProcessData.Append(";MEDIATYPE=");
2380 ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
2384 // Check if there is a value for PID.
2386 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
2388 ProcessData.Append(";PID=");
2389 ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
2393 // Check if there is a value for PREF.
2395 if ((*SoundsListPref)[SoundsIter->first] > 0){
2397 ProcessData.Append(";PREF=");
2398 ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
2402 // Check if there is a value for tokens.
2404 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
2406 ProcessData.Append(";");
2407 ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
2411 ProcessData.Append(":data:");
2412 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
2413 ProcessData.Append(";");
2414 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
2415 ProcessData.Append(",");
2416 ProcessData.Append(SoundsIter->second);
2417 ProcessData.Append("\n");
2419 ProcessData = OutputText(&ProcessData);
2421 SaveData->Append(ProcessData);
2422 ProcessData.clear();
2428 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
2429 map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
2430 map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
2431 map<int, wxString> *CalendarListTokens, wxString *SaveData){
2433 wxString ProcessData = "";
2435 for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
2436 CalendarIter != CalendarList->end(); CalendarIter++){
2438 ProcessData.Append("CALURI");
2440 // Check if there is a value for TYPE.
2442 if ((*CalendarListType)[CalendarIter->first].size() > 0){
2444 ProcessData.Append(";TYPE=");
2445 ProcessData.Append((*CalendarListType)[CalendarIter->first]);
2449 // Check if there is a value for ALTID.
2451 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2453 ProcessData.Append(";ALTID=");
2454 ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2458 // Check if there is a value for MEDIATYPE.
2460 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2462 ProcessData.Append(";MEDIATYPE=");
2463 ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2467 // Check if there is a value for PID.
2469 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2471 ProcessData.Append(";PID=");
2472 ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2476 // Check if there is a value for PREF.
2478 if ((*CalendarListPref)[CalendarIter->first] > 0){
2480 ProcessData.Append(";PREF=");
2481 ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2485 // Check if there is a value for tokens.
2487 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2489 ProcessData.Append(";");
2490 ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2494 ProcessData.Append(":");
2495 ProcessData.Append(CalendarIter->second);
2496 ProcessData.Append("\n");
2498 ProcessData = OutputText(&ProcessData);
2500 SaveData->Append(ProcessData);
2501 ProcessData.clear();
2507 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2508 map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2509 map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2510 map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2512 wxString ProcessData = "";
2514 for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2515 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2517 ProcessData.Append("CALADRURI");
2519 // Check if there is a value for TYPE.
2521 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2523 ProcessData.Append(";TYPE=");
2524 ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2528 // Check if there is a value for ALTID.
2530 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2532 ProcessData.Append(";ALTID=");
2533 ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2537 // Check if there is a value for MEDIATYPE.
2539 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2541 ProcessData.Append(";MEDIATYPE=");
2542 ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2546 // Check if there is a value for PID.
2548 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2550 ProcessData.Append(";PID=");
2551 ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2555 // Check if there is a value for PREF.
2557 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2559 ProcessData.Append(";PREF=");
2560 ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2564 // Check if there is a value for tokens.
2566 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2568 ProcessData.Append(";");
2569 ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2573 ProcessData.Append(":");
2574 ProcessData.Append(CalendarRequestIter->second);
2575 ProcessData.Append("\n");
2577 ProcessData = OutputText(&ProcessData);
2579 SaveData->Append(ProcessData);
2580 ProcessData.clear();
2586 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID,
2587 std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2588 std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref,
2589 std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2591 wxString ProcessData = "";
2593 for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2594 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2596 ProcessData.Append("FBURL");
2598 // Check if there is a value for TYPE.
2600 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2602 ProcessData.Append(";TYPE=");
2603 ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2607 // Check if there is a value for ALTID.
2609 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2611 ProcessData.Append(";ALTID=");
2612 ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2616 // Check if there is a value for MEDIATYPE.
2618 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2620 ProcessData.Append(";MEDIATYPE=");
2621 ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2625 // Check if there is a value for PID.
2627 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2629 ProcessData.Append(";PID=");
2630 ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2634 // Check if there is a value for PREF.
2636 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2638 ProcessData.Append(";PREF=");
2639 ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2643 // Check if there is a value for tokens.
2645 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2647 ProcessData.Append(";");
2648 ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2652 ProcessData.Append(":");
2653 ProcessData.Append(FreeBusyIter->second);
2654 ProcessData.Append("\n");
2656 ProcessData = OutputText(&ProcessData);
2658 SaveData->Append(ProcessData);
2659 ProcessData.clear();
2665 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID,
2666 map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2667 map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType,
2668 map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref,
2669 map<int, wxString> *KeyListTokens, wxString *SaveData){
2671 wxString ProcessData = "";
2673 for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2674 KeyIter != KeyList->end(); KeyIter++){
2676 ProcessData.Append("KEY");
2678 // Check if there is a value for TYPE.
2680 if ((*KeyListType)[KeyIter->first].size() > 0){
2682 ProcessData.Append(";TYPE=");
2683 ProcessData.Append((*KeyListType)[KeyIter->first]);
2687 // Check if there is a value for ALTID.
2689 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2691 ProcessData.Append(";ALTID=");
2692 ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2696 // Check if there is a value for PID.
2698 if ((*KeyListPID)[KeyIter->first].size() > 0){
2700 ProcessData.Append(";PID=");
2701 ProcessData.Append((*KeyListPID)[KeyIter->first]);
2705 // Check if there is a value for PREF.
2707 if ((*KeyListPref)[KeyIter->first] > 0){
2709 ProcessData.Append(";PREF=");
2710 ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2714 // Check if there is a value for tokens.
2716 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2718 ProcessData.Append(";");
2719 ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2723 ProcessData.Append(":data:");
2724 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2725 ProcessData.Append(";");
2726 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2727 ProcessData.Append(",");
2728 ProcessData.Append(KeyIter->second);
2729 ProcessData.Append("\n");
2731 ProcessData = OutputText(&ProcessData);
2733 SaveData->Append(ProcessData);
2734 ProcessData.clear();
2740 void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN,
2741 map<int, wxString> *VendorListElement, wxString *SaveData){
2743 wxString ProcessData = "";
2745 for (std::map<int, wxString>::iterator VendorIter = VendorList->begin();
2746 VendorIter != VendorList->end(); VendorIter++){
2748 ProcessData.Append("VND-");
2749 ProcessData.Append((*VendorListPEN)[VendorIter->first]);
2750 ProcessData.Append("-");
2751 ProcessData.Append((*VendorListElement)[VendorIter->first]);
2752 ProcessData.Append(":");
2753 ProcessData.Append(VendorIter->second);
2754 ProcessData.Append("\n");
2756 ProcessData = OutputText(&ProcessData);
2758 SaveData->Append(ProcessData);
2759 ProcessData.clear();
2765 void ContactDataObject::SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens,
2766 wxString *SaveData){
2768 wxString ProcessData = "";
2770 for (std::map<int, wxString>::iterator XTokenIter = XTokenList->begin();
2771 XTokenIter != XTokenList->end(); XTokenIter++){
2773 ProcessData.Append("X-");
2774 ProcessData.Append((*XTokenListTokens)[XTokenIter->first]);
2775 ProcessData.Append(":");
2776 ProcessData.Append(XTokenIter->second);
2777 ProcessData.Append("\n");
2779 ProcessData = OutputText(&ProcessData);
2781 SaveData->Append(ProcessData);
2782 ProcessData.clear();