Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added MEMBER to the SaveString function of ContactDataObject
[xestiaab/.git] / source / contacteditor / cdo / ContactDataObject-Save.cpp
1 // ContactDataObject-Save.cpp - Client Data Object.
2 //
3 // (c) 2012-2016 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
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.
10 //
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.
15 //
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){
23         
24         ContactSaveStatus SaveDataStatus = CONTACTSAVE_UNITTESTFAIL;
25         
26         // Write the header for the vCard data file.
27         
28         SaveData->Append("BEGIN:VCARD\n");
29         SaveData->Append("VERSION:4.0\n");
30         
31         // Write the product ID.
32         
33 #ifdef XAB_UNITTEST
34         
35         SaveData->Append("PRODID:-//Xestia//Address Book Unit Testing//KW\n");
36         
37 #else
38         
39         SaveData->Append(wxT("PRODID:-//Xestia//Address Book Version "));
40         SaveData->Append(wxT(XSDAB_VERSION));
41         SaveData->Append(wxT("//KW\n"));
42         
43 #endif
45         wxString ProcessData = "";
47         // Process UID.
49         if (UIDToken.size() > 0){
50                 
51                 ProcessData.Append("UID:");
52                 ProcessData.Append(UIDToken);
53                 ProcessData.Append("\n");
54                 SaveData->Append(ProcessData);
55                 ProcessData.clear();
56                 
57         }
58         
59         // Process KIND.
60         
61         switch(ContactKind){
63                 case CONTACTKIND_NONE:
64                         break;
65                 case CONTACTKIND_INDIVIDUAL:
66                         SaveData->Append("KIND:individual\n");
67                         break;
68                 case CONTACTKIND_GROUP:
69                         SaveData->Append("KIND:group\n");
70                         break;
71                 case CONTACTKIND_ORGANISATION:
72                         SaveData->Append("KIND:org\n");
73                         break;
74                 case CONTACTKIND_LOCATION:
75                         SaveData->Append("KIND:location\n");
76                         break;
77                 default:
78                         break;
79                 
80         }
81         
82         // TODO: Sortout REV.
83         
84         // Process XML.
86         for (std::map<int, wxString>::iterator XMLIter = XMLList.begin();
87                 XMLIter != XMLList.end(); XMLIter++){
88         
89                 ProcessData.Append("XML");
90                         
91                 if (XMLListAltID[XMLIter->first].size() > 0){
92                 
93                         ProcessData.Append(";ALTID=");
94                         ProcessData.Append(XMLListAltID[XMLIter->first]);
95                         
96                 }
97                         
98                 ProcessData.Append(":");
99                 ProcessData.Append(XMLIter->second);
100                 ProcessData.Append("\n");
101                 
102                 ProcessData = OutputText(&ProcessData);
103                 
104                 SaveData->Append(ProcessData);
105                 ProcessData.clear();
106                         
107         }
108         
109         // Process SOURCE.
110         
111         SaveSource(&SourceList, &SourceListAltID, 
112                 &SourceListPID, &SourceListType,
113                 &SourceListMediatype, &SourceListPref, 
114                 &SourceListTokens, SaveData);
115         
116         // Process MEMBER (if contact kind is CONTACTKIND_GROUP).
117         
118         if (ContactKind == CONTACTKIND_GROUP){
119                 
120                 SaveMember(&GroupsList, &GroupsListAltID, 
121                         &GroupsListPID, &GroupsListType,
122                         &GroupsListMediaType, &GroupsListPref, 
123                         &GroupsListTokens, SaveData);
124                 
125         }
126         
127         // Process CLIENTPIDMAP.
128         
129         for (std::map<int, wxString>::iterator CPIDIter = ClientPIDList.begin();
130                 CPIDIter != ClientPIDList.end(); CPIDIter++){
131         
132                 ProcessData.Append("CLIENTPIDMAP");
133                         
134                 if (ClientPIDListTokens[CPIDIter->first].size() > 0){
135                 
136                         ProcessData.Append(";");
137                         ProcessData.Append(ClientPIDListTokens[CPIDIter->first]);
138                         
139                 }
140                         
141                 ProcessData.Append(":");
142                 ProcessData.Append(CPIDIter->second);
143                 ProcessData.Append("\n");
144                 
145                 ProcessData = OutputText(&ProcessData);
146                 
147                 SaveData->Append(ProcessData);
148                 ProcessData.clear();
149                         
150         }
151         
152         // Process FN.
153         
154         for (std::map<int, wxString>::iterator FNIter = FullNamesList.begin();
155                 FNIter != FullNamesList.end(); FNIter++){
156                 
157                 ProcessData.Append("FN");
159                 // Check if there is a value for TYPE.
160                 
161                 if (FullNamesListType[FNIter->first].size() > 0){
162                 
163                         ProcessData.Append(";TYPE=");
164                         ProcessData.Append(FullNamesListType[FNIter->first]);
165                         
166                 }
168                 // Check if there is a value for LANGUAGE.
169                 
170                 if (FullNamesListLanguage[FNIter->first].size() > 0){
171                 
172                         ProcessData.Append(";LANGUAGE=");
173                         ProcessData.Append(FullNamesListLanguage[FNIter->first]);
174                         
175                 }
176                 
177                 // Check if there is a value for ALTID.
178                 
179                 if (FullNamesListAltID[FNIter->first].size() > 0){
180                 
181                         ProcessData.Append(";ALTID=");
182                         ProcessData.Append(FullNamesListAltID[FNIter->first]);
183                         
184                 }
185                 
186                 // Check if there is a value for PID.
188                 if (FullNamesListPID[FNIter->first].size() > 0){
189                 
190                         ProcessData.Append(";PID=");
191                         ProcessData.Append(FullNamesListPID[FNIter->first]);
192                         
193                 }
195                 // Check if there is a value for PREF.
197                 if (FullNamesListPref[FNIter->first] > 0){
198                 
199                         ProcessData.Append(";PREF=");
200                         ProcessData.Append(wxString::Format("%i", FullNamesListPref[FNIter->first]));
201                         
202                 }
204                 // Check if there is a value for tokens.
206                 if (FullNamesListTokens[FNIter->first].size() > 0){
207                 
208                         ProcessData.Append(";");
209                         ProcessData.Append(FullNamesListTokens[FNIter->first]);
210                         
211                 }
212                 
213                 ProcessData.Append(":");
214                 ProcessData.Append(FNIter->second);
215                 ProcessData.Append("\n");
216                 
217                 ProcessData = OutputText(&ProcessData);
218                 
219                 SaveData->Append(ProcessData);
220                 ProcessData.clear();
221                         
222         }
223         
224         // Process NICKNAME.
225         
226         SaveNickname(&GeneralNicknamesList, &GeneralNicknamesListAltID, 
227                 &GeneralNicknamesListPID, &GeneralNicknamesListType,
228                 &GeneralNicknamesListLanguage, &GeneralNicknamesListPref, 
229                 &GeneralNicknamesListTokens, SaveData, "");
230         SaveNickname(&HomeNicknamesList, &HomeNicknamesListAltID, 
231                 &HomeNicknamesListPID, &HomeNicknamesListType,
232                 &HomeNicknamesListLanguage, &HomeNicknamesListPref, 
233                 &HomeNicknamesListTokens, SaveData, "home");
234         SaveNickname(&BusinessNicknamesList, &BusinessNicknamesListAltID, 
235                 &BusinessNicknamesListPID, &BusinessNicknamesListType,
236                 &BusinessNicknamesListLanguage, &BusinessNicknamesListPref, 
237                 &BusinessNicknamesListTokens, SaveData, "work");
238         
239         // Process TITLE.
241         SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
242                 &GeneralTitleListAltID, &GeneralTitleListPID,
243                 &GeneralTitleListType, &GeneralTitleListPref,
244                 &GeneralTitleListTokens, SaveData, "");
245         SaveTitle(&HomeTitleList, &HomeTitleListLanguage,
246                 &HomeTitleListAltID, &HomeTitleListPID,
247                 &HomeTitleListType, &HomeTitleListPref,
248                 &HomeTitleListTokens, SaveData, "home");
249         SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage,
250                 &BusinessTitleListAltID, &BusinessTitleListPID,
251                 &BusinessTitleListType, &BusinessTitleListPref,
252                 &BusinessTitleListTokens, SaveData, "work");
253         
254         // Process TZ.
255         
256         SaveTimezone(&GeneralTZList, &GeneralTZListAltID, 
257                 &GeneralTZListPID, &GeneralTZListType,
258                 &GeneralTZListMediatype, &GeneralTZListPref, 
259                 &GeneralTZListTokens, SaveData, "");
260         SaveTimezone(&HomeTZList, &HomeTZListAltID, 
261                 &HomeTZListPID, &HomeTZListType,
262                 &HomeTZListMediatype, &HomeTZListPref, 
263                 &HomeTZListTokens, SaveData, "home");
264         SaveTimezone(&BusinessTZList, &BusinessTZListAltID, 
265                 &BusinessTZListPID, &BusinessTZListType,
266                 &BusinessTZListMediatype, &BusinessTZListPref, 
267                 &BusinessTZListTokens, SaveData, "work");
269         // Process ADR.
270         
271         SaveAddress(&GeneralAddressList, &GeneralAddressListTown,
272                 &GeneralAddressListCounty, &GeneralAddressListPostCode,
273                 &GeneralAddressListCountry, &GeneralAddressListLabel,
274                 &GeneralAddressListLang, &GeneralAddressListAltID,
275                 &GeneralAddressListPID, &GeneralAddressListGeo, 
276                 &GeneralAddressListTimezone, &GeneralAddressListType, 
277                 &GeneralAddressListMediatype, &GeneralAddressListPref,
278                 &GeneralAddressListTokens, SaveData, "");
279         SaveAddress(&HomeAddressList, &HomeAddressListTown,
280                 &HomeAddressListCounty, &HomeAddressListPostCode,
281                 &HomeAddressListCountry, &HomeAddressListLabel,
282                 &HomeAddressListLang, &HomeAddressListAltID,
283                 &HomeAddressListPID, &HomeAddressListGeo, 
284                 &HomeAddressListTimezone, &HomeAddressListType, 
285                 &HomeAddressListMediatype, &HomeAddressListPref,
286                 &HomeAddressListTokens, SaveData, "home");
287         SaveAddress(&BusinessAddressList, &BusinessAddressListTown,
288                 &BusinessAddressListCounty, &BusinessAddressListPostCode,
289                 &BusinessAddressListCountry, &BusinessAddressListLabel,
290                 &BusinessAddressListLang, &BusinessAddressListAltID,
291                 &BusinessAddressListPID, &BusinessAddressListGeo, 
292                 &BusinessAddressListTimezone, &BusinessAddressListType, 
293                 &BusinessAddressListMediatype, &BusinessAddressListPref,
294                 &BusinessAddressListTokens, SaveData, "work");
296         // Process EMAIL.
297         
298         SaveEmail(&GeneralEmailList, &GeneralEmailListAltID, 
299                 &GeneralEmailListPID, &GeneralEmailListType,
300                 &GeneralEmailListPref, &GeneralEmailListTokens, 
301                 SaveData, "");
302         SaveEmail(&HomeEmailList, &HomeEmailListAltID, 
303                 &HomeEmailListPID, &HomeEmailListType,
304                 &HomeEmailListPref, &HomeEmailListTokens, 
305                 SaveData, "home");
306         SaveEmail(&BusinessEmailList, &BusinessEmailListAltID, 
307                 &BusinessEmailListPID, &BusinessEmailListType,
308                 &BusinessEmailListPref, &BusinessEmailListTokens, 
309                 SaveData, "work");
311         // TODO: Process IMPP.
312         
313         // TODO: Process TEL.
314         
315         // Process LANG.
316         
317         SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID, 
318                 &GeneralLanguageListPID, &GeneralLanguageListType,
319                 &GeneralLanguageListPref, &GeneralLanguageListTokens, 
320                 SaveData, "");
321         SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID, 
322                 &HomeLanguageListPID, &HomeLanguageListType,
323                 &HomeLanguageListPref, &HomeLanguageListTokens, 
324                 SaveData, "home");
325         SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID, 
326                 &BusinessLanguageListPID, &BusinessLanguageListType,
327                 &BusinessLanguageListPref, &BusinessLanguageListTokens, 
328                 SaveData, "work");
330         // Process GEO.
331         
332         SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID, 
333                 &GeneralGeographyListPID, &GeneralGeographyListType,
334                 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
335                 &GeneralGeographyListPref, &GeneralGeographyListTokens, 
336                 SaveData, "");
337         SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID, 
338                 &HomeGeographyListPID, &HomeGeographyListType,
339                 &HomeGeographyListMediatype, &HomeGeographyListDataType,
340                 &HomeGeographyListPref, &HomeGeographyListTokens, 
341                 SaveData, "home");
342         SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID, 
343                 &BusinessGeographyListPID, &BusinessGeographyListType,
344                 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
345                 &BusinessGeographyListPref, &BusinessGeographyListTokens, 
346                 SaveData, "work");
348         // Process RELATED.
349         
350         int Moo = 0;
352         for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
353                 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
354                 
355                 ProcessData.Append("RELATED");
357                 // Check if there is a value for TYPE.
358                 
359                 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
360                 
361                         wxString RelatedType = "";
362                         
363                         ProcessData.Append(";TYPE=");
364                         
365                         if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
367                                 RelatedType = wxT("contact");
369                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
371                                 RelatedType = wxT("acquaintance");
373                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
375                                 RelatedType = wxT("friend");
377                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
379                                 RelatedType = wxT("met");
381                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
383                                 RelatedType = wxT("co-worker");
385                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
387                                 RelatedType = wxT("colleague");
389                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
391                                 RelatedType = wxT("co-resident");
393                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
395                                 RelatedType = wxT("neighbor");
397                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
399                                 RelatedType = wxT("child");
401                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
403                                 RelatedType = wxT("parent");
405                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
407                                 RelatedType = wxT("sibling");
409                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
411                                 RelatedType = wxT("spouse");
413                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
415                                 RelatedType = wxT("kin");
417                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
419                                 RelatedType = wxT("muse");
421                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
423                                 RelatedType = wxT("crush");
425                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
427                                 RelatedType = wxT("date");
429                         } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
431                                 RelatedType = wxT("sweetheart");
433                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
435                                 RelatedType = wxT("me");
437                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
439                                 RelatedType = wxT("agent");
441                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
443                                 RelatedType = wxT("emergency");
445                         } else {
447                                 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
449                         }
450                         
451                         ProcessData.Append(RelatedType);
452                         
453                 }
455                 // Check if there is a value for LANGUAGE.
456                 
457                 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
458                 
459                         ProcessData.Append(";LANGUAGE=");
460                         ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
461                         
462                 }
463                 
464                 // Check if there is a value for ALTID.
465                 
466                 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
467                 
468                         ProcessData.Append(";ALTID=");
469                         ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
470                         
471                 }
472                 
473                 // Check if there is a value for PID.
475                 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
476                 
477                         ProcessData.Append(";PID=");
478                         ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
479                         
480                 }
482                 // Check if there is a value for PREF.
484                 if (GeneralRelatedListPref[RelatedIter->first] > 0){
485                 
486                         ProcessData.Append(";PREF=");
487                         ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
488                         
489                 }
491                 // Check if there is a value for tokens.
493                 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
494                 
495                         ProcessData.Append(";");
496                         ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
497                         
498                 }
499                 
500                 ProcessData.Append(":");
501                 ProcessData.Append(RelatedIter->second);
502                 ProcessData.Append("\n");
503                 
504                 ProcessData = OutputText(&ProcessData);
505                 
506                 SaveData->Append(ProcessData);
507                 ProcessData.clear();
508                         
509         }
510         
511         // Process URL.
512         
513         SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID, 
514                 &GeneralWebsiteListPID, &GeneralWebsiteListType,
515                 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref, 
516                 &GeneralWebsiteListTokens, SaveData, "");
517         SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID, 
518                 &HomeWebsiteListPID, &HomeWebsiteListType,
519                 &HomeWebsiteListMediatype, &HomeWebsiteListPref, 
520                 &HomeWebsiteListTokens, SaveData, "home");
521         SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID, 
522                 &BusinessWebsiteListPID, &BusinessWebsiteListType,
523                 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref, 
524                 &BusinessWebsiteListTokens, SaveData, "work");
526         // Process ROLE.
527         
528         SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
529                 &GeneralRoleListAltID, &GeneralRoleListPID,
530                 &GeneralRoleListType, &GeneralRoleListPref,
531                 &GeneralRoleListTokens, SaveData, "");
532         SaveRole(&HomeRoleList, &HomeRoleListLanguage,
533                 &HomeRoleListAltID, &HomeRoleListPID,
534                 &HomeRoleListType, &HomeRoleListPref,
535                 &HomeRoleListTokens, SaveData, "home");
536         SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
537                 &BusinessRoleListAltID, &BusinessRoleListPID,
538                 &BusinessRoleListType, &BusinessRoleListPref,
539                 &BusinessRoleListTokens, SaveData, "work");
541         // Process ORG.
542         
543         SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
544                 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage, 
545                 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType, 
546                 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens, 
547                 SaveData, "");
548         SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
549                 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage, 
550                 &HomeOrganisationsListSortAs, &HomeOrganisationsListType, 
551                 &HomeOrganisationsListPref, &HomeOrganisationsListTokens, 
552                 SaveData, "home");
553         SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
554                 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage, 
555                 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType, 
556                 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens, 
557                 SaveData, "work");
559         // Process NOTE.
560         
561         SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
562                 &GeneralNoteListAltID, &GeneralNoteListPID,
563                 &GeneralNoteListType, &GeneralNoteListPref,
564                 &GeneralNoteListTokens, SaveData, "");
565         SaveNote(&HomeNoteList, &HomeNoteListLanguage,
566                 &HomeNoteListAltID, &HomeNoteListPID,
567                 &HomeNoteListType, &HomeNoteListPref,
568                 &HomeNoteListTokens, SaveData, "home");
569         SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
570                 &BusinessNoteListAltID, &BusinessNoteListPID,
571                 &BusinessNoteListType, &BusinessNoteListPref,
572                 &BusinessNoteListTokens, SaveData, "work");
574         // Process CATEGORIES.
575         
576         SaveCategory(&CategoriesList, &CategoriesListLanguage,
577                 &CategoriesListAltID, &CategoriesListPID,
578                 &CategoriesListType, &CategoriesListPref,
579                 &CategoriesListTokens, SaveData);
581         // Process PHOTO.
582         
583         SavePhoto(&PicturesList, &PicturesListAltID, 
584                 &PicturesListPID, &PicturesListType,
585                 &PicturesListPicEncType, &PicturesListPictureType,
586                 &PicturesListMediatype, &PicturesListPref,
587                 &PicturesListTokens, SaveData);
588         
589         // Process LOGO.
590         
591         SaveLogo(&LogosList, &LogosListAltID, 
592                 &LogosListPID, &LogosListType,
593                 &LogosListPicEncType, &LogosListPictureType,
594                 &LogosListMediatype, &LogosListPref,
595                 &LogosListTokens, SaveData);
596         
597         // Process SOUND.
599         SaveSound(&SoundsList, &SoundsListAltID, 
600                 &SoundsListPID, &SoundsListType,
601                 &SoundsListAudioEncType, &SoundsListAudioType,
602                 &SoundsListMediatype, &SoundsListLanguage, 
603                 &SoundsListPref, &SoundsListTokens, 
604                 SaveData);
606         // Process CALURI.
607         
608         SaveCalendarURI(&CalendarList, &CalendarListMediatype,
609                 &CalendarListAltID, &CalendarListPID,
610                 &CalendarListType, &CalendarListPref,
611                 &CalendarListTokens, SaveData);
612         
613         // Process CALADRURI.
614         
615         SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
616                 &CalendarRequestListAltID, &CalendarRequestListPID,
617                 &CalendarRequestListType, &CalendarRequestListPref,
618                 &CalendarRequestListTokens, SaveData);
620         // Process FBURL.
621         
622         SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID, 
623                 &FreeBusyListPID, &FreeBusyListType,
624                 &FreeBusyListMediatype, &FreeBusyListPref, 
625                 &FreeBusyListTokens, SaveData);
627         // Process KEY.
628         
629         SaveKey(&KeyList, &KeyListAltID, 
630                 &KeyListPID, &KeyListType,
631                 &KeyListKeyType, &KeyListDataEncType, 
632                 &KeyListDataType, &KeyListPref, 
633                 &KeyListTokens, SaveData);
635         // Process VND-*
636         
637         SaveVendor(&VendorList, &VendorListPEN, 
638                 &VendorListElement, SaveData);
640         // Process X-Tokens.
641         
642         SaveXToken(&XTokenList, &XTokenListTokens, 
643                 SaveData);
645         // Write the end part of the vCard data file.
646         
647         SaveData->Append("END:VCARD");
648         
649         SaveDataStatus = CONTACTSAVE_OK;
650         
651         return SaveDataStatus;
652         
655 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
656         map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
657         map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
658         map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
660         wxString ProcessData = "";
661                 
662         for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
663                 TitleIter != TitleList->end(); TitleIter++){
665                 ProcessData.Append("TITLE");
666                         
667                 // Check if there is a value for TYPE.
668                 
669                 if (DataType.size() > 0){
670                 
671                         ProcessData.Append(";TYPE=");
672                         ProcessData.Append(DataType);
673                         
674                 }
675                 
676                 // Check if there is a value for ALTID.
677                 
678                 if ((*TitleListAltID)[TitleIter->first].size() > 0){
679                 
680                         ProcessData.Append(";ALTID=");
681                         ProcessData.Append((*TitleListAltID)[TitleIter->first]);
682                         
683                 }
685                 // Check if there is a value for LANGUAGE.
686                 
687                 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
688                 
689                         ProcessData.Append(";LANGUAGE=");
690                         ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
691                         
692                 }
693                 
694                 // Check if there is a value for PID.
696                 if ((*TitleListPID)[TitleIter->first].size() > 0){
697                 
698                         ProcessData.Append(";PID=");
699                         ProcessData.Append((*TitleListPID)[TitleIter->first]);
700                         
701                 }
703                 // Check if there is a value for PREF.
705                 if ((*TitleListPref)[TitleIter->first] > 0){
706                 
707                         ProcessData.Append(";PREF=");
708                         ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
709                         
710                 }
712                 // Check if there is a value for tokens.
714                 if ((*TitleListTokens)[TitleIter->first].size() > 0){
715                 
716                         ProcessData.Append(";");
717                         ProcessData.Append((*TitleListTokens)[TitleIter->first]);
718                         
719                 }
720                         
721                 ProcessData.Append(":");
722                 ProcessData.Append(TitleIter->second);
723                 ProcessData.Append("\n");
725                 ProcessData = OutputText(&ProcessData);
726                         
727                 SaveData->Append(ProcessData);
728                 ProcessData.clear();
729                         
730         }
731                 
734 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID, 
735         map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
736         map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref, 
737         map<int, wxString> *SourceListTokens, wxString *SaveData){
739         wxString ProcessData = "";
740         
741         for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
742                 SourceIter != SourceList->end(); SourceIter++){
744                 ProcessData.Append("SOURCE");
745                         
746                 // Check if there is a value for TYPE.
747                 
748                 if ((*SourceListType)[SourceIter->first].size() > 0){
749                 
750                         ProcessData.Append(";TYPE=");
751                         ProcessData.Append((*SourceListType)[SourceIter->first]);
752                         
753                 }
754                 
755                 // Check if there is a value for ALTID.
756                 
757                 if ((*SourceListAltID)[SourceIter->first].size() > 0){
758                 
759                         ProcessData.Append(";ALTID=");
760                         ProcessData.Append((*SourceListAltID)[SourceIter->first]);
761                         
762                 }
764                 // Check if there is a value for MEDIATYPE.
765                 
766                 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
767                 
768                         ProcessData.Append(";MEDIATYPE=");
769                         ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
770                         
771                 }
772                 
773                 // Check if there is a value for PID.
775                 if ((*SourceListPID)[SourceIter->first].size() > 0){
776                 
777                         ProcessData.Append(";PID=");
778                         ProcessData.Append((*SourceListPID)[SourceIter->first]);
779                         
780                 }
782                 // Check if there is a value for PREF.
784                 if ((*SourceListPref)[SourceIter->first] > 0){
785                 
786                         ProcessData.Append(";PREF=");
787                         ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
788                         
789                 }
791                 // Check if there is a value for tokens.
793                 if ((*SourceListTokens)[SourceIter->first].size() > 0){
794                 
795                         ProcessData.Append(";");
796                         ProcessData.Append((*SourceListTokens)[SourceIter->first]);
797                         
798                 }
799                         
800                 ProcessData.Append(":");
801                 ProcessData.Append(SourceIter->second);
802                 ProcessData.Append("\n");
804                 ProcessData = OutputText(&ProcessData);
805                         
806                 SaveData->Append(ProcessData);
807                 ProcessData.clear();
808                         
809         }
810                 
813 void ContactDataObject::SaveMember(std::map<int, wxString> *GroupsList, std::map<int, wxString> *GroupsListAltID, 
814         std::map<int, wxString> *GroupsListPID, std::map<int, wxString> *GroupsListType,
815         std::map<int, wxString> *GroupsListMediaType, std::map<int, int> *GroupsListPref, 
816         std::map<int, wxString> *GroupsListTokens, wxString *SaveData){
818         wxString ProcessData = "";
819                 
820         for (std::map<int, wxString>::iterator GroupsIter = GroupsList->begin();
821                 GroupsIter != GroupsList->end(); GroupsIter++){
823                 ProcessData.Append("MEMBER");
824                         
825                 // Check if there is a value for TYPE.
826                 
827                 if ((*GroupsListType)[GroupsIter->first].size() > 0){
828                 
829                         ProcessData.Append(";TYPE=");
830                         ProcessData.Append((*GroupsListType)[GroupsIter->first]);
831                         
832                 }
833                 
834                 // Check if there is a value for ALTID.
835                 
836                 if ((*GroupsListAltID)[GroupsIter->first].size() > 0){
837                 
838                         ProcessData.Append(";ALTID=");
839                         ProcessData.Append((*GroupsListAltID)[GroupsIter->first]);
840                         
841                 }
843                 // Check if there is a value for MEDIATYPE.
844                 
845                 if ((*GroupsListMediaType)[GroupsIter->first].size() > 0){
846                 
847                         ProcessData.Append(";MEDIATYPE=");
848                         ProcessData.Append((*GroupsListMediaType)[GroupsIter->first]);
849                         
850                 }
851                 
852                 // Check if there is a value for PID.
854                 if ((*GroupsListPID)[GroupsIter->first].size() > 0){
855                 
856                         ProcessData.Append(";PID=");
857                         ProcessData.Append((*GroupsListPID)[GroupsIter->first]);
858                         
859                 }
861                 // Check if there is a value for PREF.
863                 if ((*GroupsListPref)[GroupsIter->first] > 0){
864                 
865                         ProcessData.Append(";PREF=");
866                         ProcessData.Append(wxString::Format("%i", (*GroupsListPref)[GroupsIter->first]));
867                         
868                 }
870                 // Check if there is a value for tokens.
872                 if ((*GroupsListTokens)[GroupsIter->first].size() > 0){
873                 
874                         ProcessData.Append(";");
875                         ProcessData.Append((*GroupsListTokens)[GroupsIter->first]);
876                         
877                 }
878                         
879                 ProcessData.Append(":");
880                 ProcessData.Append(GroupsIter->second);
881                 ProcessData.Append("\n");
883                 ProcessData = OutputText(&ProcessData);
884                 
885                 SaveData->Append(ProcessData);
886                 ProcessData.clear();
887                         
888         }
889                 
892 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID, 
893         map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
894         map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref, 
895         map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
897         wxString ProcessData = "";
898         
899         for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
900                 NicknameIter != NicknameList->end(); NicknameIter++){
902                 ProcessData.Append("NICKNAME");
903                         
904                 // Check if there is a value for TYPE.
905                 
906                 if (DataType.size() > 0){
907                 
908                         ProcessData.Append(";TYPE=");
909                         ProcessData.Append(DataType);
910                         
911                 }
912                 
913                 // Check if there is a value for ALTID.
914                 
915                 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
916                 
917                         ProcessData.Append(";ALTID=");
918                         ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
919                         
920                 }
922                 // Check if there is a value for MEDIATYPE.
923                 
924                 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
925                 
926                         ProcessData.Append(";LANGUAGE=");
927                         ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
928                         
929                 }
930                 
931                 // Check if there is a value for PID.
933                 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
934                 
935                         ProcessData.Append(";PID=");
936                         ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
937                         
938                 }
940                 // Check if there is a value for PREF.
942                 if ((*NicknameListPref)[NicknameIter->first] > 0){
943                 
944                         ProcessData.Append(";PREF=");
945                         ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
946                         
947                 }
949                 // Check if there is a value for tokens.
951                 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
952                 
953                         ProcessData.Append(";");
954                         ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
955                         
956                 }
957                         
958                 ProcessData.Append(":");
959                 ProcessData.Append(NicknameIter->second);
960                 ProcessData.Append("\n");
962                 ProcessData = OutputText(&ProcessData);
963                         
964                 SaveData->Append(ProcessData);
965                 ProcessData.clear();
966                         
967         }
968                 
971 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID, 
972         map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
973         map<int, wxString> *TZListMediatype, map<int, int> *TZListPref, 
974         map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
976         wxString ProcessData = "";
977         
978         for (std::map<int, wxString>::iterator TZIter = TZList->begin();
979                 TZIter != TZList->end(); TZIter++){
981                 ProcessData.Append("TZ");
982                         
983                 // Check if there is a value for TYPE.
984                 
985                 if (DataType.size() > 0){
986                 
987                         ProcessData.Append(";TYPE=");
988                         ProcessData.Append(DataType);
989                         
990                 }
991                 
992                 // Check if there is a value for ALTID.
993                 
994                 if ((*TZListAltID)[TZIter->first].size() > 0){
995                 
996                         ProcessData.Append(";ALTID=");
997                         ProcessData.Append((*TZListAltID)[TZIter->first]);
998                         
999                 }
1001                 // Check if there is a value for MEDIATYPE.
1002                 
1003                 if ((*TZListMediatype)[TZIter->first].size() > 0){
1004                 
1005                         ProcessData.Append(";MEDIATYPE=");
1006                         ProcessData.Append((*TZListMediatype)[TZIter->first]);
1007                         
1008                 }
1009                 
1010                 // Check if there is a value for PID.
1012                 if ((*TZListPID)[TZIter->first].size() > 0){
1013                 
1014                         ProcessData.Append(";PID=");
1015                         ProcessData.Append((*TZListPID)[TZIter->first]);
1016                         
1017                 }
1019                 // Check if there is a value for PREF.
1021                 if ((*TZListPref)[TZIter->first] > 0){
1022                 
1023                         ProcessData.Append(";PREF=");
1024                         ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
1025                         
1026                 }
1028                 // Check if there is a value for tokens.
1030                 if ((*TZListTokens)[TZIter->first].size() > 0){
1031                 
1032                         ProcessData.Append(";");
1033                         ProcessData.Append((*TZListTokens)[TZIter->first]);
1034                         
1035                 }
1036                         
1037                 ProcessData.Append(":");
1038                 ProcessData.Append(TZIter->second);
1039                 ProcessData.Append("\n");
1041                 ProcessData = OutputText(&ProcessData);
1042                         
1043                 SaveData->Append(ProcessData);
1044                 ProcessData.clear();
1045                         
1046         }
1047                 
1050 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
1051                 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
1052                 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
1053                 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
1054                 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo, 
1055                 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType, 
1056                 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref, 
1057                 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
1059         wxString ProcessData = "";
1060                         
1061         for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
1062                 AddressIter != AddressList->end(); AddressIter++){
1063                         
1064                 ProcessData.Append("ADR");
1065                         
1066                 // Check if there is a value for TYPE.
1067                 
1068                 if (DataType.size() > 0){
1069                 
1070                         ProcessData.Append(";TYPE=");
1071                         ProcessData.Append(DataType);
1072                         
1073                 }
1074                 
1075                 // Check if there is a value for ALTID.
1076                 
1077                 if ((*AddressListAltID)[AddressIter->first].size() > 0){
1078                 
1079                         ProcessData.Append(";ALTID=");
1080                         ProcessData.Append((*AddressListAltID)[AddressIter->first]);
1081                         
1082                 }
1084                 // Check if there is a value for GEO.
1085                 
1086                 if ((*AddressListGeo)[AddressIter->first].size() > 0){
1087                 
1088                         ProcessData.Append(";GEO=\"");
1089                         ProcessData.Append((*AddressListGeo)[AddressIter->first]);
1090                         ProcessData.Append("\"");
1091                         
1092                 }
1094                 // Check if there is a value for LABEL.
1096                 if ((*AddressListLabel)[AddressIter->first].size() > 0){
1097                 
1098                         wxString AddressProcessed = "";
1099                         AddressProcessed = (*AddressListLabel)[AddressIter->first];
1100                         
1101                         AddressProcessed.Replace("\n", "\\n", true);
1102                         
1103                         ProcessData.Append(";LABEL=");
1104                         ProcessData.Append(AddressProcessed);
1105                         
1106                 }
1107                 
1108                 // Check if there is a value for LANGUAGE.
1109                 
1110                 if ((*AddressListLang)[AddressIter->first].size() > 0){
1111                 
1112                         ProcessData.Append(";LANGUAGE=");
1113                         ProcessData.Append((*AddressListLang)[AddressIter->first]);
1114                         
1115                 }
1116                 
1117                 // Check if there is a value for MEDIATYPE.
1118                 
1119                 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1120                 
1121                         ProcessData.Append(";MEDIATYPE=");
1122                         ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1123                         
1124                 }
1125                 
1126                 // Check if there is a value for PID.
1128                 if ((*AddressListPID)[AddressIter->first].size() > 0){
1129                 
1130                         ProcessData.Append(";PID=");
1131                         ProcessData.Append((*AddressListPID)[AddressIter->first]);
1132                         
1133                 }
1135                 // Check if there is a value for PREF.
1137                 if ((*AddressListPref)[AddressIter->first] > 0){
1138                 
1139                         ProcessData.Append(";PREF=");
1140                         ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1141                         
1142                 }
1144                 // Check if there is a value for TZ.
1146                 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1147                 
1148                         ProcessData.Append(";TZ=");
1149                         ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1150                         
1151                 }
1152                 
1153                 // Check if there is a value for tokens.
1155                 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1156                 
1157                         ProcessData.Append(";");
1158                         ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1159                         
1160                 }
1161                 
1162                 // Build the address.
1163                 
1164                 ProcessData.Append(":;;");
1165                 ProcessData.Append((*AddressList)[AddressIter->first]);
1166                 ProcessData.Append(";");
1167                 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1168                 ProcessData.Append(";");
1169                 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1170                 ProcessData.Append(";");
1171                 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1172                 ProcessData.Append(";");
1173                 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1174                 ProcessData.Append("\n");
1175                 
1176                 ProcessData = OutputText(&ProcessData);
1177                         
1178                 SaveData->Append(ProcessData);
1179                 ProcessData.clear();
1180                         
1181         }
1182                         
1185 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID, 
1186         map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1187         map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens, 
1188         wxString *SaveData, wxString DataType){
1190         wxString ProcessData = "";
1191         
1192         for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1193                 EmailIter != EmailList->end(); EmailIter++){
1195                 ProcessData.Append("EMAIL");
1196                         
1197                 // Check if there is a value for TYPE.
1198                 
1199                 if (DataType.size() > 0){
1200                 
1201                         ProcessData.Append(";TYPE=");
1202                         ProcessData.Append(DataType);
1203                         
1204                 }
1205                 
1206                 // Check if there is a value for ALTID.
1207                 
1208                 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1209                 
1210                         ProcessData.Append(";ALTID=");
1211                         ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1212                         
1213                 }
1214                 
1215                 // Check if there is a value for PID.
1217                 if ((*EmailListPID)[EmailIter->first].size() > 0){
1218                 
1219                         ProcessData.Append(";PID=");
1220                         ProcessData.Append((*EmailListPID)[EmailIter->first]);
1221                         
1222                 }
1224                 // Check if there is a value for PREF.
1226                 if ((*EmailListPref)[EmailIter->first] > 0){
1227                 
1228                         ProcessData.Append(";PREF=");
1229                         ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1230                         
1231                 }
1233                 // Check if there is a value for tokens.
1235                 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1236                 
1237                         ProcessData.Append(";");
1238                         ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1239                         
1240                 }
1241                         
1242                 ProcessData.Append(":");
1243                 ProcessData.Append(EmailIter->second);
1244                 ProcessData.Append("\n");
1246                 ProcessData = OutputText(&ProcessData);
1247                         
1248                 SaveData->Append(ProcessData);
1249                 ProcessData.clear();
1250                         
1251         }
1252                 
1255 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID, 
1256         map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1257         map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens, 
1258         wxString *SaveData, wxString DataType){
1260         wxString ProcessData = "";
1261         
1262         for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1263                 LanguageIter != LanguageList->end(); LanguageIter++){
1265                 ProcessData.Append("LANG");
1266                         
1267                 // Check if there is a value for TYPE.
1268                 
1269                 if (DataType.size() > 0){
1270                 
1271                         ProcessData.Append(";TYPE=");
1272                         ProcessData.Append(DataType);
1273                         
1274                 }
1275                 
1276                 // Check if there is a value for ALTID.
1277                 
1278                 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1279                 
1280                         ProcessData.Append(";ALTID=");
1281                         ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1282                         
1283                 }
1284                 
1285                 // Check if there is a value for PID.
1287                 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1288                 
1289                         ProcessData.Append(";PID=");
1290                         ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1291                         
1292                 }
1294                 // Check if there is a value for PREF.
1296                 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1297                 
1298                         ProcessData.Append(";PREF=");
1299                         ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1300                         
1301                 }
1303                 // Check if there is a value for tokens.
1305                 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1306                 
1307                         ProcessData.Append(";");
1308                         ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1309                         
1310                 }
1311                         
1312                 ProcessData.Append(":");
1313                 ProcessData.Append(LanguageIter->second);
1314                 ProcessData.Append("\n");
1316                 ProcessData = OutputText(&ProcessData);
1317                         
1318                 SaveData->Append(ProcessData);
1319                 ProcessData.clear();
1320                         
1321         }
1322                 
1325 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID, 
1326         map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1327         map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1328         map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens, 
1329         wxString *SaveData, wxString DataType){
1331         wxString ProcessData = "";
1332         
1333         for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1334                 GeographyIter != GeographyList->end(); GeographyIter++){
1336                 ProcessData.Append("GEO");
1337                         
1338                 // Check if there is a value for TYPE.
1339                 
1340                 if (DataType.size() > 0){
1341                 
1342                         ProcessData.Append(";TYPE=");
1343                         ProcessData.Append(DataType);
1344                         
1345                 }
1346                 
1347                 // Check if there is a value for ALTID.
1348                 
1349                 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1350                 
1351                         ProcessData.Append(";ALTID=");
1352                         ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1353                         
1354                 }
1355                 
1356                 // Check if there is a value for MEDIATYPE.
1357                 
1358                 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1359                 
1360                         ProcessData.Append(";MEDIATYPE=");
1361                         ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1362                         
1363                 }
1364                 
1365                 // Check if there is a value for PID.
1367                 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1368                 
1369                         ProcessData.Append(";PID=");
1370                         ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1371                         
1372                 }
1374                 // Check if there is a value for PREF.
1376                 if ((*GeographyListPref)[GeographyIter->first] > 0){
1377                 
1378                         ProcessData.Append(";PREF=");
1379                         ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1380                         
1381                 }
1383                 // Check if there is a value for tokens.
1385                 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1386                 
1387                         ProcessData.Append(";");
1388                         ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1389                         
1390                 }
1391                         
1392                 ProcessData.Append(":");
1393                 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1394                 ProcessData.Append(":");
1395                 ProcessData.Append(GeographyIter->second);
1396                 ProcessData.Append("\n");
1398                 ProcessData = OutputText(&ProcessData);
1399                         
1400                 SaveData->Append(ProcessData);
1401                 ProcessData.clear();
1402                         
1403         }
1404                 
1407 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID, 
1408                 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1409                 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref, 
1410                 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1412         wxString ProcessData = "";
1413         
1414         for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1415                 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1417                 ProcessData.Append("URL");
1418                         
1419                 // Check if there is a value for TYPE.
1420                 
1421                 if (DataType.size() > 0){
1422                 
1423                         ProcessData.Append(";TYPE=");
1424                         ProcessData.Append(DataType);
1425                         
1426                 }
1427                 
1428                 // Check if there is a value for ALTID.
1429                 
1430                 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1431                 
1432                         ProcessData.Append(";ALTID=");
1433                         ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1434                         
1435                 }
1436                 
1437                 // Check if there is a value for MEDIATYPE.
1438                 
1439                 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1440                 
1441                         ProcessData.Append(";MEDIATYPE=");
1442                         ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1443                         
1444                 }
1445                 
1446                 // Check if there is a value for PID.
1448                 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1449                 
1450                         ProcessData.Append(";PID=");
1451                         ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1452                         
1453                 }
1455                 // Check if there is a value for PREF.
1457                 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1458                 
1459                         ProcessData.Append(";PREF=");
1460                         ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1461                         
1462                 }
1464                 // Check if there is a value for tokens.
1466                 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1467                 
1468                         ProcessData.Append(";");
1469                         ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1470                         
1471                 }
1472                         
1473                 ProcessData.Append(":");
1474                 ProcessData.Append(WebsiteIter->second);
1475                 ProcessData.Append("\n");
1477                 ProcessData = OutputText(&ProcessData);
1478                         
1479                 SaveData->Append(ProcessData);
1480                 ProcessData.clear();
1481                         
1482         }
1483                         
1486 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1487         map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1488         map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1489         map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1491         wxString ProcessData = "";
1492                 
1493         for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1494                 RoleIter != RoleList->end(); RoleIter++){
1496                 ProcessData.Append("ROLE");
1497                         
1498                 // Check if there is a value for TYPE.
1499                 
1500                 if (DataType.size() > 0){
1501                 
1502                         ProcessData.Append(";TYPE=");
1503                         ProcessData.Append(DataType);
1504                         
1505                 }
1506                 
1507                 // Check if there is a value for ALTID.
1508                 
1509                 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1510                 
1511                         ProcessData.Append(";ALTID=");
1512                         ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1513                         
1514                 }
1516                 // Check if there is a value for LANGUAGE.
1517                 
1518                 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1519                 
1520                         ProcessData.Append(";LANGUAGE=");
1521                         ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1522                         
1523                 }
1524                 
1525                 // Check if there is a value for PID.
1527                 if ((*RoleListPID)[RoleIter->first].size() > 0){
1528                 
1529                         ProcessData.Append(";PID=");
1530                         ProcessData.Append((*RoleListPID)[RoleIter->first]);
1531                         
1532                 }
1534                 // Check if there is a value for PREF.
1536                 if ((*RoleListPref)[RoleIter->first] > 0){
1537                 
1538                         ProcessData.Append(";PREF=");
1539                         ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1540                         
1541                 }
1543                 // Check if there is a value for tokens.
1545                 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1546                 
1547                         ProcessData.Append(";");
1548                         ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1549                         
1550                 }
1551                         
1552                 ProcessData.Append(":");
1553                 ProcessData.Append(RoleIter->second);
1554                 ProcessData.Append("\n");
1556                 ProcessData = OutputText(&ProcessData);
1557                 
1558                 SaveData->Append(ProcessData);
1559                 ProcessData.clear();
1560                         
1561         }
1562                 
1565 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1566         map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage, 
1567         map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType, 
1568         map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens, 
1569         wxString *SaveData, wxString DataType){
1571         wxString ProcessData = "";
1572                 
1573         for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1574                 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1576                 ProcessData.Append("ORG");
1577                         
1578                 // Check if there is a value for TYPE.
1579                 
1580                 if (DataType.size() > 0){
1581                 
1582                         ProcessData.Append(";TYPE=");
1583                         ProcessData.Append(DataType);
1584                         
1585                 }
1586                 
1587                 // Check if there is a value for ALTID.
1588                 
1589                 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1590                 
1591                         ProcessData.Append(";ALTID=");
1592                         ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1593                         
1594                 }
1596                 // Check if there is a value for LANGUAGE.
1597                 
1598                 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1599                 
1600                         ProcessData.Append(";LANGUAGE=");
1601                         ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1602                         
1603                 }
1604                 
1605                 // Check if there is a value for PID.
1607                 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1608                 
1609                         ProcessData.Append(";PID=");
1610                         ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1611                         
1612                 }
1614                 // Check if there is a value for PREF.
1616                 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1617                 
1618                         ProcessData.Append(";PREF=");
1619                         ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1620                         
1621                 }
1622                 
1623                 // Check if there is a value for SORT-AS.
1624                 
1625                 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1626                 
1627                         ProcessData.Append(";SORT-AS=\"");
1628                         ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1629                         ProcessData.Append("\"");
1630                         
1631                 }
1633                 // Check if there is a value for tokens.
1635                 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1636                 
1637                         ProcessData.Append(";");
1638                         ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1639                         
1640                 }
1641                         
1642                 ProcessData.Append(":");
1643                 ProcessData.Append(OrganisationIter->second);
1644                 ProcessData.Append("\n");
1646                 ProcessData = OutputText(&ProcessData);
1647                 
1648                 SaveData->Append(ProcessData);
1649                 ProcessData.clear();
1650                         
1651         }
1652                 
1655 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1656         map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1657         map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1658         map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1660         wxString ProcessData = "";
1661                 
1662         for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1663                 NoteIter != NoteList->end(); NoteIter++){
1665                 ProcessData.Append("NOTE");
1666                         
1667                 // Check if there is a value for TYPE.
1668                 
1669                 if (DataType.size() > 0){
1670                 
1671                         ProcessData.Append(";TYPE=");
1672                         ProcessData.Append(DataType);
1673                         
1674                 }
1675                 
1676                 // Check if there is a value for ALTID.
1677                 
1678                 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1679                 
1680                         ProcessData.Append(";ALTID=");
1681                         ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1682                         
1683                 }
1685                 // Check if there is a value for LANGUAGE.
1686                 
1687                 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1688                 
1689                         ProcessData.Append(";LANGUAGE=");
1690                         ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1691                         
1692                 }
1693                 
1694                 // Check if there is a value for PID.
1696                 if ((*NoteListPID)[NoteIter->first].size() > 0){
1697                 
1698                         ProcessData.Append(";PID=");
1699                         ProcessData.Append((*NoteListPID)[NoteIter->first]);
1700                         
1701                 }
1703                 // Check if there is a value for PREF.
1705                 if ((*NoteListPref)[NoteIter->first] > 0){
1706                 
1707                         ProcessData.Append(";PREF=");
1708                         ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1709                         
1710                 }
1712                 // Check if there is a value for tokens.
1714                 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1715                 
1716                         ProcessData.Append(";");
1717                         ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1718                         
1719                 }
1720                         
1721                 ProcessData.Append(":");
1722                 ProcessData.Append(NoteIter->second);
1723                 ProcessData.Replace("\n", "\\n", true);
1724                 ProcessData.Append("\n");
1726                 ProcessData = OutputText(&ProcessData);
1727                 
1728                 SaveData->Append(ProcessData);
1729                 ProcessData.clear();
1730                         
1731         }
1732                 
1735 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1736         map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1737         map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1738         map<int, wxString> *CategoryListTokens, wxString *SaveData){
1740         wxString ProcessData = "";
1741                 
1742         for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1743                 CategoryIter != CategoryList->end(); CategoryIter++){
1745                 ProcessData.Append("CATEGORIES");
1746                         
1747                 // Check if there is a value for TYPE.
1748                 
1749                 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1750                 
1751                         ProcessData.Append(";TYPE=");
1752                         ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1753                         
1754                 }
1755                 
1756                 // Check if there is a value for ALTID.
1757                 
1758                 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1759                 
1760                         ProcessData.Append(";ALTID=");
1761                         ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1762                         
1763                 }
1765                 // Check if there is a value for LANGUAGE.
1766                 
1767                 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1768                 
1769                         ProcessData.Append(";LANGUAGE=");
1770                         ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1771                         
1772                 }
1773                 
1774                 // Check if there is a value for PID.
1776                 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1777                 
1778                         ProcessData.Append(";PID=");
1779                         ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1780                         
1781                 }
1783                 // Check if there is a value for PREF.
1785                 if ((*CategoryListPref)[CategoryIter->first] > 0){
1786                 
1787                         ProcessData.Append(";PREF=");
1788                         ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1789                         
1790                 }
1792                 // Check if there is a value for tokens.
1794                 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1795                 
1796                         ProcessData.Append(";");
1797                         ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1798                         
1799                 }
1800                         
1801                 ProcessData.Append(":");
1802                 ProcessData.Append(CategoryIter->second);
1803                 ProcessData.Append("\n");
1805                 ProcessData = OutputText(&ProcessData);
1806                 
1807                 SaveData->Append(ProcessData);
1808                 ProcessData.clear();
1809                         
1810         }
1811                 
1814 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID, 
1815                 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1816                 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1817                 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1818                 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1820         wxString ProcessData = "";
1821                 
1822         for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1823                 PicturesIter != PicturesList->end(); PicturesIter++){
1825                 ProcessData.Append("PHOTO");
1826                         
1827                 // Check if there is a value for TYPE.
1828                 
1829                 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1830                 
1831                         ProcessData.Append(";TYPE=");
1832                         ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1833                         
1834                 }
1835                 
1836                 // Check if there is a value for ALTID.
1837                 
1838                 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1839                 
1840                         ProcessData.Append(";ALTID=");
1841                         ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1842                         
1843                 }
1845                 // Check if there is a value for MEDIATYPE..
1846                 
1847                 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1848                 
1849                         ProcessData.Append(";MEDIATYPE=");
1850                         ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1851                         
1852                 }
1853                 
1854                 // Check if there is a value for PID.
1856                 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1857                 
1858                         ProcessData.Append(";PID=");
1859                         ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1860                         
1861                 }
1863                 // Check if there is a value for PREF.
1865                 if ((*PicturesListPref)[PicturesIter->first] > 0){
1866                 
1867                         ProcessData.Append(";PREF=");
1868                         ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1869                         
1870                 }
1872                 // Check if there is a value for tokens.
1874                 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1875                 
1876                         ProcessData.Append(";");
1877                         ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1878                         
1879                 }
1880                 
1881                 ProcessData.Append(":data:");
1882                 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1883                 ProcessData.Append(";");
1884                 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1885                 ProcessData.Append(",");
1886                 ProcessData.Append(PicturesIter->second);
1887                 ProcessData.Append("\n");
1889                 ProcessData = OutputText(&ProcessData);
1890                 
1891                 SaveData->Append(ProcessData);
1892                 ProcessData.clear();
1893                         
1894         }
1895                         
1898 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID, 
1899         map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
1900         map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
1901         map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
1902         map<int, wxString> *LogosListTokens, wxString *SaveData){
1904         wxString ProcessData = "";
1905                 
1906         for (std::map<int, string>::iterator LogosIter = LogosList->begin();
1907                 LogosIter != LogosList->end(); LogosIter++){
1909                 ProcessData.Append("LOGO");
1910                         
1911                 // Check if there is a value for TYPE.
1912                 
1913                 if ((*LogosListType)[LogosIter->first].size() > 0){
1914                 
1915                         ProcessData.Append(";TYPE=");
1916                         ProcessData.Append((*LogosListType)[LogosIter->first]);
1917                         
1918                 }
1919                 
1920                 // Check if there is a value for ALTID.
1921                 
1922                 if ((*LogosListAltID)[LogosIter->first].size() > 0){
1923                 
1924                         ProcessData.Append(";ALTID=");
1925                         ProcessData.Append((*LogosListAltID)[LogosIter->first]);
1926                         
1927                 }
1929                 // Check if there is a value for MEDIATYPE..
1930                 
1931                 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
1932                 
1933                         ProcessData.Append(";MEDIATYPE=");
1934                         ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
1935                         
1936                 }
1937                 
1938                 // Check if there is a value for PID.
1940                 if ((*LogosListPID)[LogosIter->first].size() > 0){
1941                 
1942                         ProcessData.Append(";PID=");
1943                         ProcessData.Append((*LogosListPID)[LogosIter->first]);
1944                         
1945                 }
1947                 // Check if there is a value for PREF.
1949                 if ((*LogosListPref)[LogosIter->first] > 0){
1950                 
1951                         ProcessData.Append(";PREF=");
1952                         ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
1953                         
1954                 }
1956                 // Check if there is a value for tokens.
1958                 if ((*LogosListTokens)[LogosIter->first].size() > 0){
1959                 
1960                         ProcessData.Append(";");
1961                         ProcessData.Append((*LogosListTokens)[LogosIter->first]);
1962                         
1963                 }
1964                 
1965                 ProcessData.Append(":data:");
1966                 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
1967                 ProcessData.Append(";");
1968                 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
1969                 ProcessData.Append(",");
1970                 ProcessData.Append(LogosIter->second);
1971                 ProcessData.Append("\n");
1973                 ProcessData = OutputText(&ProcessData);
1974                 
1975                 SaveData->Append(ProcessData);
1976                 ProcessData.clear();
1977                         
1978         }
1979                 
1982 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID, 
1983         map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
1984         map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
1985         map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage, 
1986         map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens, 
1987         wxString *SaveData){
1989         wxString ProcessData = "";
1990                 
1991         for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
1992                 SoundsIter != SoundsList->end(); SoundsIter++){
1994                 ProcessData.Append("SOUND");
1995                         
1996                 // Check if there is a value for TYPE.
1997                 
1998                 if ((*SoundsListType)[SoundsIter->first].size() > 0){
1999                 
2000                         ProcessData.Append(";TYPE=");
2001                         ProcessData.Append((*SoundsListType)[SoundsIter->first]);
2002                         
2003                 }
2004                 
2005                 // Check if there is a value for ALTID.
2006                 
2007                 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
2008                 
2009                         ProcessData.Append(";ALTID=");
2010                         ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
2011                         
2012                 }
2014                 // Check if there is a value for LANGUAGE.
2015                 
2016                 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
2017                 
2018                         ProcessData.Append(";LANGUAGE=");
2019                         ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
2020                         
2021                 }
2022                 
2023                 // Check if there is a value for MEDIATYPE.
2024                 
2025                 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
2026                 
2027                         ProcessData.Append(";MEDIATYPE=");
2028                         ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
2029                         
2030                 }
2031                 
2032                 // Check if there is a value for PID.
2034                 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
2035                 
2036                         ProcessData.Append(";PID=");
2037                         ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
2038                         
2039                 }
2041                 // Check if there is a value for PREF.
2043                 if ((*SoundsListPref)[SoundsIter->first] > 0){
2044                 
2045                         ProcessData.Append(";PREF=");
2046                         ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
2047                         
2048                 }
2050                 // Check if there is a value for tokens.
2052                 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
2053                 
2054                         ProcessData.Append(";");
2055                         ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
2056                         
2057                 }
2058                 
2059                 ProcessData.Append(":data:");
2060                 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
2061                 ProcessData.Append(";");
2062                 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
2063                 ProcessData.Append(",");
2064                 ProcessData.Append(SoundsIter->second);
2065                 ProcessData.Append("\n");
2067                 ProcessData = OutputText(&ProcessData);
2068                 
2069                 SaveData->Append(ProcessData);
2070                 ProcessData.clear();
2071                         
2072         }
2073                 
2076 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
2077         map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
2078         map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
2079         map<int, wxString> *CalendarListTokens, wxString *SaveData){
2081         wxString ProcessData = "";
2082                 
2083         for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
2084                 CalendarIter != CalendarList->end(); CalendarIter++){
2086                 ProcessData.Append("CALURI");
2087                         
2088                 // Check if there is a value for TYPE.
2089                 
2090                 if ((*CalendarListType)[CalendarIter->first].size() > 0){
2091                 
2092                         ProcessData.Append(";TYPE=");
2093                         ProcessData.Append((*CalendarListType)[CalendarIter->first]);
2094                         
2095                 }
2096                 
2097                 // Check if there is a value for ALTID.
2098                 
2099                 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2100                 
2101                         ProcessData.Append(";ALTID=");
2102                         ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2103                         
2104                 }
2106                 // Check if there is a value for MEDIATYPE.
2107                 
2108                 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2109                 
2110                         ProcessData.Append(";MEDIATYPE=");
2111                         ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2112                         
2113                 }
2114                 
2115                 // Check if there is a value for PID.
2117                 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2118                 
2119                         ProcessData.Append(";PID=");
2120                         ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2121                         
2122                 }
2124                 // Check if there is a value for PREF.
2126                 if ((*CalendarListPref)[CalendarIter->first] > 0){
2127                 
2128                         ProcessData.Append(";PREF=");
2129                         ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2130                         
2131                 }
2133                 // Check if there is a value for tokens.
2135                 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2136                 
2137                         ProcessData.Append(";");
2138                         ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2139                         
2140                 }
2141                         
2142                 ProcessData.Append(":");
2143                 ProcessData.Append(CalendarIter->second);
2144                 ProcessData.Append("\n");
2146                 ProcessData = OutputText(&ProcessData);
2147                 
2148                 SaveData->Append(ProcessData);
2149                 ProcessData.clear();
2150                         
2151         }
2152                 
2155 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2156         map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2157         map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2158         map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2160         wxString ProcessData = "";
2161                 
2162         for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2163                 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2165                 ProcessData.Append("CALADRURI");
2166                         
2167                 // Check if there is a value for TYPE.
2168                 
2169                 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2170                 
2171                         ProcessData.Append(";TYPE=");
2172                         ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2173                         
2174                 }
2175                 
2176                 // Check if there is a value for ALTID.
2177                 
2178                 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2179                 
2180                         ProcessData.Append(";ALTID=");
2181                         ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2182                         
2183                 }
2185                 // Check if there is a value for MEDIATYPE.
2186                 
2187                 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2188                 
2189                         ProcessData.Append(";MEDIATYPE=");
2190                         ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2191                         
2192                 }
2193                 
2194                 // Check if there is a value for PID.
2196                 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2197                 
2198                         ProcessData.Append(";PID=");
2199                         ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2200                         
2201                 }
2203                 // Check if there is a value for PREF.
2205                 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2206                 
2207                         ProcessData.Append(";PREF=");
2208                         ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2209                         
2210                 }
2212                 // Check if there is a value for tokens.
2214                 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2215                 
2216                         ProcessData.Append(";");
2217                         ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2218                         
2219                 }
2220                         
2221                 ProcessData.Append(":");
2222                 ProcessData.Append(CalendarRequestIter->second);
2223                 ProcessData.Append("\n");
2225                 ProcessData = OutputText(&ProcessData);
2226                 
2227                 SaveData->Append(ProcessData);
2228                 ProcessData.clear();
2229                         
2230         }
2231                 
2234 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID, 
2235         std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2236         std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref, 
2237         std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2239         wxString ProcessData = "";
2240                 
2241         for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2242                 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2244                 ProcessData.Append("FBURL");
2245                         
2246                 // Check if there is a value for TYPE.
2247                 
2248                 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2249                 
2250                         ProcessData.Append(";TYPE=");
2251                         ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2252                         
2253                 }
2254                 
2255                 // Check if there is a value for ALTID.
2256                 
2257                 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2258                 
2259                         ProcessData.Append(";ALTID=");
2260                         ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2261                         
2262                 }
2264                 // Check if there is a value for MEDIATYPE.
2265                 
2266                 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2267                 
2268                         ProcessData.Append(";MEDIATYPE=");
2269                         ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2270                         
2271                 }
2272                 
2273                 // Check if there is a value for PID.
2275                 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2276                 
2277                         ProcessData.Append(";PID=");
2278                         ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2279                         
2280                 }
2282                 // Check if there is a value for PREF.
2284                 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2285                 
2286                         ProcessData.Append(";PREF=");
2287                         ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2288                         
2289                 }
2291                 // Check if there is a value for tokens.
2293                 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2294                 
2295                         ProcessData.Append(";");
2296                         ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2297                         
2298                 }
2299                         
2300                 ProcessData.Append(":");
2301                 ProcessData.Append(FreeBusyIter->second);
2302                 ProcessData.Append("\n");
2304                 ProcessData = OutputText(&ProcessData);
2305                 
2306                 SaveData->Append(ProcessData);
2307                 ProcessData.clear();
2308                         
2309         }
2310                 
2313 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID, 
2314         map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2315         map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType, 
2316         map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref, 
2317         map<int, wxString> *KeyListTokens, wxString *SaveData){
2319         wxString ProcessData = "";
2320                 
2321         for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2322                 KeyIter != KeyList->end(); KeyIter++){
2324                 ProcessData.Append("KEY");
2325                         
2326                 // Check if there is a value for TYPE.
2327                 
2328                 if ((*KeyListType)[KeyIter->first].size() > 0){
2329                 
2330                         ProcessData.Append(";TYPE=");
2331                         ProcessData.Append((*KeyListType)[KeyIter->first]);
2332                         
2333                 }
2334                 
2335                 // Check if there is a value for ALTID.
2336                 
2337                 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2338                 
2339                         ProcessData.Append(";ALTID=");
2340                         ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2341                         
2342                 }
2343                 
2344                 // Check if there is a value for PID.
2346                 if ((*KeyListPID)[KeyIter->first].size() > 0){
2347                 
2348                         ProcessData.Append(";PID=");
2349                         ProcessData.Append((*KeyListPID)[KeyIter->first]);
2350                         
2351                 }
2353                 // Check if there is a value for PREF.
2355                 if ((*KeyListPref)[KeyIter->first] > 0){
2356                 
2357                         ProcessData.Append(";PREF=");
2358                         ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2359                         
2360                 }
2362                 // Check if there is a value for tokens.
2364                 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2365                 
2366                         ProcessData.Append(";");
2367                         ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2368                         
2369                 }
2370                         
2371                 ProcessData.Append(":data:");
2372                 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2373                 ProcessData.Append(";");
2374                 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2375                 ProcessData.Append(",");
2376                 ProcessData.Append(KeyIter->second);
2377                 ProcessData.Append("\n");
2379                 ProcessData = OutputText(&ProcessData);
2380                 
2381                 SaveData->Append(ProcessData);
2382                 ProcessData.clear();
2383                         
2384         }
2385                 
2388 void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN, 
2389         map<int, wxString> *VendorListElement, wxString *SaveData){
2391         wxString ProcessData = "";
2392                 
2393         for (std::map<int, wxString>::iterator VendorIter = VendorList->begin();
2394                 VendorIter != VendorList->end(); VendorIter++){
2396                 ProcessData.Append("VND-");
2397                 ProcessData.Append((*VendorListPEN)[VendorIter->first]);
2398                 ProcessData.Append("-");
2399                 ProcessData.Append((*VendorListElement)[VendorIter->first]);
2400                 ProcessData.Append(":");
2401                 ProcessData.Append(VendorIter->second);
2402                 ProcessData.Append("\n");
2404                 ProcessData = OutputText(&ProcessData);
2405                 
2406                 SaveData->Append(ProcessData);
2407                 ProcessData.clear();
2408                         
2409         }
2410                 
2413 void ContactDataObject::SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens, 
2414         wxString *SaveData){
2416         wxString ProcessData = "";
2417                 
2418         for (std::map<int, wxString>::iterator XTokenIter = XTokenList->begin();
2419                 XTokenIter != XTokenList->end(); XTokenIter++){
2421                 ProcessData.Append("X-");
2422                 ProcessData.Append((*XTokenListTokens)[XTokenIter->first]);
2423                 ProcessData.Append(":");
2424                 ProcessData.Append(XTokenIter->second);
2425                 ProcessData.Append("\n");
2427                 ProcessData = OutputText(&ProcessData);
2428                 
2429                 SaveData->Append(ProcessData);
2430                 ProcessData.clear();
2431                         
2432         }       
2433                 
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy