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");
86 for (std::map<int, wxString>::iterator XMLIter = XMLList.begin();
87 XMLIter != XMLList.end(); XMLIter++){
89 ProcessData.Append("XML");
91 if (XMLListAltID[XMLIter->first].size() > 0){
93 ProcessData.Append(";ALTID=");
94 ProcessData.Append(XMLListAltID[XMLIter->first]);
98 ProcessData.Append(":");
99 ProcessData.Append(XMLIter->second);
100 ProcessData.Append("\n");
102 ProcessData = OutputText(&ProcessData);
104 SaveData->Append(ProcessData);
111 SaveSource(&SourceList, &SourceListAltID,
112 &SourceListPID, &SourceListType,
113 &SourceListMediatype, &SourceListPref,
114 &SourceListTokens, SaveData);
116 // Process CLIENTPIDMAP.
118 for (std::map<int, wxString>::iterator CPIDIter = ClientPIDList.begin();
119 CPIDIter != ClientPIDList.end(); CPIDIter++){
121 ProcessData.Append("CLIENTPIDMAP");
123 if (ClientPIDListTokens[CPIDIter->first].size() > 0){
125 ProcessData.Append(";");
126 ProcessData.Append(ClientPIDListTokens[CPIDIter->first]);
130 ProcessData.Append(":");
131 ProcessData.Append(CPIDIter->second);
132 ProcessData.Append("\n");
134 ProcessData = OutputText(&ProcessData);
136 SaveData->Append(ProcessData);
143 for (std::map<int, wxString>::iterator FNIter = FullNamesList.begin();
144 FNIter != FullNamesList.end(); FNIter++){
146 ProcessData.Append("FN");
148 // Check if there is a value for TYPE.
150 if (FullNamesListType[FNIter->first].size() > 0){
152 ProcessData.Append(";TYPE=");
153 ProcessData.Append(FullNamesListType[FNIter->first]);
157 // Check if there is a value for LANGUAGE.
159 if (FullNamesListLanguage[FNIter->first].size() > 0){
161 ProcessData.Append(";LANGUAGE=");
162 ProcessData.Append(FullNamesListLanguage[FNIter->first]);
166 // Check if there is a value for ALTID.
168 if (FullNamesListAltID[FNIter->first].size() > 0){
170 ProcessData.Append(";ALTID=");
171 ProcessData.Append(FullNamesListAltID[FNIter->first]);
175 // Check if there is a value for PID.
177 if (FullNamesListPID[FNIter->first].size() > 0){
179 ProcessData.Append(";PID=");
180 ProcessData.Append(FullNamesListPID[FNIter->first]);
184 // Check if there is a value for PREF.
186 if (FullNamesListPref[FNIter->first] > 0){
188 ProcessData.Append(";PREF=");
189 ProcessData.Append(wxString::Format("%i", FullNamesListPref[FNIter->first]));
193 // Check if there is a value for tokens.
195 if (FullNamesListTokens[FNIter->first].size() > 0){
197 ProcessData.Append(";");
198 ProcessData.Append(FullNamesListTokens[FNIter->first]);
202 ProcessData.Append(":");
203 ProcessData.Append(FNIter->second);
204 ProcessData.Append("\n");
206 ProcessData = OutputText(&ProcessData);
208 SaveData->Append(ProcessData);
215 SaveNickname(&GeneralNicknamesList, &GeneralNicknamesListAltID,
216 &GeneralNicknamesListPID, &GeneralNicknamesListType,
217 &GeneralNicknamesListLanguage, &GeneralNicknamesListPref,
218 &GeneralNicknamesListTokens, SaveData, "");
219 SaveNickname(&HomeNicknamesList, &HomeNicknamesListAltID,
220 &HomeNicknamesListPID, &HomeNicknamesListType,
221 &HomeNicknamesListLanguage, &HomeNicknamesListPref,
222 &HomeNicknamesListTokens, SaveData, "home");
223 SaveNickname(&BusinessNicknamesList, &BusinessNicknamesListAltID,
224 &BusinessNicknamesListPID, &BusinessNicknamesListType,
225 &BusinessNicknamesListLanguage, &BusinessNicknamesListPref,
226 &BusinessNicknamesListTokens, SaveData, "work");
230 SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
231 &GeneralTitleListAltID, &GeneralTitleListPID,
232 &GeneralTitleListType, &GeneralTitleListPref,
233 &GeneralTitleListTokens, SaveData, "");
234 SaveTitle(&HomeTitleList, &HomeTitleListLanguage,
235 &HomeTitleListAltID, &HomeTitleListPID,
236 &HomeTitleListType, &HomeTitleListPref,
237 &HomeTitleListTokens, SaveData, "home");
238 SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage,
239 &BusinessTitleListAltID, &BusinessTitleListPID,
240 &BusinessTitleListType, &BusinessTitleListPref,
241 &BusinessTitleListTokens, SaveData, "work");
245 SaveTimezone(&GeneralTZList, &GeneralTZListAltID,
246 &GeneralTZListPID, &GeneralTZListType,
247 &GeneralTZListMediatype, &GeneralTZListPref,
248 &GeneralTZListTokens, SaveData, "");
249 SaveTimezone(&HomeTZList, &HomeTZListAltID,
250 &HomeTZListPID, &HomeTZListType,
251 &HomeTZListMediatype, &HomeTZListPref,
252 &HomeTZListTokens, SaveData, "home");
253 SaveTimezone(&BusinessTZList, &BusinessTZListAltID,
254 &BusinessTZListPID, &BusinessTZListType,
255 &BusinessTZListMediatype, &BusinessTZListPref,
256 &BusinessTZListTokens, SaveData, "work");
260 SaveAddress(&GeneralAddressList, &GeneralAddressListTown,
261 &GeneralAddressListCounty, &GeneralAddressListPostCode,
262 &GeneralAddressListCountry, &GeneralAddressListLabel,
263 &GeneralAddressListLang, &GeneralAddressListAltID,
264 &GeneralAddressListPID, &GeneralAddressListGeo,
265 &GeneralAddressListTimezone, &GeneralAddressListType,
266 &GeneralAddressListMediatype, &GeneralAddressListPref,
267 &GeneralAddressListTokens, SaveData, "");
268 SaveAddress(&HomeAddressList, &HomeAddressListTown,
269 &HomeAddressListCounty, &HomeAddressListPostCode,
270 &HomeAddressListCountry, &HomeAddressListLabel,
271 &HomeAddressListLang, &HomeAddressListAltID,
272 &HomeAddressListPID, &HomeAddressListGeo,
273 &HomeAddressListTimezone, &HomeAddressListType,
274 &HomeAddressListMediatype, &HomeAddressListPref,
275 &HomeAddressListTokens, SaveData, "home");
276 SaveAddress(&BusinessAddressList, &BusinessAddressListTown,
277 &BusinessAddressListCounty, &BusinessAddressListPostCode,
278 &BusinessAddressListCountry, &BusinessAddressListLabel,
279 &BusinessAddressListLang, &BusinessAddressListAltID,
280 &BusinessAddressListPID, &BusinessAddressListGeo,
281 &BusinessAddressListTimezone, &BusinessAddressListType,
282 &BusinessAddressListMediatype, &BusinessAddressListPref,
283 &BusinessAddressListTokens, SaveData, "work");
287 SaveEmail(&GeneralEmailList, &GeneralEmailListAltID,
288 &GeneralEmailListPID, &GeneralEmailListType,
289 &GeneralEmailListPref, &GeneralEmailListTokens,
291 SaveEmail(&HomeEmailList, &HomeEmailListAltID,
292 &HomeEmailListPID, &HomeEmailListType,
293 &HomeEmailListPref, &HomeEmailListTokens,
295 SaveEmail(&BusinessEmailList, &BusinessEmailListAltID,
296 &BusinessEmailListPID, &BusinessEmailListType,
297 &BusinessEmailListPref, &BusinessEmailListTokens,
300 // TODO: Process IMPP.
302 // TODO: Process TEL.
306 SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID,
307 &GeneralLanguageListPID, &GeneralLanguageListType,
308 &GeneralLanguageListPref, &GeneralLanguageListTokens,
310 SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID,
311 &HomeLanguageListPID, &HomeLanguageListType,
312 &HomeLanguageListPref, &HomeLanguageListTokens,
314 SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID,
315 &BusinessLanguageListPID, &BusinessLanguageListType,
316 &BusinessLanguageListPref, &BusinessLanguageListTokens,
321 SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID,
322 &GeneralGeographyListPID, &GeneralGeographyListType,
323 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
324 &GeneralGeographyListPref, &GeneralGeographyListTokens,
326 SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID,
327 &HomeGeographyListPID, &HomeGeographyListType,
328 &HomeGeographyListMediatype, &HomeGeographyListDataType,
329 &HomeGeographyListPref, &HomeGeographyListTokens,
331 SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID,
332 &BusinessGeographyListPID, &BusinessGeographyListType,
333 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
334 &BusinessGeographyListPref, &BusinessGeographyListTokens,
341 for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
342 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
344 ProcessData.Append("RELATED");
346 // Check if there is a value for TYPE.
348 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
350 wxString RelatedType = "";
352 ProcessData.Append(";TYPE=");
354 if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
356 RelatedType = wxT("contact");
358 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
360 RelatedType = wxT("acquaintance");
362 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
364 RelatedType = wxT("friend");
366 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
368 RelatedType = wxT("met");
370 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
372 RelatedType = wxT("co-worker");
374 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
376 RelatedType = wxT("colleague");
378 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
380 RelatedType = wxT("co-resident");
382 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
384 RelatedType = wxT("neighbor");
386 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
388 RelatedType = wxT("child");
390 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
392 RelatedType = wxT("parent");
394 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
396 RelatedType = wxT("sibling");
398 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
400 RelatedType = wxT("spouse");
402 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
404 RelatedType = wxT("kin");
406 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
408 RelatedType = wxT("muse");
410 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
412 RelatedType = wxT("crush");
414 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
416 RelatedType = wxT("date");
418 } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
420 RelatedType = wxT("sweetheart");
422 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
424 RelatedType = wxT("me");
426 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
428 RelatedType = wxT("agent");
430 } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
432 RelatedType = wxT("emergency");
436 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
440 ProcessData.Append(RelatedType);
444 // Check if there is a value for LANGUAGE.
446 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
448 ProcessData.Append(";LANGUAGE=");
449 ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
453 // Check if there is a value for ALTID.
455 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
457 ProcessData.Append(";ALTID=");
458 ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
462 // Check if there is a value for PID.
464 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
466 ProcessData.Append(";PID=");
467 ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
471 // Check if there is a value for PREF.
473 if (GeneralRelatedListPref[RelatedIter->first] > 0){
475 ProcessData.Append(";PREF=");
476 ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
480 // Check if there is a value for tokens.
482 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
484 ProcessData.Append(";");
485 ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
489 ProcessData.Append(":");
490 ProcessData.Append(RelatedIter->second);
491 ProcessData.Append("\n");
493 ProcessData = OutputText(&ProcessData);
495 SaveData->Append(ProcessData);
502 SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID,
503 &GeneralWebsiteListPID, &GeneralWebsiteListType,
504 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref,
505 &GeneralWebsiteListTokens, SaveData, "");
506 SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID,
507 &HomeWebsiteListPID, &HomeWebsiteListType,
508 &HomeWebsiteListMediatype, &HomeWebsiteListPref,
509 &HomeWebsiteListTokens, SaveData, "home");
510 SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID,
511 &BusinessWebsiteListPID, &BusinessWebsiteListType,
512 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref,
513 &BusinessWebsiteListTokens, SaveData, "work");
517 SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
518 &GeneralRoleListAltID, &GeneralRoleListPID,
519 &GeneralRoleListType, &GeneralRoleListPref,
520 &GeneralRoleListTokens, SaveData, "");
521 SaveRole(&HomeRoleList, &HomeRoleListLanguage,
522 &HomeRoleListAltID, &HomeRoleListPID,
523 &HomeRoleListType, &HomeRoleListPref,
524 &HomeRoleListTokens, SaveData, "home");
525 SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
526 &BusinessRoleListAltID, &BusinessRoleListPID,
527 &BusinessRoleListType, &BusinessRoleListPref,
528 &BusinessRoleListTokens, SaveData, "work");
532 SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
533 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage,
534 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType,
535 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens,
537 SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
538 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage,
539 &HomeOrganisationsListSortAs, &HomeOrganisationsListType,
540 &HomeOrganisationsListPref, &HomeOrganisationsListTokens,
542 SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
543 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage,
544 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType,
545 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens,
550 SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
551 &GeneralNoteListAltID, &GeneralNoteListPID,
552 &GeneralNoteListType, &GeneralNoteListPref,
553 &GeneralNoteListTokens, SaveData, "");
554 SaveNote(&HomeNoteList, &HomeNoteListLanguage,
555 &HomeNoteListAltID, &HomeNoteListPID,
556 &HomeNoteListType, &HomeNoteListPref,
557 &HomeNoteListTokens, SaveData, "home");
558 SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
559 &BusinessNoteListAltID, &BusinessNoteListPID,
560 &BusinessNoteListType, &BusinessNoteListPref,
561 &BusinessNoteListTokens, SaveData, "work");
563 // Process CATEGORIES.
565 SaveCategory(&CategoriesList, &CategoriesListLanguage,
566 &CategoriesListAltID, &CategoriesListPID,
567 &CategoriesListType, &CategoriesListPref,
568 &CategoriesListTokens, SaveData);
572 SavePhoto(&PicturesList, &PicturesListAltID,
573 &PicturesListPID, &PicturesListType,
574 &PicturesListPicEncType, &PicturesListPictureType,
575 &PicturesListMediatype, &PicturesListPref,
576 &PicturesListTokens, SaveData);
580 SaveLogo(&LogosList, &LogosListAltID,
581 &LogosListPID, &LogosListType,
582 &LogosListPicEncType, &LogosListPictureType,
583 &LogosListMediatype, &LogosListPref,
584 &LogosListTokens, SaveData);
588 SaveSound(&SoundsList, &SoundsListAltID,
589 &SoundsListPID, &SoundsListType,
590 &SoundsListAudioEncType, &SoundsListAudioType,
591 &SoundsListMediatype, &SoundsListLanguage,
592 &SoundsListPref, &SoundsListTokens,
597 SaveCalendarURI(&CalendarList, &CalendarListMediatype,
598 &CalendarListAltID, &CalendarListPID,
599 &CalendarListType, &CalendarListPref,
600 &CalendarListTokens, SaveData);
602 // Process CALADRURI.
604 SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
605 &CalendarRequestListAltID, &CalendarRequestListPID,
606 &CalendarRequestListType, &CalendarRequestListPref,
607 &CalendarRequestListTokens, SaveData);
611 SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID,
612 &FreeBusyListPID, &FreeBusyListType,
613 &FreeBusyListMediatype, &FreeBusyListPref,
614 &FreeBusyListTokens, SaveData);
618 SaveKey(&KeyList, &KeyListAltID,
619 &KeyListPID, &KeyListType,
620 &KeyListKeyType, &KeyListDataEncType,
621 &KeyListDataType, &KeyListPref,
622 &KeyListTokens, SaveData);
626 SaveVendor(&VendorList, &VendorListPEN,
627 &VendorListElement, SaveData);
629 // Write the end part of the vCard data file.
631 SaveData->Append("END:VCARD");
633 SaveDataStatus = CONTACTSAVE_OK;
635 return SaveDataStatus;
639 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
640 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
641 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
642 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
644 wxString ProcessData = "";
646 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
647 TitleIter != TitleList->end(); TitleIter++){
649 ProcessData.Append("TITLE");
651 // Check if there is a value for TYPE.
653 if (DataType.size() > 0){
655 ProcessData.Append(";TYPE=");
656 ProcessData.Append(DataType);
660 // Check if there is a value for ALTID.
662 if ((*TitleListAltID)[TitleIter->first].size() > 0){
664 ProcessData.Append(";ALTID=");
665 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
669 // Check if there is a value for LANGUAGE.
671 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
673 ProcessData.Append(";LANGUAGE=");
674 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
678 // Check if there is a value for PID.
680 if ((*TitleListPID)[TitleIter->first].size() > 0){
682 ProcessData.Append(";PID=");
683 ProcessData.Append((*TitleListPID)[TitleIter->first]);
687 // Check if there is a value for PREF.
689 if ((*TitleListPref)[TitleIter->first] > 0){
691 ProcessData.Append(";PREF=");
692 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
696 // Check if there is a value for tokens.
698 if ((*TitleListTokens)[TitleIter->first].size() > 0){
700 ProcessData.Append(";");
701 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
705 ProcessData.Append(":");
706 ProcessData.Append(TitleIter->second);
707 ProcessData.Append("\n");
709 ProcessData = OutputText(&ProcessData);
711 SaveData->Append(ProcessData);
718 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
719 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
720 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
721 map<int, wxString> *SourceListTokens, wxString *SaveData){
723 wxString ProcessData = "";
725 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
726 SourceIter != SourceList->end(); SourceIter++){
728 ProcessData.Append("SOURCE");
730 // Check if there is a value for TYPE.
732 if ((*SourceListType)[SourceIter->first].size() > 0){
734 ProcessData.Append(";TYPE=");
735 ProcessData.Append((*SourceListType)[SourceIter->first]);
739 // Check if there is a value for ALTID.
741 if ((*SourceListAltID)[SourceIter->first].size() > 0){
743 ProcessData.Append(";ALTID=");
744 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
748 // Check if there is a value for MEDIATYPE.
750 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
752 ProcessData.Append(";MEDIATYPE=");
753 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
757 // Check if there is a value for PID.
759 if ((*SourceListPID)[SourceIter->first].size() > 0){
761 ProcessData.Append(";PID=");
762 ProcessData.Append((*SourceListPID)[SourceIter->first]);
766 // Check if there is a value for PREF.
768 if ((*SourceListPref)[SourceIter->first] > 0){
770 ProcessData.Append(";PREF=");
771 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
775 // Check if there is a value for tokens.
777 if ((*SourceListTokens)[SourceIter->first].size() > 0){
779 ProcessData.Append(";");
780 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
784 ProcessData.Append(":");
785 ProcessData.Append(SourceIter->second);
786 ProcessData.Append("\n");
788 ProcessData = OutputText(&ProcessData);
790 SaveData->Append(ProcessData);
797 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
798 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
799 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
800 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
802 wxString ProcessData = "";
804 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
805 NicknameIter != NicknameList->end(); NicknameIter++){
807 ProcessData.Append("NICKNAME");
809 // Check if there is a value for TYPE.
811 if (DataType.size() > 0){
813 ProcessData.Append(";TYPE=");
814 ProcessData.Append(DataType);
818 // Check if there is a value for ALTID.
820 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
822 ProcessData.Append(";ALTID=");
823 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
827 // Check if there is a value for MEDIATYPE.
829 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
831 ProcessData.Append(";LANGUAGE=");
832 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
836 // Check if there is a value for PID.
838 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
840 ProcessData.Append(";PID=");
841 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
845 // Check if there is a value for PREF.
847 if ((*NicknameListPref)[NicknameIter->first] > 0){
849 ProcessData.Append(";PREF=");
850 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
854 // Check if there is a value for tokens.
856 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
858 ProcessData.Append(";");
859 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
863 ProcessData.Append(":");
864 ProcessData.Append(NicknameIter->second);
865 ProcessData.Append("\n");
867 ProcessData = OutputText(&ProcessData);
869 SaveData->Append(ProcessData);
876 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
877 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
878 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
879 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
881 wxString ProcessData = "";
883 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
884 TZIter != TZList->end(); TZIter++){
886 ProcessData.Append("TZ");
888 // Check if there is a value for TYPE.
890 if (DataType.size() > 0){
892 ProcessData.Append(";TYPE=");
893 ProcessData.Append(DataType);
897 // Check if there is a value for ALTID.
899 if ((*TZListAltID)[TZIter->first].size() > 0){
901 ProcessData.Append(";ALTID=");
902 ProcessData.Append((*TZListAltID)[TZIter->first]);
906 // Check if there is a value for MEDIATYPE.
908 if ((*TZListMediatype)[TZIter->first].size() > 0){
910 ProcessData.Append(";MEDIATYPE=");
911 ProcessData.Append((*TZListMediatype)[TZIter->first]);
915 // Check if there is a value for PID.
917 if ((*TZListPID)[TZIter->first].size() > 0){
919 ProcessData.Append(";PID=");
920 ProcessData.Append((*TZListPID)[TZIter->first]);
924 // Check if there is a value for PREF.
926 if ((*TZListPref)[TZIter->first] > 0){
928 ProcessData.Append(";PREF=");
929 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
933 // Check if there is a value for tokens.
935 if ((*TZListTokens)[TZIter->first].size() > 0){
937 ProcessData.Append(";");
938 ProcessData.Append((*TZListTokens)[TZIter->first]);
942 ProcessData.Append(":");
943 ProcessData.Append(TZIter->second);
944 ProcessData.Append("\n");
946 ProcessData = OutputText(&ProcessData);
948 SaveData->Append(ProcessData);
955 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
956 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
957 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
958 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
959 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
960 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
961 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
962 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
964 wxString ProcessData = "";
966 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
967 AddressIter != AddressList->end(); AddressIter++){
969 ProcessData.Append("ADR");
971 // Check if there is a value for TYPE.
973 if (DataType.size() > 0){
975 ProcessData.Append(";TYPE=");
976 ProcessData.Append(DataType);
980 // Check if there is a value for ALTID.
982 if ((*AddressListAltID)[AddressIter->first].size() > 0){
984 ProcessData.Append(";ALTID=");
985 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
989 // Check if there is a value for GEO.
991 if ((*AddressListGeo)[AddressIter->first].size() > 0){
993 ProcessData.Append(";GEO=\"");
994 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
995 ProcessData.Append("\"");
999 // Check if there is a value for LABEL.
1001 if ((*AddressListLabel)[AddressIter->first].size() > 0){
1003 wxString AddressProcessed = "";
1004 AddressProcessed = (*AddressListLabel)[AddressIter->first];
1006 AddressProcessed.Replace("\n", "\\n", true);
1008 ProcessData.Append(";LABEL=");
1009 ProcessData.Append(AddressProcessed);
1013 // Check if there is a value for LANGUAGE.
1015 if ((*AddressListLang)[AddressIter->first].size() > 0){
1017 ProcessData.Append(";LANGUAGE=");
1018 ProcessData.Append((*AddressListLang)[AddressIter->first]);
1022 // Check if there is a value for MEDIATYPE.
1024 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1026 ProcessData.Append(";MEDIATYPE=");
1027 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1031 // Check if there is a value for PID.
1033 if ((*AddressListPID)[AddressIter->first].size() > 0){
1035 ProcessData.Append(";PID=");
1036 ProcessData.Append((*AddressListPID)[AddressIter->first]);
1040 // Check if there is a value for PREF.
1042 if ((*AddressListPref)[AddressIter->first] > 0){
1044 ProcessData.Append(";PREF=");
1045 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1049 // Check if there is a value for TZ.
1051 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1053 ProcessData.Append(";TZ=");
1054 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1058 // Check if there is a value for tokens.
1060 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1062 ProcessData.Append(";");
1063 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1067 // Build the address.
1069 ProcessData.Append(":;;");
1070 ProcessData.Append((*AddressList)[AddressIter->first]);
1071 ProcessData.Append(";");
1072 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1073 ProcessData.Append(";");
1074 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1075 ProcessData.Append(";");
1076 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1077 ProcessData.Append(";");
1078 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1079 ProcessData.Append("\n");
1081 ProcessData = OutputText(&ProcessData);
1083 SaveData->Append(ProcessData);
1084 ProcessData.clear();
1090 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1091 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1092 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1093 wxString *SaveData, wxString DataType){
1095 wxString ProcessData = "";
1097 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1098 EmailIter != EmailList->end(); EmailIter++){
1100 ProcessData.Append("EMAIL");
1102 // Check if there is a value for TYPE.
1104 if (DataType.size() > 0){
1106 ProcessData.Append(";TYPE=");
1107 ProcessData.Append(DataType);
1111 // Check if there is a value for ALTID.
1113 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1115 ProcessData.Append(";ALTID=");
1116 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1120 // Check if there is a value for PID.
1122 if ((*EmailListPID)[EmailIter->first].size() > 0){
1124 ProcessData.Append(";PID=");
1125 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1129 // Check if there is a value for PREF.
1131 if ((*EmailListPref)[EmailIter->first] > 0){
1133 ProcessData.Append(";PREF=");
1134 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1138 // Check if there is a value for tokens.
1140 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1142 ProcessData.Append(";");
1143 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1147 ProcessData.Append(":");
1148 ProcessData.Append(EmailIter->second);
1149 ProcessData.Append("\n");
1151 ProcessData = OutputText(&ProcessData);
1153 SaveData->Append(ProcessData);
1154 ProcessData.clear();
1160 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1161 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1162 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1163 wxString *SaveData, wxString DataType){
1165 wxString ProcessData = "";
1167 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1168 LanguageIter != LanguageList->end(); LanguageIter++){
1170 ProcessData.Append("LANG");
1172 // Check if there is a value for TYPE.
1174 if (DataType.size() > 0){
1176 ProcessData.Append(";TYPE=");
1177 ProcessData.Append(DataType);
1181 // Check if there is a value for ALTID.
1183 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1185 ProcessData.Append(";ALTID=");
1186 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1190 // Check if there is a value for PID.
1192 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1194 ProcessData.Append(";PID=");
1195 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1199 // Check if there is a value for PREF.
1201 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1203 ProcessData.Append(";PREF=");
1204 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1208 // Check if there is a value for tokens.
1210 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1212 ProcessData.Append(";");
1213 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1217 ProcessData.Append(":");
1218 ProcessData.Append(LanguageIter->second);
1219 ProcessData.Append("\n");
1221 ProcessData = OutputText(&ProcessData);
1223 SaveData->Append(ProcessData);
1224 ProcessData.clear();
1230 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1231 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1232 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1233 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1234 wxString *SaveData, wxString DataType){
1236 wxString ProcessData = "";
1238 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1239 GeographyIter != GeographyList->end(); GeographyIter++){
1241 ProcessData.Append("GEO");
1243 // Check if there is a value for TYPE.
1245 if (DataType.size() > 0){
1247 ProcessData.Append(";TYPE=");
1248 ProcessData.Append(DataType);
1252 // Check if there is a value for ALTID.
1254 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1256 ProcessData.Append(";ALTID=");
1257 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1261 // Check if there is a value for MEDIATYPE.
1263 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1265 ProcessData.Append(";MEDIATYPE=");
1266 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1270 // Check if there is a value for PID.
1272 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1274 ProcessData.Append(";PID=");
1275 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1279 // Check if there is a value for PREF.
1281 if ((*GeographyListPref)[GeographyIter->first] > 0){
1283 ProcessData.Append(";PREF=");
1284 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1288 // Check if there is a value for tokens.
1290 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1292 ProcessData.Append(";");
1293 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1297 ProcessData.Append(":");
1298 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1299 ProcessData.Append(":");
1300 ProcessData.Append(GeographyIter->second);
1301 ProcessData.Append("\n");
1303 ProcessData = OutputText(&ProcessData);
1305 SaveData->Append(ProcessData);
1306 ProcessData.clear();
1312 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1313 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1314 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1315 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1317 wxString ProcessData = "";
1319 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1320 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1322 ProcessData.Append("URL");
1324 // Check if there is a value for TYPE.
1326 if (DataType.size() > 0){
1328 ProcessData.Append(";TYPE=");
1329 ProcessData.Append(DataType);
1333 // Check if there is a value for ALTID.
1335 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1337 ProcessData.Append(";ALTID=");
1338 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1342 // Check if there is a value for MEDIATYPE.
1344 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1346 ProcessData.Append(";MEDIATYPE=");
1347 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1351 // Check if there is a value for PID.
1353 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1355 ProcessData.Append(";PID=");
1356 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1360 // Check if there is a value for PREF.
1362 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1364 ProcessData.Append(";PREF=");
1365 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1369 // Check if there is a value for tokens.
1371 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1373 ProcessData.Append(";");
1374 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1378 ProcessData.Append(":");
1379 ProcessData.Append(WebsiteIter->second);
1380 ProcessData.Append("\n");
1382 ProcessData = OutputText(&ProcessData);
1384 SaveData->Append(ProcessData);
1385 ProcessData.clear();
1391 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1392 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1393 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1394 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1396 wxString ProcessData = "";
1398 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1399 RoleIter != RoleList->end(); RoleIter++){
1401 ProcessData.Append("ROLE");
1403 // Check if there is a value for TYPE.
1405 if (DataType.size() > 0){
1407 ProcessData.Append(";TYPE=");
1408 ProcessData.Append(DataType);
1412 // Check if there is a value for ALTID.
1414 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1416 ProcessData.Append(";ALTID=");
1417 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1421 // Check if there is a value for LANGUAGE.
1423 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1425 ProcessData.Append(";LANGUAGE=");
1426 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1430 // Check if there is a value for PID.
1432 if ((*RoleListPID)[RoleIter->first].size() > 0){
1434 ProcessData.Append(";PID=");
1435 ProcessData.Append((*RoleListPID)[RoleIter->first]);
1439 // Check if there is a value for PREF.
1441 if ((*RoleListPref)[RoleIter->first] > 0){
1443 ProcessData.Append(";PREF=");
1444 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1448 // Check if there is a value for tokens.
1450 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1452 ProcessData.Append(";");
1453 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1457 ProcessData.Append(":");
1458 ProcessData.Append(RoleIter->second);
1459 ProcessData.Append("\n");
1461 ProcessData = OutputText(&ProcessData);
1463 SaveData->Append(ProcessData);
1464 ProcessData.clear();
1470 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1471 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
1472 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
1473 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
1474 wxString *SaveData, wxString DataType){
1476 wxString ProcessData = "";
1478 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1479 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1481 ProcessData.Append("ORG");
1483 // Check if there is a value for TYPE.
1485 if (DataType.size() > 0){
1487 ProcessData.Append(";TYPE=");
1488 ProcessData.Append(DataType);
1492 // Check if there is a value for ALTID.
1494 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1496 ProcessData.Append(";ALTID=");
1497 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1501 // Check if there is a value for LANGUAGE.
1503 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1505 ProcessData.Append(";LANGUAGE=");
1506 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1510 // Check if there is a value for PID.
1512 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1514 ProcessData.Append(";PID=");
1515 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1519 // Check if there is a value for PREF.
1521 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1523 ProcessData.Append(";PREF=");
1524 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1528 // Check if there is a value for SORT-AS.
1530 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1532 ProcessData.Append(";SORT-AS=\"");
1533 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1534 ProcessData.Append("\"");
1538 // Check if there is a value for tokens.
1540 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1542 ProcessData.Append(";");
1543 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1547 ProcessData.Append(":");
1548 ProcessData.Append(OrganisationIter->second);
1549 ProcessData.Append("\n");
1551 ProcessData = OutputText(&ProcessData);
1553 SaveData->Append(ProcessData);
1554 ProcessData.clear();
1560 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1561 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1562 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1563 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1565 wxString ProcessData = "";
1567 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1568 NoteIter != NoteList->end(); NoteIter++){
1570 ProcessData.Append("NOTE");
1572 // Check if there is a value for TYPE.
1574 if (DataType.size() > 0){
1576 ProcessData.Append(";TYPE=");
1577 ProcessData.Append(DataType);
1581 // Check if there is a value for ALTID.
1583 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1585 ProcessData.Append(";ALTID=");
1586 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1590 // Check if there is a value for LANGUAGE.
1592 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1594 ProcessData.Append(";LANGUAGE=");
1595 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1599 // Check if there is a value for PID.
1601 if ((*NoteListPID)[NoteIter->first].size() > 0){
1603 ProcessData.Append(";PID=");
1604 ProcessData.Append((*NoteListPID)[NoteIter->first]);
1608 // Check if there is a value for PREF.
1610 if ((*NoteListPref)[NoteIter->first] > 0){
1612 ProcessData.Append(";PREF=");
1613 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1617 // Check if there is a value for tokens.
1619 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1621 ProcessData.Append(";");
1622 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1626 ProcessData.Append(":");
1627 ProcessData.Append(NoteIter->second);
1628 ProcessData.Replace("\n", "\\n", true);
1629 ProcessData.Append("\n");
1631 ProcessData = OutputText(&ProcessData);
1633 SaveData->Append(ProcessData);
1634 ProcessData.clear();
1640 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1641 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1642 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1643 map<int, wxString> *CategoryListTokens, wxString *SaveData){
1645 wxString ProcessData = "";
1647 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1648 CategoryIter != CategoryList->end(); CategoryIter++){
1650 ProcessData.Append("CATEGORIES");
1652 // Check if there is a value for TYPE.
1654 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1656 ProcessData.Append(";TYPE=");
1657 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1661 // Check if there is a value for ALTID.
1663 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1665 ProcessData.Append(";ALTID=");
1666 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1670 // Check if there is a value for LANGUAGE.
1672 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1674 ProcessData.Append(";LANGUAGE=");
1675 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1679 // Check if there is a value for PID.
1681 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1683 ProcessData.Append(";PID=");
1684 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1688 // Check if there is a value for PREF.
1690 if ((*CategoryListPref)[CategoryIter->first] > 0){
1692 ProcessData.Append(";PREF=");
1693 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1697 // Check if there is a value for tokens.
1699 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1701 ProcessData.Append(";");
1702 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1706 ProcessData.Append(":");
1707 ProcessData.Append(CategoryIter->second);
1708 ProcessData.Append("\n");
1710 ProcessData = OutputText(&ProcessData);
1712 SaveData->Append(ProcessData);
1713 ProcessData.clear();
1719 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
1720 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1721 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1722 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1723 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1725 wxString ProcessData = "";
1727 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1728 PicturesIter != PicturesList->end(); PicturesIter++){
1730 ProcessData.Append("PHOTO");
1732 // Check if there is a value for TYPE.
1734 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1736 ProcessData.Append(";TYPE=");
1737 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1741 // Check if there is a value for ALTID.
1743 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1745 ProcessData.Append(";ALTID=");
1746 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1750 // Check if there is a value for MEDIATYPE..
1752 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1754 ProcessData.Append(";MEDIATYPE=");
1755 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1759 // Check if there is a value for PID.
1761 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1763 ProcessData.Append(";PID=");
1764 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1768 // Check if there is a value for PREF.
1770 if ((*PicturesListPref)[PicturesIter->first] > 0){
1772 ProcessData.Append(";PREF=");
1773 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1777 // Check if there is a value for tokens.
1779 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1781 ProcessData.Append(";");
1782 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1786 ProcessData.Append(":data:");
1787 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1788 ProcessData.Append(";");
1789 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1790 ProcessData.Append(",");
1791 ProcessData.Append(PicturesIter->second);
1792 ProcessData.Append("\n");
1794 ProcessData = OutputText(&ProcessData);
1796 SaveData->Append(ProcessData);
1797 ProcessData.clear();
1803 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID,
1804 map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
1805 map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
1806 map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
1807 map<int, wxString> *LogosListTokens, wxString *SaveData){
1809 wxString ProcessData = "";
1811 for (std::map<int, string>::iterator LogosIter = LogosList->begin();
1812 LogosIter != LogosList->end(); LogosIter++){
1814 ProcessData.Append("LOGO");
1816 // Check if there is a value for TYPE.
1818 if ((*LogosListType)[LogosIter->first].size() > 0){
1820 ProcessData.Append(";TYPE=");
1821 ProcessData.Append((*LogosListType)[LogosIter->first]);
1825 // Check if there is a value for ALTID.
1827 if ((*LogosListAltID)[LogosIter->first].size() > 0){
1829 ProcessData.Append(";ALTID=");
1830 ProcessData.Append((*LogosListAltID)[LogosIter->first]);
1834 // Check if there is a value for MEDIATYPE..
1836 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
1838 ProcessData.Append(";MEDIATYPE=");
1839 ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
1843 // Check if there is a value for PID.
1845 if ((*LogosListPID)[LogosIter->first].size() > 0){
1847 ProcessData.Append(";PID=");
1848 ProcessData.Append((*LogosListPID)[LogosIter->first]);
1852 // Check if there is a value for PREF.
1854 if ((*LogosListPref)[LogosIter->first] > 0){
1856 ProcessData.Append(";PREF=");
1857 ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
1861 // Check if there is a value for tokens.
1863 if ((*LogosListTokens)[LogosIter->first].size() > 0){
1865 ProcessData.Append(";");
1866 ProcessData.Append((*LogosListTokens)[LogosIter->first]);
1870 ProcessData.Append(":data:");
1871 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
1872 ProcessData.Append(";");
1873 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
1874 ProcessData.Append(",");
1875 ProcessData.Append(LogosIter->second);
1876 ProcessData.Append("\n");
1878 ProcessData = OutputText(&ProcessData);
1880 SaveData->Append(ProcessData);
1881 ProcessData.clear();
1887 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID,
1888 map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
1889 map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
1890 map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage,
1891 map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens,
1892 wxString *SaveData){
1894 wxString ProcessData = "";
1896 for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
1897 SoundsIter != SoundsList->end(); SoundsIter++){
1899 ProcessData.Append("SOUND");
1901 // Check if there is a value for TYPE.
1903 if ((*SoundsListType)[SoundsIter->first].size() > 0){
1905 ProcessData.Append(";TYPE=");
1906 ProcessData.Append((*SoundsListType)[SoundsIter->first]);
1910 // Check if there is a value for ALTID.
1912 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
1914 ProcessData.Append(";ALTID=");
1915 ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
1919 // Check if there is a value for LANGUAGE.
1921 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
1923 ProcessData.Append(";LANGUAGE=");
1924 ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
1928 // Check if there is a value for MEDIATYPE.
1930 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
1932 ProcessData.Append(";MEDIATYPE=");
1933 ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
1937 // Check if there is a value for PID.
1939 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
1941 ProcessData.Append(";PID=");
1942 ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
1946 // Check if there is a value for PREF.
1948 if ((*SoundsListPref)[SoundsIter->first] > 0){
1950 ProcessData.Append(";PREF=");
1951 ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
1955 // Check if there is a value for tokens.
1957 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
1959 ProcessData.Append(";");
1960 ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
1964 ProcessData.Append(":data:");
1965 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
1966 ProcessData.Append(";");
1967 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
1968 ProcessData.Append(",");
1969 ProcessData.Append(SoundsIter->second);
1970 ProcessData.Append("\n");
1972 ProcessData = OutputText(&ProcessData);
1974 SaveData->Append(ProcessData);
1975 ProcessData.clear();
1981 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
1982 map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
1983 map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
1984 map<int, wxString> *CalendarListTokens, wxString *SaveData){
1986 wxString ProcessData = "";
1988 for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
1989 CalendarIter != CalendarList->end(); CalendarIter++){
1991 ProcessData.Append("CALURI");
1993 // Check if there is a value for TYPE.
1995 if ((*CalendarListType)[CalendarIter->first].size() > 0){
1997 ProcessData.Append(";TYPE=");
1998 ProcessData.Append((*CalendarListType)[CalendarIter->first]);
2002 // Check if there is a value for ALTID.
2004 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2006 ProcessData.Append(";ALTID=");
2007 ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2011 // Check if there is a value for MEDIATYPE.
2013 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2015 ProcessData.Append(";MEDIATYPE=");
2016 ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2020 // Check if there is a value for PID.
2022 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2024 ProcessData.Append(";PID=");
2025 ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2029 // Check if there is a value for PREF.
2031 if ((*CalendarListPref)[CalendarIter->first] > 0){
2033 ProcessData.Append(";PREF=");
2034 ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2038 // Check if there is a value for tokens.
2040 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2042 ProcessData.Append(";");
2043 ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2047 ProcessData.Append(":");
2048 ProcessData.Append(CalendarIter->second);
2049 ProcessData.Append("\n");
2051 ProcessData = OutputText(&ProcessData);
2053 SaveData->Append(ProcessData);
2054 ProcessData.clear();
2060 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2061 map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2062 map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2063 map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2065 wxString ProcessData = "";
2067 for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2068 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2070 ProcessData.Append("CALADRURI");
2072 // Check if there is a value for TYPE.
2074 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2076 ProcessData.Append(";TYPE=");
2077 ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2081 // Check if there is a value for ALTID.
2083 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2085 ProcessData.Append(";ALTID=");
2086 ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2090 // Check if there is a value for MEDIATYPE.
2092 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2094 ProcessData.Append(";MEDIATYPE=");
2095 ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2099 // Check if there is a value for PID.
2101 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2103 ProcessData.Append(";PID=");
2104 ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2108 // Check if there is a value for PREF.
2110 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2112 ProcessData.Append(";PREF=");
2113 ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2117 // Check if there is a value for tokens.
2119 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2121 ProcessData.Append(";");
2122 ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2126 ProcessData.Append(":");
2127 ProcessData.Append(CalendarRequestIter->second);
2128 ProcessData.Append("\n");
2130 ProcessData = OutputText(&ProcessData);
2132 SaveData->Append(ProcessData);
2133 ProcessData.clear();
2139 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID,
2140 std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2141 std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref,
2142 std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2144 wxString ProcessData = "";
2146 for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2147 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2149 ProcessData.Append("FBURL");
2151 // Check if there is a value for TYPE.
2153 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2155 ProcessData.Append(";TYPE=");
2156 ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2160 // Check if there is a value for ALTID.
2162 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2164 ProcessData.Append(";ALTID=");
2165 ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2169 // Check if there is a value for MEDIATYPE.
2171 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2173 ProcessData.Append(";MEDIATYPE=");
2174 ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2178 // Check if there is a value for PID.
2180 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2182 ProcessData.Append(";PID=");
2183 ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2187 // Check if there is a value for PREF.
2189 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2191 ProcessData.Append(";PREF=");
2192 ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2196 // Check if there is a value for tokens.
2198 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2200 ProcessData.Append(";");
2201 ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2205 ProcessData.Append(":");
2206 ProcessData.Append(FreeBusyIter->second);
2207 ProcessData.Append("\n");
2209 ProcessData = OutputText(&ProcessData);
2211 SaveData->Append(ProcessData);
2212 ProcessData.clear();
2218 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID,
2219 map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2220 map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType,
2221 map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref,
2222 map<int, wxString> *KeyListTokens, wxString *SaveData){
2224 wxString ProcessData = "";
2226 for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2227 KeyIter != KeyList->end(); KeyIter++){
2229 ProcessData.Append("KEY");
2231 // Check if there is a value for TYPE.
2233 if ((*KeyListType)[KeyIter->first].size() > 0){
2235 ProcessData.Append(";TYPE=");
2236 ProcessData.Append((*KeyListType)[KeyIter->first]);
2240 // Check if there is a value for ALTID.
2242 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2244 ProcessData.Append(";ALTID=");
2245 ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2249 // Check if there is a value for PID.
2251 if ((*KeyListPID)[KeyIter->first].size() > 0){
2253 ProcessData.Append(";PID=");
2254 ProcessData.Append((*KeyListPID)[KeyIter->first]);
2258 // Check if there is a value for PREF.
2260 if ((*KeyListPref)[KeyIter->first] > 0){
2262 ProcessData.Append(";PREF=");
2263 ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2267 // Check if there is a value for tokens.
2269 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2271 ProcessData.Append(";");
2272 ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2276 ProcessData.Append(":data:");
2277 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2278 ProcessData.Append(";");
2279 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2280 ProcessData.Append(",");
2281 ProcessData.Append(KeyIter->second);
2282 ProcessData.Append("\n");
2284 ProcessData = OutputText(&ProcessData);
2286 SaveData->Append(ProcessData);
2287 ProcessData.clear();
2293 void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN,
2294 map<int, wxString> *VendorListElement, wxString *SaveData){
2296 wxString ProcessData = "";
2298 for (std::map<int, wxString>::iterator VendorIter = VendorList->begin();
2299 VendorIter != VendorList->end(); VendorIter++){
2301 ProcessData.Append("VND-");
2302 ProcessData.Append((*VendorListPEN)[VendorIter->first]);
2303 ProcessData.Append("-");
2304 ProcessData.Append((*VendorListElement)[VendorIter->first]);
2305 ProcessData.Append(":");
2306 ProcessData.Append(VendorIter->second);
2307 ProcessData.Append("\n");
2309 ProcessData = OutputText(&ProcessData);
2311 SaveData->Append(ProcessData);
2312 ProcessData.clear();