Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added X-* 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 CLIENTPIDMAP.
117         
118         for (std::map<int, wxString>::iterator CPIDIter = ClientPIDList.begin();
119                 CPIDIter != ClientPIDList.end(); CPIDIter++){
120         
121                 ProcessData.Append("CLIENTPIDMAP");
122                         
123                 if (ClientPIDListTokens[CPIDIter->first].size() > 0){
124                 
125                         ProcessData.Append(";");
126                         ProcessData.Append(ClientPIDListTokens[CPIDIter->first]);
127                         
128                 }
129                         
130                 ProcessData.Append(":");
131                 ProcessData.Append(CPIDIter->second);
132                 ProcessData.Append("\n");
133                 
134                 ProcessData = OutputText(&ProcessData);
135                 
136                 SaveData->Append(ProcessData);
137                 ProcessData.clear();
138                         
139         }
140         
141         // Process FN.
142         
143         for (std::map<int, wxString>::iterator FNIter = FullNamesList.begin();
144                 FNIter != FullNamesList.end(); FNIter++){
145                 
146                 ProcessData.Append("FN");
148                 // Check if there is a value for TYPE.
149                 
150                 if (FullNamesListType[FNIter->first].size() > 0){
151                 
152                         ProcessData.Append(";TYPE=");
153                         ProcessData.Append(FullNamesListType[FNIter->first]);
154                         
155                 }
157                 // Check if there is a value for LANGUAGE.
158                 
159                 if (FullNamesListLanguage[FNIter->first].size() > 0){
160                 
161                         ProcessData.Append(";LANGUAGE=");
162                         ProcessData.Append(FullNamesListLanguage[FNIter->first]);
163                         
164                 }
165                 
166                 // Check if there is a value for ALTID.
167                 
168                 if (FullNamesListAltID[FNIter->first].size() > 0){
169                 
170                         ProcessData.Append(";ALTID=");
171                         ProcessData.Append(FullNamesListAltID[FNIter->first]);
172                         
173                 }
174                 
175                 // Check if there is a value for PID.
177                 if (FullNamesListPID[FNIter->first].size() > 0){
178                 
179                         ProcessData.Append(";PID=");
180                         ProcessData.Append(FullNamesListPID[FNIter->first]);
181                         
182                 }
184                 // Check if there is a value for PREF.
186                 if (FullNamesListPref[FNIter->first] > 0){
187                 
188                         ProcessData.Append(";PREF=");
189                         ProcessData.Append(wxString::Format("%i", FullNamesListPref[FNIter->first]));
190                         
191                 }
193                 // Check if there is a value for tokens.
195                 if (FullNamesListTokens[FNIter->first].size() > 0){
196                 
197                         ProcessData.Append(";");
198                         ProcessData.Append(FullNamesListTokens[FNIter->first]);
199                         
200                 }
201                 
202                 ProcessData.Append(":");
203                 ProcessData.Append(FNIter->second);
204                 ProcessData.Append("\n");
205                 
206                 ProcessData = OutputText(&ProcessData);
207                 
208                 SaveData->Append(ProcessData);
209                 ProcessData.clear();
210                         
211         }
212         
213         // Process NICKNAME.
214         
215         SaveNickname(&GeneralNicknamesList, &GeneralNicknamesListAltID, 
216                 &GeneralNicknamesListPID, &GeneralNicknamesListType,
217                 &GeneralNicknamesListLanguage, &GeneralNicknamesListPref, 
218                 &GeneralNicknamesListTokens, SaveData, "");
219         SaveNickname(&HomeNicknamesList, &HomeNicknamesListAltID, 
220                 &HomeNicknamesListPID, &HomeNicknamesListType,
221                 &HomeNicknamesListLanguage, &HomeNicknamesListPref, 
222                 &HomeNicknamesListTokens, SaveData, "home");
223         SaveNickname(&BusinessNicknamesList, &BusinessNicknamesListAltID, 
224                 &BusinessNicknamesListPID, &BusinessNicknamesListType,
225                 &BusinessNicknamesListLanguage, &BusinessNicknamesListPref, 
226                 &BusinessNicknamesListTokens, SaveData, "work");
227         
228         // Process TITLE.
230         SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
231                 &GeneralTitleListAltID, &GeneralTitleListPID,
232                 &GeneralTitleListType, &GeneralTitleListPref,
233                 &GeneralTitleListTokens, SaveData, "");
234         SaveTitle(&HomeTitleList, &HomeTitleListLanguage,
235                 &HomeTitleListAltID, &HomeTitleListPID,
236                 &HomeTitleListType, &HomeTitleListPref,
237                 &HomeTitleListTokens, SaveData, "home");
238         SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage,
239                 &BusinessTitleListAltID, &BusinessTitleListPID,
240                 &BusinessTitleListType, &BusinessTitleListPref,
241                 &BusinessTitleListTokens, SaveData, "work");
242         
243         // Process TZ.
244         
245         SaveTimezone(&GeneralTZList, &GeneralTZListAltID, 
246                 &GeneralTZListPID, &GeneralTZListType,
247                 &GeneralTZListMediatype, &GeneralTZListPref, 
248                 &GeneralTZListTokens, SaveData, "");
249         SaveTimezone(&HomeTZList, &HomeTZListAltID, 
250                 &HomeTZListPID, &HomeTZListType,
251                 &HomeTZListMediatype, &HomeTZListPref, 
252                 &HomeTZListTokens, SaveData, "home");
253         SaveTimezone(&BusinessTZList, &BusinessTZListAltID, 
254                 &BusinessTZListPID, &BusinessTZListType,
255                 &BusinessTZListMediatype, &BusinessTZListPref, 
256                 &BusinessTZListTokens, SaveData, "work");
258         // Process ADR.
259         
260         SaveAddress(&GeneralAddressList, &GeneralAddressListTown,
261                 &GeneralAddressListCounty, &GeneralAddressListPostCode,
262                 &GeneralAddressListCountry, &GeneralAddressListLabel,
263                 &GeneralAddressListLang, &GeneralAddressListAltID,
264                 &GeneralAddressListPID, &GeneralAddressListGeo, 
265                 &GeneralAddressListTimezone, &GeneralAddressListType, 
266                 &GeneralAddressListMediatype, &GeneralAddressListPref,
267                 &GeneralAddressListTokens, SaveData, "");
268         SaveAddress(&HomeAddressList, &HomeAddressListTown,
269                 &HomeAddressListCounty, &HomeAddressListPostCode,
270                 &HomeAddressListCountry, &HomeAddressListLabel,
271                 &HomeAddressListLang, &HomeAddressListAltID,
272                 &HomeAddressListPID, &HomeAddressListGeo, 
273                 &HomeAddressListTimezone, &HomeAddressListType, 
274                 &HomeAddressListMediatype, &HomeAddressListPref,
275                 &HomeAddressListTokens, SaveData, "home");
276         SaveAddress(&BusinessAddressList, &BusinessAddressListTown,
277                 &BusinessAddressListCounty, &BusinessAddressListPostCode,
278                 &BusinessAddressListCountry, &BusinessAddressListLabel,
279                 &BusinessAddressListLang, &BusinessAddressListAltID,
280                 &BusinessAddressListPID, &BusinessAddressListGeo, 
281                 &BusinessAddressListTimezone, &BusinessAddressListType, 
282                 &BusinessAddressListMediatype, &BusinessAddressListPref,
283                 &BusinessAddressListTokens, SaveData, "work");
285         // Process EMAIL.
286         
287         SaveEmail(&GeneralEmailList, &GeneralEmailListAltID, 
288                 &GeneralEmailListPID, &GeneralEmailListType,
289                 &GeneralEmailListPref, &GeneralEmailListTokens, 
290                 SaveData, "");
291         SaveEmail(&HomeEmailList, &HomeEmailListAltID, 
292                 &HomeEmailListPID, &HomeEmailListType,
293                 &HomeEmailListPref, &HomeEmailListTokens, 
294                 SaveData, "home");
295         SaveEmail(&BusinessEmailList, &BusinessEmailListAltID, 
296                 &BusinessEmailListPID, &BusinessEmailListType,
297                 &BusinessEmailListPref, &BusinessEmailListTokens, 
298                 SaveData, "work");
300         // TODO: Process IMPP.
301         
302         // TODO: Process TEL.
303         
304         // Process LANG.
305         
306         SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID, 
307                 &GeneralLanguageListPID, &GeneralLanguageListType,
308                 &GeneralLanguageListPref, &GeneralLanguageListTokens, 
309                 SaveData, "");
310         SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID, 
311                 &HomeLanguageListPID, &HomeLanguageListType,
312                 &HomeLanguageListPref, &HomeLanguageListTokens, 
313                 SaveData, "home");
314         SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID, 
315                 &BusinessLanguageListPID, &BusinessLanguageListType,
316                 &BusinessLanguageListPref, &BusinessLanguageListTokens, 
317                 SaveData, "work");
319         // Process GEO.
320         
321         SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID, 
322                 &GeneralGeographyListPID, &GeneralGeographyListType,
323                 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
324                 &GeneralGeographyListPref, &GeneralGeographyListTokens, 
325                 SaveData, "");
326         SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID, 
327                 &HomeGeographyListPID, &HomeGeographyListType,
328                 &HomeGeographyListMediatype, &HomeGeographyListDataType,
329                 &HomeGeographyListPref, &HomeGeographyListTokens, 
330                 SaveData, "home");
331         SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID, 
332                 &BusinessGeographyListPID, &BusinessGeographyListType,
333                 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
334                 &BusinessGeographyListPref, &BusinessGeographyListTokens, 
335                 SaveData, "work");
337         // Process RELATED.
338         
339         int Moo = 0;
341         for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
342                 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
343                 
344                 ProcessData.Append("RELATED");
346                 // Check if there is a value for TYPE.
347                 
348                 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
349                 
350                         wxString RelatedType = "";
351                         
352                         ProcessData.Append(";TYPE=");
353                         
354                         if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
356                                 RelatedType = wxT("contact");
358                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
360                                 RelatedType = wxT("acquaintance");
362                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
364                                 RelatedType = wxT("friend");
366                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
368                                 RelatedType = wxT("met");
370                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
372                                 RelatedType = wxT("co-worker");
374                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
376                                 RelatedType = wxT("colleague");
378                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
380                                 RelatedType = wxT("co-resident");
382                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
384                                 RelatedType = wxT("neighbor");
386                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
388                                 RelatedType = wxT("child");
390                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
392                                 RelatedType = wxT("parent");
394                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
396                                 RelatedType = wxT("sibling");
398                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
400                                 RelatedType = wxT("spouse");
402                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
404                                 RelatedType = wxT("kin");
406                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
408                                 RelatedType = wxT("muse");
410                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
412                                 RelatedType = wxT("crush");
414                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
416                                 RelatedType = wxT("date");
418                         } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
420                                 RelatedType = wxT("sweetheart");
422                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
424                                 RelatedType = wxT("me");
426                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
428                                 RelatedType = wxT("agent");
430                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
432                                 RelatedType = wxT("emergency");
434                         } else {
436                                 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
438                         }
439                         
440                         ProcessData.Append(RelatedType);
441                         
442                 }
444                 // Check if there is a value for LANGUAGE.
445                 
446                 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
447                 
448                         ProcessData.Append(";LANGUAGE=");
449                         ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
450                         
451                 }
452                 
453                 // Check if there is a value for ALTID.
454                 
455                 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
456                 
457                         ProcessData.Append(";ALTID=");
458                         ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
459                         
460                 }
461                 
462                 // Check if there is a value for PID.
464                 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
465                 
466                         ProcessData.Append(";PID=");
467                         ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
468                         
469                 }
471                 // Check if there is a value for PREF.
473                 if (GeneralRelatedListPref[RelatedIter->first] > 0){
474                 
475                         ProcessData.Append(";PREF=");
476                         ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
477                         
478                 }
480                 // Check if there is a value for tokens.
482                 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
483                 
484                         ProcessData.Append(";");
485                         ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
486                         
487                 }
488                 
489                 ProcessData.Append(":");
490                 ProcessData.Append(RelatedIter->second);
491                 ProcessData.Append("\n");
492                 
493                 ProcessData = OutputText(&ProcessData);
494                 
495                 SaveData->Append(ProcessData);
496                 ProcessData.clear();
497                         
498         }
499         
500         // Process URL.
501         
502         SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID, 
503                 &GeneralWebsiteListPID, &GeneralWebsiteListType,
504                 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref, 
505                 &GeneralWebsiteListTokens, SaveData, "");
506         SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID, 
507                 &HomeWebsiteListPID, &HomeWebsiteListType,
508                 &HomeWebsiteListMediatype, &HomeWebsiteListPref, 
509                 &HomeWebsiteListTokens, SaveData, "home");
510         SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID, 
511                 &BusinessWebsiteListPID, &BusinessWebsiteListType,
512                 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref, 
513                 &BusinessWebsiteListTokens, SaveData, "work");
515         // Process ROLE.
516         
517         SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
518                 &GeneralRoleListAltID, &GeneralRoleListPID,
519                 &GeneralRoleListType, &GeneralRoleListPref,
520                 &GeneralRoleListTokens, SaveData, "");
521         SaveRole(&HomeRoleList, &HomeRoleListLanguage,
522                 &HomeRoleListAltID, &HomeRoleListPID,
523                 &HomeRoleListType, &HomeRoleListPref,
524                 &HomeRoleListTokens, SaveData, "home");
525         SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
526                 &BusinessRoleListAltID, &BusinessRoleListPID,
527                 &BusinessRoleListType, &BusinessRoleListPref,
528                 &BusinessRoleListTokens, SaveData, "work");
530         // Process ORG.
531         
532         SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
533                 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage, 
534                 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType, 
535                 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens, 
536                 SaveData, "");
537         SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
538                 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage, 
539                 &HomeOrganisationsListSortAs, &HomeOrganisationsListType, 
540                 &HomeOrganisationsListPref, &HomeOrganisationsListTokens, 
541                 SaveData, "home");
542         SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
543                 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage, 
544                 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType, 
545                 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens, 
546                 SaveData, "work");
548         // Process NOTE.
549         
550         SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
551                 &GeneralNoteListAltID, &GeneralNoteListPID,
552                 &GeneralNoteListType, &GeneralNoteListPref,
553                 &GeneralNoteListTokens, SaveData, "");
554         SaveNote(&HomeNoteList, &HomeNoteListLanguage,
555                 &HomeNoteListAltID, &HomeNoteListPID,
556                 &HomeNoteListType, &HomeNoteListPref,
557                 &HomeNoteListTokens, SaveData, "home");
558         SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
559                 &BusinessNoteListAltID, &BusinessNoteListPID,
560                 &BusinessNoteListType, &BusinessNoteListPref,
561                 &BusinessNoteListTokens, SaveData, "work");
563         // Process CATEGORIES.
564         
565         SaveCategory(&CategoriesList, &CategoriesListLanguage,
566                 &CategoriesListAltID, &CategoriesListPID,
567                 &CategoriesListType, &CategoriesListPref,
568                 &CategoriesListTokens, SaveData);
570         // Process PHOTO.
571         
572         SavePhoto(&PicturesList, &PicturesListAltID, 
573                 &PicturesListPID, &PicturesListType,
574                 &PicturesListPicEncType, &PicturesListPictureType,
575                 &PicturesListMediatype, &PicturesListPref,
576                 &PicturesListTokens, SaveData);
577         
578         // Process LOGO.
579         
580         SaveLogo(&LogosList, &LogosListAltID, 
581                 &LogosListPID, &LogosListType,
582                 &LogosListPicEncType, &LogosListPictureType,
583                 &LogosListMediatype, &LogosListPref,
584                 &LogosListTokens, SaveData);
585         
586         // Process SOUND.
588         SaveSound(&SoundsList, &SoundsListAltID, 
589                 &SoundsListPID, &SoundsListType,
590                 &SoundsListAudioEncType, &SoundsListAudioType,
591                 &SoundsListMediatype, &SoundsListLanguage, 
592                 &SoundsListPref, &SoundsListTokens, 
593                 SaveData);
595         // Process CALURI.
596         
597         SaveCalendarURI(&CalendarList, &CalendarListMediatype,
598                 &CalendarListAltID, &CalendarListPID,
599                 &CalendarListType, &CalendarListPref,
600                 &CalendarListTokens, SaveData);
601         
602         // Process CALADRURI.
603         
604         SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
605                 &CalendarRequestListAltID, &CalendarRequestListPID,
606                 &CalendarRequestListType, &CalendarRequestListPref,
607                 &CalendarRequestListTokens, SaveData);
609         // Process FBURL.
610         
611         SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID, 
612                 &FreeBusyListPID, &FreeBusyListType,
613                 &FreeBusyListMediatype, &FreeBusyListPref, 
614                 &FreeBusyListTokens, SaveData);
616         // Process KEY.
617         
618         SaveKey(&KeyList, &KeyListAltID, 
619                 &KeyListPID, &KeyListType,
620                 &KeyListKeyType, &KeyListDataEncType, 
621                 &KeyListDataType, &KeyListPref, 
622                 &KeyListTokens, SaveData);
624         // Process VND-*
625         
626         SaveVendor(&VendorList, &VendorListPEN, 
627                 &VendorListElement, SaveData);
629         // Process X-Tokens.
630         
631         SaveXToken(&XTokenList, &XTokenListTokens, 
632                 SaveData);
634         // Write the end part of the vCard data file.
635         
636         SaveData->Append("END:VCARD");
637         
638         SaveDataStatus = CONTACTSAVE_OK;
639         
640         return SaveDataStatus;
641         
644 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
645         map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
646         map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
647         map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
649         wxString ProcessData = "";
650                 
651         for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
652                 TitleIter != TitleList->end(); TitleIter++){
654                 ProcessData.Append("TITLE");
655                         
656                 // Check if there is a value for TYPE.
657                 
658                 if (DataType.size() > 0){
659                 
660                         ProcessData.Append(";TYPE=");
661                         ProcessData.Append(DataType);
662                         
663                 }
664                 
665                 // Check if there is a value for ALTID.
666                 
667                 if ((*TitleListAltID)[TitleIter->first].size() > 0){
668                 
669                         ProcessData.Append(";ALTID=");
670                         ProcessData.Append((*TitleListAltID)[TitleIter->first]);
671                         
672                 }
674                 // Check if there is a value for LANGUAGE.
675                 
676                 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
677                 
678                         ProcessData.Append(";LANGUAGE=");
679                         ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
680                         
681                 }
682                 
683                 // Check if there is a value for PID.
685                 if ((*TitleListPID)[TitleIter->first].size() > 0){
686                 
687                         ProcessData.Append(";PID=");
688                         ProcessData.Append((*TitleListPID)[TitleIter->first]);
689                         
690                 }
692                 // Check if there is a value for PREF.
694                 if ((*TitleListPref)[TitleIter->first] > 0){
695                 
696                         ProcessData.Append(";PREF=");
697                         ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
698                         
699                 }
701                 // Check if there is a value for tokens.
703                 if ((*TitleListTokens)[TitleIter->first].size() > 0){
704                 
705                         ProcessData.Append(";");
706                         ProcessData.Append((*TitleListTokens)[TitleIter->first]);
707                         
708                 }
709                         
710                 ProcessData.Append(":");
711                 ProcessData.Append(TitleIter->second);
712                 ProcessData.Append("\n");
714                 ProcessData = OutputText(&ProcessData);
715                         
716                 SaveData->Append(ProcessData);
717                 ProcessData.clear();
718                         
719         }
720                 
723 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID, 
724         map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
725         map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref, 
726         map<int, wxString> *SourceListTokens, wxString *SaveData){
728         wxString ProcessData = "";
729         
730         for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
731                 SourceIter != SourceList->end(); SourceIter++){
733                 ProcessData.Append("SOURCE");
734                         
735                 // Check if there is a value for TYPE.
736                 
737                 if ((*SourceListType)[SourceIter->first].size() > 0){
738                 
739                         ProcessData.Append(";TYPE=");
740                         ProcessData.Append((*SourceListType)[SourceIter->first]);
741                         
742                 }
743                 
744                 // Check if there is a value for ALTID.
745                 
746                 if ((*SourceListAltID)[SourceIter->first].size() > 0){
747                 
748                         ProcessData.Append(";ALTID=");
749                         ProcessData.Append((*SourceListAltID)[SourceIter->first]);
750                         
751                 }
753                 // Check if there is a value for MEDIATYPE.
754                 
755                 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
756                 
757                         ProcessData.Append(";MEDIATYPE=");
758                         ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
759                         
760                 }
761                 
762                 // Check if there is a value for PID.
764                 if ((*SourceListPID)[SourceIter->first].size() > 0){
765                 
766                         ProcessData.Append(";PID=");
767                         ProcessData.Append((*SourceListPID)[SourceIter->first]);
768                         
769                 }
771                 // Check if there is a value for PREF.
773                 if ((*SourceListPref)[SourceIter->first] > 0){
774                 
775                         ProcessData.Append(";PREF=");
776                         ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
777                         
778                 }
780                 // Check if there is a value for tokens.
782                 if ((*SourceListTokens)[SourceIter->first].size() > 0){
783                 
784                         ProcessData.Append(";");
785                         ProcessData.Append((*SourceListTokens)[SourceIter->first]);
786                         
787                 }
788                         
789                 ProcessData.Append(":");
790                 ProcessData.Append(SourceIter->second);
791                 ProcessData.Append("\n");
793                 ProcessData = OutputText(&ProcessData);
794                         
795                 SaveData->Append(ProcessData);
796                 ProcessData.clear();
797                         
798         }
799                 
802 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID, 
803         map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
804         map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref, 
805         map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
807         wxString ProcessData = "";
808         
809         for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
810                 NicknameIter != NicknameList->end(); NicknameIter++){
812                 ProcessData.Append("NICKNAME");
813                         
814                 // Check if there is a value for TYPE.
815                 
816                 if (DataType.size() > 0){
817                 
818                         ProcessData.Append(";TYPE=");
819                         ProcessData.Append(DataType);
820                         
821                 }
822                 
823                 // Check if there is a value for ALTID.
824                 
825                 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
826                 
827                         ProcessData.Append(";ALTID=");
828                         ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
829                         
830                 }
832                 // Check if there is a value for MEDIATYPE.
833                 
834                 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
835                 
836                         ProcessData.Append(";LANGUAGE=");
837                         ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
838                         
839                 }
840                 
841                 // Check if there is a value for PID.
843                 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
844                 
845                         ProcessData.Append(";PID=");
846                         ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
847                         
848                 }
850                 // Check if there is a value for PREF.
852                 if ((*NicknameListPref)[NicknameIter->first] > 0){
853                 
854                         ProcessData.Append(";PREF=");
855                         ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
856                         
857                 }
859                 // Check if there is a value for tokens.
861                 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
862                 
863                         ProcessData.Append(";");
864                         ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
865                         
866                 }
867                         
868                 ProcessData.Append(":");
869                 ProcessData.Append(NicknameIter->second);
870                 ProcessData.Append("\n");
872                 ProcessData = OutputText(&ProcessData);
873                         
874                 SaveData->Append(ProcessData);
875                 ProcessData.clear();
876                         
877         }
878                 
881 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID, 
882         map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
883         map<int, wxString> *TZListMediatype, map<int, int> *TZListPref, 
884         map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
886         wxString ProcessData = "";
887         
888         for (std::map<int, wxString>::iterator TZIter = TZList->begin();
889                 TZIter != TZList->end(); TZIter++){
891                 ProcessData.Append("TZ");
892                         
893                 // Check if there is a value for TYPE.
894                 
895                 if (DataType.size() > 0){
896                 
897                         ProcessData.Append(";TYPE=");
898                         ProcessData.Append(DataType);
899                         
900                 }
901                 
902                 // Check if there is a value for ALTID.
903                 
904                 if ((*TZListAltID)[TZIter->first].size() > 0){
905                 
906                         ProcessData.Append(";ALTID=");
907                         ProcessData.Append((*TZListAltID)[TZIter->first]);
908                         
909                 }
911                 // Check if there is a value for MEDIATYPE.
912                 
913                 if ((*TZListMediatype)[TZIter->first].size() > 0){
914                 
915                         ProcessData.Append(";MEDIATYPE=");
916                         ProcessData.Append((*TZListMediatype)[TZIter->first]);
917                         
918                 }
919                 
920                 // Check if there is a value for PID.
922                 if ((*TZListPID)[TZIter->first].size() > 0){
923                 
924                         ProcessData.Append(";PID=");
925                         ProcessData.Append((*TZListPID)[TZIter->first]);
926                         
927                 }
929                 // Check if there is a value for PREF.
931                 if ((*TZListPref)[TZIter->first] > 0){
932                 
933                         ProcessData.Append(";PREF=");
934                         ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
935                         
936                 }
938                 // Check if there is a value for tokens.
940                 if ((*TZListTokens)[TZIter->first].size() > 0){
941                 
942                         ProcessData.Append(";");
943                         ProcessData.Append((*TZListTokens)[TZIter->first]);
944                         
945                 }
946                         
947                 ProcessData.Append(":");
948                 ProcessData.Append(TZIter->second);
949                 ProcessData.Append("\n");
951                 ProcessData = OutputText(&ProcessData);
952                         
953                 SaveData->Append(ProcessData);
954                 ProcessData.clear();
955                         
956         }
957                 
960 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
961                 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
962                 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
963                 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
964                 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo, 
965                 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType, 
966                 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref, 
967                 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
969         wxString ProcessData = "";
970                         
971         for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
972                 AddressIter != AddressList->end(); AddressIter++){
973                         
974                 ProcessData.Append("ADR");
975                         
976                 // Check if there is a value for TYPE.
977                 
978                 if (DataType.size() > 0){
979                 
980                         ProcessData.Append(";TYPE=");
981                         ProcessData.Append(DataType);
982                         
983                 }
984                 
985                 // Check if there is a value for ALTID.
986                 
987                 if ((*AddressListAltID)[AddressIter->first].size() > 0){
988                 
989                         ProcessData.Append(";ALTID=");
990                         ProcessData.Append((*AddressListAltID)[AddressIter->first]);
991                         
992                 }
994                 // Check if there is a value for GEO.
995                 
996                 if ((*AddressListGeo)[AddressIter->first].size() > 0){
997                 
998                         ProcessData.Append(";GEO=\"");
999                         ProcessData.Append((*AddressListGeo)[AddressIter->first]);
1000                         ProcessData.Append("\"");
1001                         
1002                 }
1004                 // Check if there is a value for LABEL.
1006                 if ((*AddressListLabel)[AddressIter->first].size() > 0){
1007                 
1008                         wxString AddressProcessed = "";
1009                         AddressProcessed = (*AddressListLabel)[AddressIter->first];
1010                         
1011                         AddressProcessed.Replace("\n", "\\n", true);
1012                         
1013                         ProcessData.Append(";LABEL=");
1014                         ProcessData.Append(AddressProcessed);
1015                         
1016                 }
1017                 
1018                 // Check if there is a value for LANGUAGE.
1019                 
1020                 if ((*AddressListLang)[AddressIter->first].size() > 0){
1021                 
1022                         ProcessData.Append(";LANGUAGE=");
1023                         ProcessData.Append((*AddressListLang)[AddressIter->first]);
1024                         
1025                 }
1026                 
1027                 // Check if there is a value for MEDIATYPE.
1028                 
1029                 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1030                 
1031                         ProcessData.Append(";MEDIATYPE=");
1032                         ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1033                         
1034                 }
1035                 
1036                 // Check if there is a value for PID.
1038                 if ((*AddressListPID)[AddressIter->first].size() > 0){
1039                 
1040                         ProcessData.Append(";PID=");
1041                         ProcessData.Append((*AddressListPID)[AddressIter->first]);
1042                         
1043                 }
1045                 // Check if there is a value for PREF.
1047                 if ((*AddressListPref)[AddressIter->first] > 0){
1048                 
1049                         ProcessData.Append(";PREF=");
1050                         ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1051                         
1052                 }
1054                 // Check if there is a value for TZ.
1056                 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1057                 
1058                         ProcessData.Append(";TZ=");
1059                         ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1060                         
1061                 }
1062                 
1063                 // Check if there is a value for tokens.
1065                 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1066                 
1067                         ProcessData.Append(";");
1068                         ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1069                         
1070                 }
1071                 
1072                 // Build the address.
1073                 
1074                 ProcessData.Append(":;;");
1075                 ProcessData.Append((*AddressList)[AddressIter->first]);
1076                 ProcessData.Append(";");
1077                 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1078                 ProcessData.Append(";");
1079                 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1080                 ProcessData.Append(";");
1081                 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1082                 ProcessData.Append(";");
1083                 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1084                 ProcessData.Append("\n");
1085                 
1086                 ProcessData = OutputText(&ProcessData);
1087                         
1088                 SaveData->Append(ProcessData);
1089                 ProcessData.clear();
1090                         
1091         }
1092                         
1095 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID, 
1096         map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1097         map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens, 
1098         wxString *SaveData, wxString DataType){
1100         wxString ProcessData = "";
1101         
1102         for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1103                 EmailIter != EmailList->end(); EmailIter++){
1105                 ProcessData.Append("EMAIL");
1106                         
1107                 // Check if there is a value for TYPE.
1108                 
1109                 if (DataType.size() > 0){
1110                 
1111                         ProcessData.Append(";TYPE=");
1112                         ProcessData.Append(DataType);
1113                         
1114                 }
1115                 
1116                 // Check if there is a value for ALTID.
1117                 
1118                 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1119                 
1120                         ProcessData.Append(";ALTID=");
1121                         ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1122                         
1123                 }
1124                 
1125                 // Check if there is a value for PID.
1127                 if ((*EmailListPID)[EmailIter->first].size() > 0){
1128                 
1129                         ProcessData.Append(";PID=");
1130                         ProcessData.Append((*EmailListPID)[EmailIter->first]);
1131                         
1132                 }
1134                 // Check if there is a value for PREF.
1136                 if ((*EmailListPref)[EmailIter->first] > 0){
1137                 
1138                         ProcessData.Append(";PREF=");
1139                         ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1140                         
1141                 }
1143                 // Check if there is a value for tokens.
1145                 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1146                 
1147                         ProcessData.Append(";");
1148                         ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1149                         
1150                 }
1151                         
1152                 ProcessData.Append(":");
1153                 ProcessData.Append(EmailIter->second);
1154                 ProcessData.Append("\n");
1156                 ProcessData = OutputText(&ProcessData);
1157                         
1158                 SaveData->Append(ProcessData);
1159                 ProcessData.clear();
1160                         
1161         }
1162                 
1165 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID, 
1166         map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1167         map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens, 
1168         wxString *SaveData, wxString DataType){
1170         wxString ProcessData = "";
1171         
1172         for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1173                 LanguageIter != LanguageList->end(); LanguageIter++){
1175                 ProcessData.Append("LANG");
1176                         
1177                 // Check if there is a value for TYPE.
1178                 
1179                 if (DataType.size() > 0){
1180                 
1181                         ProcessData.Append(";TYPE=");
1182                         ProcessData.Append(DataType);
1183                         
1184                 }
1185                 
1186                 // Check if there is a value for ALTID.
1187                 
1188                 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1189                 
1190                         ProcessData.Append(";ALTID=");
1191                         ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1192                         
1193                 }
1194                 
1195                 // Check if there is a value for PID.
1197                 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1198                 
1199                         ProcessData.Append(";PID=");
1200                         ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1201                         
1202                 }
1204                 // Check if there is a value for PREF.
1206                 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1207                 
1208                         ProcessData.Append(";PREF=");
1209                         ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1210                         
1211                 }
1213                 // Check if there is a value for tokens.
1215                 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1216                 
1217                         ProcessData.Append(";");
1218                         ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1219                         
1220                 }
1221                         
1222                 ProcessData.Append(":");
1223                 ProcessData.Append(LanguageIter->second);
1224                 ProcessData.Append("\n");
1226                 ProcessData = OutputText(&ProcessData);
1227                         
1228                 SaveData->Append(ProcessData);
1229                 ProcessData.clear();
1230                         
1231         }
1232                 
1235 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID, 
1236         map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1237         map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1238         map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens, 
1239         wxString *SaveData, wxString DataType){
1241         wxString ProcessData = "";
1242         
1243         for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1244                 GeographyIter != GeographyList->end(); GeographyIter++){
1246                 ProcessData.Append("GEO");
1247                         
1248                 // Check if there is a value for TYPE.
1249                 
1250                 if (DataType.size() > 0){
1251                 
1252                         ProcessData.Append(";TYPE=");
1253                         ProcessData.Append(DataType);
1254                         
1255                 }
1256                 
1257                 // Check if there is a value for ALTID.
1258                 
1259                 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1260                 
1261                         ProcessData.Append(";ALTID=");
1262                         ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1263                         
1264                 }
1265                 
1266                 // Check if there is a value for MEDIATYPE.
1267                 
1268                 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1269                 
1270                         ProcessData.Append(";MEDIATYPE=");
1271                         ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1272                         
1273                 }
1274                 
1275                 // Check if there is a value for PID.
1277                 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1278                 
1279                         ProcessData.Append(";PID=");
1280                         ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1281                         
1282                 }
1284                 // Check if there is a value for PREF.
1286                 if ((*GeographyListPref)[GeographyIter->first] > 0){
1287                 
1288                         ProcessData.Append(";PREF=");
1289                         ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1290                         
1291                 }
1293                 // Check if there is a value for tokens.
1295                 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1296                 
1297                         ProcessData.Append(";");
1298                         ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1299                         
1300                 }
1301                         
1302                 ProcessData.Append(":");
1303                 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1304                 ProcessData.Append(":");
1305                 ProcessData.Append(GeographyIter->second);
1306                 ProcessData.Append("\n");
1308                 ProcessData = OutputText(&ProcessData);
1309                         
1310                 SaveData->Append(ProcessData);
1311                 ProcessData.clear();
1312                         
1313         }
1314                 
1317 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID, 
1318                 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1319                 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref, 
1320                 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1322         wxString ProcessData = "";
1323         
1324         for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1325                 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1327                 ProcessData.Append("URL");
1328                         
1329                 // Check if there is a value for TYPE.
1330                 
1331                 if (DataType.size() > 0){
1332                 
1333                         ProcessData.Append(";TYPE=");
1334                         ProcessData.Append(DataType);
1335                         
1336                 }
1337                 
1338                 // Check if there is a value for ALTID.
1339                 
1340                 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1341                 
1342                         ProcessData.Append(";ALTID=");
1343                         ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1344                         
1345                 }
1346                 
1347                 // Check if there is a value for MEDIATYPE.
1348                 
1349                 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1350                 
1351                         ProcessData.Append(";MEDIATYPE=");
1352                         ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1353                         
1354                 }
1355                 
1356                 // Check if there is a value for PID.
1358                 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1359                 
1360                         ProcessData.Append(";PID=");
1361                         ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1362                         
1363                 }
1365                 // Check if there is a value for PREF.
1367                 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1368                 
1369                         ProcessData.Append(";PREF=");
1370                         ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1371                         
1372                 }
1374                 // Check if there is a value for tokens.
1376                 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1377                 
1378                         ProcessData.Append(";");
1379                         ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1380                         
1381                 }
1382                         
1383                 ProcessData.Append(":");
1384                 ProcessData.Append(WebsiteIter->second);
1385                 ProcessData.Append("\n");
1387                 ProcessData = OutputText(&ProcessData);
1388                         
1389                 SaveData->Append(ProcessData);
1390                 ProcessData.clear();
1391                         
1392         }
1393                         
1396 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1397         map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1398         map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1399         map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1401         wxString ProcessData = "";
1402                 
1403         for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1404                 RoleIter != RoleList->end(); RoleIter++){
1406                 ProcessData.Append("ROLE");
1407                         
1408                 // Check if there is a value for TYPE.
1409                 
1410                 if (DataType.size() > 0){
1411                 
1412                         ProcessData.Append(";TYPE=");
1413                         ProcessData.Append(DataType);
1414                         
1415                 }
1416                 
1417                 // Check if there is a value for ALTID.
1418                 
1419                 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1420                 
1421                         ProcessData.Append(";ALTID=");
1422                         ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1423                         
1424                 }
1426                 // Check if there is a value for LANGUAGE.
1427                 
1428                 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1429                 
1430                         ProcessData.Append(";LANGUAGE=");
1431                         ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1432                         
1433                 }
1434                 
1435                 // Check if there is a value for PID.
1437                 if ((*RoleListPID)[RoleIter->first].size() > 0){
1438                 
1439                         ProcessData.Append(";PID=");
1440                         ProcessData.Append((*RoleListPID)[RoleIter->first]);
1441                         
1442                 }
1444                 // Check if there is a value for PREF.
1446                 if ((*RoleListPref)[RoleIter->first] > 0){
1447                 
1448                         ProcessData.Append(";PREF=");
1449                         ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1450                         
1451                 }
1453                 // Check if there is a value for tokens.
1455                 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1456                 
1457                         ProcessData.Append(";");
1458                         ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1459                         
1460                 }
1461                         
1462                 ProcessData.Append(":");
1463                 ProcessData.Append(RoleIter->second);
1464                 ProcessData.Append("\n");
1466                 ProcessData = OutputText(&ProcessData);
1467                 
1468                 SaveData->Append(ProcessData);
1469                 ProcessData.clear();
1470                         
1471         }
1472                 
1475 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1476         map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage, 
1477         map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType, 
1478         map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens, 
1479         wxString *SaveData, wxString DataType){
1481         wxString ProcessData = "";
1482                 
1483         for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1484                 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1486                 ProcessData.Append("ORG");
1487                         
1488                 // Check if there is a value for TYPE.
1489                 
1490                 if (DataType.size() > 0){
1491                 
1492                         ProcessData.Append(";TYPE=");
1493                         ProcessData.Append(DataType);
1494                         
1495                 }
1496                 
1497                 // Check if there is a value for ALTID.
1498                 
1499                 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1500                 
1501                         ProcessData.Append(";ALTID=");
1502                         ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1503                         
1504                 }
1506                 // Check if there is a value for LANGUAGE.
1507                 
1508                 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1509                 
1510                         ProcessData.Append(";LANGUAGE=");
1511                         ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1512                         
1513                 }
1514                 
1515                 // Check if there is a value for PID.
1517                 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1518                 
1519                         ProcessData.Append(";PID=");
1520                         ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1521                         
1522                 }
1524                 // Check if there is a value for PREF.
1526                 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1527                 
1528                         ProcessData.Append(";PREF=");
1529                         ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1530                         
1531                 }
1532                 
1533                 // Check if there is a value for SORT-AS.
1534                 
1535                 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1536                 
1537                         ProcessData.Append(";SORT-AS=\"");
1538                         ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1539                         ProcessData.Append("\"");
1540                         
1541                 }
1543                 // Check if there is a value for tokens.
1545                 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1546                 
1547                         ProcessData.Append(";");
1548                         ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1549                         
1550                 }
1551                         
1552                 ProcessData.Append(":");
1553                 ProcessData.Append(OrganisationIter->second);
1554                 ProcessData.Append("\n");
1556                 ProcessData = OutputText(&ProcessData);
1557                 
1558                 SaveData->Append(ProcessData);
1559                 ProcessData.clear();
1560                         
1561         }
1562                 
1565 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1566         map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1567         map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1568         map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1570         wxString ProcessData = "";
1571                 
1572         for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1573                 NoteIter != NoteList->end(); NoteIter++){
1575                 ProcessData.Append("NOTE");
1576                         
1577                 // Check if there is a value for TYPE.
1578                 
1579                 if (DataType.size() > 0){
1580                 
1581                         ProcessData.Append(";TYPE=");
1582                         ProcessData.Append(DataType);
1583                         
1584                 }
1585                 
1586                 // Check if there is a value for ALTID.
1587                 
1588                 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1589                 
1590                         ProcessData.Append(";ALTID=");
1591                         ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1592                         
1593                 }
1595                 // Check if there is a value for LANGUAGE.
1596                 
1597                 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1598                 
1599                         ProcessData.Append(";LANGUAGE=");
1600                         ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1601                         
1602                 }
1603                 
1604                 // Check if there is a value for PID.
1606                 if ((*NoteListPID)[NoteIter->first].size() > 0){
1607                 
1608                         ProcessData.Append(";PID=");
1609                         ProcessData.Append((*NoteListPID)[NoteIter->first]);
1610                         
1611                 }
1613                 // Check if there is a value for PREF.
1615                 if ((*NoteListPref)[NoteIter->first] > 0){
1616                 
1617                         ProcessData.Append(";PREF=");
1618                         ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1619                         
1620                 }
1622                 // Check if there is a value for tokens.
1624                 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1625                 
1626                         ProcessData.Append(";");
1627                         ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1628                         
1629                 }
1630                         
1631                 ProcessData.Append(":");
1632                 ProcessData.Append(NoteIter->second);
1633                 ProcessData.Replace("\n", "\\n", true);
1634                 ProcessData.Append("\n");
1636                 ProcessData = OutputText(&ProcessData);
1637                 
1638                 SaveData->Append(ProcessData);
1639                 ProcessData.clear();
1640                         
1641         }
1642                 
1645 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1646         map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1647         map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1648         map<int, wxString> *CategoryListTokens, wxString *SaveData){
1650         wxString ProcessData = "";
1651                 
1652         for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1653                 CategoryIter != CategoryList->end(); CategoryIter++){
1655                 ProcessData.Append("CATEGORIES");
1656                         
1657                 // Check if there is a value for TYPE.
1658                 
1659                 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1660                 
1661                         ProcessData.Append(";TYPE=");
1662                         ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1663                         
1664                 }
1665                 
1666                 // Check if there is a value for ALTID.
1667                 
1668                 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1669                 
1670                         ProcessData.Append(";ALTID=");
1671                         ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1672                         
1673                 }
1675                 // Check if there is a value for LANGUAGE.
1676                 
1677                 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1678                 
1679                         ProcessData.Append(";LANGUAGE=");
1680                         ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1681                         
1682                 }
1683                 
1684                 // Check if there is a value for PID.
1686                 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1687                 
1688                         ProcessData.Append(";PID=");
1689                         ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1690                         
1691                 }
1693                 // Check if there is a value for PREF.
1695                 if ((*CategoryListPref)[CategoryIter->first] > 0){
1696                 
1697                         ProcessData.Append(";PREF=");
1698                         ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1699                         
1700                 }
1702                 // Check if there is a value for tokens.
1704                 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1705                 
1706                         ProcessData.Append(";");
1707                         ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1708                         
1709                 }
1710                         
1711                 ProcessData.Append(":");
1712                 ProcessData.Append(CategoryIter->second);
1713                 ProcessData.Append("\n");
1715                 ProcessData = OutputText(&ProcessData);
1716                 
1717                 SaveData->Append(ProcessData);
1718                 ProcessData.clear();
1719                         
1720         }
1721                 
1724 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID, 
1725                 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1726                 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1727                 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1728                 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1730         wxString ProcessData = "";
1731                 
1732         for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1733                 PicturesIter != PicturesList->end(); PicturesIter++){
1735                 ProcessData.Append("PHOTO");
1736                         
1737                 // Check if there is a value for TYPE.
1738                 
1739                 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1740                 
1741                         ProcessData.Append(";TYPE=");
1742                         ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1743                         
1744                 }
1745                 
1746                 // Check if there is a value for ALTID.
1747                 
1748                 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1749                 
1750                         ProcessData.Append(";ALTID=");
1751                         ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1752                         
1753                 }
1755                 // Check if there is a value for MEDIATYPE..
1756                 
1757                 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1758                 
1759                         ProcessData.Append(";MEDIATYPE=");
1760                         ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1761                         
1762                 }
1763                 
1764                 // Check if there is a value for PID.
1766                 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1767                 
1768                         ProcessData.Append(";PID=");
1769                         ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1770                         
1771                 }
1773                 // Check if there is a value for PREF.
1775                 if ((*PicturesListPref)[PicturesIter->first] > 0){
1776                 
1777                         ProcessData.Append(";PREF=");
1778                         ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1779                         
1780                 }
1782                 // Check if there is a value for tokens.
1784                 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1785                 
1786                         ProcessData.Append(";");
1787                         ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1788                         
1789                 }
1790                 
1791                 ProcessData.Append(":data:");
1792                 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1793                 ProcessData.Append(";");
1794                 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1795                 ProcessData.Append(",");
1796                 ProcessData.Append(PicturesIter->second);
1797                 ProcessData.Append("\n");
1799                 ProcessData = OutputText(&ProcessData);
1800                 
1801                 SaveData->Append(ProcessData);
1802                 ProcessData.clear();
1803                         
1804         }
1805                         
1808 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID, 
1809         map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
1810         map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
1811         map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
1812         map<int, wxString> *LogosListTokens, wxString *SaveData){
1814         wxString ProcessData = "";
1815                 
1816         for (std::map<int, string>::iterator LogosIter = LogosList->begin();
1817                 LogosIter != LogosList->end(); LogosIter++){
1819                 ProcessData.Append("LOGO");
1820                         
1821                 // Check if there is a value for TYPE.
1822                 
1823                 if ((*LogosListType)[LogosIter->first].size() > 0){
1824                 
1825                         ProcessData.Append(";TYPE=");
1826                         ProcessData.Append((*LogosListType)[LogosIter->first]);
1827                         
1828                 }
1829                 
1830                 // Check if there is a value for ALTID.
1831                 
1832                 if ((*LogosListAltID)[LogosIter->first].size() > 0){
1833                 
1834                         ProcessData.Append(";ALTID=");
1835                         ProcessData.Append((*LogosListAltID)[LogosIter->first]);
1836                         
1837                 }
1839                 // Check if there is a value for MEDIATYPE..
1840                 
1841                 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
1842                 
1843                         ProcessData.Append(";MEDIATYPE=");
1844                         ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
1845                         
1846                 }
1847                 
1848                 // Check if there is a value for PID.
1850                 if ((*LogosListPID)[LogosIter->first].size() > 0){
1851                 
1852                         ProcessData.Append(";PID=");
1853                         ProcessData.Append((*LogosListPID)[LogosIter->first]);
1854                         
1855                 }
1857                 // Check if there is a value for PREF.
1859                 if ((*LogosListPref)[LogosIter->first] > 0){
1860                 
1861                         ProcessData.Append(";PREF=");
1862                         ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
1863                         
1864                 }
1866                 // Check if there is a value for tokens.
1868                 if ((*LogosListTokens)[LogosIter->first].size() > 0){
1869                 
1870                         ProcessData.Append(";");
1871                         ProcessData.Append((*LogosListTokens)[LogosIter->first]);
1872                         
1873                 }
1874                 
1875                 ProcessData.Append(":data:");
1876                 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
1877                 ProcessData.Append(";");
1878                 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
1879                 ProcessData.Append(",");
1880                 ProcessData.Append(LogosIter->second);
1881                 ProcessData.Append("\n");
1883                 ProcessData = OutputText(&ProcessData);
1884                 
1885                 SaveData->Append(ProcessData);
1886                 ProcessData.clear();
1887                         
1888         }
1889                 
1892 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID, 
1893         map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
1894         map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
1895         map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage, 
1896         map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens, 
1897         wxString *SaveData){
1899         wxString ProcessData = "";
1900                 
1901         for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
1902                 SoundsIter != SoundsList->end(); SoundsIter++){
1904                 ProcessData.Append("SOUND");
1905                         
1906                 // Check if there is a value for TYPE.
1907                 
1908                 if ((*SoundsListType)[SoundsIter->first].size() > 0){
1909                 
1910                         ProcessData.Append(";TYPE=");
1911                         ProcessData.Append((*SoundsListType)[SoundsIter->first]);
1912                         
1913                 }
1914                 
1915                 // Check if there is a value for ALTID.
1916                 
1917                 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
1918                 
1919                         ProcessData.Append(";ALTID=");
1920                         ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
1921                         
1922                 }
1924                 // Check if there is a value for LANGUAGE.
1925                 
1926                 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
1927                 
1928                         ProcessData.Append(";LANGUAGE=");
1929                         ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
1930                         
1931                 }
1932                 
1933                 // Check if there is a value for MEDIATYPE.
1934                 
1935                 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
1936                 
1937                         ProcessData.Append(";MEDIATYPE=");
1938                         ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
1939                         
1940                 }
1941                 
1942                 // Check if there is a value for PID.
1944                 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
1945                 
1946                         ProcessData.Append(";PID=");
1947                         ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
1948                         
1949                 }
1951                 // Check if there is a value for PREF.
1953                 if ((*SoundsListPref)[SoundsIter->first] > 0){
1954                 
1955                         ProcessData.Append(";PREF=");
1956                         ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
1957                         
1958                 }
1960                 // Check if there is a value for tokens.
1962                 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
1963                 
1964                         ProcessData.Append(";");
1965                         ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
1966                         
1967                 }
1968                 
1969                 ProcessData.Append(":data:");
1970                 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
1971                 ProcessData.Append(";");
1972                 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
1973                 ProcessData.Append(",");
1974                 ProcessData.Append(SoundsIter->second);
1975                 ProcessData.Append("\n");
1977                 ProcessData = OutputText(&ProcessData);
1978                 
1979                 SaveData->Append(ProcessData);
1980                 ProcessData.clear();
1981                         
1982         }
1983                 
1986 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
1987         map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
1988         map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
1989         map<int, wxString> *CalendarListTokens, wxString *SaveData){
1991         wxString ProcessData = "";
1992                 
1993         for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
1994                 CalendarIter != CalendarList->end(); CalendarIter++){
1996                 ProcessData.Append("CALURI");
1997                         
1998                 // Check if there is a value for TYPE.
1999                 
2000                 if ((*CalendarListType)[CalendarIter->first].size() > 0){
2001                 
2002                         ProcessData.Append(";TYPE=");
2003                         ProcessData.Append((*CalendarListType)[CalendarIter->first]);
2004                         
2005                 }
2006                 
2007                 // Check if there is a value for ALTID.
2008                 
2009                 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2010                 
2011                         ProcessData.Append(";ALTID=");
2012                         ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2013                         
2014                 }
2016                 // Check if there is a value for MEDIATYPE.
2017                 
2018                 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2019                 
2020                         ProcessData.Append(";MEDIATYPE=");
2021                         ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2022                         
2023                 }
2024                 
2025                 // Check if there is a value for PID.
2027                 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2028                 
2029                         ProcessData.Append(";PID=");
2030                         ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2031                         
2032                 }
2034                 // Check if there is a value for PREF.
2036                 if ((*CalendarListPref)[CalendarIter->first] > 0){
2037                 
2038                         ProcessData.Append(";PREF=");
2039                         ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2040                         
2041                 }
2043                 // Check if there is a value for tokens.
2045                 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2046                 
2047                         ProcessData.Append(";");
2048                         ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2049                         
2050                 }
2051                         
2052                 ProcessData.Append(":");
2053                 ProcessData.Append(CalendarIter->second);
2054                 ProcessData.Append("\n");
2056                 ProcessData = OutputText(&ProcessData);
2057                 
2058                 SaveData->Append(ProcessData);
2059                 ProcessData.clear();
2060                         
2061         }
2062                 
2065 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2066         map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2067         map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2068         map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2070         wxString ProcessData = "";
2071                 
2072         for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2073                 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2075                 ProcessData.Append("CALADRURI");
2076                         
2077                 // Check if there is a value for TYPE.
2078                 
2079                 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2080                 
2081                         ProcessData.Append(";TYPE=");
2082                         ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2083                         
2084                 }
2085                 
2086                 // Check if there is a value for ALTID.
2087                 
2088                 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2089                 
2090                         ProcessData.Append(";ALTID=");
2091                         ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2092                         
2093                 }
2095                 // Check if there is a value for MEDIATYPE.
2096                 
2097                 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2098                 
2099                         ProcessData.Append(";MEDIATYPE=");
2100                         ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2101                         
2102                 }
2103                 
2104                 // Check if there is a value for PID.
2106                 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2107                 
2108                         ProcessData.Append(";PID=");
2109                         ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2110                         
2111                 }
2113                 // Check if there is a value for PREF.
2115                 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2116                 
2117                         ProcessData.Append(";PREF=");
2118                         ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2119                         
2120                 }
2122                 // Check if there is a value for tokens.
2124                 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2125                 
2126                         ProcessData.Append(";");
2127                         ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2128                         
2129                 }
2130                         
2131                 ProcessData.Append(":");
2132                 ProcessData.Append(CalendarRequestIter->second);
2133                 ProcessData.Append("\n");
2135                 ProcessData = OutputText(&ProcessData);
2136                 
2137                 SaveData->Append(ProcessData);
2138                 ProcessData.clear();
2139                         
2140         }
2141                 
2144 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID, 
2145         std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2146         std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref, 
2147         std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2149         wxString ProcessData = "";
2150                 
2151         for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2152                 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2154                 ProcessData.Append("FBURL");
2155                         
2156                 // Check if there is a value for TYPE.
2157                 
2158                 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2159                 
2160                         ProcessData.Append(";TYPE=");
2161                         ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2162                         
2163                 }
2164                 
2165                 // Check if there is a value for ALTID.
2166                 
2167                 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2168                 
2169                         ProcessData.Append(";ALTID=");
2170                         ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2171                         
2172                 }
2174                 // Check if there is a value for MEDIATYPE.
2175                 
2176                 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2177                 
2178                         ProcessData.Append(";MEDIATYPE=");
2179                         ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2180                         
2181                 }
2182                 
2183                 // Check if there is a value for PID.
2185                 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2186                 
2187                         ProcessData.Append(";PID=");
2188                         ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2189                         
2190                 }
2192                 // Check if there is a value for PREF.
2194                 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2195                 
2196                         ProcessData.Append(";PREF=");
2197                         ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2198                         
2199                 }
2201                 // Check if there is a value for tokens.
2203                 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2204                 
2205                         ProcessData.Append(";");
2206                         ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2207                         
2208                 }
2209                         
2210                 ProcessData.Append(":");
2211                 ProcessData.Append(FreeBusyIter->second);
2212                 ProcessData.Append("\n");
2214                 ProcessData = OutputText(&ProcessData);
2215                 
2216                 SaveData->Append(ProcessData);
2217                 ProcessData.clear();
2218                         
2219         }
2220                 
2223 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID, 
2224         map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2225         map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType, 
2226         map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref, 
2227         map<int, wxString> *KeyListTokens, wxString *SaveData){
2229         wxString ProcessData = "";
2230                 
2231         for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2232                 KeyIter != KeyList->end(); KeyIter++){
2234                 ProcessData.Append("KEY");
2235                         
2236                 // Check if there is a value for TYPE.
2237                 
2238                 if ((*KeyListType)[KeyIter->first].size() > 0){
2239                 
2240                         ProcessData.Append(";TYPE=");
2241                         ProcessData.Append((*KeyListType)[KeyIter->first]);
2242                         
2243                 }
2244                 
2245                 // Check if there is a value for ALTID.
2246                 
2247                 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2248                 
2249                         ProcessData.Append(";ALTID=");
2250                         ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2251                         
2252                 }
2253                 
2254                 // Check if there is a value for PID.
2256                 if ((*KeyListPID)[KeyIter->first].size() > 0){
2257                 
2258                         ProcessData.Append(";PID=");
2259                         ProcessData.Append((*KeyListPID)[KeyIter->first]);
2260                         
2261                 }
2263                 // Check if there is a value for PREF.
2265                 if ((*KeyListPref)[KeyIter->first] > 0){
2266                 
2267                         ProcessData.Append(";PREF=");
2268                         ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2269                         
2270                 }
2272                 // Check if there is a value for tokens.
2274                 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2275                 
2276                         ProcessData.Append(";");
2277                         ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2278                         
2279                 }
2280                         
2281                 ProcessData.Append(":data:");
2282                 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2283                 ProcessData.Append(";");
2284                 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2285                 ProcessData.Append(",");
2286                 ProcessData.Append(KeyIter->second);
2287                 ProcessData.Append("\n");
2289                 ProcessData = OutputText(&ProcessData);
2290                 
2291                 SaveData->Append(ProcessData);
2292                 ProcessData.clear();
2293                         
2294         }
2295                 
2298 void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN, 
2299         map<int, wxString> *VendorListElement, wxString *SaveData){
2301         wxString ProcessData = "";
2302                 
2303         for (std::map<int, wxString>::iterator VendorIter = VendorList->begin();
2304                 VendorIter != VendorList->end(); VendorIter++){
2306                 ProcessData.Append("VND-");
2307                 ProcessData.Append((*VendorListPEN)[VendorIter->first]);
2308                 ProcessData.Append("-");
2309                 ProcessData.Append((*VendorListElement)[VendorIter->first]);
2310                 ProcessData.Append(":");
2311                 ProcessData.Append(VendorIter->second);
2312                 ProcessData.Append("\n");
2314                 ProcessData = OutputText(&ProcessData);
2315                 
2316                 SaveData->Append(ProcessData);
2317                 ProcessData.clear();
2318                         
2319         }
2320                 
2323 void ContactDataObject::SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens, 
2324         wxString *SaveData){
2326         wxString ProcessData = "";
2327                 
2328         for (std::map<int, wxString>::iterator XTokenIter = XTokenList->begin();
2329                 XTokenIter != XTokenList->end(); XTokenIter++){
2331                 ProcessData.Append("X-");
2332                 ProcessData.Append((*XTokenListTokens)[XTokenIter->first]);
2333                 ProcessData.Append(":");
2334                 ProcessData.Append(XTokenIter->second);
2335                 ProcessData.Append("\n");
2337                 ProcessData = OutputText(&ProcessData);
2338                 
2339                 SaveData->Append(ProcessData);
2340                 ProcessData.clear();
2341                         
2342         }       
2343                 
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