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,
358 // TODO: Process IMPP.
362 // TODO: Process TEL.
368 SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID,
369 &GeneralLanguageListPID, &GeneralLanguageListType,
370 &GeneralLanguageListPref, &GeneralLanguageListTokens,
372 SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID,
373 &HomeLanguageListPID, &HomeLanguageListType,
374 &HomeLanguageListPref, &HomeLanguageListTokens,
376 SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID,
377 &BusinessLanguageListPID, &BusinessLanguageListType,
378 &BusinessLanguageListPref, &BusinessLanguageListTokens,
383 SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID,
384 &GeneralGeographyListPID, &GeneralGeographyListType,
385 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
386 &GeneralGeographyListPref, &GeneralGeographyListTokens,
388 SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID,
389 &HomeGeographyListPID, &HomeGeographyListType,
390 &HomeGeographyListMediatype, &HomeGeographyListDataType,
391 &HomeGeographyListPref, &HomeGeographyListTokens,
393 SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID,
394 &BusinessGeographyListPID, &BusinessGeographyListType,
395 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
396 &BusinessGeographyListPref, &BusinessGeographyListTokens,
403 for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
404 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
406 ProcessData.Append("RELATED");
408 // Check if there is a value for TYPE.
410 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
412 wxString RelatedType = "";
414 ProcessData.Append(";TYPE=");
416 if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
418 RelatedType = wxT("contact");
420 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
422 RelatedType = wxT("acquaintance");
424 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
426 RelatedType = wxT("friend");
428 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
430 RelatedType = wxT("met");
432 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
434 RelatedType = wxT("co-worker");
436 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
438 RelatedType = wxT("colleague");
440 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
442 RelatedType = wxT("co-resident");
444 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
446 RelatedType = wxT("neighbor");
448 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
450 RelatedType = wxT("child");
452 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
454 RelatedType = wxT("parent");
456 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
458 RelatedType = wxT("sibling");
460 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
462 RelatedType = wxT("spouse");
464 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
466 RelatedType = wxT("kin");
468 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
470 RelatedType = wxT("muse");
472 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
474 RelatedType = wxT("crush");
476 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
478 RelatedType = wxT("date");
480 } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
482 RelatedType = wxT("sweetheart");
484 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
486 RelatedType = wxT("me");
488 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
490 RelatedType = wxT("agent");
492 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
494 RelatedType = wxT("emergency");
498 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
502 ProcessData.Append(RelatedType);
506 // Check if there is a value for LANGUAGE.
508 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
510 ProcessData.Append(";LANGUAGE=");
511 ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
515 // Check if there is a value for ALTID.
517 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
519 ProcessData.Append(";ALTID=");
520 ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
524 // Check if there is a value for PID.
526 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
528 ProcessData.Append(";PID=");
529 ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
533 // Check if there is a value for PREF.
535 if (GeneralRelatedListPref[RelatedIter->first] > 0){
537 ProcessData.Append(";PREF=");
538 ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
542 // Check if there is a value for tokens.
544 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
546 ProcessData.Append(";");
547 ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
551 ProcessData.Append(":");
552 ProcessData.Append(RelatedIter->second);
553 ProcessData.Append("\n");
555 ProcessData = OutputText(&ProcessData);
557 SaveData->Append(ProcessData);
564 SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID,
565 &GeneralWebsiteListPID, &GeneralWebsiteListType,
566 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref,
567 &GeneralWebsiteListTokens, SaveData, "");
568 SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID,
569 &HomeWebsiteListPID, &HomeWebsiteListType,
570 &HomeWebsiteListMediatype, &HomeWebsiteListPref,
571 &HomeWebsiteListTokens, SaveData, "home");
572 SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID,
573 &BusinessWebsiteListPID, &BusinessWebsiteListType,
574 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref,
575 &BusinessWebsiteListTokens, SaveData, "work");
579 SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
580 &GeneralRoleListAltID, &GeneralRoleListPID,
581 &GeneralRoleListType, &GeneralRoleListPref,
582 &GeneralRoleListTokens, SaveData, "");
583 SaveRole(&HomeRoleList, &HomeRoleListLanguage,
584 &HomeRoleListAltID, &HomeRoleListPID,
585 &HomeRoleListType, &HomeRoleListPref,
586 &HomeRoleListTokens, SaveData, "home");
587 SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
588 &BusinessRoleListAltID, &BusinessRoleListPID,
589 &BusinessRoleListType, &BusinessRoleListPref,
590 &BusinessRoleListTokens, SaveData, "work");
594 SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
595 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage,
596 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType,
597 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens,
599 SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
600 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage,
601 &HomeOrganisationsListSortAs, &HomeOrganisationsListType,
602 &HomeOrganisationsListPref, &HomeOrganisationsListTokens,
604 SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
605 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage,
606 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType,
607 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens,
612 SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
613 &GeneralNoteListAltID, &GeneralNoteListPID,
614 &GeneralNoteListType, &GeneralNoteListPref,
615 &GeneralNoteListTokens, SaveData, "");
616 SaveNote(&HomeNoteList, &HomeNoteListLanguage,
617 &HomeNoteListAltID, &HomeNoteListPID,
618 &HomeNoteListType, &HomeNoteListPref,
619 &HomeNoteListTokens, SaveData, "home");
620 SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
621 &BusinessNoteListAltID, &BusinessNoteListPID,
622 &BusinessNoteListType, &BusinessNoteListPref,
623 &BusinessNoteListTokens, SaveData, "work");
625 // Process CATEGORIES.
627 SaveCategory(&CategoriesList, &CategoriesListLanguage,
628 &CategoriesListAltID, &CategoriesListPID,
629 &CategoriesListType, &CategoriesListPref,
630 &CategoriesListTokens, SaveData);
634 SavePhoto(&PicturesList, &PicturesListAltID,
635 &PicturesListPID, &PicturesListType,
636 &PicturesListPicEncType, &PicturesListPictureType,
637 &PicturesListMediatype, &PicturesListPref,
638 &PicturesListTokens, SaveData);
642 SaveLogo(&LogosList, &LogosListAltID,
643 &LogosListPID, &LogosListType,
644 &LogosListPicEncType, &LogosListPictureType,
645 &LogosListMediatype, &LogosListPref,
646 &LogosListTokens, SaveData);
650 SaveSound(&SoundsList, &SoundsListAltID,
651 &SoundsListPID, &SoundsListType,
652 &SoundsListAudioEncType, &SoundsListAudioType,
653 &SoundsListMediatype, &SoundsListLanguage,
654 &SoundsListPref, &SoundsListTokens,
659 SaveCalendarURI(&CalendarList, &CalendarListMediatype,
660 &CalendarListAltID, &CalendarListPID,
661 &CalendarListType, &CalendarListPref,
662 &CalendarListTokens, SaveData);
664 // Process CALADRURI.
666 SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
667 &CalendarRequestListAltID, &CalendarRequestListPID,
668 &CalendarRequestListType, &CalendarRequestListPref,
669 &CalendarRequestListTokens, SaveData);
673 SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID,
674 &FreeBusyListPID, &FreeBusyListType,
675 &FreeBusyListMediatype, &FreeBusyListPref,
676 &FreeBusyListTokens, SaveData);
680 SaveKey(&KeyList, &KeyListAltID,
681 &KeyListPID, &KeyListType,
682 &KeyListKeyType, &KeyListDataEncType,
683 &KeyListDataType, &KeyListPref,
684 &KeyListTokens, SaveData);
688 SaveVendor(&VendorList, &VendorListPEN,
689 &VendorListElement, SaveData);
693 SaveXToken(&XTokenList, &XTokenListTokens,
696 // Write the end part of the vCard data file.
698 SaveData->Append("END:VCARD");
700 SaveDataStatus = CONTACTSAVE_OK;
702 return SaveDataStatus;
706 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
707 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
708 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
709 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
711 wxString ProcessData = "";
713 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
714 TitleIter != TitleList->end(); TitleIter++){
716 ProcessData.Append("TITLE");
718 // Check if there is a value for TYPE.
720 if (DataType.size() > 0){
722 ProcessData.Append(";TYPE=");
723 ProcessData.Append(DataType);
727 // Check if there is a value for ALTID.
729 if ((*TitleListAltID)[TitleIter->first].size() > 0){
731 ProcessData.Append(";ALTID=");
732 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
736 // Check if there is a value for LANGUAGE.
738 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
740 ProcessData.Append(";LANGUAGE=");
741 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
745 // Check if there is a value for PID.
747 if ((*TitleListPID)[TitleIter->first].size() > 0){
749 ProcessData.Append(";PID=");
750 ProcessData.Append((*TitleListPID)[TitleIter->first]);
754 // Check if there is a value for PREF.
756 if ((*TitleListPref)[TitleIter->first] > 0){
758 ProcessData.Append(";PREF=");
759 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
763 // Check if there is a value for tokens.
765 if ((*TitleListTokens)[TitleIter->first].size() > 0){
767 ProcessData.Append(";");
768 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
772 ProcessData.Append(":");
773 ProcessData.Append(TitleIter->second);
774 ProcessData.Append("\n");
776 ProcessData = OutputText(&ProcessData);
778 SaveData->Append(ProcessData);
785 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
786 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
787 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
788 map<int, wxString> *SourceListTokens, wxString *SaveData){
790 wxString ProcessData = "";
792 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
793 SourceIter != SourceList->end(); SourceIter++){
795 ProcessData.Append("SOURCE");
797 // Check if there is a value for TYPE.
799 if ((*SourceListType)[SourceIter->first].size() > 0){
801 ProcessData.Append(";TYPE=");
802 ProcessData.Append((*SourceListType)[SourceIter->first]);
806 // Check if there is a value for ALTID.
808 if ((*SourceListAltID)[SourceIter->first].size() > 0){
810 ProcessData.Append(";ALTID=");
811 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
815 // Check if there is a value for MEDIATYPE.
817 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
819 ProcessData.Append(";MEDIATYPE=");
820 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
824 // Check if there is a value for PID.
826 if ((*SourceListPID)[SourceIter->first].size() > 0){
828 ProcessData.Append(";PID=");
829 ProcessData.Append((*SourceListPID)[SourceIter->first]);
833 // Check if there is a value for PREF.
835 if ((*SourceListPref)[SourceIter->first] > 0){
837 ProcessData.Append(";PREF=");
838 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
842 // Check if there is a value for tokens.
844 if ((*SourceListTokens)[SourceIter->first].size() > 0){
846 ProcessData.Append(";");
847 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
851 ProcessData.Append(":");
852 ProcessData.Append(SourceIter->second);
853 ProcessData.Append("\n");
855 ProcessData = OutputText(&ProcessData);
857 SaveData->Append(ProcessData);
864 void ContactDataObject::SaveMember(std::map<int, wxString> *GroupsList, std::map<int, wxString> *GroupsListAltID,
865 std::map<int, wxString> *GroupsListPID, std::map<int, wxString> *GroupsListType,
866 std::map<int, wxString> *GroupsListMediaType, std::map<int, int> *GroupsListPref,
867 std::map<int, wxString> *GroupsListTokens, wxString *SaveData){
869 wxString ProcessData = "";
871 for (std::map<int, wxString>::iterator GroupsIter = GroupsList->begin();
872 GroupsIter != GroupsList->end(); GroupsIter++){
874 ProcessData.Append("MEMBER");
876 // Check if there is a value for TYPE.
878 if ((*GroupsListType)[GroupsIter->first].size() > 0){
880 ProcessData.Append(";TYPE=");
881 ProcessData.Append((*GroupsListType)[GroupsIter->first]);
885 // Check if there is a value for ALTID.
887 if ((*GroupsListAltID)[GroupsIter->first].size() > 0){
889 ProcessData.Append(";ALTID=");
890 ProcessData.Append((*GroupsListAltID)[GroupsIter->first]);
894 // Check if there is a value for MEDIATYPE.
896 if ((*GroupsListMediaType)[GroupsIter->first].size() > 0){
898 ProcessData.Append(";MEDIATYPE=");
899 ProcessData.Append((*GroupsListMediaType)[GroupsIter->first]);
903 // Check if there is a value for PID.
905 if ((*GroupsListPID)[GroupsIter->first].size() > 0){
907 ProcessData.Append(";PID=");
908 ProcessData.Append((*GroupsListPID)[GroupsIter->first]);
912 // Check if there is a value for PREF.
914 if ((*GroupsListPref)[GroupsIter->first] > 0){
916 ProcessData.Append(";PREF=");
917 ProcessData.Append(wxString::Format("%i", (*GroupsListPref)[GroupsIter->first]));
921 // Check if there is a value for tokens.
923 if ((*GroupsListTokens)[GroupsIter->first].size() > 0){
925 ProcessData.Append(";");
926 ProcessData.Append((*GroupsListTokens)[GroupsIter->first]);
930 ProcessData.Append(":");
931 ProcessData.Append(GroupsIter->second);
932 ProcessData.Append("\n");
934 ProcessData = OutputText(&ProcessData);
936 SaveData->Append(ProcessData);
943 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
944 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
945 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
946 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
948 wxString ProcessData = "";
950 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
951 NicknameIter != NicknameList->end(); NicknameIter++){
953 ProcessData.Append("NICKNAME");
955 // Check if there is a value for TYPE.
957 if (DataType.size() > 0){
959 ProcessData.Append(";TYPE=");
960 ProcessData.Append(DataType);
964 // Check if there is a value for ALTID.
966 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
968 ProcessData.Append(";ALTID=");
969 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
973 // Check if there is a value for MEDIATYPE.
975 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
977 ProcessData.Append(";LANGUAGE=");
978 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
982 // Check if there is a value for PID.
984 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
986 ProcessData.Append(";PID=");
987 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
991 // Check if there is a value for PREF.
993 if ((*NicknameListPref)[NicknameIter->first] > 0){
995 ProcessData.Append(";PREF=");
996 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
1000 // Check if there is a value for tokens.
1002 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
1004 ProcessData.Append(";");
1005 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
1009 ProcessData.Append(":");
1010 ProcessData.Append(NicknameIter->second);
1011 ProcessData.Append("\n");
1013 ProcessData = OutputText(&ProcessData);
1015 SaveData->Append(ProcessData);
1016 ProcessData.clear();
1022 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
1023 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
1024 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
1025 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
1027 wxString ProcessData = "";
1029 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
1030 TZIter != TZList->end(); TZIter++){
1032 ProcessData.Append("TZ");
1034 // Check if there is a value for TYPE.
1036 if (DataType.size() > 0){
1038 ProcessData.Append(";TYPE=");
1039 ProcessData.Append(DataType);
1043 // Check if there is a value for ALTID.
1045 if ((*TZListAltID)[TZIter->first].size() > 0){
1047 ProcessData.Append(";ALTID=");
1048 ProcessData.Append((*TZListAltID)[TZIter->first]);
1052 // Check if there is a value for MEDIATYPE.
1054 if ((*TZListMediatype)[TZIter->first].size() > 0){
1056 ProcessData.Append(";MEDIATYPE=");
1057 ProcessData.Append((*TZListMediatype)[TZIter->first]);
1061 // Check if there is a value for PID.
1063 if ((*TZListPID)[TZIter->first].size() > 0){
1065 ProcessData.Append(";PID=");
1066 ProcessData.Append((*TZListPID)[TZIter->first]);
1070 // Check if there is a value for PREF.
1072 if ((*TZListPref)[TZIter->first] > 0){
1074 ProcessData.Append(";PREF=");
1075 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
1079 // Check if there is a value for tokens.
1081 if ((*TZListTokens)[TZIter->first].size() > 0){
1083 ProcessData.Append(";");
1084 ProcessData.Append((*TZListTokens)[TZIter->first]);
1088 ProcessData.Append(":");
1089 ProcessData.Append(TZIter->second);
1090 ProcessData.Append("\n");
1092 ProcessData = OutputText(&ProcessData);
1094 SaveData->Append(ProcessData);
1095 ProcessData.clear();
1101 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
1102 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
1103 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
1104 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
1105 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
1106 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
1107 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
1108 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
1110 wxString ProcessData = "";
1112 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
1113 AddressIter != AddressList->end(); AddressIter++){
1115 ProcessData.Append("ADR");
1117 // Check if there is a value for TYPE.
1119 if (DataType.size() > 0){
1121 ProcessData.Append(";TYPE=");
1122 ProcessData.Append(DataType);
1126 // Check if there is a value for ALTID.
1128 if ((*AddressListAltID)[AddressIter->first].size() > 0){
1130 ProcessData.Append(";ALTID=");
1131 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
1135 // Check if there is a value for GEO.
1137 if ((*AddressListGeo)[AddressIter->first].size() > 0){
1139 ProcessData.Append(";GEO=\"");
1140 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
1141 ProcessData.Append("\"");
1145 // Check if there is a value for LABEL.
1147 if ((*AddressListLabel)[AddressIter->first].size() > 0){
1149 wxString AddressProcessed = "";
1150 AddressProcessed = (*AddressListLabel)[AddressIter->first];
1152 AddressProcessed.Replace("\n", "\\n", true);
1154 ProcessData.Append(";LABEL=");
1155 ProcessData.Append(AddressProcessed);
1159 // Check if there is a value for LANGUAGE.
1161 if ((*AddressListLang)[AddressIter->first].size() > 0){
1163 ProcessData.Append(";LANGUAGE=");
1164 ProcessData.Append((*AddressListLang)[AddressIter->first]);
1168 // Check if there is a value for MEDIATYPE.
1170 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1172 ProcessData.Append(";MEDIATYPE=");
1173 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1177 // Check if there is a value for PID.
1179 if ((*AddressListPID)[AddressIter->first].size() > 0){
1181 ProcessData.Append(";PID=");
1182 ProcessData.Append((*AddressListPID)[AddressIter->first]);
1186 // Check if there is a value for PREF.
1188 if ((*AddressListPref)[AddressIter->first] > 0){
1190 ProcessData.Append(";PREF=");
1191 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1195 // Check if there is a value for TZ.
1197 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1199 ProcessData.Append(";TZ=");
1200 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1204 // Check if there is a value for tokens.
1206 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1208 ProcessData.Append(";");
1209 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1213 // Build the address.
1215 ProcessData.Append(":;;");
1216 ProcessData.Append((*AddressList)[AddressIter->first]);
1217 ProcessData.Append(";");
1218 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1219 ProcessData.Append(";");
1220 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1221 ProcessData.Append(";");
1222 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1223 ProcessData.Append(";");
1224 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1225 ProcessData.Append("\n");
1227 ProcessData = OutputText(&ProcessData);
1229 SaveData->Append(ProcessData);
1230 ProcessData.clear();
1236 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1237 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1238 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1239 wxString *SaveData, wxString DataType){
1241 wxString ProcessData = "";
1243 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1244 EmailIter != EmailList->end(); EmailIter++){
1246 ProcessData.Append("EMAIL");
1248 // Check if there is a value for TYPE.
1250 if (DataType.size() > 0){
1252 ProcessData.Append(";TYPE=");
1253 ProcessData.Append(DataType);
1257 // Check if there is a value for ALTID.
1259 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1261 ProcessData.Append(";ALTID=");
1262 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1266 // Check if there is a value for PID.
1268 if ((*EmailListPID)[EmailIter->first].size() > 0){
1270 ProcessData.Append(";PID=");
1271 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1275 // Check if there is a value for PREF.
1277 if ((*EmailListPref)[EmailIter->first] > 0){
1279 ProcessData.Append(";PREF=");
1280 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1284 // Check if there is a value for tokens.
1286 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1288 ProcessData.Append(";");
1289 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1293 ProcessData.Append(":");
1294 ProcessData.Append(EmailIter->second);
1295 ProcessData.Append("\n");
1297 ProcessData = OutputText(&ProcessData);
1299 SaveData->Append(ProcessData);
1300 ProcessData.clear();
1306 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1307 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1308 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1309 wxString *SaveData, wxString DataType){
1311 wxString ProcessData = "";
1313 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1314 LanguageIter != LanguageList->end(); LanguageIter++){
1316 ProcessData.Append("LANG");
1318 // Check if there is a value for TYPE.
1320 if (DataType.size() > 0){
1322 ProcessData.Append(";TYPE=");
1323 ProcessData.Append(DataType);
1327 // Check if there is a value for ALTID.
1329 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1331 ProcessData.Append(";ALTID=");
1332 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1336 // Check if there is a value for PID.
1338 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1340 ProcessData.Append(";PID=");
1341 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1345 // Check if there is a value for PREF.
1347 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1349 ProcessData.Append(";PREF=");
1350 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1354 // Check if there is a value for tokens.
1356 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1358 ProcessData.Append(";");
1359 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1363 ProcessData.Append(":");
1364 ProcessData.Append(LanguageIter->second);
1365 ProcessData.Append("\n");
1367 ProcessData = OutputText(&ProcessData);
1369 SaveData->Append(ProcessData);
1370 ProcessData.clear();
1376 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1377 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1378 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1379 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1380 wxString *SaveData, wxString DataType){
1382 wxString ProcessData = "";
1384 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1385 GeographyIter != GeographyList->end(); GeographyIter++){
1387 ProcessData.Append("GEO");
1389 // Check if there is a value for TYPE.
1391 if (DataType.size() > 0){
1393 ProcessData.Append(";TYPE=");
1394 ProcessData.Append(DataType);
1398 // Check if there is a value for ALTID.
1400 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1402 ProcessData.Append(";ALTID=");
1403 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1407 // Check if there is a value for MEDIATYPE.
1409 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1411 ProcessData.Append(";MEDIATYPE=");
1412 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1416 // Check if there is a value for PID.
1418 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1420 ProcessData.Append(";PID=");
1421 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1425 // Check if there is a value for PREF.
1427 if ((*GeographyListPref)[GeographyIter->first] > 0){
1429 ProcessData.Append(";PREF=");
1430 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1434 // Check if there is a value for tokens.
1436 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1438 ProcessData.Append(";");
1439 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1443 ProcessData.Append(":");
1444 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1445 ProcessData.Append(":");
1446 ProcessData.Append(GeographyIter->second);
1447 ProcessData.Append("\n");
1449 ProcessData = OutputText(&ProcessData);
1451 SaveData->Append(ProcessData);
1452 ProcessData.clear();
1458 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1459 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1460 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1461 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1463 wxString ProcessData = "";
1465 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1466 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1468 ProcessData.Append("URL");
1470 // Check if there is a value for TYPE.
1472 if (DataType.size() > 0){
1474 ProcessData.Append(";TYPE=");
1475 ProcessData.Append(DataType);
1479 // Check if there is a value for ALTID.
1481 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1483 ProcessData.Append(";ALTID=");
1484 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1488 // Check if there is a value for MEDIATYPE.
1490 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1492 ProcessData.Append(";MEDIATYPE=");
1493 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1497 // Check if there is a value for PID.
1499 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1501 ProcessData.Append(";PID=");
1502 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1506 // Check if there is a value for PREF.
1508 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1510 ProcessData.Append(";PREF=");
1511 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1515 // Check if there is a value for tokens.
1517 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1519 ProcessData.Append(";");
1520 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1524 ProcessData.Append(":");
1525 ProcessData.Append(WebsiteIter->second);
1526 ProcessData.Append("\n");
1528 ProcessData = OutputText(&ProcessData);
1530 SaveData->Append(ProcessData);
1531 ProcessData.clear();
1537 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1538 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1539 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1540 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1542 wxString ProcessData = "";
1544 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1545 RoleIter != RoleList->end(); RoleIter++){
1547 ProcessData.Append("ROLE");
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 ((*RoleListAltID)[RoleIter->first].size() > 0){
1562 ProcessData.Append(";ALTID=");
1563 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1567 // Check if there is a value for LANGUAGE.
1569 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1571 ProcessData.Append(";LANGUAGE=");
1572 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1576 // Check if there is a value for PID.
1578 if ((*RoleListPID)[RoleIter->first].size() > 0){
1580 ProcessData.Append(";PID=");
1581 ProcessData.Append((*RoleListPID)[RoleIter->first]);
1585 // Check if there is a value for PREF.
1587 if ((*RoleListPref)[RoleIter->first] > 0){
1589 ProcessData.Append(";PREF=");
1590 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1594 // Check if there is a value for tokens.
1596 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1598 ProcessData.Append(";");
1599 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1603 ProcessData.Append(":");
1604 ProcessData.Append(RoleIter->second);
1605 ProcessData.Append("\n");
1607 ProcessData = OutputText(&ProcessData);
1609 SaveData->Append(ProcessData);
1610 ProcessData.clear();
1616 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1617 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
1618 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
1619 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
1620 wxString *SaveData, wxString DataType){
1622 wxString ProcessData = "";
1624 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1625 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1627 ProcessData.Append("ORG");
1629 // Check if there is a value for TYPE.
1631 if (DataType.size() > 0){
1633 ProcessData.Append(";TYPE=");
1634 ProcessData.Append(DataType);
1638 // Check if there is a value for ALTID.
1640 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1642 ProcessData.Append(";ALTID=");
1643 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1647 // Check if there is a value for LANGUAGE.
1649 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1651 ProcessData.Append(";LANGUAGE=");
1652 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1656 // Check if there is a value for PID.
1658 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1660 ProcessData.Append(";PID=");
1661 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1665 // Check if there is a value for PREF.
1667 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1669 ProcessData.Append(";PREF=");
1670 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1674 // Check if there is a value for SORT-AS.
1676 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1678 ProcessData.Append(";SORT-AS=\"");
1679 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1680 ProcessData.Append("\"");
1684 // Check if there is a value for tokens.
1686 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1688 ProcessData.Append(";");
1689 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1693 ProcessData.Append(":");
1694 ProcessData.Append(OrganisationIter->second);
1695 ProcessData.Append("\n");
1697 ProcessData = OutputText(&ProcessData);
1699 SaveData->Append(ProcessData);
1700 ProcessData.clear();
1706 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1707 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1708 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1709 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1711 wxString ProcessData = "";
1713 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1714 NoteIter != NoteList->end(); NoteIter++){
1716 ProcessData.Append("NOTE");
1718 // Check if there is a value for TYPE.
1720 if (DataType.size() > 0){
1722 ProcessData.Append(";TYPE=");
1723 ProcessData.Append(DataType);
1727 // Check if there is a value for ALTID.
1729 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1731 ProcessData.Append(";ALTID=");
1732 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1736 // Check if there is a value for LANGUAGE.
1738 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1740 ProcessData.Append(";LANGUAGE=");
1741 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1745 // Check if there is a value for PID.
1747 if ((*NoteListPID)[NoteIter->first].size() > 0){
1749 ProcessData.Append(";PID=");
1750 ProcessData.Append((*NoteListPID)[NoteIter->first]);
1754 // Check if there is a value for PREF.
1756 if ((*NoteListPref)[NoteIter->first] > 0){
1758 ProcessData.Append(";PREF=");
1759 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1763 // Check if there is a value for tokens.
1765 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1767 ProcessData.Append(";");
1768 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1772 ProcessData.Append(":");
1773 ProcessData.Append(NoteIter->second);
1774 ProcessData.Replace("\n", "\\n", true);
1775 ProcessData.Append("\n");
1777 ProcessData = OutputText(&ProcessData);
1779 SaveData->Append(ProcessData);
1780 ProcessData.clear();
1786 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1787 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1788 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1789 map<int, wxString> *CategoryListTokens, wxString *SaveData){
1791 wxString ProcessData = "";
1793 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1794 CategoryIter != CategoryList->end(); CategoryIter++){
1796 ProcessData.Append("CATEGORIES");
1798 // Check if there is a value for TYPE.
1800 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1802 ProcessData.Append(";TYPE=");
1803 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1807 // Check if there is a value for ALTID.
1809 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1811 ProcessData.Append(";ALTID=");
1812 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1816 // Check if there is a value for LANGUAGE.
1818 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1820 ProcessData.Append(";LANGUAGE=");
1821 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1825 // Check if there is a value for PID.
1827 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1829 ProcessData.Append(";PID=");
1830 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1834 // Check if there is a value for PREF.
1836 if ((*CategoryListPref)[CategoryIter->first] > 0){
1838 ProcessData.Append(";PREF=");
1839 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1843 // Check if there is a value for tokens.
1845 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1847 ProcessData.Append(";");
1848 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1852 ProcessData.Append(":");
1853 ProcessData.Append(CategoryIter->second);
1854 ProcessData.Append("\n");
1856 ProcessData = OutputText(&ProcessData);
1858 SaveData->Append(ProcessData);
1859 ProcessData.clear();
1865 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
1866 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1867 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1868 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1869 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1871 wxString ProcessData = "";
1873 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1874 PicturesIter != PicturesList->end(); PicturesIter++){
1876 ProcessData.Append("PHOTO");
1878 // Check if there is a value for TYPE.
1880 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1882 ProcessData.Append(";TYPE=");
1883 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1887 // Check if there is a value for ALTID.
1889 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1891 ProcessData.Append(";ALTID=");
1892 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1896 // Check if there is a value for MEDIATYPE..
1898 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1900 ProcessData.Append(";MEDIATYPE=");
1901 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1905 // Check if there is a value for PID.
1907 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1909 ProcessData.Append(";PID=");
1910 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1914 // Check if there is a value for PREF.
1916 if ((*PicturesListPref)[PicturesIter->first] > 0){
1918 ProcessData.Append(";PREF=");
1919 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1923 // Check if there is a value for tokens.
1925 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1927 ProcessData.Append(";");
1928 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1932 ProcessData.Append(":data:");
1933 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1934 ProcessData.Append(";");
1935 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1936 ProcessData.Append(",");
1937 ProcessData.Append(PicturesIter->second);
1938 ProcessData.Append("\n");
1940 ProcessData = OutputText(&ProcessData);
1942 SaveData->Append(ProcessData);
1943 ProcessData.clear();
1949 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID,
1950 map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
1951 map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
1952 map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
1953 map<int, wxString> *LogosListTokens, wxString *SaveData){
1955 wxString ProcessData = "";
1957 for (std::map<int, string>::iterator LogosIter = LogosList->begin();
1958 LogosIter != LogosList->end(); LogosIter++){
1960 ProcessData.Append("LOGO");
1962 // Check if there is a value for TYPE.
1964 if ((*LogosListType)[LogosIter->first].size() > 0){
1966 ProcessData.Append(";TYPE=");
1967 ProcessData.Append((*LogosListType)[LogosIter->first]);
1971 // Check if there is a value for ALTID.
1973 if ((*LogosListAltID)[LogosIter->first].size() > 0){
1975 ProcessData.Append(";ALTID=");
1976 ProcessData.Append((*LogosListAltID)[LogosIter->first]);
1980 // Check if there is a value for MEDIATYPE..
1982 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
1984 ProcessData.Append(";MEDIATYPE=");
1985 ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
1989 // Check if there is a value for PID.
1991 if ((*LogosListPID)[LogosIter->first].size() > 0){
1993 ProcessData.Append(";PID=");
1994 ProcessData.Append((*LogosListPID)[LogosIter->first]);
1998 // Check if there is a value for PREF.
2000 if ((*LogosListPref)[LogosIter->first] > 0){
2002 ProcessData.Append(";PREF=");
2003 ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
2007 // Check if there is a value for tokens.
2009 if ((*LogosListTokens)[LogosIter->first].size() > 0){
2011 ProcessData.Append(";");
2012 ProcessData.Append((*LogosListTokens)[LogosIter->first]);
2016 ProcessData.Append(":data:");
2017 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
2018 ProcessData.Append(";");
2019 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
2020 ProcessData.Append(",");
2021 ProcessData.Append(LogosIter->second);
2022 ProcessData.Append("\n");
2024 ProcessData = OutputText(&ProcessData);
2026 SaveData->Append(ProcessData);
2027 ProcessData.clear();
2033 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID,
2034 map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
2035 map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
2036 map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage,
2037 map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens,
2038 wxString *SaveData){
2040 wxString ProcessData = "";
2042 for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
2043 SoundsIter != SoundsList->end(); SoundsIter++){
2045 ProcessData.Append("SOUND");
2047 // Check if there is a value for TYPE.
2049 if ((*SoundsListType)[SoundsIter->first].size() > 0){
2051 ProcessData.Append(";TYPE=");
2052 ProcessData.Append((*SoundsListType)[SoundsIter->first]);
2056 // Check if there is a value for ALTID.
2058 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
2060 ProcessData.Append(";ALTID=");
2061 ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
2065 // Check if there is a value for LANGUAGE.
2067 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
2069 ProcessData.Append(";LANGUAGE=");
2070 ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
2074 // Check if there is a value for MEDIATYPE.
2076 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
2078 ProcessData.Append(";MEDIATYPE=");
2079 ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
2083 // Check if there is a value for PID.
2085 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
2087 ProcessData.Append(";PID=");
2088 ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
2092 // Check if there is a value for PREF.
2094 if ((*SoundsListPref)[SoundsIter->first] > 0){
2096 ProcessData.Append(";PREF=");
2097 ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
2101 // Check if there is a value for tokens.
2103 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
2105 ProcessData.Append(";");
2106 ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
2110 ProcessData.Append(":data:");
2111 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
2112 ProcessData.Append(";");
2113 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
2114 ProcessData.Append(",");
2115 ProcessData.Append(SoundsIter->second);
2116 ProcessData.Append("\n");
2118 ProcessData = OutputText(&ProcessData);
2120 SaveData->Append(ProcessData);
2121 ProcessData.clear();
2127 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
2128 map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
2129 map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
2130 map<int, wxString> *CalendarListTokens, wxString *SaveData){
2132 wxString ProcessData = "";
2134 for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
2135 CalendarIter != CalendarList->end(); CalendarIter++){
2137 ProcessData.Append("CALURI");
2139 // Check if there is a value for TYPE.
2141 if ((*CalendarListType)[CalendarIter->first].size() > 0){
2143 ProcessData.Append(";TYPE=");
2144 ProcessData.Append((*CalendarListType)[CalendarIter->first]);
2148 // Check if there is a value for ALTID.
2150 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2152 ProcessData.Append(";ALTID=");
2153 ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2157 // Check if there is a value for MEDIATYPE.
2159 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2161 ProcessData.Append(";MEDIATYPE=");
2162 ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2166 // Check if there is a value for PID.
2168 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2170 ProcessData.Append(";PID=");
2171 ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2175 // Check if there is a value for PREF.
2177 if ((*CalendarListPref)[CalendarIter->first] > 0){
2179 ProcessData.Append(";PREF=");
2180 ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2184 // Check if there is a value for tokens.
2186 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2188 ProcessData.Append(";");
2189 ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2193 ProcessData.Append(":");
2194 ProcessData.Append(CalendarIter->second);
2195 ProcessData.Append("\n");
2197 ProcessData = OutputText(&ProcessData);
2199 SaveData->Append(ProcessData);
2200 ProcessData.clear();
2206 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2207 map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2208 map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2209 map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2211 wxString ProcessData = "";
2213 for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2214 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2216 ProcessData.Append("CALADRURI");
2218 // Check if there is a value for TYPE.
2220 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2222 ProcessData.Append(";TYPE=");
2223 ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2227 // Check if there is a value for ALTID.
2229 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2231 ProcessData.Append(";ALTID=");
2232 ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2236 // Check if there is a value for MEDIATYPE.
2238 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2240 ProcessData.Append(";MEDIATYPE=");
2241 ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2245 // Check if there is a value for PID.
2247 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2249 ProcessData.Append(";PID=");
2250 ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2254 // Check if there is a value for PREF.
2256 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2258 ProcessData.Append(";PREF=");
2259 ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2263 // Check if there is a value for tokens.
2265 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2267 ProcessData.Append(";");
2268 ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2272 ProcessData.Append(":");
2273 ProcessData.Append(CalendarRequestIter->second);
2274 ProcessData.Append("\n");
2276 ProcessData = OutputText(&ProcessData);
2278 SaveData->Append(ProcessData);
2279 ProcessData.clear();
2285 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID,
2286 std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2287 std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref,
2288 std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2290 wxString ProcessData = "";
2292 for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2293 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2295 ProcessData.Append("FBURL");
2297 // Check if there is a value for TYPE.
2299 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2301 ProcessData.Append(";TYPE=");
2302 ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2306 // Check if there is a value for ALTID.
2308 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2310 ProcessData.Append(";ALTID=");
2311 ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2315 // Check if there is a value for MEDIATYPE.
2317 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2319 ProcessData.Append(";MEDIATYPE=");
2320 ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2324 // Check if there is a value for PID.
2326 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2328 ProcessData.Append(";PID=");
2329 ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2333 // Check if there is a value for PREF.
2335 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2337 ProcessData.Append(";PREF=");
2338 ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2342 // Check if there is a value for tokens.
2344 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2346 ProcessData.Append(";");
2347 ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2351 ProcessData.Append(":");
2352 ProcessData.Append(FreeBusyIter->second);
2353 ProcessData.Append("\n");
2355 ProcessData = OutputText(&ProcessData);
2357 SaveData->Append(ProcessData);
2358 ProcessData.clear();
2364 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID,
2365 map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2366 map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType,
2367 map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref,
2368 map<int, wxString> *KeyListTokens, wxString *SaveData){
2370 wxString ProcessData = "";
2372 for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2373 KeyIter != KeyList->end(); KeyIter++){
2375 ProcessData.Append("KEY");
2377 // Check if there is a value for TYPE.
2379 if ((*KeyListType)[KeyIter->first].size() > 0){
2381 ProcessData.Append(";TYPE=");
2382 ProcessData.Append((*KeyListType)[KeyIter->first]);
2386 // Check if there is a value for ALTID.
2388 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2390 ProcessData.Append(";ALTID=");
2391 ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2395 // Check if there is a value for PID.
2397 if ((*KeyListPID)[KeyIter->first].size() > 0){
2399 ProcessData.Append(";PID=");
2400 ProcessData.Append((*KeyListPID)[KeyIter->first]);
2404 // Check if there is a value for PREF.
2406 if ((*KeyListPref)[KeyIter->first] > 0){
2408 ProcessData.Append(";PREF=");
2409 ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2413 // Check if there is a value for tokens.
2415 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2417 ProcessData.Append(";");
2418 ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2422 ProcessData.Append(":data:");
2423 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2424 ProcessData.Append(";");
2425 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2426 ProcessData.Append(",");
2427 ProcessData.Append(KeyIter->second);
2428 ProcessData.Append("\n");
2430 ProcessData = OutputText(&ProcessData);
2432 SaveData->Append(ProcessData);
2433 ProcessData.clear();
2439 void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN,
2440 map<int, wxString> *VendorListElement, wxString *SaveData){
2442 wxString ProcessData = "";
2444 for (std::map<int, wxString>::iterator VendorIter = VendorList->begin();
2445 VendorIter != VendorList->end(); VendorIter++){
2447 ProcessData.Append("VND-");
2448 ProcessData.Append((*VendorListPEN)[VendorIter->first]);
2449 ProcessData.Append("-");
2450 ProcessData.Append((*VendorListElement)[VendorIter->first]);
2451 ProcessData.Append(":");
2452 ProcessData.Append(VendorIter->second);
2453 ProcessData.Append("\n");
2455 ProcessData = OutputText(&ProcessData);
2457 SaveData->Append(ProcessData);
2458 ProcessData.clear();
2464 void ContactDataObject::SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens,
2465 wxString *SaveData){
2467 wxString ProcessData = "";
2469 for (std::map<int, wxString>::iterator XTokenIter = XTokenList->begin();
2470 XTokenIter != XTokenList->end(); XTokenIter++){
2472 ProcessData.Append("X-");
2473 ProcessData.Append((*XTokenListTokens)[XTokenIter->first]);
2474 ProcessData.Append(":");
2475 ProcessData.Append(XTokenIter->second);
2476 ProcessData.Append("\n");
2478 ProcessData = OutputText(&ProcessData);
2480 SaveData->Append(ProcessData);
2481 ProcessData.clear();