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::SaveString(wxString *SaveData){
24 ContactSaveStatus SaveDataStatus = CONTACTSAVE_UNITTESTFAIL;
26 // Write the header for the vCard data file.
28 SaveData->Append("BEGIN:VCARD\n");
29 SaveData->Append("VERSION:4.0\n");
31 // Write the product ID.
35 SaveData->Append("PRODID:-//Xestia//Address Book Unit Testing//KW\n");
39 SaveData->Append(wxT("PRODID:-//Xestia//Address Book Version "));
40 SaveData->Append(wxT(XSDAB_VERSION));
41 SaveData->Append(wxT("//KW\n"));
45 wxString ProcessData = "";
49 if (UIDToken.size() > 0){
51 ProcessData.Append("UID:");
52 ProcessData.Append(UIDToken);
53 ProcessData.Append("\n");
54 SaveData->Append(ProcessData);
63 case CONTACTKIND_NONE:
65 case CONTACTKIND_INDIVIDUAL:
66 SaveData->Append("KIND:individual\n");
68 case CONTACTKIND_GROUP:
69 SaveData->Append("KIND:group\n");
71 case CONTACTKIND_ORGANISATION:
72 SaveData->Append("KIND:org\n");
74 case CONTACTKIND_LOCATION:
75 SaveData->Append("KIND:location\n");
84 wxDateTime DateTimeSave;
85 DateTimeSave = DateTimeSave.SetToCurrent();
86 wxString DateTimeSaveValue;
90 DateTimeSaveValue += "20160703T091000Z";
94 DateTimeSaveValue += wxString::Format("%04i", DateTimeSave.GetYear());
95 DateTimeSaveValue += wxString::Format("%02i", (DateTimeSave.GetMonth() + 1));
96 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetDay());
97 DateTimeSaveValue += "T";
98 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetHour());
99 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetMinute());
100 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetSecond());
101 DateTimeSaveValue += "Z";
105 if (!RevisionTokens.IsEmpty()){
107 ProcessData.Append("REV;");
108 ProcessData.Append(RevisionTokens);
109 ProcessData.Append(":");
110 ProcessData.Append(DateTimeSaveValue);
111 ProcessData.Append("\n");
113 ProcessData = OutputText(&ProcessData);
115 SaveData->Append(ProcessData);
120 ProcessData.Append("REV:");
121 ProcessData.Append(DateTimeSaveValue);
122 ProcessData.Append("\n");
124 ProcessData = OutputText(&ProcessData);
126 SaveData->Append(ProcessData);
133 for (std::map<int, wxString>::iterator XMLIter = XMLList.begin();
134 XMLIter != XMLList.end(); XMLIter++){
136 ProcessData.Append("XML");
138 if (XMLListAltID[XMLIter->first].size() > 0){
140 ProcessData.Append(";ALTID=");
141 ProcessData.Append(XMLListAltID[XMLIter->first]);
145 ProcessData.Append(":");
146 ProcessData.Append(XMLIter->second);
147 ProcessData.Append("\n");
149 ProcessData = OutputText(&ProcessData);
151 SaveData->Append(ProcessData);
158 SaveSource(&SourceList, &SourceListAltID,
159 &SourceListPID, &SourceListType,
160 &SourceListMediatype, &SourceListPref,
161 &SourceListTokens, SaveData);
163 // Process MEMBER (if contact kind is CONTACTKIND_GROUP).
165 if (ContactKind == CONTACTKIND_GROUP){
167 SaveMember(&GroupsList, &GroupsListAltID,
168 &GroupsListPID, &GroupsListType,
169 &GroupsListMediaType, &GroupsListPref,
170 &GroupsListTokens, SaveData);
174 // Process CLIENTPIDMAP.
176 for (std::map<int, wxString>::iterator CPIDIter = ClientPIDList.begin();
177 CPIDIter != ClientPIDList.end(); CPIDIter++){
179 ProcessData.Append("CLIENTPIDMAP");
181 if (ClientPIDListTokens[CPIDIter->first].size() > 0){
183 ProcessData.Append(";");
184 ProcessData.Append(ClientPIDListTokens[CPIDIter->first]);
188 ProcessData.Append(":");
189 ProcessData.Append(CPIDIter->second);
190 ProcessData.Append("\n");
192 ProcessData = OutputText(&ProcessData);
194 SaveData->Append(ProcessData);
201 for (std::map<int, wxString>::iterator FNIter = FullNamesList.begin();
202 FNIter != FullNamesList.end(); FNIter++){
204 ProcessData.Append("FN");
206 // Check if there is a value for TYPE.
208 if (FullNamesListType[FNIter->first].size() > 0){
210 ProcessData.Append(";TYPE=");
211 ProcessData.Append(FullNamesListType[FNIter->first]);
215 // Check if there is a value for LANGUAGE.
217 if (FullNamesListLanguage[FNIter->first].size() > 0){
219 ProcessData.Append(";LANGUAGE=");
220 ProcessData.Append(FullNamesListLanguage[FNIter->first]);
224 // Check if there is a value for ALTID.
226 if (FullNamesListAltID[FNIter->first].size() > 0){
228 ProcessData.Append(";ALTID=");
229 ProcessData.Append(FullNamesListAltID[FNIter->first]);
233 // Check if there is a value for PID.
235 if (FullNamesListPID[FNIter->first].size() > 0){
237 ProcessData.Append(";PID=");
238 ProcessData.Append(FullNamesListPID[FNIter->first]);
242 // Check if there is a value for PREF.
244 if (FullNamesListPref[FNIter->first] > 0){
246 ProcessData.Append(";PREF=");
247 ProcessData.Append(wxString::Format("%i", FullNamesListPref[FNIter->first]));
251 // Check if there is a value for tokens.
253 if (FullNamesListTokens[FNIter->first].size() > 0){
255 ProcessData.Append(";");
256 ProcessData.Append(FullNamesListTokens[FNIter->first]);
260 ProcessData.Append(":");
261 ProcessData.Append(FNIter->second);
262 ProcessData.Append("\n");
264 ProcessData = OutputText(&ProcessData);
266 SaveData->Append(ProcessData);
273 SaveNickname(&GeneralNicknamesList, &GeneralNicknamesListAltID,
274 &GeneralNicknamesListPID, &GeneralNicknamesListType,
275 &GeneralNicknamesListLanguage, &GeneralNicknamesListPref,
276 &GeneralNicknamesListTokens, SaveData, "");
277 SaveNickname(&HomeNicknamesList, &HomeNicknamesListAltID,
278 &HomeNicknamesListPID, &HomeNicknamesListType,
279 &HomeNicknamesListLanguage, &HomeNicknamesListPref,
280 &HomeNicknamesListTokens, SaveData, "home");
281 SaveNickname(&BusinessNicknamesList, &BusinessNicknamesListAltID,
282 &BusinessNicknamesListPID, &BusinessNicknamesListType,
283 &BusinessNicknamesListLanguage, &BusinessNicknamesListPref,
284 &BusinessNicknamesListTokens, SaveData, "work");
288 SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
289 &GeneralTitleListAltID, &GeneralTitleListPID,
290 &GeneralTitleListType, &GeneralTitleListPref,
291 &GeneralTitleListTokens, SaveData, "");
292 SaveTitle(&HomeTitleList, &HomeTitleListLanguage,
293 &HomeTitleListAltID, &HomeTitleListPID,
294 &HomeTitleListType, &HomeTitleListPref,
295 &HomeTitleListTokens, SaveData, "home");
296 SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage,
297 &BusinessTitleListAltID, &BusinessTitleListPID,
298 &BusinessTitleListType, &BusinessTitleListPref,
299 &BusinessTitleListTokens, SaveData, "work");
303 SaveTimezone(&GeneralTZList, &GeneralTZListAltID,
304 &GeneralTZListPID, &GeneralTZListType,
305 &GeneralTZListMediatype, &GeneralTZListPref,
306 &GeneralTZListTokens, SaveData, "");
307 SaveTimezone(&HomeTZList, &HomeTZListAltID,
308 &HomeTZListPID, &HomeTZListType,
309 &HomeTZListMediatype, &HomeTZListPref,
310 &HomeTZListTokens, SaveData, "home");
311 SaveTimezone(&BusinessTZList, &BusinessTZListAltID,
312 &BusinessTZListPID, &BusinessTZListType,
313 &BusinessTZListMediatype, &BusinessTZListPref,
314 &BusinessTZListTokens, SaveData, "work");
318 SaveAddress(&GeneralAddressList, &GeneralAddressListTown,
319 &GeneralAddressListCounty, &GeneralAddressListPostCode,
320 &GeneralAddressListCountry, &GeneralAddressListLabel,
321 &GeneralAddressListLang, &GeneralAddressListAltID,
322 &GeneralAddressListPID, &GeneralAddressListGeo,
323 &GeneralAddressListTimezone, &GeneralAddressListType,
324 &GeneralAddressListMediatype, &GeneralAddressListPref,
325 &GeneralAddressListTokens, SaveData, "");
326 SaveAddress(&HomeAddressList, &HomeAddressListTown,
327 &HomeAddressListCounty, &HomeAddressListPostCode,
328 &HomeAddressListCountry, &HomeAddressListLabel,
329 &HomeAddressListLang, &HomeAddressListAltID,
330 &HomeAddressListPID, &HomeAddressListGeo,
331 &HomeAddressListTimezone, &HomeAddressListType,
332 &HomeAddressListMediatype, &HomeAddressListPref,
333 &HomeAddressListTokens, SaveData, "home");
334 SaveAddress(&BusinessAddressList, &BusinessAddressListTown,
335 &BusinessAddressListCounty, &BusinessAddressListPostCode,
336 &BusinessAddressListCountry, &BusinessAddressListLabel,
337 &BusinessAddressListLang, &BusinessAddressListAltID,
338 &BusinessAddressListPID, &BusinessAddressListGeo,
339 &BusinessAddressListTimezone, &BusinessAddressListType,
340 &BusinessAddressListMediatype, &BusinessAddressListPref,
341 &BusinessAddressListTokens, SaveData, "work");
345 SaveEmail(&GeneralEmailList, &GeneralEmailListAltID,
346 &GeneralEmailListPID, &GeneralEmailListType,
347 &GeneralEmailListPref, &GeneralEmailListTokens,
349 SaveEmail(&HomeEmailList, &HomeEmailListAltID,
350 &HomeEmailListPID, &HomeEmailListType,
351 &HomeEmailListPref, &HomeEmailListTokens,
353 SaveEmail(&BusinessEmailList, &BusinessEmailListAltID,
354 &BusinessEmailListPID, &BusinessEmailListType,
355 &BusinessEmailListPref, &BusinessEmailListTokens,
360 SaveIMPP(&GeneralIMList, &GeneralIMListAltID,
361 &GeneralIMListPID, &GeneralIMListType,
362 &GeneralIMListTypeInfo, &GeneralIMListMediatype,
363 &GeneralIMListPref, &GeneralIMListTokens,
365 SaveIMPP(&HomeIMList, &HomeIMListAltID,
366 &HomeIMListPID, &HomeIMListType,
367 &HomeIMListTypeInfo, &HomeIMListMediatype,
368 &HomeIMListPref, &HomeIMListTokens,
370 SaveIMPP(&BusinessIMList, &BusinessIMListAltID,
371 &BusinessIMListPID, &BusinessIMListType,
372 &BusinessIMListTypeInfo, &BusinessIMListMediatype,
373 &BusinessIMListPref, &BusinessIMListTokens,
378 SaveTelephone(&GeneralTelephoneList, &GeneralTelephoneListAltID,
379 &GeneralTelephoneListPID, &GeneralTelephoneListType,
380 &GeneralTelephoneListTypeInfo, &GeneralTelephoneListDataType,
381 &GeneralTelephoneListPref, &GeneralTelephoneListTokens,
383 SaveTelephone(&HomeTelephoneList, &HomeTelephoneListAltID,
384 &HomeTelephoneListPID, &HomeTelephoneListType,
385 &HomeTelephoneListTypeInfo, &HomeTelephoneListDataType,
386 &HomeTelephoneListPref, &HomeTelephoneListTokens,
388 SaveTelephone(&BusinessTelephoneList, &BusinessTelephoneListAltID,
389 &BusinessTelephoneListPID, &BusinessTelephoneListType,
390 &BusinessTelephoneListTypeInfo, &BusinessTelephoneListDataType,
391 &BusinessTelephoneListPref, &BusinessTelephoneListTokens,
396 SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID,
397 &GeneralLanguageListPID, &GeneralLanguageListType,
398 &GeneralLanguageListPref, &GeneralLanguageListTokens,
400 SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID,
401 &HomeLanguageListPID, &HomeLanguageListType,
402 &HomeLanguageListPref, &HomeLanguageListTokens,
404 SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID,
405 &BusinessLanguageListPID, &BusinessLanguageListType,
406 &BusinessLanguageListPref, &BusinessLanguageListTokens,
411 SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID,
412 &GeneralGeographyListPID, &GeneralGeographyListType,
413 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
414 &GeneralGeographyListPref, &GeneralGeographyListTokens,
416 SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID,
417 &HomeGeographyListPID, &HomeGeographyListType,
418 &HomeGeographyListMediatype, &HomeGeographyListDataType,
419 &HomeGeographyListPref, &HomeGeographyListTokens,
421 SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID,
422 &BusinessGeographyListPID, &BusinessGeographyListType,
423 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
424 &BusinessGeographyListPref, &BusinessGeographyListTokens,
431 for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
432 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
434 ProcessData.Append("RELATED");
436 // Check if there is a value for TYPE.
438 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
440 wxString RelatedType = "";
442 ProcessData.Append(";TYPE=");
444 if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
446 RelatedType = wxT("contact");
448 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
450 RelatedType = wxT("acquaintance");
452 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
454 RelatedType = wxT("friend");
456 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
458 RelatedType = wxT("met");
460 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
462 RelatedType = wxT("co-worker");
464 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
466 RelatedType = wxT("colleague");
468 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
470 RelatedType = wxT("co-resident");
472 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
474 RelatedType = wxT("neighbor");
476 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
478 RelatedType = wxT("child");
480 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
482 RelatedType = wxT("parent");
484 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
486 RelatedType = wxT("sibling");
488 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
490 RelatedType = wxT("spouse");
492 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
494 RelatedType = wxT("kin");
496 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
498 RelatedType = wxT("muse");
500 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
502 RelatedType = wxT("crush");
504 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
506 RelatedType = wxT("date");
508 } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
510 RelatedType = wxT("sweetheart");
512 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
514 RelatedType = wxT("me");
516 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
518 RelatedType = wxT("agent");
520 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
522 RelatedType = wxT("emergency");
526 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
530 ProcessData.Append(RelatedType);
534 // Check if there is a value for LANGUAGE.
536 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
538 ProcessData.Append(";LANGUAGE=");
539 ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
543 // Check if there is a value for ALTID.
545 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
547 ProcessData.Append(";ALTID=");
548 ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
552 // Check if there is a value for PID.
554 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
556 ProcessData.Append(";PID=");
557 ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
561 // Check if there is a value for PREF.
563 if (GeneralRelatedListPref[RelatedIter->first] > 0){
565 ProcessData.Append(";PREF=");
566 ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
570 // Check if there is a value for tokens.
572 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
574 ProcessData.Append(";");
575 ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
579 ProcessData.Append(":");
580 ProcessData.Append(RelatedIter->second);
581 ProcessData.Append("\n");
583 ProcessData = OutputText(&ProcessData);
585 SaveData->Append(ProcessData);
592 SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID,
593 &GeneralWebsiteListPID, &GeneralWebsiteListType,
594 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref,
595 &GeneralWebsiteListTokens, SaveData, "");
596 SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID,
597 &HomeWebsiteListPID, &HomeWebsiteListType,
598 &HomeWebsiteListMediatype, &HomeWebsiteListPref,
599 &HomeWebsiteListTokens, SaveData, "home");
600 SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID,
601 &BusinessWebsiteListPID, &BusinessWebsiteListType,
602 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref,
603 &BusinessWebsiteListTokens, SaveData, "work");
607 SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
608 &GeneralRoleListAltID, &GeneralRoleListPID,
609 &GeneralRoleListType, &GeneralRoleListPref,
610 &GeneralRoleListTokens, SaveData, "");
611 SaveRole(&HomeRoleList, &HomeRoleListLanguage,
612 &HomeRoleListAltID, &HomeRoleListPID,
613 &HomeRoleListType, &HomeRoleListPref,
614 &HomeRoleListTokens, SaveData, "home");
615 SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
616 &BusinessRoleListAltID, &BusinessRoleListPID,
617 &BusinessRoleListType, &BusinessRoleListPref,
618 &BusinessRoleListTokens, SaveData, "work");
622 SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
623 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage,
624 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType,
625 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens,
627 SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
628 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage,
629 &HomeOrganisationsListSortAs, &HomeOrganisationsListType,
630 &HomeOrganisationsListPref, &HomeOrganisationsListTokens,
632 SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
633 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage,
634 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType,
635 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens,
640 SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
641 &GeneralNoteListAltID, &GeneralNoteListPID,
642 &GeneralNoteListType, &GeneralNoteListPref,
643 &GeneralNoteListTokens, SaveData, "");
644 SaveNote(&HomeNoteList, &HomeNoteListLanguage,
645 &HomeNoteListAltID, &HomeNoteListPID,
646 &HomeNoteListType, &HomeNoteListPref,
647 &HomeNoteListTokens, SaveData, "home");
648 SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
649 &BusinessNoteListAltID, &BusinessNoteListPID,
650 &BusinessNoteListType, &BusinessNoteListPref,
651 &BusinessNoteListTokens, SaveData, "work");
653 // Process CATEGORIES.
655 SaveCategory(&CategoriesList, &CategoriesListLanguage,
656 &CategoriesListAltID, &CategoriesListPID,
657 &CategoriesListType, &CategoriesListPref,
658 &CategoriesListTokens, SaveData);
662 SavePhoto(&PicturesList, &PicturesListAltID,
663 &PicturesListPID, &PicturesListType,
664 &PicturesListPicEncType, &PicturesListPictureType,
665 &PicturesListMediatype, &PicturesListPref,
666 &PicturesListTokens, SaveData);
670 SaveLogo(&LogosList, &LogosListAltID,
671 &LogosListPID, &LogosListType,
672 &LogosListPicEncType, &LogosListPictureType,
673 &LogosListMediatype, &LogosListPref,
674 &LogosListTokens, SaveData);
678 SaveSound(&SoundsList, &SoundsListAltID,
679 &SoundsListPID, &SoundsListType,
680 &SoundsListAudioEncType, &SoundsListAudioType,
681 &SoundsListMediatype, &SoundsListLanguage,
682 &SoundsListPref, &SoundsListTokens,
687 SaveCalendarURI(&CalendarList, &CalendarListMediatype,
688 &CalendarListAltID, &CalendarListPID,
689 &CalendarListType, &CalendarListPref,
690 &CalendarListTokens, SaveData);
692 // Process CALADRURI.
694 SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
695 &CalendarRequestListAltID, &CalendarRequestListPID,
696 &CalendarRequestListType, &CalendarRequestListPref,
697 &CalendarRequestListTokens, SaveData);
701 SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID,
702 &FreeBusyListPID, &FreeBusyListType,
703 &FreeBusyListMediatype, &FreeBusyListPref,
704 &FreeBusyListTokens, SaveData);
708 SaveKey(&KeyList, &KeyListAltID,
709 &KeyListPID, &KeyListType,
710 &KeyListKeyType, &KeyListDataEncType,
711 &KeyListDataType, &KeyListPref,
712 &KeyListTokens, SaveData);
716 SaveVendor(&VendorList, &VendorListPEN,
717 &VendorListElement, SaveData);
721 SaveXToken(&XTokenList, &XTokenListTokens,
724 // Write the end part of the vCard data file.
726 SaveData->Append("END:VCARD");
728 SaveDataStatus = CONTACTSAVE_OK;
730 return SaveDataStatus;
734 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
735 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
736 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
737 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
739 wxString ProcessData = "";
741 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
742 TitleIter != TitleList->end(); TitleIter++){
744 ProcessData.Append("TITLE");
746 // Check if there is a value for TYPE.
748 if (DataType.size() > 0){
750 ProcessData.Append(";TYPE=");
751 ProcessData.Append(DataType);
755 // Check if there is a value for ALTID.
757 if ((*TitleListAltID)[TitleIter->first].size() > 0){
759 ProcessData.Append(";ALTID=");
760 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
764 // Check if there is a value for LANGUAGE.
766 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
768 ProcessData.Append(";LANGUAGE=");
769 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
773 // Check if there is a value for PID.
775 if ((*TitleListPID)[TitleIter->first].size() > 0){
777 ProcessData.Append(";PID=");
778 ProcessData.Append((*TitleListPID)[TitleIter->first]);
782 // Check if there is a value for PREF.
784 if ((*TitleListPref)[TitleIter->first] > 0){
786 ProcessData.Append(";PREF=");
787 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
791 // Check if there is a value for tokens.
793 if ((*TitleListTokens)[TitleIter->first].size() > 0){
795 ProcessData.Append(";");
796 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
800 ProcessData.Append(":");
801 ProcessData.Append(TitleIter->second);
802 ProcessData.Append("\n");
804 ProcessData = OutputText(&ProcessData);
806 SaveData->Append(ProcessData);
813 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
814 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
815 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
816 map<int, wxString> *SourceListTokens, wxString *SaveData){
818 wxString ProcessData = "";
820 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
821 SourceIter != SourceList->end(); SourceIter++){
823 ProcessData.Append("SOURCE");
825 // Check if there is a value for TYPE.
827 if ((*SourceListType)[SourceIter->first].size() > 0){
829 ProcessData.Append(";TYPE=");
830 ProcessData.Append((*SourceListType)[SourceIter->first]);
834 // Check if there is a value for ALTID.
836 if ((*SourceListAltID)[SourceIter->first].size() > 0){
838 ProcessData.Append(";ALTID=");
839 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
843 // Check if there is a value for MEDIATYPE.
845 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
847 ProcessData.Append(";MEDIATYPE=");
848 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
852 // Check if there is a value for PID.
854 if ((*SourceListPID)[SourceIter->first].size() > 0){
856 ProcessData.Append(";PID=");
857 ProcessData.Append((*SourceListPID)[SourceIter->first]);
861 // Check if there is a value for PREF.
863 if ((*SourceListPref)[SourceIter->first] > 0){
865 ProcessData.Append(";PREF=");
866 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
870 // Check if there is a value for tokens.
872 if ((*SourceListTokens)[SourceIter->first].size() > 0){
874 ProcessData.Append(";");
875 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
879 ProcessData.Append(":");
880 ProcessData.Append(SourceIter->second);
881 ProcessData.Append("\n");
883 ProcessData = OutputText(&ProcessData);
885 SaveData->Append(ProcessData);
892 void ContactDataObject::SaveMember(std::map<int, wxString> *GroupsList, std::map<int, wxString> *GroupsListAltID,
893 std::map<int, wxString> *GroupsListPID, std::map<int, wxString> *GroupsListType,
894 std::map<int, wxString> *GroupsListMediaType, std::map<int, int> *GroupsListPref,
895 std::map<int, wxString> *GroupsListTokens, wxString *SaveData){
897 wxString ProcessData = "";
899 for (std::map<int, wxString>::iterator GroupsIter = GroupsList->begin();
900 GroupsIter != GroupsList->end(); GroupsIter++){
902 ProcessData.Append("MEMBER");
904 // Check if there is a value for TYPE.
906 if ((*GroupsListType)[GroupsIter->first].size() > 0){
908 ProcessData.Append(";TYPE=");
909 ProcessData.Append((*GroupsListType)[GroupsIter->first]);
913 // Check if there is a value for ALTID.
915 if ((*GroupsListAltID)[GroupsIter->first].size() > 0){
917 ProcessData.Append(";ALTID=");
918 ProcessData.Append((*GroupsListAltID)[GroupsIter->first]);
922 // Check if there is a value for MEDIATYPE.
924 if ((*GroupsListMediaType)[GroupsIter->first].size() > 0){
926 ProcessData.Append(";MEDIATYPE=");
927 ProcessData.Append((*GroupsListMediaType)[GroupsIter->first]);
931 // Check if there is a value for PID.
933 if ((*GroupsListPID)[GroupsIter->first].size() > 0){
935 ProcessData.Append(";PID=");
936 ProcessData.Append((*GroupsListPID)[GroupsIter->first]);
940 // Check if there is a value for PREF.
942 if ((*GroupsListPref)[GroupsIter->first] > 0){
944 ProcessData.Append(";PREF=");
945 ProcessData.Append(wxString::Format("%i", (*GroupsListPref)[GroupsIter->first]));
949 // Check if there is a value for tokens.
951 if ((*GroupsListTokens)[GroupsIter->first].size() > 0){
953 ProcessData.Append(";");
954 ProcessData.Append((*GroupsListTokens)[GroupsIter->first]);
958 ProcessData.Append(":");
959 ProcessData.Append(GroupsIter->second);
960 ProcessData.Append("\n");
962 ProcessData = OutputText(&ProcessData);
964 SaveData->Append(ProcessData);
971 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
972 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
973 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
974 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
976 wxString ProcessData = "";
978 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
979 NicknameIter != NicknameList->end(); NicknameIter++){
981 ProcessData.Append("NICKNAME");
983 // Check if there is a value for TYPE.
985 if (DataType.size() > 0){
987 ProcessData.Append(";TYPE=");
988 ProcessData.Append(DataType);
992 // Check if there is a value for ALTID.
994 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
996 ProcessData.Append(";ALTID=");
997 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
1001 // Check if there is a value for MEDIATYPE.
1003 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
1005 ProcessData.Append(";LANGUAGE=");
1006 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
1010 // Check if there is a value for PID.
1012 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
1014 ProcessData.Append(";PID=");
1015 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
1019 // Check if there is a value for PREF.
1021 if ((*NicknameListPref)[NicknameIter->first] > 0){
1023 ProcessData.Append(";PREF=");
1024 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
1028 // Check if there is a value for tokens.
1030 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
1032 ProcessData.Append(";");
1033 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
1037 ProcessData.Append(":");
1038 ProcessData.Append(NicknameIter->second);
1039 ProcessData.Append("\n");
1041 ProcessData = OutputText(&ProcessData);
1043 SaveData->Append(ProcessData);
1044 ProcessData.clear();
1050 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
1051 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
1052 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
1053 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
1055 wxString ProcessData = "";
1057 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
1058 TZIter != TZList->end(); TZIter++){
1060 ProcessData.Append("TZ");
1062 // Check if there is a value for TYPE.
1064 if (DataType.size() > 0){
1066 ProcessData.Append(";TYPE=");
1067 ProcessData.Append(DataType);
1071 // Check if there is a value for ALTID.
1073 if ((*TZListAltID)[TZIter->first].size() > 0){
1075 ProcessData.Append(";ALTID=");
1076 ProcessData.Append((*TZListAltID)[TZIter->first]);
1080 // Check if there is a value for MEDIATYPE.
1082 if ((*TZListMediatype)[TZIter->first].size() > 0){
1084 ProcessData.Append(";MEDIATYPE=");
1085 ProcessData.Append((*TZListMediatype)[TZIter->first]);
1089 // Check if there is a value for PID.
1091 if ((*TZListPID)[TZIter->first].size() > 0){
1093 ProcessData.Append(";PID=");
1094 ProcessData.Append((*TZListPID)[TZIter->first]);
1098 // Check if there is a value for PREF.
1100 if ((*TZListPref)[TZIter->first] > 0){
1102 ProcessData.Append(";PREF=");
1103 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
1107 // Check if there is a value for tokens.
1109 if ((*TZListTokens)[TZIter->first].size() > 0){
1111 ProcessData.Append(";");
1112 ProcessData.Append((*TZListTokens)[TZIter->first]);
1116 ProcessData.Append(":");
1117 ProcessData.Append(TZIter->second);
1118 ProcessData.Append("\n");
1120 ProcessData = OutputText(&ProcessData);
1122 SaveData->Append(ProcessData);
1123 ProcessData.clear();
1129 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
1130 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
1131 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
1132 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
1133 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
1134 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
1135 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
1136 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
1138 wxString ProcessData = "";
1140 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
1141 AddressIter != AddressList->end(); AddressIter++){
1143 ProcessData.Append("ADR");
1145 // Check if there is a value for TYPE.
1147 if (DataType.size() > 0){
1149 ProcessData.Append(";TYPE=");
1150 ProcessData.Append(DataType);
1154 // Check if there is a value for ALTID.
1156 if ((*AddressListAltID)[AddressIter->first].size() > 0){
1158 ProcessData.Append(";ALTID=");
1159 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
1163 // Check if there is a value for GEO.
1165 if ((*AddressListGeo)[AddressIter->first].size() > 0){
1167 ProcessData.Append(";GEO=\"");
1168 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
1169 ProcessData.Append("\"");
1173 // Check if there is a value for LABEL.
1175 if ((*AddressListLabel)[AddressIter->first].size() > 0){
1177 wxString AddressProcessed = "";
1178 AddressProcessed = (*AddressListLabel)[AddressIter->first];
1180 AddressProcessed.Replace("\n", "\\n", true);
1182 ProcessData.Append(";LABEL=");
1183 ProcessData.Append(AddressProcessed);
1187 // Check if there is a value for LANGUAGE.
1189 if ((*AddressListLang)[AddressIter->first].size() > 0){
1191 ProcessData.Append(";LANGUAGE=");
1192 ProcessData.Append((*AddressListLang)[AddressIter->first]);
1196 // Check if there is a value for MEDIATYPE.
1198 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1200 ProcessData.Append(";MEDIATYPE=");
1201 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1205 // Check if there is a value for PID.
1207 if ((*AddressListPID)[AddressIter->first].size() > 0){
1209 ProcessData.Append(";PID=");
1210 ProcessData.Append((*AddressListPID)[AddressIter->first]);
1214 // Check if there is a value for PREF.
1216 if ((*AddressListPref)[AddressIter->first] > 0){
1218 ProcessData.Append(";PREF=");
1219 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1223 // Check if there is a value for TZ.
1225 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1227 ProcessData.Append(";TZ=");
1228 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1232 // Check if there is a value for tokens.
1234 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1236 ProcessData.Append(";");
1237 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1241 // Build the address.
1243 ProcessData.Append(":;;");
1244 ProcessData.Append((*AddressList)[AddressIter->first]);
1245 ProcessData.Append(";");
1246 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1247 ProcessData.Append(";");
1248 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1249 ProcessData.Append(";");
1250 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1251 ProcessData.Append(";");
1252 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1253 ProcessData.Append("\n");
1255 ProcessData = OutputText(&ProcessData);
1257 SaveData->Append(ProcessData);
1258 ProcessData.clear();
1264 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1265 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1266 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1267 wxString *SaveData, wxString DataType){
1269 wxString ProcessData = "";
1271 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1272 EmailIter != EmailList->end(); EmailIter++){
1274 ProcessData.Append("EMAIL");
1276 // Check if there is a value for TYPE.
1278 if (DataType.size() > 0){
1280 ProcessData.Append(";TYPE=");
1281 ProcessData.Append(DataType);
1285 // Check if there is a value for ALTID.
1287 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1289 ProcessData.Append(";ALTID=");
1290 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1294 // Check if there is a value for PID.
1296 if ((*EmailListPID)[EmailIter->first].size() > 0){
1298 ProcessData.Append(";PID=");
1299 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1303 // Check if there is a value for PREF.
1305 if ((*EmailListPref)[EmailIter->first] > 0){
1307 ProcessData.Append(";PREF=");
1308 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1312 // Check if there is a value for tokens.
1314 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1316 ProcessData.Append(";");
1317 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1321 ProcessData.Append(":");
1322 ProcessData.Append(EmailIter->second);
1323 ProcessData.Append("\n");
1325 ProcessData = OutputText(&ProcessData);
1327 SaveData->Append(ProcessData);
1328 ProcessData.clear();
1334 void ContactDataObject::SaveIMPP(map<int, wxString> *IMList, map<int, wxString> *IMListAltID,
1335 map<int, wxString> *IMListPID, map<int, wxString> *IMListType,
1336 map<int, wxString> *IMListTypeInfo, map<int, wxString> *IMListMediatype,
1337 map<int, int> *IMListPref, map<int, wxString> *IMListTokens,
1338 wxString *SaveData, wxString DataType){
1340 wxString ProcessData = "";
1342 for (std::map<int, wxString>::iterator IMIter = IMList->begin();
1343 IMIter != IMList->end(); IMIter++){
1345 ProcessData.Append("IMPP");
1347 // Check if there is a value for TYPE.
1349 if (DataType.size() > 0){
1351 ProcessData.Append(";TYPE=");
1352 ProcessData.Append(DataType);
1356 // Check if there is a value for ALTID.
1358 if ((*IMListAltID)[IMIter->first].size() > 0){
1360 ProcessData.Append(";ALTID=");
1361 ProcessData.Append((*IMListAltID)[IMIter->first]);
1365 // Check if there is a value for MEDIATYPE.
1367 if ((*IMListMediatype)[IMIter->first].size() > 0){
1369 ProcessData.Append(";MEDIATYPE=");
1370 ProcessData.Append((*IMListMediatype)[IMIter->first]);
1374 // Check if there is a value for PID.
1376 if ((*IMListPID)[IMIter->first].size() > 0){
1378 ProcessData.Append(";PID=");
1379 ProcessData.Append((*IMListPID)[IMIter->first]);
1383 // Check if there is a value for PREF.
1385 if ((*IMListPref)[IMIter->first] > 0){
1387 ProcessData.Append(";PREF=");
1388 ProcessData.Append(wxString::Format("%i", (*IMListPref)[IMIter->first]));
1392 // Check if there is a value for tokens.
1394 if ((*IMListTokens)[IMIter->first].size() > 0){
1396 ProcessData.Append(";");
1397 ProcessData.Append((*IMListTokens)[IMIter->first]);
1401 ProcessData.Append(":");
1402 ProcessData.Append((*IMListTypeInfo)[IMIter->first]);
1403 ProcessData.Append(":");
1404 ProcessData.Append(IMIter->second);
1405 ProcessData.Append("\n");
1407 ProcessData = OutputText(&ProcessData);
1409 SaveData->Append(ProcessData);
1410 ProcessData.clear();
1416 void ContactDataObject::SaveTelephone(map<int, wxString> *TelephoneList, map<int, wxString> *TelephoneListAltID,
1417 map<int, wxString> *TelephoneListPID, map<int, wxString> *TelephoneListType,
1418 map<int, wxString> *TelephoneListTypeInfo, map<int, wxString> *TelephoneListDataType,
1419 map<int, int> *TelephoneListPref, map<int, wxString> *TelephoneListTokens,
1420 wxString *SaveData, wxString DataType){
1422 wxString ProcessData = "";
1424 for (std::map<int, wxString>::iterator TelephoneIter = TelephoneList->begin();
1425 TelephoneIter != TelephoneList->end(); TelephoneIter++){
1427 ProcessData.Append("TEL");
1429 // Check if there is a value for TYPE.
1431 if (DataType.size() > 0 || (*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1433 ProcessData.Append(";TYPE=\"");
1435 bool ProcessedType = false;
1437 if (DataType.size() > 0){
1439 ProcessData.Append(DataType);
1440 ProcessedType = true;
1444 if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1446 if (ProcessedType == true){
1447 ProcessData.Append(",");
1449 ProcessData.Append((*TelephoneListTypeInfo)[TelephoneIter->first]);
1453 ProcessData.Append("\"");
1457 // Check if there is a value for ALTID.
1459 if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1461 ProcessData.Append(";ALTID=");
1462 ProcessData.Append((*TelephoneListAltID)[TelephoneIter->first]);
1466 // Check if there is a value for PID.
1468 if ((*TelephoneListPID)[TelephoneIter->first].size() > 0){
1470 ProcessData.Append(";PID=");
1471 ProcessData.Append((*TelephoneListPID)[TelephoneIter->first]);
1475 // Check if there is a value for PREF.
1477 if ((*TelephoneListPref)[TelephoneIter->first] > 0){
1479 ProcessData.Append(";PREF=");
1480 ProcessData.Append(wxString::Format("%i", (*TelephoneListPref)[TelephoneIter->first]));
1484 // Check if there is a value for tokens.
1486 if ((*TelephoneListTokens)[TelephoneIter->first].size() > 0){
1488 ProcessData.Append(";");
1489 ProcessData.Append((*TelephoneListTokens)[TelephoneIter->first]);
1493 ProcessData.Append(":");
1494 ProcessData.Append((*TelephoneListDataType)[TelephoneIter->first]);
1495 ProcessData.Append(":");
1496 ProcessData.Append(TelephoneIter->second);
1497 ProcessData.Append("\n");
1499 ProcessData = OutputText(&ProcessData);
1501 SaveData->Append(ProcessData);
1502 ProcessData.clear();
1508 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1509 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1510 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1511 wxString *SaveData, wxString DataType){
1513 wxString ProcessData = "";
1515 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1516 LanguageIter != LanguageList->end(); LanguageIter++){
1518 ProcessData.Append("LANG");
1520 // Check if there is a value for TYPE.
1522 if (DataType.size() > 0){
1524 ProcessData.Append(";TYPE=");
1525 ProcessData.Append(DataType);
1529 // Check if there is a value for ALTID.
1531 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1533 ProcessData.Append(";ALTID=");
1534 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1538 // Check if there is a value for PID.
1540 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1542 ProcessData.Append(";PID=");
1543 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1547 // Check if there is a value for PREF.
1549 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1551 ProcessData.Append(";PREF=");
1552 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1556 // Check if there is a value for tokens.
1558 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1560 ProcessData.Append(";");
1561 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1565 ProcessData.Append(":");
1566 ProcessData.Append(LanguageIter->second);
1567 ProcessData.Append("\n");
1569 ProcessData = OutputText(&ProcessData);
1571 SaveData->Append(ProcessData);
1572 ProcessData.clear();
1578 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1579 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1580 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1581 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1582 wxString *SaveData, wxString DataType){
1584 wxString ProcessData = "";
1586 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1587 GeographyIter != GeographyList->end(); GeographyIter++){
1589 ProcessData.Append("GEO");
1591 // Check if there is a value for TYPE.
1593 if (DataType.size() > 0){
1595 ProcessData.Append(";TYPE=");
1596 ProcessData.Append(DataType);
1600 // Check if there is a value for ALTID.
1602 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1604 ProcessData.Append(";ALTID=");
1605 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1609 // Check if there is a value for MEDIATYPE.
1611 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1613 ProcessData.Append(";MEDIATYPE=");
1614 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1618 // Check if there is a value for PID.
1620 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1622 ProcessData.Append(";PID=");
1623 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1627 // Check if there is a value for PREF.
1629 if ((*GeographyListPref)[GeographyIter->first] > 0){
1631 ProcessData.Append(";PREF=");
1632 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1636 // Check if there is a value for tokens.
1638 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1640 ProcessData.Append(";");
1641 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1645 ProcessData.Append(":");
1646 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1647 ProcessData.Append(":");
1648 ProcessData.Append(GeographyIter->second);
1649 ProcessData.Append("\n");
1651 ProcessData = OutputText(&ProcessData);
1653 SaveData->Append(ProcessData);
1654 ProcessData.clear();
1660 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1661 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1662 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1663 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1665 wxString ProcessData = "";
1667 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1668 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1670 ProcessData.Append("URL");
1672 // Check if there is a value for TYPE.
1674 if (DataType.size() > 0){
1676 ProcessData.Append(";TYPE=");
1677 ProcessData.Append(DataType);
1681 // Check if there is a value for ALTID.
1683 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1685 ProcessData.Append(";ALTID=");
1686 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1690 // Check if there is a value for MEDIATYPE.
1692 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1694 ProcessData.Append(";MEDIATYPE=");
1695 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1699 // Check if there is a value for PID.
1701 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1703 ProcessData.Append(";PID=");
1704 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1708 // Check if there is a value for PREF.
1710 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1712 ProcessData.Append(";PREF=");
1713 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1717 // Check if there is a value for tokens.
1719 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1721 ProcessData.Append(";");
1722 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1726 ProcessData.Append(":");
1727 ProcessData.Append(WebsiteIter->second);
1728 ProcessData.Append("\n");
1730 ProcessData = OutputText(&ProcessData);
1732 SaveData->Append(ProcessData);
1733 ProcessData.clear();
1739 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1740 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1741 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1742 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1744 wxString ProcessData = "";
1746 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1747 RoleIter != RoleList->end(); RoleIter++){
1749 ProcessData.Append("ROLE");
1751 // Check if there is a value for TYPE.
1753 if (DataType.size() > 0){
1755 ProcessData.Append(";TYPE=");
1756 ProcessData.Append(DataType);
1760 // Check if there is a value for ALTID.
1762 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1764 ProcessData.Append(";ALTID=");
1765 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1769 // Check if there is a value for LANGUAGE.
1771 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1773 ProcessData.Append(";LANGUAGE=");
1774 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1778 // Check if there is a value for PID.
1780 if ((*RoleListPID)[RoleIter->first].size() > 0){
1782 ProcessData.Append(";PID=");
1783 ProcessData.Append((*RoleListPID)[RoleIter->first]);
1787 // Check if there is a value for PREF.
1789 if ((*RoleListPref)[RoleIter->first] > 0){
1791 ProcessData.Append(";PREF=");
1792 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1796 // Check if there is a value for tokens.
1798 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1800 ProcessData.Append(";");
1801 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1805 ProcessData.Append(":");
1806 ProcessData.Append(RoleIter->second);
1807 ProcessData.Append("\n");
1809 ProcessData = OutputText(&ProcessData);
1811 SaveData->Append(ProcessData);
1812 ProcessData.clear();
1818 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1819 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
1820 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
1821 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
1822 wxString *SaveData, wxString DataType){
1824 wxString ProcessData = "";
1826 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1827 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1829 ProcessData.Append("ORG");
1831 // Check if there is a value for TYPE.
1833 if (DataType.size() > 0){
1835 ProcessData.Append(";TYPE=");
1836 ProcessData.Append(DataType);
1840 // Check if there is a value for ALTID.
1842 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1844 ProcessData.Append(";ALTID=");
1845 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1849 // Check if there is a value for LANGUAGE.
1851 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1853 ProcessData.Append(";LANGUAGE=");
1854 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1858 // Check if there is a value for PID.
1860 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1862 ProcessData.Append(";PID=");
1863 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1867 // Check if there is a value for PREF.
1869 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1871 ProcessData.Append(";PREF=");
1872 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1876 // Check if there is a value for SORT-AS.
1878 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1880 ProcessData.Append(";SORT-AS=\"");
1881 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1882 ProcessData.Append("\"");
1886 // Check if there is a value for tokens.
1888 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1890 ProcessData.Append(";");
1891 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1895 ProcessData.Append(":");
1896 ProcessData.Append(OrganisationIter->second);
1897 ProcessData.Append("\n");
1899 ProcessData = OutputText(&ProcessData);
1901 SaveData->Append(ProcessData);
1902 ProcessData.clear();
1908 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1909 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1910 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1911 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1913 wxString ProcessData = "";
1915 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1916 NoteIter != NoteList->end(); NoteIter++){
1918 ProcessData.Append("NOTE");
1920 // Check if there is a value for TYPE.
1922 if (DataType.size() > 0){
1924 ProcessData.Append(";TYPE=");
1925 ProcessData.Append(DataType);
1929 // Check if there is a value for ALTID.
1931 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1933 ProcessData.Append(";ALTID=");
1934 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1938 // Check if there is a value for LANGUAGE.
1940 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1942 ProcessData.Append(";LANGUAGE=");
1943 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1947 // Check if there is a value for PID.
1949 if ((*NoteListPID)[NoteIter->first].size() > 0){
1951 ProcessData.Append(";PID=");
1952 ProcessData.Append((*NoteListPID)[NoteIter->first]);
1956 // Check if there is a value for PREF.
1958 if ((*NoteListPref)[NoteIter->first] > 0){
1960 ProcessData.Append(";PREF=");
1961 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1965 // Check if there is a value for tokens.
1967 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1969 ProcessData.Append(";");
1970 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1974 ProcessData.Append(":");
1975 ProcessData.Append(NoteIter->second);
1976 ProcessData.Replace("\n", "\\n", true);
1977 ProcessData.Append("\n");
1979 ProcessData = OutputText(&ProcessData);
1981 SaveData->Append(ProcessData);
1982 ProcessData.clear();
1988 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1989 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1990 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1991 map<int, wxString> *CategoryListTokens, wxString *SaveData){
1993 wxString ProcessData = "";
1995 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1996 CategoryIter != CategoryList->end(); CategoryIter++){
1998 ProcessData.Append("CATEGORIES");
2000 // Check if there is a value for TYPE.
2002 if ((*CategoryListType)[CategoryIter->first].size() > 0){
2004 ProcessData.Append(";TYPE=");
2005 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
2009 // Check if there is a value for ALTID.
2011 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
2013 ProcessData.Append(";ALTID=");
2014 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
2018 // Check if there is a value for LANGUAGE.
2020 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
2022 ProcessData.Append(";LANGUAGE=");
2023 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
2027 // Check if there is a value for PID.
2029 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
2031 ProcessData.Append(";PID=");
2032 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
2036 // Check if there is a value for PREF.
2038 if ((*CategoryListPref)[CategoryIter->first] > 0){
2040 ProcessData.Append(";PREF=");
2041 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
2045 // Check if there is a value for tokens.
2047 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
2049 ProcessData.Append(";");
2050 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
2054 ProcessData.Append(":");
2055 ProcessData.Append(CategoryIter->second);
2056 ProcessData.Append("\n");
2058 ProcessData = OutputText(&ProcessData);
2060 SaveData->Append(ProcessData);
2061 ProcessData.clear();
2067 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
2068 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
2069 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
2070 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
2071 map<int, wxString> *PicturesListTokens, wxString *SaveData){
2073 wxString ProcessData = "";
2075 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
2076 PicturesIter != PicturesList->end(); PicturesIter++){
2078 ProcessData.Append("PHOTO");
2080 // Check if there is a value for TYPE.
2082 if ((*PicturesListType)[PicturesIter->first].size() > 0){
2084 ProcessData.Append(";TYPE=");
2085 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
2089 // Check if there is a value for ALTID.
2091 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
2093 ProcessData.Append(";ALTID=");
2094 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
2098 // Check if there is a value for MEDIATYPE..
2100 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
2102 ProcessData.Append(";MEDIATYPE=");
2103 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
2107 // Check if there is a value for PID.
2109 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
2111 ProcessData.Append(";PID=");
2112 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
2116 // Check if there is a value for PREF.
2118 if ((*PicturesListPref)[PicturesIter->first] > 0){
2120 ProcessData.Append(";PREF=");
2121 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
2125 // Check if there is a value for tokens.
2127 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
2129 ProcessData.Append(";");
2130 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
2134 ProcessData.Append(":data:");
2135 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
2136 ProcessData.Append(";");
2137 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
2138 ProcessData.Append(",");
2139 ProcessData.Append(PicturesIter->second);
2140 ProcessData.Append("\n");
2142 ProcessData = OutputText(&ProcessData);
2144 SaveData->Append(ProcessData);
2145 ProcessData.clear();
2151 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID,
2152 map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
2153 map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
2154 map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
2155 map<int, wxString> *LogosListTokens, wxString *SaveData){
2157 wxString ProcessData = "";
2159 for (std::map<int, string>::iterator LogosIter = LogosList->begin();
2160 LogosIter != LogosList->end(); LogosIter++){
2162 ProcessData.Append("LOGO");
2164 // Check if there is a value for TYPE.
2166 if ((*LogosListType)[LogosIter->first].size() > 0){
2168 ProcessData.Append(";TYPE=");
2169 ProcessData.Append((*LogosListType)[LogosIter->first]);
2173 // Check if there is a value for ALTID.
2175 if ((*LogosListAltID)[LogosIter->first].size() > 0){
2177 ProcessData.Append(";ALTID=");
2178 ProcessData.Append((*LogosListAltID)[LogosIter->first]);
2182 // Check if there is a value for MEDIATYPE..
2184 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
2186 ProcessData.Append(";MEDIATYPE=");
2187 ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
2191 // Check if there is a value for PID.
2193 if ((*LogosListPID)[LogosIter->first].size() > 0){
2195 ProcessData.Append(";PID=");
2196 ProcessData.Append((*LogosListPID)[LogosIter->first]);
2200 // Check if there is a value for PREF.
2202 if ((*LogosListPref)[LogosIter->first] > 0){
2204 ProcessData.Append(";PREF=");
2205 ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
2209 // Check if there is a value for tokens.
2211 if ((*LogosListTokens)[LogosIter->first].size() > 0){
2213 ProcessData.Append(";");
2214 ProcessData.Append((*LogosListTokens)[LogosIter->first]);
2218 ProcessData.Append(":data:");
2219 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
2220 ProcessData.Append(";");
2221 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
2222 ProcessData.Append(",");
2223 ProcessData.Append(LogosIter->second);
2224 ProcessData.Append("\n");
2226 ProcessData = OutputText(&ProcessData);
2228 SaveData->Append(ProcessData);
2229 ProcessData.clear();
2235 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID,
2236 map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
2237 map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
2238 map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage,
2239 map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens,
2240 wxString *SaveData){
2242 wxString ProcessData = "";
2244 for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
2245 SoundsIter != SoundsList->end(); SoundsIter++){
2247 ProcessData.Append("SOUND");
2249 // Check if there is a value for TYPE.
2251 if ((*SoundsListType)[SoundsIter->first].size() > 0){
2253 ProcessData.Append(";TYPE=");
2254 ProcessData.Append((*SoundsListType)[SoundsIter->first]);
2258 // Check if there is a value for ALTID.
2260 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
2262 ProcessData.Append(";ALTID=");
2263 ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
2267 // Check if there is a value for LANGUAGE.
2269 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
2271 ProcessData.Append(";LANGUAGE=");
2272 ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
2276 // Check if there is a value for MEDIATYPE.
2278 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
2280 ProcessData.Append(";MEDIATYPE=");
2281 ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
2285 // Check if there is a value for PID.
2287 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
2289 ProcessData.Append(";PID=");
2290 ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
2294 // Check if there is a value for PREF.
2296 if ((*SoundsListPref)[SoundsIter->first] > 0){
2298 ProcessData.Append(";PREF=");
2299 ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
2303 // Check if there is a value for tokens.
2305 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
2307 ProcessData.Append(";");
2308 ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
2312 ProcessData.Append(":data:");
2313 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
2314 ProcessData.Append(";");
2315 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
2316 ProcessData.Append(",");
2317 ProcessData.Append(SoundsIter->second);
2318 ProcessData.Append("\n");
2320 ProcessData = OutputText(&ProcessData);
2322 SaveData->Append(ProcessData);
2323 ProcessData.clear();
2329 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
2330 map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
2331 map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
2332 map<int, wxString> *CalendarListTokens, wxString *SaveData){
2334 wxString ProcessData = "";
2336 for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
2337 CalendarIter != CalendarList->end(); CalendarIter++){
2339 ProcessData.Append("CALURI");
2341 // Check if there is a value for TYPE.
2343 if ((*CalendarListType)[CalendarIter->first].size() > 0){
2345 ProcessData.Append(";TYPE=");
2346 ProcessData.Append((*CalendarListType)[CalendarIter->first]);
2350 // Check if there is a value for ALTID.
2352 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2354 ProcessData.Append(";ALTID=");
2355 ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2359 // Check if there is a value for MEDIATYPE.
2361 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2363 ProcessData.Append(";MEDIATYPE=");
2364 ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2368 // Check if there is a value for PID.
2370 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2372 ProcessData.Append(";PID=");
2373 ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2377 // Check if there is a value for PREF.
2379 if ((*CalendarListPref)[CalendarIter->first] > 0){
2381 ProcessData.Append(";PREF=");
2382 ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2386 // Check if there is a value for tokens.
2388 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2390 ProcessData.Append(";");
2391 ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2395 ProcessData.Append(":");
2396 ProcessData.Append(CalendarIter->second);
2397 ProcessData.Append("\n");
2399 ProcessData = OutputText(&ProcessData);
2401 SaveData->Append(ProcessData);
2402 ProcessData.clear();
2408 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2409 map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2410 map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2411 map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2413 wxString ProcessData = "";
2415 for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2416 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2418 ProcessData.Append("CALADRURI");
2420 // Check if there is a value for TYPE.
2422 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2424 ProcessData.Append(";TYPE=");
2425 ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2429 // Check if there is a value for ALTID.
2431 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2433 ProcessData.Append(";ALTID=");
2434 ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2438 // Check if there is a value for MEDIATYPE.
2440 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2442 ProcessData.Append(";MEDIATYPE=");
2443 ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2447 // Check if there is a value for PID.
2449 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2451 ProcessData.Append(";PID=");
2452 ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2456 // Check if there is a value for PREF.
2458 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2460 ProcessData.Append(";PREF=");
2461 ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2465 // Check if there is a value for tokens.
2467 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2469 ProcessData.Append(";");
2470 ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2474 ProcessData.Append(":");
2475 ProcessData.Append(CalendarRequestIter->second);
2476 ProcessData.Append("\n");
2478 ProcessData = OutputText(&ProcessData);
2480 SaveData->Append(ProcessData);
2481 ProcessData.clear();
2487 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID,
2488 std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2489 std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref,
2490 std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2492 wxString ProcessData = "";
2494 for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2495 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2497 ProcessData.Append("FBURL");
2499 // Check if there is a value for TYPE.
2501 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2503 ProcessData.Append(";TYPE=");
2504 ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2508 // Check if there is a value for ALTID.
2510 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2512 ProcessData.Append(";ALTID=");
2513 ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2517 // Check if there is a value for MEDIATYPE.
2519 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2521 ProcessData.Append(";MEDIATYPE=");
2522 ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2526 // Check if there is a value for PID.
2528 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2530 ProcessData.Append(";PID=");
2531 ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2535 // Check if there is a value for PREF.
2537 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2539 ProcessData.Append(";PREF=");
2540 ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2544 // Check if there is a value for tokens.
2546 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2548 ProcessData.Append(";");
2549 ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2553 ProcessData.Append(":");
2554 ProcessData.Append(FreeBusyIter->second);
2555 ProcessData.Append("\n");
2557 ProcessData = OutputText(&ProcessData);
2559 SaveData->Append(ProcessData);
2560 ProcessData.clear();
2566 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID,
2567 map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2568 map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType,
2569 map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref,
2570 map<int, wxString> *KeyListTokens, wxString *SaveData){
2572 wxString ProcessData = "";
2574 for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2575 KeyIter != KeyList->end(); KeyIter++){
2577 ProcessData.Append("KEY");
2579 // Check if there is a value for TYPE.
2581 if ((*KeyListType)[KeyIter->first].size() > 0){
2583 ProcessData.Append(";TYPE=");
2584 ProcessData.Append((*KeyListType)[KeyIter->first]);
2588 // Check if there is a value for ALTID.
2590 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2592 ProcessData.Append(";ALTID=");
2593 ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2597 // Check if there is a value for PID.
2599 if ((*KeyListPID)[KeyIter->first].size() > 0){
2601 ProcessData.Append(";PID=");
2602 ProcessData.Append((*KeyListPID)[KeyIter->first]);
2606 // Check if there is a value for PREF.
2608 if ((*KeyListPref)[KeyIter->first] > 0){
2610 ProcessData.Append(";PREF=");
2611 ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2615 // Check if there is a value for tokens.
2617 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2619 ProcessData.Append(";");
2620 ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2624 ProcessData.Append(":data:");
2625 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2626 ProcessData.Append(";");
2627 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2628 ProcessData.Append(",");
2629 ProcessData.Append(KeyIter->second);
2630 ProcessData.Append("\n");
2632 ProcessData = OutputText(&ProcessData);
2634 SaveData->Append(ProcessData);
2635 ProcessData.clear();
2641 void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN,
2642 map<int, wxString> *VendorListElement, wxString *SaveData){
2644 wxString ProcessData = "";
2646 for (std::map<int, wxString>::iterator VendorIter = VendorList->begin();
2647 VendorIter != VendorList->end(); VendorIter++){
2649 ProcessData.Append("VND-");
2650 ProcessData.Append((*VendorListPEN)[VendorIter->first]);
2651 ProcessData.Append("-");
2652 ProcessData.Append((*VendorListElement)[VendorIter->first]);
2653 ProcessData.Append(":");
2654 ProcessData.Append(VendorIter->second);
2655 ProcessData.Append("\n");
2657 ProcessData = OutputText(&ProcessData);
2659 SaveData->Append(ProcessData);
2660 ProcessData.clear();
2666 void ContactDataObject::SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens,
2667 wxString *SaveData){
2669 wxString ProcessData = "";
2671 for (std::map<int, wxString>::iterator XTokenIter = XTokenList->begin();
2672 XTokenIter != XTokenList->end(); XTokenIter++){
2674 ProcessData.Append("X-");
2675 ProcessData.Append((*XTokenListTokens)[XTokenIter->first]);
2676 ProcessData.Append(":");
2677 ProcessData.Append(XTokenIter->second);
2678 ProcessData.Append("\n");
2680 ProcessData = OutputText(&ProcessData);
2682 SaveData->Append(ProcessData);
2683 ProcessData.clear();