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);
631 SaveXToken(&XTokenList, &XTokenListTokens,
634 // Write the end part of the vCard data file.
636 SaveData->Append("END:VCARD");
638 SaveDataStatus = CONTACTSAVE_OK;
640 return SaveDataStatus;
644 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
645 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
646 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
647 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
649 wxString ProcessData = "";
651 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
652 TitleIter != TitleList->end(); TitleIter++){
654 ProcessData.Append("TITLE");
656 // Check if there is a value for TYPE.
658 if (DataType.size() > 0){
660 ProcessData.Append(";TYPE=");
661 ProcessData.Append(DataType);
665 // Check if there is a value for ALTID.
667 if ((*TitleListAltID)[TitleIter->first].size() > 0){
669 ProcessData.Append(";ALTID=");
670 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
674 // Check if there is a value for LANGUAGE.
676 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
678 ProcessData.Append(";LANGUAGE=");
679 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
683 // Check if there is a value for PID.
685 if ((*TitleListPID)[TitleIter->first].size() > 0){
687 ProcessData.Append(";PID=");
688 ProcessData.Append((*TitleListPID)[TitleIter->first]);
692 // Check if there is a value for PREF.
694 if ((*TitleListPref)[TitleIter->first] > 0){
696 ProcessData.Append(";PREF=");
697 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
701 // Check if there is a value for tokens.
703 if ((*TitleListTokens)[TitleIter->first].size() > 0){
705 ProcessData.Append(";");
706 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
710 ProcessData.Append(":");
711 ProcessData.Append(TitleIter->second);
712 ProcessData.Append("\n");
714 ProcessData = OutputText(&ProcessData);
716 SaveData->Append(ProcessData);
723 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
724 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
725 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
726 map<int, wxString> *SourceListTokens, wxString *SaveData){
728 wxString ProcessData = "";
730 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
731 SourceIter != SourceList->end(); SourceIter++){
733 ProcessData.Append("SOURCE");
735 // Check if there is a value for TYPE.
737 if ((*SourceListType)[SourceIter->first].size() > 0){
739 ProcessData.Append(";TYPE=");
740 ProcessData.Append((*SourceListType)[SourceIter->first]);
744 // Check if there is a value for ALTID.
746 if ((*SourceListAltID)[SourceIter->first].size() > 0){
748 ProcessData.Append(";ALTID=");
749 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
753 // Check if there is a value for MEDIATYPE.
755 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
757 ProcessData.Append(";MEDIATYPE=");
758 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
762 // Check if there is a value for PID.
764 if ((*SourceListPID)[SourceIter->first].size() > 0){
766 ProcessData.Append(";PID=");
767 ProcessData.Append((*SourceListPID)[SourceIter->first]);
771 // Check if there is a value for PREF.
773 if ((*SourceListPref)[SourceIter->first] > 0){
775 ProcessData.Append(";PREF=");
776 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
780 // Check if there is a value for tokens.
782 if ((*SourceListTokens)[SourceIter->first].size() > 0){
784 ProcessData.Append(";");
785 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
789 ProcessData.Append(":");
790 ProcessData.Append(SourceIter->second);
791 ProcessData.Append("\n");
793 ProcessData = OutputText(&ProcessData);
795 SaveData->Append(ProcessData);
802 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
803 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
804 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
805 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
807 wxString ProcessData = "";
809 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
810 NicknameIter != NicknameList->end(); NicknameIter++){
812 ProcessData.Append("NICKNAME");
814 // Check if there is a value for TYPE.
816 if (DataType.size() > 0){
818 ProcessData.Append(";TYPE=");
819 ProcessData.Append(DataType);
823 // Check if there is a value for ALTID.
825 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
827 ProcessData.Append(";ALTID=");
828 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
832 // Check if there is a value for MEDIATYPE.
834 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
836 ProcessData.Append(";LANGUAGE=");
837 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
841 // Check if there is a value for PID.
843 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
845 ProcessData.Append(";PID=");
846 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
850 // Check if there is a value for PREF.
852 if ((*NicknameListPref)[NicknameIter->first] > 0){
854 ProcessData.Append(";PREF=");
855 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
859 // Check if there is a value for tokens.
861 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
863 ProcessData.Append(";");
864 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
868 ProcessData.Append(":");
869 ProcessData.Append(NicknameIter->second);
870 ProcessData.Append("\n");
872 ProcessData = OutputText(&ProcessData);
874 SaveData->Append(ProcessData);
881 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
882 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
883 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
884 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
886 wxString ProcessData = "";
888 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
889 TZIter != TZList->end(); TZIter++){
891 ProcessData.Append("TZ");
893 // Check if there is a value for TYPE.
895 if (DataType.size() > 0){
897 ProcessData.Append(";TYPE=");
898 ProcessData.Append(DataType);
902 // Check if there is a value for ALTID.
904 if ((*TZListAltID)[TZIter->first].size() > 0){
906 ProcessData.Append(";ALTID=");
907 ProcessData.Append((*TZListAltID)[TZIter->first]);
911 // Check if there is a value for MEDIATYPE.
913 if ((*TZListMediatype)[TZIter->first].size() > 0){
915 ProcessData.Append(";MEDIATYPE=");
916 ProcessData.Append((*TZListMediatype)[TZIter->first]);
920 // Check if there is a value for PID.
922 if ((*TZListPID)[TZIter->first].size() > 0){
924 ProcessData.Append(";PID=");
925 ProcessData.Append((*TZListPID)[TZIter->first]);
929 // Check if there is a value for PREF.
931 if ((*TZListPref)[TZIter->first] > 0){
933 ProcessData.Append(";PREF=");
934 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
938 // Check if there is a value for tokens.
940 if ((*TZListTokens)[TZIter->first].size() > 0){
942 ProcessData.Append(";");
943 ProcessData.Append((*TZListTokens)[TZIter->first]);
947 ProcessData.Append(":");
948 ProcessData.Append(TZIter->second);
949 ProcessData.Append("\n");
951 ProcessData = OutputText(&ProcessData);
953 SaveData->Append(ProcessData);
960 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
961 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
962 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
963 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
964 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
965 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
966 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
967 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
969 wxString ProcessData = "";
971 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
972 AddressIter != AddressList->end(); AddressIter++){
974 ProcessData.Append("ADR");
976 // Check if there is a value for TYPE.
978 if (DataType.size() > 0){
980 ProcessData.Append(";TYPE=");
981 ProcessData.Append(DataType);
985 // Check if there is a value for ALTID.
987 if ((*AddressListAltID)[AddressIter->first].size() > 0){
989 ProcessData.Append(";ALTID=");
990 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
994 // Check if there is a value for GEO.
996 if ((*AddressListGeo)[AddressIter->first].size() > 0){
998 ProcessData.Append(";GEO=\"");
999 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
1000 ProcessData.Append("\"");
1004 // Check if there is a value for LABEL.
1006 if ((*AddressListLabel)[AddressIter->first].size() > 0){
1008 wxString AddressProcessed = "";
1009 AddressProcessed = (*AddressListLabel)[AddressIter->first];
1011 AddressProcessed.Replace("\n", "\\n", true);
1013 ProcessData.Append(";LABEL=");
1014 ProcessData.Append(AddressProcessed);
1018 // Check if there is a value for LANGUAGE.
1020 if ((*AddressListLang)[AddressIter->first].size() > 0){
1022 ProcessData.Append(";LANGUAGE=");
1023 ProcessData.Append((*AddressListLang)[AddressIter->first]);
1027 // Check if there is a value for MEDIATYPE.
1029 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1031 ProcessData.Append(";MEDIATYPE=");
1032 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1036 // Check if there is a value for PID.
1038 if ((*AddressListPID)[AddressIter->first].size() > 0){
1040 ProcessData.Append(";PID=");
1041 ProcessData.Append((*AddressListPID)[AddressIter->first]);
1045 // Check if there is a value for PREF.
1047 if ((*AddressListPref)[AddressIter->first] > 0){
1049 ProcessData.Append(";PREF=");
1050 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1054 // Check if there is a value for TZ.
1056 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1058 ProcessData.Append(";TZ=");
1059 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1063 // Check if there is a value for tokens.
1065 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1067 ProcessData.Append(";");
1068 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1072 // Build the address.
1074 ProcessData.Append(":;;");
1075 ProcessData.Append((*AddressList)[AddressIter->first]);
1076 ProcessData.Append(";");
1077 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1078 ProcessData.Append(";");
1079 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1080 ProcessData.Append(";");
1081 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1082 ProcessData.Append(";");
1083 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1084 ProcessData.Append("\n");
1086 ProcessData = OutputText(&ProcessData);
1088 SaveData->Append(ProcessData);
1089 ProcessData.clear();
1095 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1096 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1097 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1098 wxString *SaveData, wxString DataType){
1100 wxString ProcessData = "";
1102 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1103 EmailIter != EmailList->end(); EmailIter++){
1105 ProcessData.Append("EMAIL");
1107 // Check if there is a value for TYPE.
1109 if (DataType.size() > 0){
1111 ProcessData.Append(";TYPE=");
1112 ProcessData.Append(DataType);
1116 // Check if there is a value for ALTID.
1118 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1120 ProcessData.Append(";ALTID=");
1121 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1125 // Check if there is a value for PID.
1127 if ((*EmailListPID)[EmailIter->first].size() > 0){
1129 ProcessData.Append(";PID=");
1130 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1134 // Check if there is a value for PREF.
1136 if ((*EmailListPref)[EmailIter->first] > 0){
1138 ProcessData.Append(";PREF=");
1139 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1143 // Check if there is a value for tokens.
1145 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1147 ProcessData.Append(";");
1148 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1152 ProcessData.Append(":");
1153 ProcessData.Append(EmailIter->second);
1154 ProcessData.Append("\n");
1156 ProcessData = OutputText(&ProcessData);
1158 SaveData->Append(ProcessData);
1159 ProcessData.clear();
1165 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1166 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1167 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1168 wxString *SaveData, wxString DataType){
1170 wxString ProcessData = "";
1172 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1173 LanguageIter != LanguageList->end(); LanguageIter++){
1175 ProcessData.Append("LANG");
1177 // Check if there is a value for TYPE.
1179 if (DataType.size() > 0){
1181 ProcessData.Append(";TYPE=");
1182 ProcessData.Append(DataType);
1186 // Check if there is a value for ALTID.
1188 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1190 ProcessData.Append(";ALTID=");
1191 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1195 // Check if there is a value for PID.
1197 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1199 ProcessData.Append(";PID=");
1200 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1204 // Check if there is a value for PREF.
1206 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1208 ProcessData.Append(";PREF=");
1209 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1213 // Check if there is a value for tokens.
1215 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1217 ProcessData.Append(";");
1218 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1222 ProcessData.Append(":");
1223 ProcessData.Append(LanguageIter->second);
1224 ProcessData.Append("\n");
1226 ProcessData = OutputText(&ProcessData);
1228 SaveData->Append(ProcessData);
1229 ProcessData.clear();
1235 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1236 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1237 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1238 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1239 wxString *SaveData, wxString DataType){
1241 wxString ProcessData = "";
1243 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1244 GeographyIter != GeographyList->end(); GeographyIter++){
1246 ProcessData.Append("GEO");
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 ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1261 ProcessData.Append(";ALTID=");
1262 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1266 // Check if there is a value for MEDIATYPE.
1268 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1270 ProcessData.Append(";MEDIATYPE=");
1271 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1275 // Check if there is a value for PID.
1277 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1279 ProcessData.Append(";PID=");
1280 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1284 // Check if there is a value for PREF.
1286 if ((*GeographyListPref)[GeographyIter->first] > 0){
1288 ProcessData.Append(";PREF=");
1289 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1293 // Check if there is a value for tokens.
1295 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1297 ProcessData.Append(";");
1298 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1302 ProcessData.Append(":");
1303 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1304 ProcessData.Append(":");
1305 ProcessData.Append(GeographyIter->second);
1306 ProcessData.Append("\n");
1308 ProcessData = OutputText(&ProcessData);
1310 SaveData->Append(ProcessData);
1311 ProcessData.clear();
1317 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1318 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1319 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1320 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1322 wxString ProcessData = "";
1324 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1325 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1327 ProcessData.Append("URL");
1329 // Check if there is a value for TYPE.
1331 if (DataType.size() > 0){
1333 ProcessData.Append(";TYPE=");
1334 ProcessData.Append(DataType);
1338 // Check if there is a value for ALTID.
1340 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1342 ProcessData.Append(";ALTID=");
1343 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1347 // Check if there is a value for MEDIATYPE.
1349 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1351 ProcessData.Append(";MEDIATYPE=");
1352 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1356 // Check if there is a value for PID.
1358 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1360 ProcessData.Append(";PID=");
1361 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1365 // Check if there is a value for PREF.
1367 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1369 ProcessData.Append(";PREF=");
1370 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1374 // Check if there is a value for tokens.
1376 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1378 ProcessData.Append(";");
1379 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1383 ProcessData.Append(":");
1384 ProcessData.Append(WebsiteIter->second);
1385 ProcessData.Append("\n");
1387 ProcessData = OutputText(&ProcessData);
1389 SaveData->Append(ProcessData);
1390 ProcessData.clear();
1396 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1397 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1398 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1399 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1401 wxString ProcessData = "";
1403 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1404 RoleIter != RoleList->end(); RoleIter++){
1406 ProcessData.Append("ROLE");
1408 // Check if there is a value for TYPE.
1410 if (DataType.size() > 0){
1412 ProcessData.Append(";TYPE=");
1413 ProcessData.Append(DataType);
1417 // Check if there is a value for ALTID.
1419 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1421 ProcessData.Append(";ALTID=");
1422 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1426 // Check if there is a value for LANGUAGE.
1428 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1430 ProcessData.Append(";LANGUAGE=");
1431 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1435 // Check if there is a value for PID.
1437 if ((*RoleListPID)[RoleIter->first].size() > 0){
1439 ProcessData.Append(";PID=");
1440 ProcessData.Append((*RoleListPID)[RoleIter->first]);
1444 // Check if there is a value for PREF.
1446 if ((*RoleListPref)[RoleIter->first] > 0){
1448 ProcessData.Append(";PREF=");
1449 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1453 // Check if there is a value for tokens.
1455 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1457 ProcessData.Append(";");
1458 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1462 ProcessData.Append(":");
1463 ProcessData.Append(RoleIter->second);
1464 ProcessData.Append("\n");
1466 ProcessData = OutputText(&ProcessData);
1468 SaveData->Append(ProcessData);
1469 ProcessData.clear();
1475 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1476 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
1477 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
1478 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
1479 wxString *SaveData, wxString DataType){
1481 wxString ProcessData = "";
1483 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1484 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1486 ProcessData.Append("ORG");
1488 // Check if there is a value for TYPE.
1490 if (DataType.size() > 0){
1492 ProcessData.Append(";TYPE=");
1493 ProcessData.Append(DataType);
1497 // Check if there is a value for ALTID.
1499 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1501 ProcessData.Append(";ALTID=");
1502 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1506 // Check if there is a value for LANGUAGE.
1508 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1510 ProcessData.Append(";LANGUAGE=");
1511 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1515 // Check if there is a value for PID.
1517 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1519 ProcessData.Append(";PID=");
1520 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1524 // Check if there is a value for PREF.
1526 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1528 ProcessData.Append(";PREF=");
1529 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1533 // Check if there is a value for SORT-AS.
1535 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1537 ProcessData.Append(";SORT-AS=\"");
1538 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1539 ProcessData.Append("\"");
1543 // Check if there is a value for tokens.
1545 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1547 ProcessData.Append(";");
1548 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1552 ProcessData.Append(":");
1553 ProcessData.Append(OrganisationIter->second);
1554 ProcessData.Append("\n");
1556 ProcessData = OutputText(&ProcessData);
1558 SaveData->Append(ProcessData);
1559 ProcessData.clear();
1565 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1566 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1567 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1568 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1570 wxString ProcessData = "";
1572 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1573 NoteIter != NoteList->end(); NoteIter++){
1575 ProcessData.Append("NOTE");
1577 // Check if there is a value for TYPE.
1579 if (DataType.size() > 0){
1581 ProcessData.Append(";TYPE=");
1582 ProcessData.Append(DataType);
1586 // Check if there is a value for ALTID.
1588 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1590 ProcessData.Append(";ALTID=");
1591 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1595 // Check if there is a value for LANGUAGE.
1597 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1599 ProcessData.Append(";LANGUAGE=");
1600 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1604 // Check if there is a value for PID.
1606 if ((*NoteListPID)[NoteIter->first].size() > 0){
1608 ProcessData.Append(";PID=");
1609 ProcessData.Append((*NoteListPID)[NoteIter->first]);
1613 // Check if there is a value for PREF.
1615 if ((*NoteListPref)[NoteIter->first] > 0){
1617 ProcessData.Append(";PREF=");
1618 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1622 // Check if there is a value for tokens.
1624 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1626 ProcessData.Append(";");
1627 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1631 ProcessData.Append(":");
1632 ProcessData.Append(NoteIter->second);
1633 ProcessData.Replace("\n", "\\n", true);
1634 ProcessData.Append("\n");
1636 ProcessData = OutputText(&ProcessData);
1638 SaveData->Append(ProcessData);
1639 ProcessData.clear();
1645 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1646 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1647 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1648 map<int, wxString> *CategoryListTokens, wxString *SaveData){
1650 wxString ProcessData = "";
1652 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1653 CategoryIter != CategoryList->end(); CategoryIter++){
1655 ProcessData.Append("CATEGORIES");
1657 // Check if there is a value for TYPE.
1659 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1661 ProcessData.Append(";TYPE=");
1662 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1666 // Check if there is a value for ALTID.
1668 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1670 ProcessData.Append(";ALTID=");
1671 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1675 // Check if there is a value for LANGUAGE.
1677 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1679 ProcessData.Append(";LANGUAGE=");
1680 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1684 // Check if there is a value for PID.
1686 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1688 ProcessData.Append(";PID=");
1689 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1693 // Check if there is a value for PREF.
1695 if ((*CategoryListPref)[CategoryIter->first] > 0){
1697 ProcessData.Append(";PREF=");
1698 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1702 // Check if there is a value for tokens.
1704 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1706 ProcessData.Append(";");
1707 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1711 ProcessData.Append(":");
1712 ProcessData.Append(CategoryIter->second);
1713 ProcessData.Append("\n");
1715 ProcessData = OutputText(&ProcessData);
1717 SaveData->Append(ProcessData);
1718 ProcessData.clear();
1724 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
1725 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1726 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1727 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1728 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1730 wxString ProcessData = "";
1732 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1733 PicturesIter != PicturesList->end(); PicturesIter++){
1735 ProcessData.Append("PHOTO");
1737 // Check if there is a value for TYPE.
1739 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1741 ProcessData.Append(";TYPE=");
1742 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1746 // Check if there is a value for ALTID.
1748 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1750 ProcessData.Append(";ALTID=");
1751 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1755 // Check if there is a value for MEDIATYPE..
1757 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1759 ProcessData.Append(";MEDIATYPE=");
1760 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1764 // Check if there is a value for PID.
1766 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1768 ProcessData.Append(";PID=");
1769 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1773 // Check if there is a value for PREF.
1775 if ((*PicturesListPref)[PicturesIter->first] > 0){
1777 ProcessData.Append(";PREF=");
1778 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1782 // Check if there is a value for tokens.
1784 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1786 ProcessData.Append(";");
1787 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1791 ProcessData.Append(":data:");
1792 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1793 ProcessData.Append(";");
1794 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1795 ProcessData.Append(",");
1796 ProcessData.Append(PicturesIter->second);
1797 ProcessData.Append("\n");
1799 ProcessData = OutputText(&ProcessData);
1801 SaveData->Append(ProcessData);
1802 ProcessData.clear();
1808 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID,
1809 map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
1810 map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
1811 map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
1812 map<int, wxString> *LogosListTokens, wxString *SaveData){
1814 wxString ProcessData = "";
1816 for (std::map<int, string>::iterator LogosIter = LogosList->begin();
1817 LogosIter != LogosList->end(); LogosIter++){
1819 ProcessData.Append("LOGO");
1821 // Check if there is a value for TYPE.
1823 if ((*LogosListType)[LogosIter->first].size() > 0){
1825 ProcessData.Append(";TYPE=");
1826 ProcessData.Append((*LogosListType)[LogosIter->first]);
1830 // Check if there is a value for ALTID.
1832 if ((*LogosListAltID)[LogosIter->first].size() > 0){
1834 ProcessData.Append(";ALTID=");
1835 ProcessData.Append((*LogosListAltID)[LogosIter->first]);
1839 // Check if there is a value for MEDIATYPE..
1841 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
1843 ProcessData.Append(";MEDIATYPE=");
1844 ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
1848 // Check if there is a value for PID.
1850 if ((*LogosListPID)[LogosIter->first].size() > 0){
1852 ProcessData.Append(";PID=");
1853 ProcessData.Append((*LogosListPID)[LogosIter->first]);
1857 // Check if there is a value for PREF.
1859 if ((*LogosListPref)[LogosIter->first] > 0){
1861 ProcessData.Append(";PREF=");
1862 ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
1866 // Check if there is a value for tokens.
1868 if ((*LogosListTokens)[LogosIter->first].size() > 0){
1870 ProcessData.Append(";");
1871 ProcessData.Append((*LogosListTokens)[LogosIter->first]);
1875 ProcessData.Append(":data:");
1876 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
1877 ProcessData.Append(";");
1878 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
1879 ProcessData.Append(",");
1880 ProcessData.Append(LogosIter->second);
1881 ProcessData.Append("\n");
1883 ProcessData = OutputText(&ProcessData);
1885 SaveData->Append(ProcessData);
1886 ProcessData.clear();
1892 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID,
1893 map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
1894 map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
1895 map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage,
1896 map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens,
1897 wxString *SaveData){
1899 wxString ProcessData = "";
1901 for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
1902 SoundsIter != SoundsList->end(); SoundsIter++){
1904 ProcessData.Append("SOUND");
1906 // Check if there is a value for TYPE.
1908 if ((*SoundsListType)[SoundsIter->first].size() > 0){
1910 ProcessData.Append(";TYPE=");
1911 ProcessData.Append((*SoundsListType)[SoundsIter->first]);
1915 // Check if there is a value for ALTID.
1917 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
1919 ProcessData.Append(";ALTID=");
1920 ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
1924 // Check if there is a value for LANGUAGE.
1926 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
1928 ProcessData.Append(";LANGUAGE=");
1929 ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
1933 // Check if there is a value for MEDIATYPE.
1935 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
1937 ProcessData.Append(";MEDIATYPE=");
1938 ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
1942 // Check if there is a value for PID.
1944 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
1946 ProcessData.Append(";PID=");
1947 ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
1951 // Check if there is a value for PREF.
1953 if ((*SoundsListPref)[SoundsIter->first] > 0){
1955 ProcessData.Append(";PREF=");
1956 ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
1960 // Check if there is a value for tokens.
1962 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
1964 ProcessData.Append(";");
1965 ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
1969 ProcessData.Append(":data:");
1970 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
1971 ProcessData.Append(";");
1972 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
1973 ProcessData.Append(",");
1974 ProcessData.Append(SoundsIter->second);
1975 ProcessData.Append("\n");
1977 ProcessData = OutputText(&ProcessData);
1979 SaveData->Append(ProcessData);
1980 ProcessData.clear();
1986 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
1987 map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
1988 map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
1989 map<int, wxString> *CalendarListTokens, wxString *SaveData){
1991 wxString ProcessData = "";
1993 for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
1994 CalendarIter != CalendarList->end(); CalendarIter++){
1996 ProcessData.Append("CALURI");
1998 // Check if there is a value for TYPE.
2000 if ((*CalendarListType)[CalendarIter->first].size() > 0){
2002 ProcessData.Append(";TYPE=");
2003 ProcessData.Append((*CalendarListType)[CalendarIter->first]);
2007 // Check if there is a value for ALTID.
2009 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2011 ProcessData.Append(";ALTID=");
2012 ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2016 // Check if there is a value for MEDIATYPE.
2018 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2020 ProcessData.Append(";MEDIATYPE=");
2021 ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2025 // Check if there is a value for PID.
2027 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2029 ProcessData.Append(";PID=");
2030 ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2034 // Check if there is a value for PREF.
2036 if ((*CalendarListPref)[CalendarIter->first] > 0){
2038 ProcessData.Append(";PREF=");
2039 ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2043 // Check if there is a value for tokens.
2045 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2047 ProcessData.Append(";");
2048 ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2052 ProcessData.Append(":");
2053 ProcessData.Append(CalendarIter->second);
2054 ProcessData.Append("\n");
2056 ProcessData = OutputText(&ProcessData);
2058 SaveData->Append(ProcessData);
2059 ProcessData.clear();
2065 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2066 map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2067 map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2068 map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2070 wxString ProcessData = "";
2072 for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2073 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2075 ProcessData.Append("CALADRURI");
2077 // Check if there is a value for TYPE.
2079 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2081 ProcessData.Append(";TYPE=");
2082 ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2086 // Check if there is a value for ALTID.
2088 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2090 ProcessData.Append(";ALTID=");
2091 ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2095 // Check if there is a value for MEDIATYPE.
2097 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2099 ProcessData.Append(";MEDIATYPE=");
2100 ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2104 // Check if there is a value for PID.
2106 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2108 ProcessData.Append(";PID=");
2109 ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2113 // Check if there is a value for PREF.
2115 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2117 ProcessData.Append(";PREF=");
2118 ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2122 // Check if there is a value for tokens.
2124 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2126 ProcessData.Append(";");
2127 ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2131 ProcessData.Append(":");
2132 ProcessData.Append(CalendarRequestIter->second);
2133 ProcessData.Append("\n");
2135 ProcessData = OutputText(&ProcessData);
2137 SaveData->Append(ProcessData);
2138 ProcessData.clear();
2144 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID,
2145 std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2146 std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref,
2147 std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2149 wxString ProcessData = "";
2151 for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2152 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2154 ProcessData.Append("FBURL");
2156 // Check if there is a value for TYPE.
2158 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2160 ProcessData.Append(";TYPE=");
2161 ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2165 // Check if there is a value for ALTID.
2167 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2169 ProcessData.Append(";ALTID=");
2170 ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2174 // Check if there is a value for MEDIATYPE.
2176 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2178 ProcessData.Append(";MEDIATYPE=");
2179 ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2183 // Check if there is a value for PID.
2185 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2187 ProcessData.Append(";PID=");
2188 ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2192 // Check if there is a value for PREF.
2194 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2196 ProcessData.Append(";PREF=");
2197 ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2201 // Check if there is a value for tokens.
2203 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2205 ProcessData.Append(";");
2206 ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2210 ProcessData.Append(":");
2211 ProcessData.Append(FreeBusyIter->second);
2212 ProcessData.Append("\n");
2214 ProcessData = OutputText(&ProcessData);
2216 SaveData->Append(ProcessData);
2217 ProcessData.clear();
2223 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID,
2224 map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2225 map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType,
2226 map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref,
2227 map<int, wxString> *KeyListTokens, wxString *SaveData){
2229 wxString ProcessData = "";
2231 for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2232 KeyIter != KeyList->end(); KeyIter++){
2234 ProcessData.Append("KEY");
2236 // Check if there is a value for TYPE.
2238 if ((*KeyListType)[KeyIter->first].size() > 0){
2240 ProcessData.Append(";TYPE=");
2241 ProcessData.Append((*KeyListType)[KeyIter->first]);
2245 // Check if there is a value for ALTID.
2247 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2249 ProcessData.Append(";ALTID=");
2250 ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2254 // Check if there is a value for PID.
2256 if ((*KeyListPID)[KeyIter->first].size() > 0){
2258 ProcessData.Append(";PID=");
2259 ProcessData.Append((*KeyListPID)[KeyIter->first]);
2263 // Check if there is a value for PREF.
2265 if ((*KeyListPref)[KeyIter->first] > 0){
2267 ProcessData.Append(";PREF=");
2268 ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2272 // Check if there is a value for tokens.
2274 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2276 ProcessData.Append(";");
2277 ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2281 ProcessData.Append(":data:");
2282 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2283 ProcessData.Append(";");
2284 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2285 ProcessData.Append(",");
2286 ProcessData.Append(KeyIter->second);
2287 ProcessData.Append("\n");
2289 ProcessData = OutputText(&ProcessData);
2291 SaveData->Append(ProcessData);
2292 ProcessData.clear();
2298 void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN,
2299 map<int, wxString> *VendorListElement, wxString *SaveData){
2301 wxString ProcessData = "";
2303 for (std::map<int, wxString>::iterator VendorIter = VendorList->begin();
2304 VendorIter != VendorList->end(); VendorIter++){
2306 ProcessData.Append("VND-");
2307 ProcessData.Append((*VendorListPEN)[VendorIter->first]);
2308 ProcessData.Append("-");
2309 ProcessData.Append((*VendorListElement)[VendorIter->first]);
2310 ProcessData.Append(":");
2311 ProcessData.Append(VendorIter->second);
2312 ProcessData.Append("\n");
2314 ProcessData = OutputText(&ProcessData);
2316 SaveData->Append(ProcessData);
2317 ProcessData.clear();
2323 void ContactDataObject::SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens,
2324 wxString *SaveData){
2326 wxString ProcessData = "";
2328 for (std::map<int, wxString>::iterator XTokenIter = XTokenList->begin();
2329 XTokenIter != XTokenList->end(); XTokenIter++){
2331 ProcessData.Append("X-");
2332 ProcessData.Append((*XTokenListTokens)[XTokenIter->first]);
2333 ProcessData.Append(":");
2334 ProcessData.Append(XTokenIter->second);
2335 ProcessData.Append("\n");
2337 ProcessData = OutputText(&ProcessData);
2339 SaveData->Append(ProcessData);
2340 ProcessData.clear();