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);
609 // Write the end part of the vCard data file.
611 SaveData->Append("END:VCARD");
613 SaveDataStatus = CONTACTSAVE_OK;
615 return SaveDataStatus;
619 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
620 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
621 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
622 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
624 wxString ProcessData = "";
626 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
627 TitleIter != TitleList->end(); TitleIter++){
629 ProcessData.Append("TITLE");
631 // Check if there is a value for TYPE.
633 if (DataType.size() > 0){
635 ProcessData.Append(";TYPE=");
636 ProcessData.Append(DataType);
640 // Check if there is a value for ALTID.
642 if ((*TitleListAltID)[TitleIter->first].size() > 0){
644 ProcessData.Append(";ALTID=");
645 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
649 // Check if there is a value for LANGUAGE.
651 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
653 ProcessData.Append(";LANGUAGE=");
654 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
658 // Check if there is a value for PID.
660 if ((*TitleListPID)[TitleIter->first].size() > 0){
662 ProcessData.Append(";PID=");
663 ProcessData.Append((*TitleListPID)[TitleIter->first]);
667 // Check if there is a value for PREF.
669 if ((*TitleListPref)[TitleIter->first] > 0){
671 ProcessData.Append(";PREF=");
672 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
676 // Check if there is a value for tokens.
678 if ((*TitleListTokens)[TitleIter->first].size() > 0){
680 ProcessData.Append(";");
681 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
685 ProcessData.Append(":");
686 ProcessData.Append(TitleIter->second);
687 ProcessData.Append("\n");
689 ProcessData = OutputText(&ProcessData);
691 SaveData->Append(ProcessData);
698 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
699 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
700 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
701 map<int, wxString> *SourceListTokens, wxString *SaveData){
703 wxString ProcessData = "";
705 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
706 SourceIter != SourceList->end(); SourceIter++){
708 ProcessData.Append("SOURCE");
710 // Check if there is a value for TYPE.
712 if ((*SourceListType)[SourceIter->first].size() > 0){
714 ProcessData.Append(";TYPE=");
715 ProcessData.Append((*SourceListType)[SourceIter->first]);
719 // Check if there is a value for ALTID.
721 if ((*SourceListAltID)[SourceIter->first].size() > 0){
723 ProcessData.Append(";ALTID=");
724 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
728 // Check if there is a value for MEDIATYPE.
730 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
732 ProcessData.Append(";MEDIATYPE=");
733 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
737 // Check if there is a value for PID.
739 if ((*SourceListPID)[SourceIter->first].size() > 0){
741 ProcessData.Append(";PID=");
742 ProcessData.Append((*SourceListPID)[SourceIter->first]);
746 // Check if there is a value for PREF.
748 if ((*SourceListPref)[SourceIter->first] > 0){
750 ProcessData.Append(";PREF=");
751 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
755 // Check if there is a value for tokens.
757 if ((*SourceListTokens)[SourceIter->first].size() > 0){
759 ProcessData.Append(";");
760 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
764 ProcessData.Append(":");
765 ProcessData.Append(SourceIter->second);
766 ProcessData.Append("\n");
768 ProcessData = OutputText(&ProcessData);
770 SaveData->Append(ProcessData);
777 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
778 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
779 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
780 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
782 wxString ProcessData = "";
784 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
785 NicknameIter != NicknameList->end(); NicknameIter++){
787 ProcessData.Append("NICKNAME");
789 // Check if there is a value for TYPE.
791 if (DataType.size() > 0){
793 ProcessData.Append(";TYPE=");
794 ProcessData.Append(DataType);
798 // Check if there is a value for ALTID.
800 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
802 ProcessData.Append(";ALTID=");
803 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
807 // Check if there is a value for MEDIATYPE.
809 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
811 ProcessData.Append(";LANGUAGE=");
812 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
816 // Check if there is a value for PID.
818 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
820 ProcessData.Append(";PID=");
821 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
825 // Check if there is a value for PREF.
827 if ((*NicknameListPref)[NicknameIter->first] > 0){
829 ProcessData.Append(";PREF=");
830 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
834 // Check if there is a value for tokens.
836 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
838 ProcessData.Append(";");
839 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
843 ProcessData.Append(":");
844 ProcessData.Append(NicknameIter->second);
845 ProcessData.Append("\n");
847 ProcessData = OutputText(&ProcessData);
849 SaveData->Append(ProcessData);
856 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
857 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
858 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
859 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
861 wxString ProcessData = "";
863 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
864 TZIter != TZList->end(); TZIter++){
866 ProcessData.Append("TZ");
868 // Check if there is a value for TYPE.
870 if (DataType.size() > 0){
872 ProcessData.Append(";TYPE=");
873 ProcessData.Append(DataType);
877 // Check if there is a value for ALTID.
879 if ((*TZListAltID)[TZIter->first].size() > 0){
881 ProcessData.Append(";ALTID=");
882 ProcessData.Append((*TZListAltID)[TZIter->first]);
886 // Check if there is a value for MEDIATYPE.
888 if ((*TZListMediatype)[TZIter->first].size() > 0){
890 ProcessData.Append(";MEDIATYPE=");
891 ProcessData.Append((*TZListMediatype)[TZIter->first]);
895 // Check if there is a value for PID.
897 if ((*TZListPID)[TZIter->first].size() > 0){
899 ProcessData.Append(";PID=");
900 ProcessData.Append((*TZListPID)[TZIter->first]);
904 // Check if there is a value for PREF.
906 if ((*TZListPref)[TZIter->first] > 0){
908 ProcessData.Append(";PREF=");
909 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
913 // Check if there is a value for tokens.
915 if ((*TZListTokens)[TZIter->first].size() > 0){
917 ProcessData.Append(";");
918 ProcessData.Append((*TZListTokens)[TZIter->first]);
922 ProcessData.Append(":");
923 ProcessData.Append(TZIter->second);
924 ProcessData.Append("\n");
926 ProcessData = OutputText(&ProcessData);
928 SaveData->Append(ProcessData);
935 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
936 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
937 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
938 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
939 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
940 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
941 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
942 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
944 wxString ProcessData = "";
946 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
947 AddressIter != AddressList->end(); AddressIter++){
949 ProcessData.Append("ADR");
951 // Check if there is a value for TYPE.
953 if (DataType.size() > 0){
955 ProcessData.Append(";TYPE=");
956 ProcessData.Append(DataType);
960 // Check if there is a value for ALTID.
962 if ((*AddressListAltID)[AddressIter->first].size() > 0){
964 ProcessData.Append(";ALTID=");
965 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
969 // Check if there is a value for GEO.
971 if ((*AddressListGeo)[AddressIter->first].size() > 0){
973 ProcessData.Append(";GEO=\"");
974 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
975 ProcessData.Append("\"");
979 // Check if there is a value for LABEL.
981 if ((*AddressListLabel)[AddressIter->first].size() > 0){
983 wxString AddressProcessed = "";
984 AddressProcessed = (*AddressListLabel)[AddressIter->first];
986 AddressProcessed.Replace("\n", "\\n", true);
988 ProcessData.Append(";LABEL=");
989 ProcessData.Append(AddressProcessed);
993 // Check if there is a value for LANGUAGE.
995 if ((*AddressListLang)[AddressIter->first].size() > 0){
997 ProcessData.Append(";LANGUAGE=");
998 ProcessData.Append((*AddressListLang)[AddressIter->first]);
1002 // Check if there is a value for MEDIATYPE.
1004 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1006 ProcessData.Append(";MEDIATYPE=");
1007 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1011 // Check if there is a value for PID.
1013 if ((*AddressListPID)[AddressIter->first].size() > 0){
1015 ProcessData.Append(";PID=");
1016 ProcessData.Append((*AddressListPID)[AddressIter->first]);
1020 // Check if there is a value for PREF.
1022 if ((*AddressListPref)[AddressIter->first] > 0){
1024 ProcessData.Append(";PREF=");
1025 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1029 // Check if there is a value for TZ.
1031 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1033 ProcessData.Append(";TZ=");
1034 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1038 // Check if there is a value for tokens.
1040 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1042 ProcessData.Append(";");
1043 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1047 // Build the address.
1049 ProcessData.Append(":;;");
1050 ProcessData.Append((*AddressList)[AddressIter->first]);
1051 ProcessData.Append(";");
1052 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1053 ProcessData.Append(";");
1054 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1055 ProcessData.Append(";");
1056 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1057 ProcessData.Append(";");
1058 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1059 ProcessData.Append("\n");
1061 ProcessData = OutputText(&ProcessData);
1063 SaveData->Append(ProcessData);
1064 ProcessData.clear();
1070 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1071 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1072 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1073 wxString *SaveData, wxString DataType){
1075 wxString ProcessData = "";
1077 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1078 EmailIter != EmailList->end(); EmailIter++){
1080 ProcessData.Append("EMAIL");
1082 // Check if there is a value for TYPE.
1084 if (DataType.size() > 0){
1086 ProcessData.Append(";TYPE=");
1087 ProcessData.Append(DataType);
1091 // Check if there is a value for ALTID.
1093 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1095 ProcessData.Append(";ALTID=");
1096 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1100 // Check if there is a value for PID.
1102 if ((*EmailListPID)[EmailIter->first].size() > 0){
1104 ProcessData.Append(";PID=");
1105 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1109 // Check if there is a value for PREF.
1111 if ((*EmailListPref)[EmailIter->first] > 0){
1113 ProcessData.Append(";PREF=");
1114 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1118 // Check if there is a value for tokens.
1120 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1122 ProcessData.Append(";");
1123 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1127 ProcessData.Append(":");
1128 ProcessData.Append(EmailIter->second);
1129 ProcessData.Append("\n");
1131 ProcessData = OutputText(&ProcessData);
1133 SaveData->Append(ProcessData);
1134 ProcessData.clear();
1140 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1141 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1142 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1143 wxString *SaveData, wxString DataType){
1145 wxString ProcessData = "";
1147 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1148 LanguageIter != LanguageList->end(); LanguageIter++){
1150 ProcessData.Append("LANG");
1152 // Check if there is a value for TYPE.
1154 if (DataType.size() > 0){
1156 ProcessData.Append(";TYPE=");
1157 ProcessData.Append(DataType);
1161 // Check if there is a value for ALTID.
1163 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1165 ProcessData.Append(";ALTID=");
1166 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1170 // Check if there is a value for PID.
1172 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1174 ProcessData.Append(";PID=");
1175 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1179 // Check if there is a value for PREF.
1181 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1183 ProcessData.Append(";PREF=");
1184 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1188 // Check if there is a value for tokens.
1190 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1192 ProcessData.Append(";");
1193 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1197 ProcessData.Append(":");
1198 ProcessData.Append(LanguageIter->second);
1199 ProcessData.Append("\n");
1201 ProcessData = OutputText(&ProcessData);
1203 SaveData->Append(ProcessData);
1204 ProcessData.clear();
1210 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1211 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1212 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1213 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1214 wxString *SaveData, wxString DataType){
1216 wxString ProcessData = "";
1218 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1219 GeographyIter != GeographyList->end(); GeographyIter++){
1221 ProcessData.Append("GEO");
1223 // Check if there is a value for TYPE.
1225 if (DataType.size() > 0){
1227 ProcessData.Append(";TYPE=");
1228 ProcessData.Append(DataType);
1232 // Check if there is a value for ALTID.
1234 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1236 ProcessData.Append(";ALTID=");
1237 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1241 // Check if there is a value for MEDIATYPE.
1243 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1245 ProcessData.Append(";MEDIATYPE=");
1246 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1250 // Check if there is a value for PID.
1252 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1254 ProcessData.Append(";PID=");
1255 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1259 // Check if there is a value for PREF.
1261 if ((*GeographyListPref)[GeographyIter->first] > 0){
1263 ProcessData.Append(";PREF=");
1264 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1268 // Check if there is a value for tokens.
1270 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1272 ProcessData.Append(";");
1273 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1277 ProcessData.Append(":");
1278 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1279 ProcessData.Append(":");
1280 ProcessData.Append(GeographyIter->second);
1281 ProcessData.Append("\n");
1283 ProcessData = OutputText(&ProcessData);
1285 SaveData->Append(ProcessData);
1286 ProcessData.clear();
1292 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1293 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1294 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1295 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1297 wxString ProcessData = "";
1299 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1300 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1302 ProcessData.Append("URL");
1304 // Check if there is a value for TYPE.
1306 if (DataType.size() > 0){
1308 ProcessData.Append(";TYPE=");
1309 ProcessData.Append(DataType);
1313 // Check if there is a value for ALTID.
1315 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1317 ProcessData.Append(";ALTID=");
1318 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1322 // Check if there is a value for MEDIATYPE.
1324 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1326 ProcessData.Append(";MEDIATYPE=");
1327 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1331 // Check if there is a value for PID.
1333 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1335 ProcessData.Append(";PID=");
1336 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1340 // Check if there is a value for PREF.
1342 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1344 ProcessData.Append(";PREF=");
1345 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1349 // Check if there is a value for tokens.
1351 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1353 ProcessData.Append(";");
1354 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1358 ProcessData.Append(":");
1359 ProcessData.Append(WebsiteIter->second);
1360 ProcessData.Append("\n");
1362 ProcessData = OutputText(&ProcessData);
1364 SaveData->Append(ProcessData);
1365 ProcessData.clear();
1371 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1372 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1373 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1374 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1376 wxString ProcessData = "";
1378 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1379 RoleIter != RoleList->end(); RoleIter++){
1381 ProcessData.Append("ROLE");
1383 // Check if there is a value for TYPE.
1385 if (DataType.size() > 0){
1387 ProcessData.Append(";TYPE=");
1388 ProcessData.Append(DataType);
1392 // Check if there is a value for ALTID.
1394 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1396 ProcessData.Append(";ALTID=");
1397 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1401 // Check if there is a value for LANGUAGE.
1403 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1405 ProcessData.Append(";LANGUAGE=");
1406 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1410 // Check if there is a value for PID.
1412 if ((*RoleListPID)[RoleIter->first].size() > 0){
1414 ProcessData.Append(";PID=");
1415 ProcessData.Append((*RoleListPID)[RoleIter->first]);
1419 // Check if there is a value for PREF.
1421 if ((*RoleListPref)[RoleIter->first] > 0){
1423 ProcessData.Append(";PREF=");
1424 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1428 // Check if there is a value for tokens.
1430 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1432 ProcessData.Append(";");
1433 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1437 ProcessData.Append(":");
1438 ProcessData.Append(RoleIter->second);
1439 ProcessData.Append("\n");
1441 ProcessData = OutputText(&ProcessData);
1443 SaveData->Append(ProcessData);
1444 ProcessData.clear();
1450 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1451 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
1452 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
1453 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
1454 wxString *SaveData, wxString DataType){
1456 wxString ProcessData = "";
1458 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1459 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1461 ProcessData.Append("ORG");
1463 // Check if there is a value for TYPE.
1465 if (DataType.size() > 0){
1467 ProcessData.Append(";TYPE=");
1468 ProcessData.Append(DataType);
1472 // Check if there is a value for ALTID.
1474 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1476 ProcessData.Append(";ALTID=");
1477 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1481 // Check if there is a value for LANGUAGE.
1483 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1485 ProcessData.Append(";LANGUAGE=");
1486 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1490 // Check if there is a value for PID.
1492 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1494 ProcessData.Append(";PID=");
1495 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1499 // Check if there is a value for PREF.
1501 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1503 ProcessData.Append(";PREF=");
1504 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1508 // Check if there is a value for SORT-AS.
1510 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1512 ProcessData.Append(";SORT-AS=\"");
1513 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1514 ProcessData.Append("\"");
1518 // Check if there is a value for tokens.
1520 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1522 ProcessData.Append(";");
1523 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1527 ProcessData.Append(":");
1528 ProcessData.Append(OrganisationIter->second);
1529 ProcessData.Append("\n");
1531 ProcessData = OutputText(&ProcessData);
1533 SaveData->Append(ProcessData);
1534 ProcessData.clear();
1540 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1541 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1542 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1543 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1545 wxString ProcessData = "";
1547 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1548 NoteIter != NoteList->end(); NoteIter++){
1550 ProcessData.Append("NOTE");
1552 // Check if there is a value for TYPE.
1554 if (DataType.size() > 0){
1556 ProcessData.Append(";TYPE=");
1557 ProcessData.Append(DataType);
1561 // Check if there is a value for ALTID.
1563 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1565 ProcessData.Append(";ALTID=");
1566 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1570 // Check if there is a value for LANGUAGE.
1572 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1574 ProcessData.Append(";LANGUAGE=");
1575 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1579 // Check if there is a value for PID.
1581 if ((*NoteListPID)[NoteIter->first].size() > 0){
1583 ProcessData.Append(";PID=");
1584 ProcessData.Append((*NoteListPID)[NoteIter->first]);
1588 // Check if there is a value for PREF.
1590 if ((*NoteListPref)[NoteIter->first] > 0){
1592 ProcessData.Append(";PREF=");
1593 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1597 // Check if there is a value for tokens.
1599 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1601 ProcessData.Append(";");
1602 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1606 ProcessData.Append(":");
1607 ProcessData.Append(NoteIter->second);
1608 ProcessData.Replace("\n", "\\n", true);
1609 ProcessData.Append("\n");
1611 ProcessData = OutputText(&ProcessData);
1613 SaveData->Append(ProcessData);
1614 ProcessData.clear();
1620 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1621 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1622 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1623 map<int, wxString> *CategoryListTokens, wxString *SaveData){
1625 wxString ProcessData = "";
1627 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1628 CategoryIter != CategoryList->end(); CategoryIter++){
1630 ProcessData.Append("CATEGORIES");
1632 // Check if there is a value for TYPE.
1634 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1636 ProcessData.Append(";TYPE=");
1637 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1641 // Check if there is a value for ALTID.
1643 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1645 ProcessData.Append(";ALTID=");
1646 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1650 // Check if there is a value for LANGUAGE.
1652 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1654 ProcessData.Append(";LANGUAGE=");
1655 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1659 // Check if there is a value for PID.
1661 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1663 ProcessData.Append(";PID=");
1664 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1668 // Check if there is a value for PREF.
1670 if ((*CategoryListPref)[CategoryIter->first] > 0){
1672 ProcessData.Append(";PREF=");
1673 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1677 // Check if there is a value for tokens.
1679 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1681 ProcessData.Append(";");
1682 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1686 ProcessData.Append(":");
1687 ProcessData.Append(CategoryIter->second);
1688 ProcessData.Append("\n");
1690 ProcessData = OutputText(&ProcessData);
1692 SaveData->Append(ProcessData);
1693 ProcessData.clear();
1699 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
1700 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1701 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1702 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1703 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1705 wxString ProcessData = "";
1707 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1708 PicturesIter != PicturesList->end(); PicturesIter++){
1710 ProcessData.Append("PHOTO");
1712 // Check if there is a value for TYPE.
1714 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1716 ProcessData.Append(";TYPE=");
1717 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1721 // Check if there is a value for ALTID.
1723 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1725 ProcessData.Append(";ALTID=");
1726 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1730 // Check if there is a value for MEDIATYPE..
1732 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1734 ProcessData.Append(";MEDIATYPE=");
1735 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1739 // Check if there is a value for PID.
1741 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1743 ProcessData.Append(";PID=");
1744 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1748 // Check if there is a value for PREF.
1750 if ((*PicturesListPref)[PicturesIter->first] > 0){
1752 ProcessData.Append(";PREF=");
1753 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1757 // Check if there is a value for tokens.
1759 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1761 ProcessData.Append(";");
1762 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1766 ProcessData.Append(":data:");
1767 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1768 ProcessData.Append(";");
1769 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1770 ProcessData.Append(",");
1771 ProcessData.Append(PicturesIter->second);
1772 ProcessData.Append("\n");
1774 ProcessData = OutputText(&ProcessData);
1776 SaveData->Append(ProcessData);
1777 ProcessData.clear();
1783 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID,
1784 map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
1785 map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
1786 map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
1787 map<int, wxString> *LogosListTokens, wxString *SaveData){
1789 wxString ProcessData = "";
1791 for (std::map<int, string>::iterator LogosIter = LogosList->begin();
1792 LogosIter != LogosList->end(); LogosIter++){
1794 ProcessData.Append("LOGO");
1796 // Check if there is a value for TYPE.
1798 if ((*LogosListType)[LogosIter->first].size() > 0){
1800 ProcessData.Append(";TYPE=");
1801 ProcessData.Append((*LogosListType)[LogosIter->first]);
1805 // Check if there is a value for ALTID.
1807 if ((*LogosListAltID)[LogosIter->first].size() > 0){
1809 ProcessData.Append(";ALTID=");
1810 ProcessData.Append((*LogosListAltID)[LogosIter->first]);
1814 // Check if there is a value for MEDIATYPE..
1816 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
1818 ProcessData.Append(";MEDIATYPE=");
1819 ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
1823 // Check if there is a value for PID.
1825 if ((*LogosListPID)[LogosIter->first].size() > 0){
1827 ProcessData.Append(";PID=");
1828 ProcessData.Append((*LogosListPID)[LogosIter->first]);
1832 // Check if there is a value for PREF.
1834 if ((*LogosListPref)[LogosIter->first] > 0){
1836 ProcessData.Append(";PREF=");
1837 ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
1841 // Check if there is a value for tokens.
1843 if ((*LogosListTokens)[LogosIter->first].size() > 0){
1845 ProcessData.Append(";");
1846 ProcessData.Append((*LogosListTokens)[LogosIter->first]);
1850 ProcessData.Append(":data:");
1851 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
1852 ProcessData.Append(";");
1853 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
1854 ProcessData.Append(",");
1855 ProcessData.Append(LogosIter->second);
1856 ProcessData.Append("\n");
1858 ProcessData = OutputText(&ProcessData);
1860 SaveData->Append(ProcessData);
1861 ProcessData.clear();
1867 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID,
1868 map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
1869 map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
1870 map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage,
1871 map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens,
1872 wxString *SaveData){
1874 wxString ProcessData = "";
1876 for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
1877 SoundsIter != SoundsList->end(); SoundsIter++){
1879 ProcessData.Append("SOUND");
1881 // Check if there is a value for TYPE.
1883 if ((*SoundsListType)[SoundsIter->first].size() > 0){
1885 ProcessData.Append(";TYPE=");
1886 ProcessData.Append((*SoundsListType)[SoundsIter->first]);
1890 // Check if there is a value for ALTID.
1892 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
1894 ProcessData.Append(";ALTID=");
1895 ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
1899 // Check if there is a value for LANGUAGE.
1901 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
1903 ProcessData.Append(";LANGUAGE=");
1904 ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
1908 // Check if there is a value for MEDIATYPE.
1910 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
1912 ProcessData.Append(";MEDIATYPE=");
1913 ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
1917 // Check if there is a value for PID.
1919 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
1921 ProcessData.Append(";PID=");
1922 ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
1926 // Check if there is a value for PREF.
1928 if ((*SoundsListPref)[SoundsIter->first] > 0){
1930 ProcessData.Append(";PREF=");
1931 ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
1935 // Check if there is a value for tokens.
1937 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
1939 ProcessData.Append(";");
1940 ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
1944 ProcessData.Append(":data:");
1945 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
1946 ProcessData.Append(";");
1947 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
1948 ProcessData.Append(",");
1949 ProcessData.Append(SoundsIter->second);
1950 ProcessData.Append("\n");
1952 ProcessData = OutputText(&ProcessData);
1954 SaveData->Append(ProcessData);
1955 ProcessData.clear();
1961 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
1962 map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
1963 map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
1964 map<int, wxString> *CalendarListTokens, wxString *SaveData){
1966 wxString ProcessData = "";
1968 for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
1969 CalendarIter != CalendarList->end(); CalendarIter++){
1971 ProcessData.Append("CALURI");
1973 // Check if there is a value for TYPE.
1975 if ((*CalendarListType)[CalendarIter->first].size() > 0){
1977 ProcessData.Append(";TYPE=");
1978 ProcessData.Append((*CalendarListType)[CalendarIter->first]);
1982 // Check if there is a value for ALTID.
1984 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
1986 ProcessData.Append(";ALTID=");
1987 ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
1991 // Check if there is a value for MEDIATYPE.
1993 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
1995 ProcessData.Append(";MEDIATYPE=");
1996 ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2000 // Check if there is a value for PID.
2002 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2004 ProcessData.Append(";PID=");
2005 ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2009 // Check if there is a value for PREF.
2011 if ((*CalendarListPref)[CalendarIter->first] > 0){
2013 ProcessData.Append(";PREF=");
2014 ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2018 // Check if there is a value for tokens.
2020 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2022 ProcessData.Append(";");
2023 ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2027 ProcessData.Append(":");
2028 ProcessData.Append(CalendarIter->second);
2029 ProcessData.Append("\n");
2031 ProcessData = OutputText(&ProcessData);
2033 SaveData->Append(ProcessData);
2034 ProcessData.clear();
2040 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2041 map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2042 map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2043 map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2045 wxString ProcessData = "";
2047 for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2048 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2050 ProcessData.Append("CALADRURI");
2052 // Check if there is a value for TYPE.
2054 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2056 ProcessData.Append(";TYPE=");
2057 ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2061 // Check if there is a value for ALTID.
2063 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2065 ProcessData.Append(";ALTID=");
2066 ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2070 // Check if there is a value for MEDIATYPE.
2072 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2074 ProcessData.Append(";MEDIATYPE=");
2075 ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2079 // Check if there is a value for PID.
2081 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2083 ProcessData.Append(";PID=");
2084 ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2088 // Check if there is a value for PREF.
2090 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2092 ProcessData.Append(";PREF=");
2093 ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2097 // Check if there is a value for tokens.
2099 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2101 ProcessData.Append(";");
2102 ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2106 ProcessData.Append(":");
2107 ProcessData.Append(CalendarRequestIter->second);
2108 ProcessData.Append("\n");
2110 ProcessData = OutputText(&ProcessData);
2112 SaveData->Append(ProcessData);
2113 ProcessData.clear();