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 SaveNickname(&GeneralNicknamesList, &GeneralNicknamesListAltID,
303 &GeneralNicknamesListPID, &GeneralNicknamesListType,
304 &GeneralNicknamesListLanguage, &GeneralNicknamesListPref,
305 &GeneralNicknamesListTokens, SaveData, "");
306 SaveNickname(&HomeNicknamesList, &HomeNicknamesListAltID,
307 &HomeNicknamesListPID, &HomeNicknamesListType,
308 &HomeNicknamesListLanguage, &HomeNicknamesListPref,
309 &HomeNicknamesListTokens, SaveData, "home");
310 SaveNickname(&BusinessNicknamesList, &BusinessNicknamesListAltID,
311 &BusinessNicknamesListPID, &BusinessNicknamesListType,
312 &BusinessNicknamesListLanguage, &BusinessNicknamesListPref,
313 &BusinessNicknamesListTokens, SaveData, "work");
317 SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
318 &GeneralTitleListAltID, &GeneralTitleListPID,
319 &GeneralTitleListType, &GeneralTitleListPref,
320 &GeneralTitleListTokens, SaveData, "");
321 SaveTitle(&HomeTitleList, &HomeTitleListLanguage,
322 &HomeTitleListAltID, &HomeTitleListPID,
323 &HomeTitleListType, &HomeTitleListPref,
324 &HomeTitleListTokens, SaveData, "home");
325 SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage,
326 &BusinessTitleListAltID, &BusinessTitleListPID,
327 &BusinessTitleListType, &BusinessTitleListPref,
328 &BusinessTitleListTokens, SaveData, "work");
332 SaveTimezone(&GeneralTZList, &GeneralTZListAltID,
333 &GeneralTZListPID, &GeneralTZListType,
334 &GeneralTZListMediatype, &GeneralTZListPref,
335 &GeneralTZListTokens, SaveData, "");
336 SaveTimezone(&HomeTZList, &HomeTZListAltID,
337 &HomeTZListPID, &HomeTZListType,
338 &HomeTZListMediatype, &HomeTZListPref,
339 &HomeTZListTokens, SaveData, "home");
340 SaveTimezone(&BusinessTZList, &BusinessTZListAltID,
341 &BusinessTZListPID, &BusinessTZListType,
342 &BusinessTZListMediatype, &BusinessTZListPref,
343 &BusinessTZListTokens, SaveData, "work");
347 SaveAddress(&GeneralAddressList, &GeneralAddressListTown,
348 &GeneralAddressListCounty, &GeneralAddressListPostCode,
349 &GeneralAddressListCountry, &GeneralAddressListLabel,
350 &GeneralAddressListLang, &GeneralAddressListAltID,
351 &GeneralAddressListPID, &GeneralAddressListGeo,
352 &GeneralAddressListTimezone, &GeneralAddressListType,
353 &GeneralAddressListMediatype, &GeneralAddressListPref,
354 &GeneralAddressListTokens, SaveData, "");
355 SaveAddress(&HomeAddressList, &HomeAddressListTown,
356 &HomeAddressListCounty, &HomeAddressListPostCode,
357 &HomeAddressListCountry, &HomeAddressListLabel,
358 &HomeAddressListLang, &HomeAddressListAltID,
359 &HomeAddressListPID, &HomeAddressListGeo,
360 &HomeAddressListTimezone, &HomeAddressListType,
361 &HomeAddressListMediatype, &HomeAddressListPref,
362 &HomeAddressListTokens, SaveData, "home");
363 SaveAddress(&BusinessAddressList, &BusinessAddressListTown,
364 &BusinessAddressListCounty, &BusinessAddressListPostCode,
365 &BusinessAddressListCountry, &BusinessAddressListLabel,
366 &BusinessAddressListLang, &BusinessAddressListAltID,
367 &BusinessAddressListPID, &BusinessAddressListGeo,
368 &BusinessAddressListTimezone, &BusinessAddressListType,
369 &BusinessAddressListMediatype, &BusinessAddressListPref,
370 &BusinessAddressListTokens, SaveData, "work");
374 SaveEmail(&GeneralEmailList, &GeneralEmailListAltID,
375 &GeneralEmailListPID, &GeneralEmailListType,
376 &GeneralEmailListPref, &GeneralEmailListTokens,
378 SaveEmail(&HomeEmailList, &HomeEmailListAltID,
379 &HomeEmailListPID, &HomeEmailListType,
380 &HomeEmailListPref, &HomeEmailListTokens,
382 SaveEmail(&BusinessEmailList, &BusinessEmailListAltID,
383 &BusinessEmailListPID, &BusinessEmailListType,
384 &BusinessEmailListPref, &BusinessEmailListTokens,
389 SaveIMPP(&GeneralIMList, &GeneralIMListAltID,
390 &GeneralIMListPID, &GeneralIMListType,
391 &GeneralIMListTypeInfo, &GeneralIMListMediatype,
392 &GeneralIMListPref, &GeneralIMListTokens,
394 SaveIMPP(&HomeIMList, &HomeIMListAltID,
395 &HomeIMListPID, &HomeIMListType,
396 &HomeIMListTypeInfo, &HomeIMListMediatype,
397 &HomeIMListPref, &HomeIMListTokens,
399 SaveIMPP(&BusinessIMList, &BusinessIMListAltID,
400 &BusinessIMListPID, &BusinessIMListType,
401 &BusinessIMListTypeInfo, &BusinessIMListMediatype,
402 &BusinessIMListPref, &BusinessIMListTokens,
407 SaveTelephone(&GeneralTelephoneList, &GeneralTelephoneListAltID,
408 &GeneralTelephoneListPID, &GeneralTelephoneListType,
409 &GeneralTelephoneListTypeInfo, &GeneralTelephoneListDataType,
410 &GeneralTelephoneListPref, &GeneralTelephoneListTokens,
412 SaveTelephone(&HomeTelephoneList, &HomeTelephoneListAltID,
413 &HomeTelephoneListPID, &HomeTelephoneListType,
414 &HomeTelephoneListTypeInfo, &HomeTelephoneListDataType,
415 &HomeTelephoneListPref, &HomeTelephoneListTokens,
417 SaveTelephone(&BusinessTelephoneList, &BusinessTelephoneListAltID,
418 &BusinessTelephoneListPID, &BusinessTelephoneListType,
419 &BusinessTelephoneListTypeInfo, &BusinessTelephoneListDataType,
420 &BusinessTelephoneListPref, &BusinessTelephoneListTokens,
425 SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID,
426 &GeneralLanguageListPID, &GeneralLanguageListType,
427 &GeneralLanguageListPref, &GeneralLanguageListTokens,
429 SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID,
430 &HomeLanguageListPID, &HomeLanguageListType,
431 &HomeLanguageListPref, &HomeLanguageListTokens,
433 SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID,
434 &BusinessLanguageListPID, &BusinessLanguageListType,
435 &BusinessLanguageListPref, &BusinessLanguageListTokens,
440 SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID,
441 &GeneralGeographyListPID, &GeneralGeographyListType,
442 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
443 &GeneralGeographyListPref, &GeneralGeographyListTokens,
445 SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID,
446 &HomeGeographyListPID, &HomeGeographyListType,
447 &HomeGeographyListMediatype, &HomeGeographyListDataType,
448 &HomeGeographyListPref, &HomeGeographyListTokens,
450 SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID,
451 &BusinessGeographyListPID, &BusinessGeographyListType,
452 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
453 &BusinessGeographyListPref, &BusinessGeographyListTokens,
460 for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
461 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
463 ProcessData.Append("RELATED");
465 // Check if there is a value for TYPE.
467 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
469 wxString RelatedType = "";
471 ProcessData.Append(";TYPE=");
473 if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
475 RelatedType = wxT("contact");
477 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
479 RelatedType = wxT("acquaintance");
481 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
483 RelatedType = wxT("friend");
485 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
487 RelatedType = wxT("met");
489 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
491 RelatedType = wxT("co-worker");
493 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
495 RelatedType = wxT("colleague");
497 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
499 RelatedType = wxT("co-resident");
501 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
503 RelatedType = wxT("neighbor");
505 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
507 RelatedType = wxT("child");
509 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
511 RelatedType = wxT("parent");
513 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
515 RelatedType = wxT("sibling");
517 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
519 RelatedType = wxT("spouse");
521 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
523 RelatedType = wxT("kin");
525 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
527 RelatedType = wxT("muse");
529 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
531 RelatedType = wxT("crush");
533 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
535 RelatedType = wxT("date");
537 } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
539 RelatedType = wxT("sweetheart");
541 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
543 RelatedType = wxT("me");
545 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
547 RelatedType = wxT("agent");
549 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
551 RelatedType = wxT("emergency");
555 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
559 ProcessData.Append(RelatedType);
563 // Check if there is a value for LANGUAGE.
565 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
567 ProcessData.Append(";LANGUAGE=");
568 ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
572 // Check if there is a value for ALTID.
574 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
576 ProcessData.Append(";ALTID=");
577 ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
581 // Check if there is a value for PID.
583 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
585 ProcessData.Append(";PID=");
586 ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
590 // Check if there is a value for PREF.
592 if (GeneralRelatedListPref[RelatedIter->first] > 0){
594 ProcessData.Append(";PREF=");
595 ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
599 // Check if there is a value for tokens.
601 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
603 ProcessData.Append(";");
604 ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
608 ProcessData.Append(":");
609 ProcessData.Append(RelatedIter->second);
610 ProcessData.Append("\n");
612 ProcessData = OutputText(&ProcessData);
614 SaveData->Append(ProcessData);
621 SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID,
622 &GeneralWebsiteListPID, &GeneralWebsiteListType,
623 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref,
624 &GeneralWebsiteListTokens, SaveData, "");
625 SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID,
626 &HomeWebsiteListPID, &HomeWebsiteListType,
627 &HomeWebsiteListMediatype, &HomeWebsiteListPref,
628 &HomeWebsiteListTokens, SaveData, "home");
629 SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID,
630 &BusinessWebsiteListPID, &BusinessWebsiteListType,
631 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref,
632 &BusinessWebsiteListTokens, SaveData, "work");
636 SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
637 &GeneralRoleListAltID, &GeneralRoleListPID,
638 &GeneralRoleListType, &GeneralRoleListPref,
639 &GeneralRoleListTokens, SaveData, "");
640 SaveRole(&HomeRoleList, &HomeRoleListLanguage,
641 &HomeRoleListAltID, &HomeRoleListPID,
642 &HomeRoleListType, &HomeRoleListPref,
643 &HomeRoleListTokens, SaveData, "home");
644 SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
645 &BusinessRoleListAltID, &BusinessRoleListPID,
646 &BusinessRoleListType, &BusinessRoleListPref,
647 &BusinessRoleListTokens, SaveData, "work");
651 SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
652 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage,
653 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType,
654 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens,
656 SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
657 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage,
658 &HomeOrganisationsListSortAs, &HomeOrganisationsListType,
659 &HomeOrganisationsListPref, &HomeOrganisationsListTokens,
661 SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
662 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage,
663 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType,
664 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens,
669 SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
670 &GeneralNoteListAltID, &GeneralNoteListPID,
671 &GeneralNoteListType, &GeneralNoteListPref,
672 &GeneralNoteListTokens, SaveData, "");
673 SaveNote(&HomeNoteList, &HomeNoteListLanguage,
674 &HomeNoteListAltID, &HomeNoteListPID,
675 &HomeNoteListType, &HomeNoteListPref,
676 &HomeNoteListTokens, SaveData, "home");
677 SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
678 &BusinessNoteListAltID, &BusinessNoteListPID,
679 &BusinessNoteListType, &BusinessNoteListPref,
680 &BusinessNoteListTokens, SaveData, "work");
682 // Process CATEGORIES.
684 SaveCategory(&CategoriesList, &CategoriesListLanguage,
685 &CategoriesListAltID, &CategoriesListPID,
686 &CategoriesListType, &CategoriesListPref,
687 &CategoriesListTokens, SaveData);
691 SavePhoto(&PicturesList, &PicturesListAltID,
692 &PicturesListPID, &PicturesListType,
693 &PicturesListPicEncType, &PicturesListPictureType,
694 &PicturesListMediatype, &PicturesListPref,
695 &PicturesListTokens, SaveData);
699 SaveLogo(&LogosList, &LogosListAltID,
700 &LogosListPID, &LogosListType,
701 &LogosListPicEncType, &LogosListPictureType,
702 &LogosListMediatype, &LogosListPref,
703 &LogosListTokens, SaveData);
707 SaveSound(&SoundsList, &SoundsListAltID,
708 &SoundsListPID, &SoundsListType,
709 &SoundsListAudioEncType, &SoundsListAudioType,
710 &SoundsListMediatype, &SoundsListLanguage,
711 &SoundsListPref, &SoundsListTokens,
716 SaveCalendarURI(&CalendarList, &CalendarListMediatype,
717 &CalendarListAltID, &CalendarListPID,
718 &CalendarListType, &CalendarListPref,
719 &CalendarListTokens, SaveData);
721 // Process CALADRURI.
723 SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
724 &CalendarRequestListAltID, &CalendarRequestListPID,
725 &CalendarRequestListType, &CalendarRequestListPref,
726 &CalendarRequestListTokens, SaveData);
730 SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID,
731 &FreeBusyListPID, &FreeBusyListType,
732 &FreeBusyListMediatype, &FreeBusyListPref,
733 &FreeBusyListTokens, SaveData);
737 SaveKey(&KeyList, &KeyListAltID,
738 &KeyListPID, &KeyListType,
739 &KeyListKeyType, &KeyListDataEncType,
740 &KeyListDataType, &KeyListPref,
741 &KeyListTokens, SaveData);
745 SaveVendor(&VendorList, &VendorListPEN,
746 &VendorListElement, SaveData);
750 SaveXToken(&XTokenList, &XTokenListTokens,
753 // Write the end part of the vCard data file.
755 SaveData->Append("END:VCARD");
757 SaveDataStatus = CONTACTSAVE_OK;
759 return SaveDataStatus;
763 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
764 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
765 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
766 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
768 wxString ProcessData = "";
770 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
771 TitleIter != TitleList->end(); TitleIter++){
773 ProcessData.Append("TITLE");
775 // Check if there is a value for TYPE.
777 if (DataType.size() > 0){
779 ProcessData.Append(";TYPE=");
780 ProcessData.Append(DataType);
784 // Check if there is a value for ALTID.
786 if ((*TitleListAltID)[TitleIter->first].size() > 0){
788 ProcessData.Append(";ALTID=");
789 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
793 // Check if there is a value for LANGUAGE.
795 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
797 ProcessData.Append(";LANGUAGE=");
798 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
802 // Check if there is a value for PID.
804 if ((*TitleListPID)[TitleIter->first].size() > 0){
806 ProcessData.Append(";PID=");
807 ProcessData.Append((*TitleListPID)[TitleIter->first]);
811 // Check if there is a value for PREF.
813 if ((*TitleListPref)[TitleIter->first] > 0){
815 ProcessData.Append(";PREF=");
816 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
820 // Check if there is a value for tokens.
822 if ((*TitleListTokens)[TitleIter->first].size() > 0){
824 ProcessData.Append(";");
825 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
829 ProcessData.Append(":");
830 ProcessData.Append(TitleIter->second);
831 ProcessData.Append("\n");
833 ProcessData = OutputText(&ProcessData);
835 SaveData->Append(ProcessData);
842 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
843 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
844 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
845 map<int, wxString> *SourceListTokens, wxString *SaveData){
847 wxString ProcessData = "";
849 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
850 SourceIter != SourceList->end(); SourceIter++){
852 ProcessData.Append("SOURCE");
854 // Check if there is a value for TYPE.
856 if ((*SourceListType)[SourceIter->first].size() > 0){
858 ProcessData.Append(";TYPE=");
859 ProcessData.Append((*SourceListType)[SourceIter->first]);
863 // Check if there is a value for ALTID.
865 if ((*SourceListAltID)[SourceIter->first].size() > 0){
867 ProcessData.Append(";ALTID=");
868 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
872 // Check if there is a value for MEDIATYPE.
874 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
876 ProcessData.Append(";MEDIATYPE=");
877 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
881 // Check if there is a value for PID.
883 if ((*SourceListPID)[SourceIter->first].size() > 0){
885 ProcessData.Append(";PID=");
886 ProcessData.Append((*SourceListPID)[SourceIter->first]);
890 // Check if there is a value for PREF.
892 if ((*SourceListPref)[SourceIter->first] > 0){
894 ProcessData.Append(";PREF=");
895 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
899 // Check if there is a value for tokens.
901 if ((*SourceListTokens)[SourceIter->first].size() > 0){
903 ProcessData.Append(";");
904 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
908 ProcessData.Append(":");
909 ProcessData.Append(SourceIter->second);
910 ProcessData.Append("\n");
912 ProcessData = OutputText(&ProcessData);
914 SaveData->Append(ProcessData);
921 void ContactDataObject::SaveMember(std::map<int, wxString> *GroupsList, std::map<int, wxString> *GroupsListAltID,
922 std::map<int, wxString> *GroupsListPID, std::map<int, wxString> *GroupsListType,
923 std::map<int, wxString> *GroupsListMediaType, std::map<int, int> *GroupsListPref,
924 std::map<int, wxString> *GroupsListTokens, wxString *SaveData){
926 wxString ProcessData = "";
928 for (std::map<int, wxString>::iterator GroupsIter = GroupsList->begin();
929 GroupsIter != GroupsList->end(); GroupsIter++){
931 ProcessData.Append("MEMBER");
933 // Check if there is a value for TYPE.
935 if ((*GroupsListType)[GroupsIter->first].size() > 0){
937 ProcessData.Append(";TYPE=");
938 ProcessData.Append((*GroupsListType)[GroupsIter->first]);
942 // Check if there is a value for ALTID.
944 if ((*GroupsListAltID)[GroupsIter->first].size() > 0){
946 ProcessData.Append(";ALTID=");
947 ProcessData.Append((*GroupsListAltID)[GroupsIter->first]);
951 // Check if there is a value for MEDIATYPE.
953 if ((*GroupsListMediaType)[GroupsIter->first].size() > 0){
955 ProcessData.Append(";MEDIATYPE=");
956 ProcessData.Append((*GroupsListMediaType)[GroupsIter->first]);
960 // Check if there is a value for PID.
962 if ((*GroupsListPID)[GroupsIter->first].size() > 0){
964 ProcessData.Append(";PID=");
965 ProcessData.Append((*GroupsListPID)[GroupsIter->first]);
969 // Check if there is a value for PREF.
971 if ((*GroupsListPref)[GroupsIter->first] > 0){
973 ProcessData.Append(";PREF=");
974 ProcessData.Append(wxString::Format("%i", (*GroupsListPref)[GroupsIter->first]));
978 // Check if there is a value for tokens.
980 if ((*GroupsListTokens)[GroupsIter->first].size() > 0){
982 ProcessData.Append(";");
983 ProcessData.Append((*GroupsListTokens)[GroupsIter->first]);
987 ProcessData.Append(":");
988 ProcessData.Append(GroupsIter->second);
989 ProcessData.Append("\n");
991 ProcessData = OutputText(&ProcessData);
993 SaveData->Append(ProcessData);
1000 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
1001 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
1002 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
1003 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
1005 wxString ProcessData = "";
1007 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
1008 NicknameIter != NicknameList->end(); NicknameIter++){
1010 ProcessData.Append("NICKNAME");
1012 // Check if there is a value for TYPE.
1014 if (DataType.size() > 0){
1016 ProcessData.Append(";TYPE=");
1017 ProcessData.Append(DataType);
1021 // Check if there is a value for ALTID.
1023 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
1025 ProcessData.Append(";ALTID=");
1026 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
1030 // Check if there is a value for MEDIATYPE.
1032 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
1034 ProcessData.Append(";LANGUAGE=");
1035 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
1039 // Check if there is a value for PID.
1041 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
1043 ProcessData.Append(";PID=");
1044 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
1048 // Check if there is a value for PREF.
1050 if ((*NicknameListPref)[NicknameIter->first] > 0){
1052 ProcessData.Append(";PREF=");
1053 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
1057 // Check if there is a value for tokens.
1059 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
1061 ProcessData.Append(";");
1062 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
1066 ProcessData.Append(":");
1067 ProcessData.Append(NicknameIter->second);
1068 ProcessData.Append("\n");
1070 ProcessData = OutputText(&ProcessData);
1072 SaveData->Append(ProcessData);
1073 ProcessData.clear();
1079 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
1080 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
1081 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
1082 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
1084 wxString ProcessData = "";
1086 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
1087 TZIter != TZList->end(); TZIter++){
1089 ProcessData.Append("TZ");
1091 // Check if there is a value for TYPE.
1093 if (DataType.size() > 0){
1095 ProcessData.Append(";TYPE=");
1096 ProcessData.Append(DataType);
1100 // Check if there is a value for ALTID.
1102 if ((*TZListAltID)[TZIter->first].size() > 0){
1104 ProcessData.Append(";ALTID=");
1105 ProcessData.Append((*TZListAltID)[TZIter->first]);
1109 // Check if there is a value for MEDIATYPE.
1111 if ((*TZListMediatype)[TZIter->first].size() > 0){
1113 ProcessData.Append(";MEDIATYPE=");
1114 ProcessData.Append((*TZListMediatype)[TZIter->first]);
1118 // Check if there is a value for PID.
1120 if ((*TZListPID)[TZIter->first].size() > 0){
1122 ProcessData.Append(";PID=");
1123 ProcessData.Append((*TZListPID)[TZIter->first]);
1127 // Check if there is a value for PREF.
1129 if ((*TZListPref)[TZIter->first] > 0){
1131 ProcessData.Append(";PREF=");
1132 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
1136 // Check if there is a value for tokens.
1138 if ((*TZListTokens)[TZIter->first].size() > 0){
1140 ProcessData.Append(";");
1141 ProcessData.Append((*TZListTokens)[TZIter->first]);
1145 ProcessData.Append(":");
1146 ProcessData.Append(TZIter->second);
1147 ProcessData.Append("\n");
1149 ProcessData = OutputText(&ProcessData);
1151 SaveData->Append(ProcessData);
1152 ProcessData.clear();
1158 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
1159 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
1160 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
1161 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
1162 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
1163 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
1164 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
1165 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
1167 wxString ProcessData = "";
1169 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
1170 AddressIter != AddressList->end(); AddressIter++){
1172 ProcessData.Append("ADR");
1174 // Check if there is a value for TYPE.
1176 if (DataType.size() > 0){
1178 ProcessData.Append(";TYPE=");
1179 ProcessData.Append(DataType);
1183 // Check if there is a value for ALTID.
1185 if ((*AddressListAltID)[AddressIter->first].size() > 0){
1187 ProcessData.Append(";ALTID=");
1188 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
1192 // Check if there is a value for GEO.
1194 if ((*AddressListGeo)[AddressIter->first].size() > 0){
1196 ProcessData.Append(";GEO=\"");
1197 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
1198 ProcessData.Append("\"");
1202 // Check if there is a value for LABEL.
1204 if ((*AddressListLabel)[AddressIter->first].size() > 0){
1206 wxString AddressProcessed = "";
1207 AddressProcessed = (*AddressListLabel)[AddressIter->first];
1209 AddressProcessed.Replace("\n", "\\n", true);
1211 ProcessData.Append(";LABEL=");
1212 ProcessData.Append(AddressProcessed);
1216 // Check if there is a value for LANGUAGE.
1218 if ((*AddressListLang)[AddressIter->first].size() > 0){
1220 ProcessData.Append(";LANGUAGE=");
1221 ProcessData.Append((*AddressListLang)[AddressIter->first]);
1225 // Check if there is a value for MEDIATYPE.
1227 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1229 ProcessData.Append(";MEDIATYPE=");
1230 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1234 // Check if there is a value for PID.
1236 if ((*AddressListPID)[AddressIter->first].size() > 0){
1238 ProcessData.Append(";PID=");
1239 ProcessData.Append((*AddressListPID)[AddressIter->first]);
1243 // Check if there is a value for PREF.
1245 if ((*AddressListPref)[AddressIter->first] > 0){
1247 ProcessData.Append(";PREF=");
1248 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1252 // Check if there is a value for TZ.
1254 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1256 ProcessData.Append(";TZ=");
1257 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1261 // Check if there is a value for tokens.
1263 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1265 ProcessData.Append(";");
1266 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1270 // Build the address.
1272 ProcessData.Append(":;;");
1273 ProcessData.Append((*AddressList)[AddressIter->first]);
1274 ProcessData.Append(";");
1275 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1276 ProcessData.Append(";");
1277 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1278 ProcessData.Append(";");
1279 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1280 ProcessData.Append(";");
1281 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1282 ProcessData.Append("\n");
1284 ProcessData = OutputText(&ProcessData);
1286 SaveData->Append(ProcessData);
1287 ProcessData.clear();
1293 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1294 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1295 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1296 wxString *SaveData, wxString DataType){
1298 wxString ProcessData = "";
1300 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1301 EmailIter != EmailList->end(); EmailIter++){
1303 ProcessData.Append("EMAIL");
1305 // Check if there is a value for TYPE.
1307 if (DataType.size() > 0){
1309 ProcessData.Append(";TYPE=");
1310 ProcessData.Append(DataType);
1314 // Check if there is a value for ALTID.
1316 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1318 ProcessData.Append(";ALTID=");
1319 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1323 // Check if there is a value for PID.
1325 if ((*EmailListPID)[EmailIter->first].size() > 0){
1327 ProcessData.Append(";PID=");
1328 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1332 // Check if there is a value for PREF.
1334 if ((*EmailListPref)[EmailIter->first] > 0){
1336 ProcessData.Append(";PREF=");
1337 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1341 // Check if there is a value for tokens.
1343 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1345 ProcessData.Append(";");
1346 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1350 ProcessData.Append(":");
1351 ProcessData.Append(EmailIter->second);
1352 ProcessData.Append("\n");
1354 ProcessData = OutputText(&ProcessData);
1356 SaveData->Append(ProcessData);
1357 ProcessData.clear();
1363 void ContactDataObject::SaveIMPP(map<int, wxString> *IMList, map<int, wxString> *IMListAltID,
1364 map<int, wxString> *IMListPID, map<int, wxString> *IMListType,
1365 map<int, wxString> *IMListTypeInfo, map<int, wxString> *IMListMediatype,
1366 map<int, int> *IMListPref, map<int, wxString> *IMListTokens,
1367 wxString *SaveData, wxString DataType){
1369 wxString ProcessData = "";
1371 for (std::map<int, wxString>::iterator IMIter = IMList->begin();
1372 IMIter != IMList->end(); IMIter++){
1374 ProcessData.Append("IMPP");
1376 // Check if there is a value for TYPE.
1378 if (DataType.size() > 0){
1380 ProcessData.Append(";TYPE=");
1381 ProcessData.Append(DataType);
1385 // Check if there is a value for ALTID.
1387 if ((*IMListAltID)[IMIter->first].size() > 0){
1389 ProcessData.Append(";ALTID=");
1390 ProcessData.Append((*IMListAltID)[IMIter->first]);
1394 // Check if there is a value for MEDIATYPE.
1396 if ((*IMListMediatype)[IMIter->first].size() > 0){
1398 ProcessData.Append(";MEDIATYPE=");
1399 ProcessData.Append((*IMListMediatype)[IMIter->first]);
1403 // Check if there is a value for PID.
1405 if ((*IMListPID)[IMIter->first].size() > 0){
1407 ProcessData.Append(";PID=");
1408 ProcessData.Append((*IMListPID)[IMIter->first]);
1412 // Check if there is a value for PREF.
1414 if ((*IMListPref)[IMIter->first] > 0){
1416 ProcessData.Append(";PREF=");
1417 ProcessData.Append(wxString::Format("%i", (*IMListPref)[IMIter->first]));
1421 // Check if there is a value for tokens.
1423 if ((*IMListTokens)[IMIter->first].size() > 0){
1425 ProcessData.Append(";");
1426 ProcessData.Append((*IMListTokens)[IMIter->first]);
1430 ProcessData.Append(":");
1431 ProcessData.Append((*IMListTypeInfo)[IMIter->first]);
1432 ProcessData.Append(":");
1433 ProcessData.Append(IMIter->second);
1434 ProcessData.Append("\n");
1436 ProcessData = OutputText(&ProcessData);
1438 SaveData->Append(ProcessData);
1439 ProcessData.clear();
1445 void ContactDataObject::SaveTelephone(map<int, wxString> *TelephoneList, map<int, wxString> *TelephoneListAltID,
1446 map<int, wxString> *TelephoneListPID, map<int, wxString> *TelephoneListType,
1447 map<int, wxString> *TelephoneListTypeInfo, map<int, wxString> *TelephoneListDataType,
1448 map<int, int> *TelephoneListPref, map<int, wxString> *TelephoneListTokens,
1449 wxString *SaveData, wxString DataType){
1451 wxString ProcessData = "";
1453 for (std::map<int, wxString>::iterator TelephoneIter = TelephoneList->begin();
1454 TelephoneIter != TelephoneList->end(); TelephoneIter++){
1456 ProcessData.Append("TEL");
1458 // Check if there is a value for TYPE.
1460 if (DataType.size() > 0 || (*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1462 ProcessData.Append(";TYPE=\"");
1464 bool ProcessedType = false;
1466 if (DataType.size() > 0){
1468 ProcessData.Append(DataType);
1469 ProcessedType = true;
1473 if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1475 if (ProcessedType == true){
1476 ProcessData.Append(",");
1478 ProcessData.Append((*TelephoneListTypeInfo)[TelephoneIter->first]);
1482 ProcessData.Append("\"");
1486 // Check if there is a value for ALTID.
1488 if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1490 ProcessData.Append(";ALTID=");
1491 ProcessData.Append((*TelephoneListAltID)[TelephoneIter->first]);
1495 // Check if there is a value for PID.
1497 if ((*TelephoneListPID)[TelephoneIter->first].size() > 0){
1499 ProcessData.Append(";PID=");
1500 ProcessData.Append((*TelephoneListPID)[TelephoneIter->first]);
1504 // Check if there is a value for PREF.
1506 if ((*TelephoneListPref)[TelephoneIter->first] > 0){
1508 ProcessData.Append(";PREF=");
1509 ProcessData.Append(wxString::Format("%i", (*TelephoneListPref)[TelephoneIter->first]));
1513 // Check if there is a value for tokens.
1515 if ((*TelephoneListTokens)[TelephoneIter->first].size() > 0){
1517 ProcessData.Append(";");
1518 ProcessData.Append((*TelephoneListTokens)[TelephoneIter->first]);
1522 ProcessData.Append(":");
1523 ProcessData.Append((*TelephoneListDataType)[TelephoneIter->first]);
1524 ProcessData.Append(":");
1525 ProcessData.Append(TelephoneIter->second);
1526 ProcessData.Append("\n");
1528 ProcessData = OutputText(&ProcessData);
1530 SaveData->Append(ProcessData);
1531 ProcessData.clear();
1537 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1538 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1539 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1540 wxString *SaveData, wxString DataType){
1542 wxString ProcessData = "";
1544 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1545 LanguageIter != LanguageList->end(); LanguageIter++){
1547 ProcessData.Append("LANG");
1549 // Check if there is a value for TYPE.
1551 if (DataType.size() > 0){
1553 ProcessData.Append(";TYPE=");
1554 ProcessData.Append(DataType);
1558 // Check if there is a value for ALTID.
1560 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1562 ProcessData.Append(";ALTID=");
1563 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1567 // Check if there is a value for PID.
1569 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1571 ProcessData.Append(";PID=");
1572 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1576 // Check if there is a value for PREF.
1578 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1580 ProcessData.Append(";PREF=");
1581 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1585 // Check if there is a value for tokens.
1587 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1589 ProcessData.Append(";");
1590 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1594 ProcessData.Append(":");
1595 ProcessData.Append(LanguageIter->second);
1596 ProcessData.Append("\n");
1598 ProcessData = OutputText(&ProcessData);
1600 SaveData->Append(ProcessData);
1601 ProcessData.clear();
1607 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1608 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1609 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1610 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1611 wxString *SaveData, wxString DataType){
1613 wxString ProcessData = "";
1615 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1616 GeographyIter != GeographyList->end(); GeographyIter++){
1618 ProcessData.Append("GEO");
1620 // Check if there is a value for TYPE.
1622 if (DataType.size() > 0){
1624 ProcessData.Append(";TYPE=");
1625 ProcessData.Append(DataType);
1629 // Check if there is a value for ALTID.
1631 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1633 ProcessData.Append(";ALTID=");
1634 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1638 // Check if there is a value for MEDIATYPE.
1640 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1642 ProcessData.Append(";MEDIATYPE=");
1643 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1647 // Check if there is a value for PID.
1649 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1651 ProcessData.Append(";PID=");
1652 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1656 // Check if there is a value for PREF.
1658 if ((*GeographyListPref)[GeographyIter->first] > 0){
1660 ProcessData.Append(";PREF=");
1661 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1665 // Check if there is a value for tokens.
1667 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1669 ProcessData.Append(";");
1670 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1674 ProcessData.Append(":");
1675 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1676 ProcessData.Append(":");
1677 ProcessData.Append(GeographyIter->second);
1678 ProcessData.Append("\n");
1680 ProcessData = OutputText(&ProcessData);
1682 SaveData->Append(ProcessData);
1683 ProcessData.clear();
1689 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1690 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1691 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1692 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1694 wxString ProcessData = "";
1696 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1697 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1699 ProcessData.Append("URL");
1701 // Check if there is a value for TYPE.
1703 if (DataType.size() > 0){
1705 ProcessData.Append(";TYPE=");
1706 ProcessData.Append(DataType);
1710 // Check if there is a value for ALTID.
1712 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1714 ProcessData.Append(";ALTID=");
1715 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1719 // Check if there is a value for MEDIATYPE.
1721 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1723 ProcessData.Append(";MEDIATYPE=");
1724 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1728 // Check if there is a value for PID.
1730 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1732 ProcessData.Append(";PID=");
1733 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1737 // Check if there is a value for PREF.
1739 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1741 ProcessData.Append(";PREF=");
1742 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1746 // Check if there is a value for tokens.
1748 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1750 ProcessData.Append(";");
1751 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1755 ProcessData.Append(":");
1756 ProcessData.Append(WebsiteIter->second);
1757 ProcessData.Append("\n");
1759 ProcessData = OutputText(&ProcessData);
1761 SaveData->Append(ProcessData);
1762 ProcessData.clear();
1768 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1769 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1770 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1771 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1773 wxString ProcessData = "";
1775 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1776 RoleIter != RoleList->end(); RoleIter++){
1778 ProcessData.Append("ROLE");
1780 // Check if there is a value for TYPE.
1782 if (DataType.size() > 0){
1784 ProcessData.Append(";TYPE=");
1785 ProcessData.Append(DataType);
1789 // Check if there is a value for ALTID.
1791 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1793 ProcessData.Append(";ALTID=");
1794 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1798 // Check if there is a value for LANGUAGE.
1800 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1802 ProcessData.Append(";LANGUAGE=");
1803 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1807 // Check if there is a value for PID.
1809 if ((*RoleListPID)[RoleIter->first].size() > 0){
1811 ProcessData.Append(";PID=");
1812 ProcessData.Append((*RoleListPID)[RoleIter->first]);
1816 // Check if there is a value for PREF.
1818 if ((*RoleListPref)[RoleIter->first] > 0){
1820 ProcessData.Append(";PREF=");
1821 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1825 // Check if there is a value for tokens.
1827 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1829 ProcessData.Append(";");
1830 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1834 ProcessData.Append(":");
1835 ProcessData.Append(RoleIter->second);
1836 ProcessData.Append("\n");
1838 ProcessData = OutputText(&ProcessData);
1840 SaveData->Append(ProcessData);
1841 ProcessData.clear();
1847 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1848 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
1849 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
1850 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
1851 wxString *SaveData, wxString DataType){
1853 wxString ProcessData = "";
1855 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1856 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1858 ProcessData.Append("ORG");
1860 // Check if there is a value for TYPE.
1862 if (DataType.size() > 0){
1864 ProcessData.Append(";TYPE=");
1865 ProcessData.Append(DataType);
1869 // Check if there is a value for ALTID.
1871 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1873 ProcessData.Append(";ALTID=");
1874 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1878 // Check if there is a value for LANGUAGE.
1880 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1882 ProcessData.Append(";LANGUAGE=");
1883 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1887 // Check if there is a value for PID.
1889 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1891 ProcessData.Append(";PID=");
1892 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1896 // Check if there is a value for PREF.
1898 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1900 ProcessData.Append(";PREF=");
1901 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1905 // Check if there is a value for SORT-AS.
1907 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1909 ProcessData.Append(";SORT-AS=\"");
1910 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1911 ProcessData.Append("\"");
1915 // Check if there is a value for tokens.
1917 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1919 ProcessData.Append(";");
1920 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1924 ProcessData.Append(":");
1925 ProcessData.Append(OrganisationIter->second);
1926 ProcessData.Append("\n");
1928 ProcessData = OutputText(&ProcessData);
1930 SaveData->Append(ProcessData);
1931 ProcessData.clear();
1937 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1938 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1939 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1940 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1942 wxString ProcessData = "";
1944 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1945 NoteIter != NoteList->end(); NoteIter++){
1947 ProcessData.Append("NOTE");
1949 // Check if there is a value for TYPE.
1951 if (DataType.size() > 0){
1953 ProcessData.Append(";TYPE=");
1954 ProcessData.Append(DataType);
1958 // Check if there is a value for ALTID.
1960 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1962 ProcessData.Append(";ALTID=");
1963 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1967 // Check if there is a value for LANGUAGE.
1969 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1971 ProcessData.Append(";LANGUAGE=");
1972 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1976 // Check if there is a value for PID.
1978 if ((*NoteListPID)[NoteIter->first].size() > 0){
1980 ProcessData.Append(";PID=");
1981 ProcessData.Append((*NoteListPID)[NoteIter->first]);
1985 // Check if there is a value for PREF.
1987 if ((*NoteListPref)[NoteIter->first] > 0){
1989 ProcessData.Append(";PREF=");
1990 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1994 // Check if there is a value for tokens.
1996 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1998 ProcessData.Append(";");
1999 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
2003 ProcessData.Append(":");
2004 ProcessData.Append(NoteIter->second);
2005 ProcessData.Replace("\n", "\\n", true);
2006 ProcessData.Append("\n");
2008 ProcessData = OutputText(&ProcessData);
2010 SaveData->Append(ProcessData);
2011 ProcessData.clear();
2017 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
2018 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
2019 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
2020 map<int, wxString> *CategoryListTokens, wxString *SaveData){
2022 wxString ProcessData = "";
2024 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
2025 CategoryIter != CategoryList->end(); CategoryIter++){
2027 ProcessData.Append("CATEGORIES");
2029 // Check if there is a value for TYPE.
2031 if ((*CategoryListType)[CategoryIter->first].size() > 0){
2033 ProcessData.Append(";TYPE=");
2034 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
2038 // Check if there is a value for ALTID.
2040 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
2042 ProcessData.Append(";ALTID=");
2043 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
2047 // Check if there is a value for LANGUAGE.
2049 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
2051 ProcessData.Append(";LANGUAGE=");
2052 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
2056 // Check if there is a value for PID.
2058 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
2060 ProcessData.Append(";PID=");
2061 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
2065 // Check if there is a value for PREF.
2067 if ((*CategoryListPref)[CategoryIter->first] > 0){
2069 ProcessData.Append(";PREF=");
2070 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
2074 // Check if there is a value for tokens.
2076 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
2078 ProcessData.Append(";");
2079 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
2083 ProcessData.Append(":");
2084 ProcessData.Append(CategoryIter->second);
2085 ProcessData.Append("\n");
2087 ProcessData = OutputText(&ProcessData);
2089 SaveData->Append(ProcessData);
2090 ProcessData.clear();
2096 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
2097 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
2098 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
2099 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
2100 map<int, wxString> *PicturesListTokens, wxString *SaveData){
2102 wxString ProcessData = "";
2104 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
2105 PicturesIter != PicturesList->end(); PicturesIter++){
2107 ProcessData.Append("PHOTO");
2109 // Check if there is a value for TYPE.
2111 if ((*PicturesListType)[PicturesIter->first].size() > 0){
2113 ProcessData.Append(";TYPE=");
2114 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
2118 // Check if there is a value for ALTID.
2120 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
2122 ProcessData.Append(";ALTID=");
2123 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
2127 // Check if there is a value for MEDIATYPE..
2129 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
2131 ProcessData.Append(";MEDIATYPE=");
2132 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
2136 // Check if there is a value for PID.
2138 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
2140 ProcessData.Append(";PID=");
2141 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
2145 // Check if there is a value for PREF.
2147 if ((*PicturesListPref)[PicturesIter->first] > 0){
2149 ProcessData.Append(";PREF=");
2150 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
2154 // Check if there is a value for tokens.
2156 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
2158 ProcessData.Append(";");
2159 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
2163 ProcessData.Append(":data:");
2164 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
2165 ProcessData.Append(";");
2166 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
2167 ProcessData.Append(",");
2168 ProcessData.Append(PicturesIter->second);
2169 ProcessData.Append("\n");
2171 ProcessData = OutputText(&ProcessData);
2173 SaveData->Append(ProcessData);
2174 ProcessData.clear();
2180 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID,
2181 map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
2182 map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
2183 map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
2184 map<int, wxString> *LogosListTokens, wxString *SaveData){
2186 wxString ProcessData = "";
2188 for (std::map<int, string>::iterator LogosIter = LogosList->begin();
2189 LogosIter != LogosList->end(); LogosIter++){
2191 ProcessData.Append("LOGO");
2193 // Check if there is a value for TYPE.
2195 if ((*LogosListType)[LogosIter->first].size() > 0){
2197 ProcessData.Append(";TYPE=");
2198 ProcessData.Append((*LogosListType)[LogosIter->first]);
2202 // Check if there is a value for ALTID.
2204 if ((*LogosListAltID)[LogosIter->first].size() > 0){
2206 ProcessData.Append(";ALTID=");
2207 ProcessData.Append((*LogosListAltID)[LogosIter->first]);
2211 // Check if there is a value for MEDIATYPE..
2213 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
2215 ProcessData.Append(";MEDIATYPE=");
2216 ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
2220 // Check if there is a value for PID.
2222 if ((*LogosListPID)[LogosIter->first].size() > 0){
2224 ProcessData.Append(";PID=");
2225 ProcessData.Append((*LogosListPID)[LogosIter->first]);
2229 // Check if there is a value for PREF.
2231 if ((*LogosListPref)[LogosIter->first] > 0){
2233 ProcessData.Append(";PREF=");
2234 ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
2238 // Check if there is a value for tokens.
2240 if ((*LogosListTokens)[LogosIter->first].size() > 0){
2242 ProcessData.Append(";");
2243 ProcessData.Append((*LogosListTokens)[LogosIter->first]);
2247 ProcessData.Append(":data:");
2248 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
2249 ProcessData.Append(";");
2250 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
2251 ProcessData.Append(",");
2252 ProcessData.Append(LogosIter->second);
2253 ProcessData.Append("\n");
2255 ProcessData = OutputText(&ProcessData);
2257 SaveData->Append(ProcessData);
2258 ProcessData.clear();
2264 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID,
2265 map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
2266 map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
2267 map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage,
2268 map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens,
2269 wxString *SaveData){
2271 wxString ProcessData = "";
2273 for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
2274 SoundsIter != SoundsList->end(); SoundsIter++){
2276 ProcessData.Append("SOUND");
2278 // Check if there is a value for TYPE.
2280 if ((*SoundsListType)[SoundsIter->first].size() > 0){
2282 ProcessData.Append(";TYPE=");
2283 ProcessData.Append((*SoundsListType)[SoundsIter->first]);
2287 // Check if there is a value for ALTID.
2289 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
2291 ProcessData.Append(";ALTID=");
2292 ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
2296 // Check if there is a value for LANGUAGE.
2298 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
2300 ProcessData.Append(";LANGUAGE=");
2301 ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
2305 // Check if there is a value for MEDIATYPE.
2307 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
2309 ProcessData.Append(";MEDIATYPE=");
2310 ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
2314 // Check if there is a value for PID.
2316 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
2318 ProcessData.Append(";PID=");
2319 ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
2323 // Check if there is a value for PREF.
2325 if ((*SoundsListPref)[SoundsIter->first] > 0){
2327 ProcessData.Append(";PREF=");
2328 ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
2332 // Check if there is a value for tokens.
2334 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
2336 ProcessData.Append(";");
2337 ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
2341 ProcessData.Append(":data:");
2342 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
2343 ProcessData.Append(";");
2344 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
2345 ProcessData.Append(",");
2346 ProcessData.Append(SoundsIter->second);
2347 ProcessData.Append("\n");
2349 ProcessData = OutputText(&ProcessData);
2351 SaveData->Append(ProcessData);
2352 ProcessData.clear();
2358 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
2359 map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
2360 map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
2361 map<int, wxString> *CalendarListTokens, wxString *SaveData){
2363 wxString ProcessData = "";
2365 for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
2366 CalendarIter != CalendarList->end(); CalendarIter++){
2368 ProcessData.Append("CALURI");
2370 // Check if there is a value for TYPE.
2372 if ((*CalendarListType)[CalendarIter->first].size() > 0){
2374 ProcessData.Append(";TYPE=");
2375 ProcessData.Append((*CalendarListType)[CalendarIter->first]);
2379 // Check if there is a value for ALTID.
2381 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2383 ProcessData.Append(";ALTID=");
2384 ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2388 // Check if there is a value for MEDIATYPE.
2390 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2392 ProcessData.Append(";MEDIATYPE=");
2393 ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2397 // Check if there is a value for PID.
2399 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2401 ProcessData.Append(";PID=");
2402 ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2406 // Check if there is a value for PREF.
2408 if ((*CalendarListPref)[CalendarIter->first] > 0){
2410 ProcessData.Append(";PREF=");
2411 ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2415 // Check if there is a value for tokens.
2417 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2419 ProcessData.Append(";");
2420 ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2424 ProcessData.Append(":");
2425 ProcessData.Append(CalendarIter->second);
2426 ProcessData.Append("\n");
2428 ProcessData = OutputText(&ProcessData);
2430 SaveData->Append(ProcessData);
2431 ProcessData.clear();
2437 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2438 map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2439 map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2440 map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2442 wxString ProcessData = "";
2444 for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2445 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2447 ProcessData.Append("CALADRURI");
2449 // Check if there is a value for TYPE.
2451 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2453 ProcessData.Append(";TYPE=");
2454 ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2458 // Check if there is a value for ALTID.
2460 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2462 ProcessData.Append(";ALTID=");
2463 ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2467 // Check if there is a value for MEDIATYPE.
2469 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2471 ProcessData.Append(";MEDIATYPE=");
2472 ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2476 // Check if there is a value for PID.
2478 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2480 ProcessData.Append(";PID=");
2481 ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2485 // Check if there is a value for PREF.
2487 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2489 ProcessData.Append(";PREF=");
2490 ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2494 // Check if there is a value for tokens.
2496 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2498 ProcessData.Append(";");
2499 ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2503 ProcessData.Append(":");
2504 ProcessData.Append(CalendarRequestIter->second);
2505 ProcessData.Append("\n");
2507 ProcessData = OutputText(&ProcessData);
2509 SaveData->Append(ProcessData);
2510 ProcessData.clear();
2516 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID,
2517 std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2518 std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref,
2519 std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2521 wxString ProcessData = "";
2523 for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2524 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2526 ProcessData.Append("FBURL");
2528 // Check if there is a value for TYPE.
2530 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2532 ProcessData.Append(";TYPE=");
2533 ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2537 // Check if there is a value for ALTID.
2539 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2541 ProcessData.Append(";ALTID=");
2542 ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2546 // Check if there is a value for MEDIATYPE.
2548 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2550 ProcessData.Append(";MEDIATYPE=");
2551 ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2555 // Check if there is a value for PID.
2557 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2559 ProcessData.Append(";PID=");
2560 ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2564 // Check if there is a value for PREF.
2566 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2568 ProcessData.Append(";PREF=");
2569 ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2573 // Check if there is a value for tokens.
2575 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2577 ProcessData.Append(";");
2578 ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2582 ProcessData.Append(":");
2583 ProcessData.Append(FreeBusyIter->second);
2584 ProcessData.Append("\n");
2586 ProcessData = OutputText(&ProcessData);
2588 SaveData->Append(ProcessData);
2589 ProcessData.clear();
2595 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID,
2596 map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2597 map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType,
2598 map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref,
2599 map<int, wxString> *KeyListTokens, wxString *SaveData){
2601 wxString ProcessData = "";
2603 for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2604 KeyIter != KeyList->end(); KeyIter++){
2606 ProcessData.Append("KEY");
2608 // Check if there is a value for TYPE.
2610 if ((*KeyListType)[KeyIter->first].size() > 0){
2612 ProcessData.Append(";TYPE=");
2613 ProcessData.Append((*KeyListType)[KeyIter->first]);
2617 // Check if there is a value for ALTID.
2619 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2621 ProcessData.Append(";ALTID=");
2622 ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2626 // Check if there is a value for PID.
2628 if ((*KeyListPID)[KeyIter->first].size() > 0){
2630 ProcessData.Append(";PID=");
2631 ProcessData.Append((*KeyListPID)[KeyIter->first]);
2635 // Check if there is a value for PREF.
2637 if ((*KeyListPref)[KeyIter->first] > 0){
2639 ProcessData.Append(";PREF=");
2640 ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2644 // Check if there is a value for tokens.
2646 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2648 ProcessData.Append(";");
2649 ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2653 ProcessData.Append(":data:");
2654 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2655 ProcessData.Append(";");
2656 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2657 ProcessData.Append(",");
2658 ProcessData.Append(KeyIter->second);
2659 ProcessData.Append("\n");
2661 ProcessData = OutputText(&ProcessData);
2663 SaveData->Append(ProcessData);
2664 ProcessData.clear();
2670 void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN,
2671 map<int, wxString> *VendorListElement, wxString *SaveData){
2673 wxString ProcessData = "";
2675 for (std::map<int, wxString>::iterator VendorIter = VendorList->begin();
2676 VendorIter != VendorList->end(); VendorIter++){
2678 ProcessData.Append("VND-");
2679 ProcessData.Append((*VendorListPEN)[VendorIter->first]);
2680 ProcessData.Append("-");
2681 ProcessData.Append((*VendorListElement)[VendorIter->first]);
2682 ProcessData.Append(":");
2683 ProcessData.Append(VendorIter->second);
2684 ProcessData.Append("\n");
2686 ProcessData = OutputText(&ProcessData);
2688 SaveData->Append(ProcessData);
2689 ProcessData.clear();
2695 void ContactDataObject::SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens,
2696 wxString *SaveData){
2698 wxString ProcessData = "";
2700 for (std::map<int, wxString>::iterator XTokenIter = XTokenList->begin();
2701 XTokenIter != XTokenList->end(); XTokenIter++){
2703 ProcessData.Append("X-");
2704 ProcessData.Append((*XTokenListTokens)[XTokenIter->first]);
2705 ProcessData.Append(":");
2706 ProcessData.Append(XTokenIter->second);
2707 ProcessData.Append("\n");
2709 ProcessData = OutputText(&ProcessData);
2711 SaveData->Append(ProcessData);
2712 ProcessData.clear();