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,
595 // Write the end part of the vCard data file.
597 SaveData->Append("END:VCARD");
599 SaveDataStatus = CONTACTSAVE_OK;
601 return SaveDataStatus;
605 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
606 map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
607 map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
608 map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
610 wxString ProcessData = "";
612 for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
613 TitleIter != TitleList->end(); TitleIter++){
615 ProcessData.Append("TITLE");
617 // Check if there is a value for TYPE.
619 if (DataType.size() > 0){
621 ProcessData.Append(";TYPE=");
622 ProcessData.Append(DataType);
626 // Check if there is a value for ALTID.
628 if ((*TitleListAltID)[TitleIter->first].size() > 0){
630 ProcessData.Append(";ALTID=");
631 ProcessData.Append((*TitleListAltID)[TitleIter->first]);
635 // Check if there is a value for LANGUAGE.
637 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
639 ProcessData.Append(";LANGUAGE=");
640 ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
644 // Check if there is a value for PID.
646 if ((*TitleListPID)[TitleIter->first].size() > 0){
648 ProcessData.Append(";PID=");
649 ProcessData.Append((*TitleListPID)[TitleIter->first]);
653 // Check if there is a value for PREF.
655 if ((*TitleListPref)[TitleIter->first] > 0){
657 ProcessData.Append(";PREF=");
658 ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
662 // Check if there is a value for tokens.
664 if ((*TitleListTokens)[TitleIter->first].size() > 0){
666 ProcessData.Append(";");
667 ProcessData.Append((*TitleListTokens)[TitleIter->first]);
671 ProcessData.Append(":");
672 ProcessData.Append(TitleIter->second);
673 ProcessData.Append("\n");
675 ProcessData = OutputText(&ProcessData);
677 SaveData->Append(ProcessData);
684 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID,
685 map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
686 map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref,
687 map<int, wxString> *SourceListTokens, wxString *SaveData){
689 wxString ProcessData = "";
691 for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
692 SourceIter != SourceList->end(); SourceIter++){
694 ProcessData.Append("SOURCE");
696 // Check if there is a value for TYPE.
698 if ((*SourceListType)[SourceIter->first].size() > 0){
700 ProcessData.Append(";TYPE=");
701 ProcessData.Append((*SourceListType)[SourceIter->first]);
705 // Check if there is a value for ALTID.
707 if ((*SourceListAltID)[SourceIter->first].size() > 0){
709 ProcessData.Append(";ALTID=");
710 ProcessData.Append((*SourceListAltID)[SourceIter->first]);
714 // Check if there is a value for MEDIATYPE.
716 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
718 ProcessData.Append(";MEDIATYPE=");
719 ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
723 // Check if there is a value for PID.
725 if ((*SourceListPID)[SourceIter->first].size() > 0){
727 ProcessData.Append(";PID=");
728 ProcessData.Append((*SourceListPID)[SourceIter->first]);
732 // Check if there is a value for PREF.
734 if ((*SourceListPref)[SourceIter->first] > 0){
736 ProcessData.Append(";PREF=");
737 ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
741 // Check if there is a value for tokens.
743 if ((*SourceListTokens)[SourceIter->first].size() > 0){
745 ProcessData.Append(";");
746 ProcessData.Append((*SourceListTokens)[SourceIter->first]);
750 ProcessData.Append(":");
751 ProcessData.Append(SourceIter->second);
752 ProcessData.Append("\n");
754 ProcessData = OutputText(&ProcessData);
756 SaveData->Append(ProcessData);
763 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID,
764 map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
765 map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref,
766 map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
768 wxString ProcessData = "";
770 for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
771 NicknameIter != NicknameList->end(); NicknameIter++){
773 ProcessData.Append("NICKNAME");
775 // Check if there is a value for TYPE.
777 if (DataType.size() > 0){
779 ProcessData.Append(";TYPE=");
780 ProcessData.Append(DataType);
784 // Check if there is a value for ALTID.
786 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
788 ProcessData.Append(";ALTID=");
789 ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
793 // Check if there is a value for MEDIATYPE.
795 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
797 ProcessData.Append(";LANGUAGE=");
798 ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
802 // Check if there is a value for PID.
804 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
806 ProcessData.Append(";PID=");
807 ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
811 // Check if there is a value for PREF.
813 if ((*NicknameListPref)[NicknameIter->first] > 0){
815 ProcessData.Append(";PREF=");
816 ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
820 // Check if there is a value for tokens.
822 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
824 ProcessData.Append(";");
825 ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
829 ProcessData.Append(":");
830 ProcessData.Append(NicknameIter->second);
831 ProcessData.Append("\n");
833 ProcessData = OutputText(&ProcessData);
835 SaveData->Append(ProcessData);
842 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID,
843 map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
844 map<int, wxString> *TZListMediatype, map<int, int> *TZListPref,
845 map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
847 wxString ProcessData = "";
849 for (std::map<int, wxString>::iterator TZIter = TZList->begin();
850 TZIter != TZList->end(); TZIter++){
852 ProcessData.Append("TZ");
854 // Check if there is a value for TYPE.
856 if (DataType.size() > 0){
858 ProcessData.Append(";TYPE=");
859 ProcessData.Append(DataType);
863 // Check if there is a value for ALTID.
865 if ((*TZListAltID)[TZIter->first].size() > 0){
867 ProcessData.Append(";ALTID=");
868 ProcessData.Append((*TZListAltID)[TZIter->first]);
872 // Check if there is a value for MEDIATYPE.
874 if ((*TZListMediatype)[TZIter->first].size() > 0){
876 ProcessData.Append(";MEDIATYPE=");
877 ProcessData.Append((*TZListMediatype)[TZIter->first]);
881 // Check if there is a value for PID.
883 if ((*TZListPID)[TZIter->first].size() > 0){
885 ProcessData.Append(";PID=");
886 ProcessData.Append((*TZListPID)[TZIter->first]);
890 // Check if there is a value for PREF.
892 if ((*TZListPref)[TZIter->first] > 0){
894 ProcessData.Append(";PREF=");
895 ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
899 // Check if there is a value for tokens.
901 if ((*TZListTokens)[TZIter->first].size() > 0){
903 ProcessData.Append(";");
904 ProcessData.Append((*TZListTokens)[TZIter->first]);
908 ProcessData.Append(":");
909 ProcessData.Append(TZIter->second);
910 ProcessData.Append("\n");
912 ProcessData = OutputText(&ProcessData);
914 SaveData->Append(ProcessData);
921 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
922 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
923 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
924 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
925 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo,
926 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType,
927 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref,
928 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
930 wxString ProcessData = "";
932 for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
933 AddressIter != AddressList->end(); AddressIter++){
935 ProcessData.Append("ADR");
937 // Check if there is a value for TYPE.
939 if (DataType.size() > 0){
941 ProcessData.Append(";TYPE=");
942 ProcessData.Append(DataType);
946 // Check if there is a value for ALTID.
948 if ((*AddressListAltID)[AddressIter->first].size() > 0){
950 ProcessData.Append(";ALTID=");
951 ProcessData.Append((*AddressListAltID)[AddressIter->first]);
955 // Check if there is a value for GEO.
957 if ((*AddressListGeo)[AddressIter->first].size() > 0){
959 ProcessData.Append(";GEO=\"");
960 ProcessData.Append((*AddressListGeo)[AddressIter->first]);
961 ProcessData.Append("\"");
965 // Check if there is a value for LABEL.
967 if ((*AddressListLabel)[AddressIter->first].size() > 0){
969 wxString AddressProcessed = "";
970 AddressProcessed = (*AddressListLabel)[AddressIter->first];
972 AddressProcessed.Replace("\n", "\\n", true);
974 ProcessData.Append(";LABEL=");
975 ProcessData.Append(AddressProcessed);
979 // Check if there is a value for LANGUAGE.
981 if ((*AddressListLang)[AddressIter->first].size() > 0){
983 ProcessData.Append(";LANGUAGE=");
984 ProcessData.Append((*AddressListLang)[AddressIter->first]);
988 // Check if there is a value for MEDIATYPE.
990 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
992 ProcessData.Append(";MEDIATYPE=");
993 ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
997 // Check if there is a value for PID.
999 if ((*AddressListPID)[AddressIter->first].size() > 0){
1001 ProcessData.Append(";PID=");
1002 ProcessData.Append((*AddressListPID)[AddressIter->first]);
1006 // Check if there is a value for PREF.
1008 if ((*AddressListPref)[AddressIter->first] > 0){
1010 ProcessData.Append(";PREF=");
1011 ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1015 // Check if there is a value for TZ.
1017 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1019 ProcessData.Append(";TZ=");
1020 ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1024 // Check if there is a value for tokens.
1026 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1028 ProcessData.Append(";");
1029 ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1033 // Build the address.
1035 ProcessData.Append(":;;");
1036 ProcessData.Append((*AddressList)[AddressIter->first]);
1037 ProcessData.Append(";");
1038 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1039 ProcessData.Append(";");
1040 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1041 ProcessData.Append(";");
1042 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1043 ProcessData.Append(";");
1044 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1045 ProcessData.Append("\n");
1047 ProcessData = OutputText(&ProcessData);
1049 SaveData->Append(ProcessData);
1050 ProcessData.clear();
1056 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID,
1057 map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1058 map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens,
1059 wxString *SaveData, wxString DataType){
1061 wxString ProcessData = "";
1063 for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1064 EmailIter != EmailList->end(); EmailIter++){
1066 ProcessData.Append("EMAIL");
1068 // Check if there is a value for TYPE.
1070 if (DataType.size() > 0){
1072 ProcessData.Append(";TYPE=");
1073 ProcessData.Append(DataType);
1077 // Check if there is a value for ALTID.
1079 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1081 ProcessData.Append(";ALTID=");
1082 ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1086 // Check if there is a value for PID.
1088 if ((*EmailListPID)[EmailIter->first].size() > 0){
1090 ProcessData.Append(";PID=");
1091 ProcessData.Append((*EmailListPID)[EmailIter->first]);
1095 // Check if there is a value for PREF.
1097 if ((*EmailListPref)[EmailIter->first] > 0){
1099 ProcessData.Append(";PREF=");
1100 ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1104 // Check if there is a value for tokens.
1106 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1108 ProcessData.Append(";");
1109 ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1113 ProcessData.Append(":");
1114 ProcessData.Append(EmailIter->second);
1115 ProcessData.Append("\n");
1117 ProcessData = OutputText(&ProcessData);
1119 SaveData->Append(ProcessData);
1120 ProcessData.clear();
1126 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID,
1127 map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1128 map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens,
1129 wxString *SaveData, wxString DataType){
1131 wxString ProcessData = "";
1133 for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1134 LanguageIter != LanguageList->end(); LanguageIter++){
1136 ProcessData.Append("LANG");
1138 // Check if there is a value for TYPE.
1140 if (DataType.size() > 0){
1142 ProcessData.Append(";TYPE=");
1143 ProcessData.Append(DataType);
1147 // Check if there is a value for ALTID.
1149 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1151 ProcessData.Append(";ALTID=");
1152 ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1156 // Check if there is a value for PID.
1158 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1160 ProcessData.Append(";PID=");
1161 ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1165 // Check if there is a value for PREF.
1167 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1169 ProcessData.Append(";PREF=");
1170 ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1174 // Check if there is a value for tokens.
1176 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1178 ProcessData.Append(";");
1179 ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1183 ProcessData.Append(":");
1184 ProcessData.Append(LanguageIter->second);
1185 ProcessData.Append("\n");
1187 ProcessData = OutputText(&ProcessData);
1189 SaveData->Append(ProcessData);
1190 ProcessData.clear();
1196 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID,
1197 map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1198 map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1199 map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens,
1200 wxString *SaveData, wxString DataType){
1202 wxString ProcessData = "";
1204 for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1205 GeographyIter != GeographyList->end(); GeographyIter++){
1207 ProcessData.Append("GEO");
1209 // Check if there is a value for TYPE.
1211 if (DataType.size() > 0){
1213 ProcessData.Append(";TYPE=");
1214 ProcessData.Append(DataType);
1218 // Check if there is a value for ALTID.
1220 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1222 ProcessData.Append(";ALTID=");
1223 ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1227 // Check if there is a value for MEDIATYPE.
1229 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1231 ProcessData.Append(";MEDIATYPE=");
1232 ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1236 // Check if there is a value for PID.
1238 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1240 ProcessData.Append(";PID=");
1241 ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1245 // Check if there is a value for PREF.
1247 if ((*GeographyListPref)[GeographyIter->first] > 0){
1249 ProcessData.Append(";PREF=");
1250 ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1254 // Check if there is a value for tokens.
1256 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1258 ProcessData.Append(";");
1259 ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1263 ProcessData.Append(":");
1264 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1265 ProcessData.Append(":");
1266 ProcessData.Append(GeographyIter->second);
1267 ProcessData.Append("\n");
1269 ProcessData = OutputText(&ProcessData);
1271 SaveData->Append(ProcessData);
1272 ProcessData.clear();
1278 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID,
1279 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1280 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref,
1281 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1283 wxString ProcessData = "";
1285 for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1286 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1288 ProcessData.Append("URL");
1290 // Check if there is a value for TYPE.
1292 if (DataType.size() > 0){
1294 ProcessData.Append(";TYPE=");
1295 ProcessData.Append(DataType);
1299 // Check if there is a value for ALTID.
1301 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1303 ProcessData.Append(";ALTID=");
1304 ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1308 // Check if there is a value for MEDIATYPE.
1310 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1312 ProcessData.Append(";MEDIATYPE=");
1313 ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1317 // Check if there is a value for PID.
1319 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1321 ProcessData.Append(";PID=");
1322 ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1326 // Check if there is a value for PREF.
1328 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1330 ProcessData.Append(";PREF=");
1331 ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1335 // Check if there is a value for tokens.
1337 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1339 ProcessData.Append(";");
1340 ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1344 ProcessData.Append(":");
1345 ProcessData.Append(WebsiteIter->second);
1346 ProcessData.Append("\n");
1348 ProcessData = OutputText(&ProcessData);
1350 SaveData->Append(ProcessData);
1351 ProcessData.clear();
1357 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1358 map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1359 map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1360 map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1362 wxString ProcessData = "";
1364 for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1365 RoleIter != RoleList->end(); RoleIter++){
1367 ProcessData.Append("ROLE");
1369 // Check if there is a value for TYPE.
1371 if (DataType.size() > 0){
1373 ProcessData.Append(";TYPE=");
1374 ProcessData.Append(DataType);
1378 // Check if there is a value for ALTID.
1380 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1382 ProcessData.Append(";ALTID=");
1383 ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1387 // Check if there is a value for LANGUAGE.
1389 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1391 ProcessData.Append(";LANGUAGE=");
1392 ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1396 // Check if there is a value for PID.
1398 if ((*RoleListPID)[RoleIter->first].size() > 0){
1400 ProcessData.Append(";PID=");
1401 ProcessData.Append((*RoleListPID)[RoleIter->first]);
1405 // Check if there is a value for PREF.
1407 if ((*RoleListPref)[RoleIter->first] > 0){
1409 ProcessData.Append(";PREF=");
1410 ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1414 // Check if there is a value for tokens.
1416 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1418 ProcessData.Append(";");
1419 ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1423 ProcessData.Append(":");
1424 ProcessData.Append(RoleIter->second);
1425 ProcessData.Append("\n");
1427 ProcessData = OutputText(&ProcessData);
1429 SaveData->Append(ProcessData);
1430 ProcessData.clear();
1436 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1437 map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage,
1438 map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType,
1439 map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens,
1440 wxString *SaveData, wxString DataType){
1442 wxString ProcessData = "";
1444 for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1445 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1447 ProcessData.Append("ORG");
1449 // Check if there is a value for TYPE.
1451 if (DataType.size() > 0){
1453 ProcessData.Append(";TYPE=");
1454 ProcessData.Append(DataType);
1458 // Check if there is a value for ALTID.
1460 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1462 ProcessData.Append(";ALTID=");
1463 ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1467 // Check if there is a value for LANGUAGE.
1469 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1471 ProcessData.Append(";LANGUAGE=");
1472 ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1476 // Check if there is a value for PID.
1478 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1480 ProcessData.Append(";PID=");
1481 ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1485 // Check if there is a value for PREF.
1487 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1489 ProcessData.Append(";PREF=");
1490 ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1494 // Check if there is a value for SORT-AS.
1496 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1498 ProcessData.Append(";SORT-AS=\"");
1499 ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1500 ProcessData.Append("\"");
1504 // Check if there is a value for tokens.
1506 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1508 ProcessData.Append(";");
1509 ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1513 ProcessData.Append(":");
1514 ProcessData.Append(OrganisationIter->second);
1515 ProcessData.Append("\n");
1517 ProcessData = OutputText(&ProcessData);
1519 SaveData->Append(ProcessData);
1520 ProcessData.clear();
1526 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1527 map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1528 map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1529 map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1531 wxString ProcessData = "";
1533 for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1534 NoteIter != NoteList->end(); NoteIter++){
1536 ProcessData.Append("NOTE");
1538 // Check if there is a value for TYPE.
1540 if (DataType.size() > 0){
1542 ProcessData.Append(";TYPE=");
1543 ProcessData.Append(DataType);
1547 // Check if there is a value for ALTID.
1549 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1551 ProcessData.Append(";ALTID=");
1552 ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1556 // Check if there is a value for LANGUAGE.
1558 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1560 ProcessData.Append(";LANGUAGE=");
1561 ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1565 // Check if there is a value for PID.
1567 if ((*NoteListPID)[NoteIter->first].size() > 0){
1569 ProcessData.Append(";PID=");
1570 ProcessData.Append((*NoteListPID)[NoteIter->first]);
1574 // Check if there is a value for PREF.
1576 if ((*NoteListPref)[NoteIter->first] > 0){
1578 ProcessData.Append(";PREF=");
1579 ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1583 // Check if there is a value for tokens.
1585 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1587 ProcessData.Append(";");
1588 ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1592 ProcessData.Append(":");
1593 ProcessData.Append(NoteIter->second);
1594 ProcessData.Replace("\n", "\\n", true);
1595 ProcessData.Append("\n");
1597 ProcessData = OutputText(&ProcessData);
1599 SaveData->Append(ProcessData);
1600 ProcessData.clear();
1606 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1607 map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1608 map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1609 map<int, wxString> *CategoryListTokens, wxString *SaveData){
1611 wxString ProcessData = "";
1613 for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1614 CategoryIter != CategoryList->end(); CategoryIter++){
1616 ProcessData.Append("CATEGORIES");
1618 // Check if there is a value for TYPE.
1620 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1622 ProcessData.Append(";TYPE=");
1623 ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1627 // Check if there is a value for ALTID.
1629 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1631 ProcessData.Append(";ALTID=");
1632 ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1636 // Check if there is a value for LANGUAGE.
1638 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1640 ProcessData.Append(";LANGUAGE=");
1641 ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1645 // Check if there is a value for PID.
1647 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1649 ProcessData.Append(";PID=");
1650 ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1654 // Check if there is a value for PREF.
1656 if ((*CategoryListPref)[CategoryIter->first] > 0){
1658 ProcessData.Append(";PREF=");
1659 ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1663 // Check if there is a value for tokens.
1665 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1667 ProcessData.Append(";");
1668 ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1672 ProcessData.Append(":");
1673 ProcessData.Append(CategoryIter->second);
1674 ProcessData.Append("\n");
1676 ProcessData = OutputText(&ProcessData);
1678 SaveData->Append(ProcessData);
1679 ProcessData.clear();
1685 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID,
1686 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1687 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1688 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1689 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1691 wxString ProcessData = "";
1693 for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1694 PicturesIter != PicturesList->end(); PicturesIter++){
1696 ProcessData.Append("PHOTO");
1698 // Check if there is a value for TYPE.
1700 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1702 ProcessData.Append(";TYPE=");
1703 ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1707 // Check if there is a value for ALTID.
1709 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1711 ProcessData.Append(";ALTID=");
1712 ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1716 // Check if there is a value for MEDIATYPE..
1718 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1720 ProcessData.Append(";MEDIATYPE=");
1721 ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1725 // Check if there is a value for PID.
1727 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1729 ProcessData.Append(";PID=");
1730 ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1734 // Check if there is a value for PREF.
1736 if ((*PicturesListPref)[PicturesIter->first] > 0){
1738 ProcessData.Append(";PREF=");
1739 ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1743 // Check if there is a value for tokens.
1745 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1747 ProcessData.Append(";");
1748 ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1752 ProcessData.Append(":data:");
1753 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1754 ProcessData.Append(";");
1755 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1756 ProcessData.Append(",");
1757 ProcessData.Append(PicturesIter->second);
1758 ProcessData.Append("\n");
1760 ProcessData = OutputText(&ProcessData);
1762 SaveData->Append(ProcessData);
1763 ProcessData.clear();
1769 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID,
1770 map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
1771 map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
1772 map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
1773 map<int, wxString> *LogosListTokens, wxString *SaveData){
1775 wxString ProcessData = "";
1777 for (std::map<int, string>::iterator LogosIter = LogosList->begin();
1778 LogosIter != LogosList->end(); LogosIter++){
1780 ProcessData.Append("LOGO");
1782 // Check if there is a value for TYPE.
1784 if ((*LogosListType)[LogosIter->first].size() > 0){
1786 ProcessData.Append(";TYPE=");
1787 ProcessData.Append((*LogosListType)[LogosIter->first]);
1791 // Check if there is a value for ALTID.
1793 if ((*LogosListAltID)[LogosIter->first].size() > 0){
1795 ProcessData.Append(";ALTID=");
1796 ProcessData.Append((*LogosListAltID)[LogosIter->first]);
1800 // Check if there is a value for MEDIATYPE..
1802 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
1804 ProcessData.Append(";MEDIATYPE=");
1805 ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
1809 // Check if there is a value for PID.
1811 if ((*LogosListPID)[LogosIter->first].size() > 0){
1813 ProcessData.Append(";PID=");
1814 ProcessData.Append((*LogosListPID)[LogosIter->first]);
1818 // Check if there is a value for PREF.
1820 if ((*LogosListPref)[LogosIter->first] > 0){
1822 ProcessData.Append(";PREF=");
1823 ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
1827 // Check if there is a value for tokens.
1829 if ((*LogosListTokens)[LogosIter->first].size() > 0){
1831 ProcessData.Append(";");
1832 ProcessData.Append((*LogosListTokens)[LogosIter->first]);
1836 ProcessData.Append(":data:");
1837 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
1838 ProcessData.Append(";");
1839 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
1840 ProcessData.Append(",");
1841 ProcessData.Append(LogosIter->second);
1842 ProcessData.Append("\n");
1844 ProcessData = OutputText(&ProcessData);
1846 SaveData->Append(ProcessData);
1847 ProcessData.clear();
1853 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID,
1854 map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
1855 map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
1856 map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage,
1857 map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens,
1858 wxString *SaveData){
1860 wxString ProcessData = "";
1862 for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
1863 SoundsIter != SoundsList->end(); SoundsIter++){
1865 ProcessData.Append("SOUND");
1867 // Check if there is a value for TYPE.
1869 if ((*SoundsListType)[SoundsIter->first].size() > 0){
1871 ProcessData.Append(";TYPE=");
1872 ProcessData.Append((*SoundsListType)[SoundsIter->first]);
1876 // Check if there is a value for ALTID.
1878 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
1880 ProcessData.Append(";ALTID=");
1881 ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
1885 // Check if there is a value for LANGUAGE.
1887 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
1889 ProcessData.Append(";LANGUAGE=");
1890 ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
1894 // Check if there is a value for MEDIATYPE.
1896 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
1898 ProcessData.Append(";MEDIATYPE=");
1899 ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
1903 // Check if there is a value for PID.
1905 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
1907 ProcessData.Append(";PID=");
1908 ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
1912 // Check if there is a value for PREF.
1914 if ((*SoundsListPref)[SoundsIter->first] > 0){
1916 ProcessData.Append(";PREF=");
1917 ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
1921 // Check if there is a value for tokens.
1923 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
1925 ProcessData.Append(";");
1926 ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
1930 ProcessData.Append(":data:");
1931 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
1932 ProcessData.Append(";");
1933 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
1934 ProcessData.Append(",");
1935 ProcessData.Append(SoundsIter->second);
1936 ProcessData.Append("\n");
1938 ProcessData = OutputText(&ProcessData);
1940 SaveData->Append(ProcessData);
1941 ProcessData.clear();