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);
616 // Write the end part of the vCard data file.
618 SaveData->Append("END:VCARD");
620 SaveDataStatus = CONTACTSAVE_OK;
622 return SaveDataStatus;
626 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
627 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
628 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
629 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
631 wxString ProcessData = "";
633 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
634 TitleIter != TitleList->end(); TitleIter++){
636 ProcessData.Append("TITLE");
638 // Check if there is a value for TYPE.
640 if (DataType.size() > 0){
642 ProcessData.Append(";TYPE=");
643 ProcessData.Append(DataType);
647 // Check if there is a value for ALTID.
649 if ((*TitleListAltID)[TitleIter->first].size() > 0){
651 ProcessData.Append(";ALTID=");
652 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
656 // Check if there is a value for LANGUAGE.
658 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
660 ProcessData.Append(";LANGUAGE=");
661 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
665 // Check if there is a value for PID.
667 if ((*TitleListPID)[TitleIter->first].size() > 0){
669 ProcessData.Append(";PID=");
670 ProcessData.Append((*TitleListPID)[TitleIter->first]);
674 // Check if there is a value for PREF.
676 if ((*TitleListPref)[TitleIter->first] > 0){
678 ProcessData.Append(";PREF=");
679 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
683 // Check if there is a value for tokens.
685 if ((*TitleListTokens)[TitleIter->first].size() > 0){
687 ProcessData.Append(";");
688 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
692 ProcessData.Append(":");
693 ProcessData.Append(TitleIter->second);
694 ProcessData.Append("\n");
696 ProcessData = OutputText(&ProcessData);
698 SaveData->Append(ProcessData);
705 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
706 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
707 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
708 map<int, wxString> *SourceListTokens, wxString *SaveData){
710 wxString ProcessData = "";
712 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
713 SourceIter != SourceList->end(); SourceIter++){
715 ProcessData.Append("SOURCE");
717 // Check if there is a value for TYPE.
719 if ((*SourceListType)[SourceIter->first].size() > 0){
721 ProcessData.Append(";TYPE=");
722 ProcessData.Append((*SourceListType)[SourceIter->first]);
726 // Check if there is a value for ALTID.
728 if ((*SourceListAltID)[SourceIter->first].size() > 0){
730 ProcessData.Append(";ALTID=");
731 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
735 // Check if there is a value for MEDIATYPE.
737 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
739 ProcessData.Append(";MEDIATYPE=");
740 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
744 // Check if there is a value for PID.
746 if ((*SourceListPID)[SourceIter->first].size() > 0){
748 ProcessData.Append(";PID=");
749 ProcessData.Append((*SourceListPID)[SourceIter->first]);
753 // Check if there is a value for PREF.
755 if ((*SourceListPref)[SourceIter->first] > 0){
757 ProcessData.Append(";PREF=");
758 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
762 // Check if there is a value for tokens.
764 if ((*SourceListTokens)[SourceIter->first].size() > 0){
766 ProcessData.Append(";");
767 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
771 ProcessData.Append(":");
772 ProcessData.Append(SourceIter->second);
773 ProcessData.Append("\n");
775 ProcessData = OutputText(&ProcessData);
777 SaveData->Append(ProcessData);
784 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
785 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
786 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
787 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
789 wxString ProcessData = "";
791 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
792 NicknameIter != NicknameList->end(); NicknameIter++){
794 ProcessData.Append("NICKNAME");
796 // Check if there is a value for TYPE.
798 if (DataType.size() > 0){
800 ProcessData.Append(";TYPE=");
801 ProcessData.Append(DataType);
805 // Check if there is a value for ALTID.
807 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
809 ProcessData.Append(";ALTID=");
810 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
814 // Check if there is a value for MEDIATYPE.
816 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
818 ProcessData.Append(";LANGUAGE=");
819 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
823 // Check if there is a value for PID.
825 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
827 ProcessData.Append(";PID=");
828 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
832 // Check if there is a value for PREF.
834 if ((*NicknameListPref)[NicknameIter->first] > 0){
836 ProcessData.Append(";PREF=");
837 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
841 // Check if there is a value for tokens.
843 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
845 ProcessData.Append(";");
846 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
850 ProcessData.Append(":");
851 ProcessData.Append(NicknameIter->second);
852 ProcessData.Append("\n");
854 ProcessData = OutputText(&ProcessData);
856 SaveData->Append(ProcessData);
863 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
864 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
865 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
866 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
868 wxString ProcessData = "";
870 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
871 TZIter != TZList->end(); TZIter++){
873 ProcessData.Append("TZ");
875 // Check if there is a value for TYPE.
877 if (DataType.size() > 0){
879 ProcessData.Append(";TYPE=");
880 ProcessData.Append(DataType);
884 // Check if there is a value for ALTID.
886 if ((*TZListAltID)[TZIter->first].size() > 0){
888 ProcessData.Append(";ALTID=");
889 ProcessData.Append((*TZListAltID)[TZIter->first]);
893 // Check if there is a value for MEDIATYPE.
895 if ((*TZListMediatype)[TZIter->first].size() > 0){
897 ProcessData.Append(";MEDIATYPE=");
898 ProcessData.Append((*TZListMediatype)[TZIter->first]);
902 // Check if there is a value for PID.
904 if ((*TZListPID)[TZIter->first].size() > 0){
906 ProcessData.Append(";PID=");
907 ProcessData.Append((*TZListPID)[TZIter->first]);
911 // Check if there is a value for PREF.
913 if ((*TZListPref)[TZIter->first] > 0){
915 ProcessData.Append(";PREF=");
916 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
920 // Check if there is a value for tokens.
922 if ((*TZListTokens)[TZIter->first].size() > 0){
924 ProcessData.Append(";");
925 ProcessData.Append((*TZListTokens)[TZIter->first]);
929 ProcessData.Append(":");
930 ProcessData.Append(TZIter->second);
931 ProcessData.Append("\n");
933 ProcessData = OutputText(&ProcessData);
935 SaveData->Append(ProcessData);
942 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
943 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
944 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
945 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
946 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
947 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
948 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
949 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
951 wxString ProcessData = "";
953 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
954 AddressIter != AddressList->end(); AddressIter++){
956 ProcessData.Append("ADR");
958 // Check if there is a value for TYPE.
960 if (DataType.size() > 0){
962 ProcessData.Append(";TYPE=");
963 ProcessData.Append(DataType);
967 // Check if there is a value for ALTID.
969 if ((*AddressListAltID)[AddressIter->first].size() > 0){
971 ProcessData.Append(";ALTID=");
972 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
976 // Check if there is a value for GEO.
978 if ((*AddressListGeo)[AddressIter->first].size() > 0){
980 ProcessData.Append(";GEO=\"");
981 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
982 ProcessData.Append("\"");
986 // Check if there is a value for LABEL.
988 if ((*AddressListLabel)[AddressIter->first].size() > 0){
990 wxString AddressProcessed = "";
991 AddressProcessed = (*AddressListLabel)[AddressIter->first];
993 AddressProcessed.Replace("\n", "\\n", true);
995 ProcessData.Append(";LABEL=");
996 ProcessData.Append(AddressProcessed);
1000 // Check if there is a value for LANGUAGE.
1002 if ((*AddressListLang)[AddressIter->first].size() > 0){
1004 ProcessData.Append(";LANGUAGE=");
1005 ProcessData.Append((*AddressListLang)[AddressIter->first]);
1009 // Check if there is a value for MEDIATYPE.
1011 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1013 ProcessData.Append(";MEDIATYPE=");
1014 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1018 // Check if there is a value for PID.
1020 if ((*AddressListPID)[AddressIter->first].size() > 0){
1022 ProcessData.Append(";PID=");
1023 ProcessData.Append((*AddressListPID)[AddressIter->first]);
1027 // Check if there is a value for PREF.
1029 if ((*AddressListPref)[AddressIter->first] > 0){
1031 ProcessData.Append(";PREF=");
1032 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1036 // Check if there is a value for TZ.
1038 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1040 ProcessData.Append(";TZ=");
1041 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1045 // Check if there is a value for tokens.
1047 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1049 ProcessData.Append(";");
1050 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1054 // Build the address.
1056 ProcessData.Append(":;;");
1057 ProcessData.Append((*AddressList)[AddressIter->first]);
1058 ProcessData.Append(";");
1059 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1060 ProcessData.Append(";");
1061 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1062 ProcessData.Append(";");
1063 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1064 ProcessData.Append(";");
1065 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1066 ProcessData.Append("\n");
1068 ProcessData = OutputText(&ProcessData);
1070 SaveData->Append(ProcessData);
1071 ProcessData.clear();
1077 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1078 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1079 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1080 wxString *SaveData, wxString DataType){
1082 wxString ProcessData = "";
1084 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1085 EmailIter != EmailList->end(); EmailIter++){
1087 ProcessData.Append("EMAIL");
1089 // Check if there is a value for TYPE.
1091 if (DataType.size() > 0){
1093 ProcessData.Append(";TYPE=");
1094 ProcessData.Append(DataType);
1098 // Check if there is a value for ALTID.
1100 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1102 ProcessData.Append(";ALTID=");
1103 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1107 // Check if there is a value for PID.
1109 if ((*EmailListPID)[EmailIter->first].size() > 0){
1111 ProcessData.Append(";PID=");
1112 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1116 // Check if there is a value for PREF.
1118 if ((*EmailListPref)[EmailIter->first] > 0){
1120 ProcessData.Append(";PREF=");
1121 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1125 // Check if there is a value for tokens.
1127 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1129 ProcessData.Append(";");
1130 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1134 ProcessData.Append(":");
1135 ProcessData.Append(EmailIter->second);
1136 ProcessData.Append("\n");
1138 ProcessData = OutputText(&ProcessData);
1140 SaveData->Append(ProcessData);
1141 ProcessData.clear();
1147 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1148 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1149 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1150 wxString *SaveData, wxString DataType){
1152 wxString ProcessData = "";
1154 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1155 LanguageIter != LanguageList->end(); LanguageIter++){
1157 ProcessData.Append("LANG");
1159 // Check if there is a value for TYPE.
1161 if (DataType.size() > 0){
1163 ProcessData.Append(";TYPE=");
1164 ProcessData.Append(DataType);
1168 // Check if there is a value for ALTID.
1170 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1172 ProcessData.Append(";ALTID=");
1173 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1177 // Check if there is a value for PID.
1179 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1181 ProcessData.Append(";PID=");
1182 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1186 // Check if there is a value for PREF.
1188 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1190 ProcessData.Append(";PREF=");
1191 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1195 // Check if there is a value for tokens.
1197 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1199 ProcessData.Append(";");
1200 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1204 ProcessData.Append(":");
1205 ProcessData.Append(LanguageIter->second);
1206 ProcessData.Append("\n");
1208 ProcessData = OutputText(&ProcessData);
1210 SaveData->Append(ProcessData);
1211 ProcessData.clear();
1217 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1218 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1219 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1220 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1221 wxString *SaveData, wxString DataType){
1223 wxString ProcessData = "";
1225 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1226 GeographyIter != GeographyList->end(); GeographyIter++){
1228 ProcessData.Append("GEO");
1230 // Check if there is a value for TYPE.
1232 if (DataType.size() > 0){
1234 ProcessData.Append(";TYPE=");
1235 ProcessData.Append(DataType);
1239 // Check if there is a value for ALTID.
1241 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1243 ProcessData.Append(";ALTID=");
1244 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1248 // Check if there is a value for MEDIATYPE.
1250 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1252 ProcessData.Append(";MEDIATYPE=");
1253 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1257 // Check if there is a value for PID.
1259 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1261 ProcessData.Append(";PID=");
1262 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1266 // Check if there is a value for PREF.
1268 if ((*GeographyListPref)[GeographyIter->first] > 0){
1270 ProcessData.Append(";PREF=");
1271 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1275 // Check if there is a value for tokens.
1277 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1279 ProcessData.Append(";");
1280 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1284 ProcessData.Append(":");
1285 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1286 ProcessData.Append(":");
1287 ProcessData.Append(GeographyIter->second);
1288 ProcessData.Append("\n");
1290 ProcessData = OutputText(&ProcessData);
1292 SaveData->Append(ProcessData);
1293 ProcessData.clear();
1299 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1300 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1301 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1302 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1304 wxString ProcessData = "";
1306 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1307 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1309 ProcessData.Append("URL");
1311 // Check if there is a value for TYPE.
1313 if (DataType.size() > 0){
1315 ProcessData.Append(";TYPE=");
1316 ProcessData.Append(DataType);
1320 // Check if there is a value for ALTID.
1322 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1324 ProcessData.Append(";ALTID=");
1325 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1329 // Check if there is a value for MEDIATYPE.
1331 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1333 ProcessData.Append(";MEDIATYPE=");
1334 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1338 // Check if there is a value for PID.
1340 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1342 ProcessData.Append(";PID=");
1343 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1347 // Check if there is a value for PREF.
1349 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1351 ProcessData.Append(";PREF=");
1352 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1356 // Check if there is a value for tokens.
1358 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1360 ProcessData.Append(";");
1361 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1365 ProcessData.Append(":");
1366 ProcessData.Append(WebsiteIter->second);
1367 ProcessData.Append("\n");
1369 ProcessData = OutputText(&ProcessData);
1371 SaveData->Append(ProcessData);
1372 ProcessData.clear();
1378 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1379 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1380 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1381 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1383 wxString ProcessData = "";
1385 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1386 RoleIter != RoleList->end(); RoleIter++){
1388 ProcessData.Append("ROLE");
1390 // Check if there is a value for TYPE.
1392 if (DataType.size() > 0){
1394 ProcessData.Append(";TYPE=");
1395 ProcessData.Append(DataType);
1399 // Check if there is a value for ALTID.
1401 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1403 ProcessData.Append(";ALTID=");
1404 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1408 // Check if there is a value for LANGUAGE.
1410 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1412 ProcessData.Append(";LANGUAGE=");
1413 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1417 // Check if there is a value for PID.
1419 if ((*RoleListPID)[RoleIter->first].size() > 0){
1421 ProcessData.Append(";PID=");
1422 ProcessData.Append((*RoleListPID)[RoleIter->first]);
1426 // Check if there is a value for PREF.
1428 if ((*RoleListPref)[RoleIter->first] > 0){
1430 ProcessData.Append(";PREF=");
1431 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1435 // Check if there is a value for tokens.
1437 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1439 ProcessData.Append(";");
1440 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1444 ProcessData.Append(":");
1445 ProcessData.Append(RoleIter->second);
1446 ProcessData.Append("\n");
1448 ProcessData = OutputText(&ProcessData);
1450 SaveData->Append(ProcessData);
1451 ProcessData.clear();
1457 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1458 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
1459 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
1460 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
1461 wxString *SaveData, wxString DataType){
1463 wxString ProcessData = "";
1465 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1466 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1468 ProcessData.Append("ORG");
1470 // Check if there is a value for TYPE.
1472 if (DataType.size() > 0){
1474 ProcessData.Append(";TYPE=");
1475 ProcessData.Append(DataType);
1479 // Check if there is a value for ALTID.
1481 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1483 ProcessData.Append(";ALTID=");
1484 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1488 // Check if there is a value for LANGUAGE.
1490 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1492 ProcessData.Append(";LANGUAGE=");
1493 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1497 // Check if there is a value for PID.
1499 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1501 ProcessData.Append(";PID=");
1502 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1506 // Check if there is a value for PREF.
1508 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1510 ProcessData.Append(";PREF=");
1511 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1515 // Check if there is a value for SORT-AS.
1517 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1519 ProcessData.Append(";SORT-AS=\"");
1520 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1521 ProcessData.Append("\"");
1525 // Check if there is a value for tokens.
1527 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1529 ProcessData.Append(";");
1530 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1534 ProcessData.Append(":");
1535 ProcessData.Append(OrganisationIter->second);
1536 ProcessData.Append("\n");
1538 ProcessData = OutputText(&ProcessData);
1540 SaveData->Append(ProcessData);
1541 ProcessData.clear();
1547 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1548 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1549 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1550 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1552 wxString ProcessData = "";
1554 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1555 NoteIter != NoteList->end(); NoteIter++){
1557 ProcessData.Append("NOTE");
1559 // Check if there is a value for TYPE.
1561 if (DataType.size() > 0){
1563 ProcessData.Append(";TYPE=");
1564 ProcessData.Append(DataType);
1568 // Check if there is a value for ALTID.
1570 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1572 ProcessData.Append(";ALTID=");
1573 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1577 // Check if there is a value for LANGUAGE.
1579 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1581 ProcessData.Append(";LANGUAGE=");
1582 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1586 // Check if there is a value for PID.
1588 if ((*NoteListPID)[NoteIter->first].size() > 0){
1590 ProcessData.Append(";PID=");
1591 ProcessData.Append((*NoteListPID)[NoteIter->first]);
1595 // Check if there is a value for PREF.
1597 if ((*NoteListPref)[NoteIter->first] > 0){
1599 ProcessData.Append(";PREF=");
1600 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1604 // Check if there is a value for tokens.
1606 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1608 ProcessData.Append(";");
1609 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1613 ProcessData.Append(":");
1614 ProcessData.Append(NoteIter->second);
1615 ProcessData.Replace("\n", "\\n", true);
1616 ProcessData.Append("\n");
1618 ProcessData = OutputText(&ProcessData);
1620 SaveData->Append(ProcessData);
1621 ProcessData.clear();
1627 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1628 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1629 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1630 map<int, wxString> *CategoryListTokens, wxString *SaveData){
1632 wxString ProcessData = "";
1634 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1635 CategoryIter != CategoryList->end(); CategoryIter++){
1637 ProcessData.Append("CATEGORIES");
1639 // Check if there is a value for TYPE.
1641 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1643 ProcessData.Append(";TYPE=");
1644 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1648 // Check if there is a value for ALTID.
1650 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1652 ProcessData.Append(";ALTID=");
1653 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1657 // Check if there is a value for LANGUAGE.
1659 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1661 ProcessData.Append(";LANGUAGE=");
1662 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1666 // Check if there is a value for PID.
1668 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1670 ProcessData.Append(";PID=");
1671 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1675 // Check if there is a value for PREF.
1677 if ((*CategoryListPref)[CategoryIter->first] > 0){
1679 ProcessData.Append(";PREF=");
1680 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1684 // Check if there is a value for tokens.
1686 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1688 ProcessData.Append(";");
1689 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1693 ProcessData.Append(":");
1694 ProcessData.Append(CategoryIter->second);
1695 ProcessData.Append("\n");
1697 ProcessData = OutputText(&ProcessData);
1699 SaveData->Append(ProcessData);
1700 ProcessData.clear();
1706 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
1707 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1708 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1709 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1710 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1712 wxString ProcessData = "";
1714 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1715 PicturesIter != PicturesList->end(); PicturesIter++){
1717 ProcessData.Append("PHOTO");
1719 // Check if there is a value for TYPE.
1721 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1723 ProcessData.Append(";TYPE=");
1724 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1728 // Check if there is a value for ALTID.
1730 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1732 ProcessData.Append(";ALTID=");
1733 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1737 // Check if there is a value for MEDIATYPE..
1739 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1741 ProcessData.Append(";MEDIATYPE=");
1742 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1746 // Check if there is a value for PID.
1748 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1750 ProcessData.Append(";PID=");
1751 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1755 // Check if there is a value for PREF.
1757 if ((*PicturesListPref)[PicturesIter->first] > 0){
1759 ProcessData.Append(";PREF=");
1760 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1764 // Check if there is a value for tokens.
1766 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1768 ProcessData.Append(";");
1769 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1773 ProcessData.Append(":data:");
1774 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1775 ProcessData.Append(";");
1776 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1777 ProcessData.Append(",");
1778 ProcessData.Append(PicturesIter->second);
1779 ProcessData.Append("\n");
1781 ProcessData = OutputText(&ProcessData);
1783 SaveData->Append(ProcessData);
1784 ProcessData.clear();
1790 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID,
1791 map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
1792 map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
1793 map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
1794 map<int, wxString> *LogosListTokens, wxString *SaveData){
1796 wxString ProcessData = "";
1798 for (std::map<int, string>::iterator LogosIter = LogosList->begin();
1799 LogosIter != LogosList->end(); LogosIter++){
1801 ProcessData.Append("LOGO");
1803 // Check if there is a value for TYPE.
1805 if ((*LogosListType)[LogosIter->first].size() > 0){
1807 ProcessData.Append(";TYPE=");
1808 ProcessData.Append((*LogosListType)[LogosIter->first]);
1812 // Check if there is a value for ALTID.
1814 if ((*LogosListAltID)[LogosIter->first].size() > 0){
1816 ProcessData.Append(";ALTID=");
1817 ProcessData.Append((*LogosListAltID)[LogosIter->first]);
1821 // Check if there is a value for MEDIATYPE..
1823 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
1825 ProcessData.Append(";MEDIATYPE=");
1826 ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
1830 // Check if there is a value for PID.
1832 if ((*LogosListPID)[LogosIter->first].size() > 0){
1834 ProcessData.Append(";PID=");
1835 ProcessData.Append((*LogosListPID)[LogosIter->first]);
1839 // Check if there is a value for PREF.
1841 if ((*LogosListPref)[LogosIter->first] > 0){
1843 ProcessData.Append(";PREF=");
1844 ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
1848 // Check if there is a value for tokens.
1850 if ((*LogosListTokens)[LogosIter->first].size() > 0){
1852 ProcessData.Append(";");
1853 ProcessData.Append((*LogosListTokens)[LogosIter->first]);
1857 ProcessData.Append(":data:");
1858 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
1859 ProcessData.Append(";");
1860 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
1861 ProcessData.Append(",");
1862 ProcessData.Append(LogosIter->second);
1863 ProcessData.Append("\n");
1865 ProcessData = OutputText(&ProcessData);
1867 SaveData->Append(ProcessData);
1868 ProcessData.clear();
1874 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID,
1875 map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
1876 map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
1877 map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage,
1878 map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens,
1879 wxString *SaveData){
1881 wxString ProcessData = "";
1883 for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
1884 SoundsIter != SoundsList->end(); SoundsIter++){
1886 ProcessData.Append("SOUND");
1888 // Check if there is a value for TYPE.
1890 if ((*SoundsListType)[SoundsIter->first].size() > 0){
1892 ProcessData.Append(";TYPE=");
1893 ProcessData.Append((*SoundsListType)[SoundsIter->first]);
1897 // Check if there is a value for ALTID.
1899 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
1901 ProcessData.Append(";ALTID=");
1902 ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
1906 // Check if there is a value for LANGUAGE.
1908 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
1910 ProcessData.Append(";LANGUAGE=");
1911 ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
1915 // Check if there is a value for MEDIATYPE.
1917 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
1919 ProcessData.Append(";MEDIATYPE=");
1920 ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
1924 // Check if there is a value for PID.
1926 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
1928 ProcessData.Append(";PID=");
1929 ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
1933 // Check if there is a value for PREF.
1935 if ((*SoundsListPref)[SoundsIter->first] > 0){
1937 ProcessData.Append(";PREF=");
1938 ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
1942 // Check if there is a value for tokens.
1944 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
1946 ProcessData.Append(";");
1947 ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
1951 ProcessData.Append(":data:");
1952 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
1953 ProcessData.Append(";");
1954 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
1955 ProcessData.Append(",");
1956 ProcessData.Append(SoundsIter->second);
1957 ProcessData.Append("\n");
1959 ProcessData = OutputText(&ProcessData);
1961 SaveData->Append(ProcessData);
1962 ProcessData.clear();
1968 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
1969 map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
1970 map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
1971 map<int, wxString> *CalendarListTokens, wxString *SaveData){
1973 wxString ProcessData = "";
1975 for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
1976 CalendarIter != CalendarList->end(); CalendarIter++){
1978 ProcessData.Append("CALURI");
1980 // Check if there is a value for TYPE.
1982 if ((*CalendarListType)[CalendarIter->first].size() > 0){
1984 ProcessData.Append(";TYPE=");
1985 ProcessData.Append((*CalendarListType)[CalendarIter->first]);
1989 // Check if there is a value for ALTID.
1991 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
1993 ProcessData.Append(";ALTID=");
1994 ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
1998 // Check if there is a value for MEDIATYPE.
2000 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2002 ProcessData.Append(";MEDIATYPE=");
2003 ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2007 // Check if there is a value for PID.
2009 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2011 ProcessData.Append(";PID=");
2012 ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2016 // Check if there is a value for PREF.
2018 if ((*CalendarListPref)[CalendarIter->first] > 0){
2020 ProcessData.Append(";PREF=");
2021 ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2025 // Check if there is a value for tokens.
2027 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2029 ProcessData.Append(";");
2030 ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2034 ProcessData.Append(":");
2035 ProcessData.Append(CalendarIter->second);
2036 ProcessData.Append("\n");
2038 ProcessData = OutputText(&ProcessData);
2040 SaveData->Append(ProcessData);
2041 ProcessData.clear();
2047 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2048 map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2049 map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2050 map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2052 wxString ProcessData = "";
2054 for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2055 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2057 ProcessData.Append("CALADRURI");
2059 // Check if there is a value for TYPE.
2061 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2063 ProcessData.Append(";TYPE=");
2064 ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2068 // Check if there is a value for ALTID.
2070 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2072 ProcessData.Append(";ALTID=");
2073 ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2077 // Check if there is a value for MEDIATYPE.
2079 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2081 ProcessData.Append(";MEDIATYPE=");
2082 ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2086 // Check if there is a value for PID.
2088 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2090 ProcessData.Append(";PID=");
2091 ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2095 // Check if there is a value for PREF.
2097 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2099 ProcessData.Append(";PREF=");
2100 ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2104 // Check if there is a value for tokens.
2106 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2108 ProcessData.Append(";");
2109 ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2113 ProcessData.Append(":");
2114 ProcessData.Append(CalendarRequestIter->second);
2115 ProcessData.Append("\n");
2117 ProcessData = OutputText(&ProcessData);
2119 SaveData->Append(ProcessData);
2120 ProcessData.clear();
2126 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID,
2127 std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2128 std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref,
2129 std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2131 wxString ProcessData = "";
2133 for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2134 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2136 ProcessData.Append("FBURL");
2138 // Check if there is a value for TYPE.
2140 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2142 ProcessData.Append(";TYPE=");
2143 ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2147 // Check if there is a value for ALTID.
2149 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2151 ProcessData.Append(";ALTID=");
2152 ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2156 // Check if there is a value for MEDIATYPE.
2158 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2160 ProcessData.Append(";MEDIATYPE=");
2161 ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2165 // Check if there is a value for PID.
2167 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2169 ProcessData.Append(";PID=");
2170 ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2174 // Check if there is a value for PREF.
2176 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2178 ProcessData.Append(";PREF=");
2179 ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2183 // Check if there is a value for tokens.
2185 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2187 ProcessData.Append(";");
2188 ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2192 ProcessData.Append(":");
2193 ProcessData.Append(FreeBusyIter->second);
2194 ProcessData.Append("\n");
2196 ProcessData = OutputText(&ProcessData);
2198 SaveData->Append(ProcessData);
2199 ProcessData.clear();