Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
f88d9ee6eaa91a541686de133f379aa7365cb6f6
[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         // Write the end part of the vCard data file.
625         
626         SaveData->Append("END:VCARD");
627         
628         SaveDataStatus = CONTACTSAVE_OK;
629         
630         return SaveDataStatus;
631         
634 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
635         map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
636         map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
637         map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
639         wxString ProcessData = "";
640                 
641         for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
642                 TitleIter != TitleList->end(); TitleIter++){
644                 ProcessData.Append("TITLE");
645                         
646                 // Check if there is a value for TYPE.
647                 
648                 if (DataType.size() > 0){
649                 
650                         ProcessData.Append(";TYPE=");
651                         ProcessData.Append(DataType);
652                         
653                 }
654                 
655                 // Check if there is a value for ALTID.
656                 
657                 if ((*TitleListAltID)[TitleIter->first].size() > 0){
658                 
659                         ProcessData.Append(";ALTID=");
660                         ProcessData.Append((*TitleListAltID)[TitleIter->first]);
661                         
662                 }
664                 // Check if there is a value for LANGUAGE.
665                 
666                 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
667                 
668                         ProcessData.Append(";LANGUAGE=");
669                         ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
670                         
671                 }
672                 
673                 // Check if there is a value for PID.
675                 if ((*TitleListPID)[TitleIter->first].size() > 0){
676                 
677                         ProcessData.Append(";PID=");
678                         ProcessData.Append((*TitleListPID)[TitleIter->first]);
679                         
680                 }
682                 // Check if there is a value for PREF.
684                 if ((*TitleListPref)[TitleIter->first] > 0){
685                 
686                         ProcessData.Append(";PREF=");
687                         ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
688                         
689                 }
691                 // Check if there is a value for tokens.
693                 if ((*TitleListTokens)[TitleIter->first].size() > 0){
694                 
695                         ProcessData.Append(";");
696                         ProcessData.Append((*TitleListTokens)[TitleIter->first]);
697                         
698                 }
699                         
700                 ProcessData.Append(":");
701                 ProcessData.Append(TitleIter->second);
702                 ProcessData.Append("\n");
704                 ProcessData = OutputText(&ProcessData);
705                         
706                 SaveData->Append(ProcessData);
707                 ProcessData.clear();
708                         
709         }
710                 
713 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID, 
714         map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
715         map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref, 
716         map<int, wxString> *SourceListTokens, wxString *SaveData){
718         wxString ProcessData = "";
719         
720         for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
721                 SourceIter != SourceList->end(); SourceIter++){
723                 ProcessData.Append("SOURCE");
724                         
725                 // Check if there is a value for TYPE.
726                 
727                 if ((*SourceListType)[SourceIter->first].size() > 0){
728                 
729                         ProcessData.Append(";TYPE=");
730                         ProcessData.Append((*SourceListType)[SourceIter->first]);
731                         
732                 }
733                 
734                 // Check if there is a value for ALTID.
735                 
736                 if ((*SourceListAltID)[SourceIter->first].size() > 0){
737                 
738                         ProcessData.Append(";ALTID=");
739                         ProcessData.Append((*SourceListAltID)[SourceIter->first]);
740                         
741                 }
743                 // Check if there is a value for MEDIATYPE.
744                 
745                 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
746                 
747                         ProcessData.Append(";MEDIATYPE=");
748                         ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
749                         
750                 }
751                 
752                 // Check if there is a value for PID.
754                 if ((*SourceListPID)[SourceIter->first].size() > 0){
755                 
756                         ProcessData.Append(";PID=");
757                         ProcessData.Append((*SourceListPID)[SourceIter->first]);
758                         
759                 }
761                 // Check if there is a value for PREF.
763                 if ((*SourceListPref)[SourceIter->first] > 0){
764                 
765                         ProcessData.Append(";PREF=");
766                         ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
767                         
768                 }
770                 // Check if there is a value for tokens.
772                 if ((*SourceListTokens)[SourceIter->first].size() > 0){
773                 
774                         ProcessData.Append(";");
775                         ProcessData.Append((*SourceListTokens)[SourceIter->first]);
776                         
777                 }
778                         
779                 ProcessData.Append(":");
780                 ProcessData.Append(SourceIter->second);
781                 ProcessData.Append("\n");
783                 ProcessData = OutputText(&ProcessData);
784                         
785                 SaveData->Append(ProcessData);
786                 ProcessData.clear();
787                         
788         }
789                 
792 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID, 
793         map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
794         map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref, 
795         map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
797         wxString ProcessData = "";
798         
799         for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
800                 NicknameIter != NicknameList->end(); NicknameIter++){
802                 ProcessData.Append("NICKNAME");
803                         
804                 // Check if there is a value for TYPE.
805                 
806                 if (DataType.size() > 0){
807                 
808                         ProcessData.Append(";TYPE=");
809                         ProcessData.Append(DataType);
810                         
811                 }
812                 
813                 // Check if there is a value for ALTID.
814                 
815                 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
816                 
817                         ProcessData.Append(";ALTID=");
818                         ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
819                         
820                 }
822                 // Check if there is a value for MEDIATYPE.
823                 
824                 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
825                 
826                         ProcessData.Append(";LANGUAGE=");
827                         ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
828                         
829                 }
830                 
831                 // Check if there is a value for PID.
833                 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
834                 
835                         ProcessData.Append(";PID=");
836                         ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
837                         
838                 }
840                 // Check if there is a value for PREF.
842                 if ((*NicknameListPref)[NicknameIter->first] > 0){
843                 
844                         ProcessData.Append(";PREF=");
845                         ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
846                         
847                 }
849                 // Check if there is a value for tokens.
851                 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
852                 
853                         ProcessData.Append(";");
854                         ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
855                         
856                 }
857                         
858                 ProcessData.Append(":");
859                 ProcessData.Append(NicknameIter->second);
860                 ProcessData.Append("\n");
862                 ProcessData = OutputText(&ProcessData);
863                         
864                 SaveData->Append(ProcessData);
865                 ProcessData.clear();
866                         
867         }
868                 
871 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID, 
872         map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
873         map<int, wxString> *TZListMediatype, map<int, int> *TZListPref, 
874         map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
876         wxString ProcessData = "";
877         
878         for (std::map<int, wxString>::iterator TZIter = TZList->begin();
879                 TZIter != TZList->end(); TZIter++){
881                 ProcessData.Append("TZ");
882                         
883                 // Check if there is a value for TYPE.
884                 
885                 if (DataType.size() > 0){
886                 
887                         ProcessData.Append(";TYPE=");
888                         ProcessData.Append(DataType);
889                         
890                 }
891                 
892                 // Check if there is a value for ALTID.
893                 
894                 if ((*TZListAltID)[TZIter->first].size() > 0){
895                 
896                         ProcessData.Append(";ALTID=");
897                         ProcessData.Append((*TZListAltID)[TZIter->first]);
898                         
899                 }
901                 // Check if there is a value for MEDIATYPE.
902                 
903                 if ((*TZListMediatype)[TZIter->first].size() > 0){
904                 
905                         ProcessData.Append(";MEDIATYPE=");
906                         ProcessData.Append((*TZListMediatype)[TZIter->first]);
907                         
908                 }
909                 
910                 // Check if there is a value for PID.
912                 if ((*TZListPID)[TZIter->first].size() > 0){
913                 
914                         ProcessData.Append(";PID=");
915                         ProcessData.Append((*TZListPID)[TZIter->first]);
916                         
917                 }
919                 // Check if there is a value for PREF.
921                 if ((*TZListPref)[TZIter->first] > 0){
922                 
923                         ProcessData.Append(";PREF=");
924                         ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
925                         
926                 }
928                 // Check if there is a value for tokens.
930                 if ((*TZListTokens)[TZIter->first].size() > 0){
931                 
932                         ProcessData.Append(";");
933                         ProcessData.Append((*TZListTokens)[TZIter->first]);
934                         
935                 }
936                         
937                 ProcessData.Append(":");
938                 ProcessData.Append(TZIter->second);
939                 ProcessData.Append("\n");
941                 ProcessData = OutputText(&ProcessData);
942                         
943                 SaveData->Append(ProcessData);
944                 ProcessData.clear();
945                         
946         }
947                 
950 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
951                 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
952                 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
953                 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
954                 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo, 
955                 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType, 
956                 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref, 
957                 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
959         wxString ProcessData = "";
960                         
961         for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
962                 AddressIter != AddressList->end(); AddressIter++){
963                         
964                 ProcessData.Append("ADR");
965                         
966                 // Check if there is a value for TYPE.
967                 
968                 if (DataType.size() > 0){
969                 
970                         ProcessData.Append(";TYPE=");
971                         ProcessData.Append(DataType);
972                         
973                 }
974                 
975                 // Check if there is a value for ALTID.
976                 
977                 if ((*AddressListAltID)[AddressIter->first].size() > 0){
978                 
979                         ProcessData.Append(";ALTID=");
980                         ProcessData.Append((*AddressListAltID)[AddressIter->first]);
981                         
982                 }
984                 // Check if there is a value for GEO.
985                 
986                 if ((*AddressListGeo)[AddressIter->first].size() > 0){
987                 
988                         ProcessData.Append(";GEO=\"");
989                         ProcessData.Append((*AddressListGeo)[AddressIter->first]);
990                         ProcessData.Append("\"");
991                         
992                 }
994                 // Check if there is a value for LABEL.
996                 if ((*AddressListLabel)[AddressIter->first].size() > 0){
997                 
998                         wxString AddressProcessed = "";
999                         AddressProcessed = (*AddressListLabel)[AddressIter->first];
1000                         
1001                         AddressProcessed.Replace("\n", "\\n", true);
1002                         
1003                         ProcessData.Append(";LABEL=");
1004                         ProcessData.Append(AddressProcessed);
1005                         
1006                 }
1007                 
1008                 // Check if there is a value for LANGUAGE.
1009                 
1010                 if ((*AddressListLang)[AddressIter->first].size() > 0){
1011                 
1012                         ProcessData.Append(";LANGUAGE=");
1013                         ProcessData.Append((*AddressListLang)[AddressIter->first]);
1014                         
1015                 }
1016                 
1017                 // Check if there is a value for MEDIATYPE.
1018                 
1019                 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1020                 
1021                         ProcessData.Append(";MEDIATYPE=");
1022                         ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1023                         
1024                 }
1025                 
1026                 // Check if there is a value for PID.
1028                 if ((*AddressListPID)[AddressIter->first].size() > 0){
1029                 
1030                         ProcessData.Append(";PID=");
1031                         ProcessData.Append((*AddressListPID)[AddressIter->first]);
1032                         
1033                 }
1035                 // Check if there is a value for PREF.
1037                 if ((*AddressListPref)[AddressIter->first] > 0){
1038                 
1039                         ProcessData.Append(";PREF=");
1040                         ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1041                         
1042                 }
1044                 // Check if there is a value for TZ.
1046                 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1047                 
1048                         ProcessData.Append(";TZ=");
1049                         ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1050                         
1051                 }
1052                 
1053                 // Check if there is a value for tokens.
1055                 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1056                 
1057                         ProcessData.Append(";");
1058                         ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1059                         
1060                 }
1061                 
1062                 // Build the address.
1063                 
1064                 ProcessData.Append(":;;");
1065                 ProcessData.Append((*AddressList)[AddressIter->first]);
1066                 ProcessData.Append(";");
1067                 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1068                 ProcessData.Append(";");
1069                 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1070                 ProcessData.Append(";");
1071                 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1072                 ProcessData.Append(";");
1073                 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1074                 ProcessData.Append("\n");
1075                 
1076                 ProcessData = OutputText(&ProcessData);
1077                         
1078                 SaveData->Append(ProcessData);
1079                 ProcessData.clear();
1080                         
1081         }
1082                         
1085 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID, 
1086         map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1087         map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens, 
1088         wxString *SaveData, wxString DataType){
1090         wxString ProcessData = "";
1091         
1092         for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1093                 EmailIter != EmailList->end(); EmailIter++){
1095                 ProcessData.Append("EMAIL");
1096                         
1097                 // Check if there is a value for TYPE.
1098                 
1099                 if (DataType.size() > 0){
1100                 
1101                         ProcessData.Append(";TYPE=");
1102                         ProcessData.Append(DataType);
1103                         
1104                 }
1105                 
1106                 // Check if there is a value for ALTID.
1107                 
1108                 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1109                 
1110                         ProcessData.Append(";ALTID=");
1111                         ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1112                         
1113                 }
1114                 
1115                 // Check if there is a value for PID.
1117                 if ((*EmailListPID)[EmailIter->first].size() > 0){
1118                 
1119                         ProcessData.Append(";PID=");
1120                         ProcessData.Append((*EmailListPID)[EmailIter->first]);
1121                         
1122                 }
1124                 // Check if there is a value for PREF.
1126                 if ((*EmailListPref)[EmailIter->first] > 0){
1127                 
1128                         ProcessData.Append(";PREF=");
1129                         ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1130                         
1131                 }
1133                 // Check if there is a value for tokens.
1135                 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1136                 
1137                         ProcessData.Append(";");
1138                         ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1139                         
1140                 }
1141                         
1142                 ProcessData.Append(":");
1143                 ProcessData.Append(EmailIter->second);
1144                 ProcessData.Append("\n");
1146                 ProcessData = OutputText(&ProcessData);
1147                         
1148                 SaveData->Append(ProcessData);
1149                 ProcessData.clear();
1150                         
1151         }
1152                 
1155 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID, 
1156         map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1157         map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens, 
1158         wxString *SaveData, wxString DataType){
1160         wxString ProcessData = "";
1161         
1162         for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1163                 LanguageIter != LanguageList->end(); LanguageIter++){
1165                 ProcessData.Append("LANG");
1166                         
1167                 // Check if there is a value for TYPE.
1168                 
1169                 if (DataType.size() > 0){
1170                 
1171                         ProcessData.Append(";TYPE=");
1172                         ProcessData.Append(DataType);
1173                         
1174                 }
1175                 
1176                 // Check if there is a value for ALTID.
1177                 
1178                 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1179                 
1180                         ProcessData.Append(";ALTID=");
1181                         ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1182                         
1183                 }
1184                 
1185                 // Check if there is a value for PID.
1187                 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1188                 
1189                         ProcessData.Append(";PID=");
1190                         ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1191                         
1192                 }
1194                 // Check if there is a value for PREF.
1196                 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1197                 
1198                         ProcessData.Append(";PREF=");
1199                         ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1200                         
1201                 }
1203                 // Check if there is a value for tokens.
1205                 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1206                 
1207                         ProcessData.Append(";");
1208                         ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1209                         
1210                 }
1211                         
1212                 ProcessData.Append(":");
1213                 ProcessData.Append(LanguageIter->second);
1214                 ProcessData.Append("\n");
1216                 ProcessData = OutputText(&ProcessData);
1217                         
1218                 SaveData->Append(ProcessData);
1219                 ProcessData.clear();
1220                         
1221         }
1222                 
1225 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID, 
1226         map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1227         map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1228         map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens, 
1229         wxString *SaveData, wxString DataType){
1231         wxString ProcessData = "";
1232         
1233         for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1234                 GeographyIter != GeographyList->end(); GeographyIter++){
1236                 ProcessData.Append("GEO");
1237                         
1238                 // Check if there is a value for TYPE.
1239                 
1240                 if (DataType.size() > 0){
1241                 
1242                         ProcessData.Append(";TYPE=");
1243                         ProcessData.Append(DataType);
1244                         
1245                 }
1246                 
1247                 // Check if there is a value for ALTID.
1248                 
1249                 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1250                 
1251                         ProcessData.Append(";ALTID=");
1252                         ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1253                         
1254                 }
1255                 
1256                 // Check if there is a value for MEDIATYPE.
1257                 
1258                 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1259                 
1260                         ProcessData.Append(";MEDIATYPE=");
1261                         ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1262                         
1263                 }
1264                 
1265                 // Check if there is a value for PID.
1267                 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1268                 
1269                         ProcessData.Append(";PID=");
1270                         ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1271                         
1272                 }
1274                 // Check if there is a value for PREF.
1276                 if ((*GeographyListPref)[GeographyIter->first] > 0){
1277                 
1278                         ProcessData.Append(";PREF=");
1279                         ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1280                         
1281                 }
1283                 // Check if there is a value for tokens.
1285                 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1286                 
1287                         ProcessData.Append(";");
1288                         ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1289                         
1290                 }
1291                         
1292                 ProcessData.Append(":");
1293                 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1294                 ProcessData.Append(":");
1295                 ProcessData.Append(GeographyIter->second);
1296                 ProcessData.Append("\n");
1298                 ProcessData = OutputText(&ProcessData);
1299                         
1300                 SaveData->Append(ProcessData);
1301                 ProcessData.clear();
1302                         
1303         }
1304                 
1307 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID, 
1308                 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1309                 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref, 
1310                 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1312         wxString ProcessData = "";
1313         
1314         for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1315                 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1317                 ProcessData.Append("URL");
1318                         
1319                 // Check if there is a value for TYPE.
1320                 
1321                 if (DataType.size() > 0){
1322                 
1323                         ProcessData.Append(";TYPE=");
1324                         ProcessData.Append(DataType);
1325                         
1326                 }
1327                 
1328                 // Check if there is a value for ALTID.
1329                 
1330                 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1331                 
1332                         ProcessData.Append(";ALTID=");
1333                         ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1334                         
1335                 }
1336                 
1337                 // Check if there is a value for MEDIATYPE.
1338                 
1339                 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1340                 
1341                         ProcessData.Append(";MEDIATYPE=");
1342                         ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1343                         
1344                 }
1345                 
1346                 // Check if there is a value for PID.
1348                 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1349                 
1350                         ProcessData.Append(";PID=");
1351                         ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1352                         
1353                 }
1355                 // Check if there is a value for PREF.
1357                 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1358                 
1359                         ProcessData.Append(";PREF=");
1360                         ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1361                         
1362                 }
1364                 // Check if there is a value for tokens.
1366                 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1367                 
1368                         ProcessData.Append(";");
1369                         ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1370                         
1371                 }
1372                         
1373                 ProcessData.Append(":");
1374                 ProcessData.Append(WebsiteIter->second);
1375                 ProcessData.Append("\n");
1377                 ProcessData = OutputText(&ProcessData);
1378                         
1379                 SaveData->Append(ProcessData);
1380                 ProcessData.clear();
1381                         
1382         }
1383                         
1386 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1387         map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1388         map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1389         map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1391         wxString ProcessData = "";
1392                 
1393         for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1394                 RoleIter != RoleList->end(); RoleIter++){
1396                 ProcessData.Append("ROLE");
1397                         
1398                 // Check if there is a value for TYPE.
1399                 
1400                 if (DataType.size() > 0){
1401                 
1402                         ProcessData.Append(";TYPE=");
1403                         ProcessData.Append(DataType);
1404                         
1405                 }
1406                 
1407                 // Check if there is a value for ALTID.
1408                 
1409                 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1410                 
1411                         ProcessData.Append(";ALTID=");
1412                         ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1413                         
1414                 }
1416                 // Check if there is a value for LANGUAGE.
1417                 
1418                 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1419                 
1420                         ProcessData.Append(";LANGUAGE=");
1421                         ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1422                         
1423                 }
1424                 
1425                 // Check if there is a value for PID.
1427                 if ((*RoleListPID)[RoleIter->first].size() > 0){
1428                 
1429                         ProcessData.Append(";PID=");
1430                         ProcessData.Append((*RoleListPID)[RoleIter->first]);
1431                         
1432                 }
1434                 // Check if there is a value for PREF.
1436                 if ((*RoleListPref)[RoleIter->first] > 0){
1437                 
1438                         ProcessData.Append(";PREF=");
1439                         ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1440                         
1441                 }
1443                 // Check if there is a value for tokens.
1445                 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1446                 
1447                         ProcessData.Append(";");
1448                         ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1449                         
1450                 }
1451                         
1452                 ProcessData.Append(":");
1453                 ProcessData.Append(RoleIter->second);
1454                 ProcessData.Append("\n");
1456                 ProcessData = OutputText(&ProcessData);
1457                 
1458                 SaveData->Append(ProcessData);
1459                 ProcessData.clear();
1460                         
1461         }
1462                 
1465 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1466         map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage, 
1467         map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType, 
1468         map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens, 
1469         wxString *SaveData, wxString DataType){
1471         wxString ProcessData = "";
1472                 
1473         for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1474                 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1476                 ProcessData.Append("ORG");
1477                         
1478                 // Check if there is a value for TYPE.
1479                 
1480                 if (DataType.size() > 0){
1481                 
1482                         ProcessData.Append(";TYPE=");
1483                         ProcessData.Append(DataType);
1484                         
1485                 }
1486                 
1487                 // Check if there is a value for ALTID.
1488                 
1489                 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1490                 
1491                         ProcessData.Append(";ALTID=");
1492                         ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1493                         
1494                 }
1496                 // Check if there is a value for LANGUAGE.
1497                 
1498                 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1499                 
1500                         ProcessData.Append(";LANGUAGE=");
1501                         ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1502                         
1503                 }
1504                 
1505                 // Check if there is a value for PID.
1507                 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1508                 
1509                         ProcessData.Append(";PID=");
1510                         ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1511                         
1512                 }
1514                 // Check if there is a value for PREF.
1516                 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1517                 
1518                         ProcessData.Append(";PREF=");
1519                         ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1520                         
1521                 }
1522                 
1523                 // Check if there is a value for SORT-AS.
1524                 
1525                 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1526                 
1527                         ProcessData.Append(";SORT-AS=\"");
1528                         ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1529                         ProcessData.Append("\"");
1530                         
1531                 }
1533                 // Check if there is a value for tokens.
1535                 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1536                 
1537                         ProcessData.Append(";");
1538                         ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1539                         
1540                 }
1541                         
1542                 ProcessData.Append(":");
1543                 ProcessData.Append(OrganisationIter->second);
1544                 ProcessData.Append("\n");
1546                 ProcessData = OutputText(&ProcessData);
1547                 
1548                 SaveData->Append(ProcessData);
1549                 ProcessData.clear();
1550                         
1551         }
1552                 
1555 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1556         map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1557         map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1558         map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1560         wxString ProcessData = "";
1561                 
1562         for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1563                 NoteIter != NoteList->end(); NoteIter++){
1565                 ProcessData.Append("NOTE");
1566                         
1567                 // Check if there is a value for TYPE.
1568                 
1569                 if (DataType.size() > 0){
1570                 
1571                         ProcessData.Append(";TYPE=");
1572                         ProcessData.Append(DataType);
1573                         
1574                 }
1575                 
1576                 // Check if there is a value for ALTID.
1577                 
1578                 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1579                 
1580                         ProcessData.Append(";ALTID=");
1581                         ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1582                         
1583                 }
1585                 // Check if there is a value for LANGUAGE.
1586                 
1587                 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1588                 
1589                         ProcessData.Append(";LANGUAGE=");
1590                         ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1591                         
1592                 }
1593                 
1594                 // Check if there is a value for PID.
1596                 if ((*NoteListPID)[NoteIter->first].size() > 0){
1597                 
1598                         ProcessData.Append(";PID=");
1599                         ProcessData.Append((*NoteListPID)[NoteIter->first]);
1600                         
1601                 }
1603                 // Check if there is a value for PREF.
1605                 if ((*NoteListPref)[NoteIter->first] > 0){
1606                 
1607                         ProcessData.Append(";PREF=");
1608                         ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1609                         
1610                 }
1612                 // Check if there is a value for tokens.
1614                 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1615                 
1616                         ProcessData.Append(";");
1617                         ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1618                         
1619                 }
1620                         
1621                 ProcessData.Append(":");
1622                 ProcessData.Append(NoteIter->second);
1623                 ProcessData.Replace("\n", "\\n", true);
1624                 ProcessData.Append("\n");
1626                 ProcessData = OutputText(&ProcessData);
1627                 
1628                 SaveData->Append(ProcessData);
1629                 ProcessData.clear();
1630                         
1631         }
1632                 
1635 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1636         map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1637         map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1638         map<int, wxString> *CategoryListTokens, wxString *SaveData){
1640         wxString ProcessData = "";
1641                 
1642         for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1643                 CategoryIter != CategoryList->end(); CategoryIter++){
1645                 ProcessData.Append("CATEGORIES");
1646                         
1647                 // Check if there is a value for TYPE.
1648                 
1649                 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1650                 
1651                         ProcessData.Append(";TYPE=");
1652                         ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1653                         
1654                 }
1655                 
1656                 // Check if there is a value for ALTID.
1657                 
1658                 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1659                 
1660                         ProcessData.Append(";ALTID=");
1661                         ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1662                         
1663                 }
1665                 // Check if there is a value for LANGUAGE.
1666                 
1667                 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1668                 
1669                         ProcessData.Append(";LANGUAGE=");
1670                         ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1671                         
1672                 }
1673                 
1674                 // Check if there is a value for PID.
1676                 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1677                 
1678                         ProcessData.Append(";PID=");
1679                         ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1680                         
1681                 }
1683                 // Check if there is a value for PREF.
1685                 if ((*CategoryListPref)[CategoryIter->first] > 0){
1686                 
1687                         ProcessData.Append(";PREF=");
1688                         ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1689                         
1690                 }
1692                 // Check if there is a value for tokens.
1694                 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1695                 
1696                         ProcessData.Append(";");
1697                         ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1698                         
1699                 }
1700                         
1701                 ProcessData.Append(":");
1702                 ProcessData.Append(CategoryIter->second);
1703                 ProcessData.Append("\n");
1705                 ProcessData = OutputText(&ProcessData);
1706                 
1707                 SaveData->Append(ProcessData);
1708                 ProcessData.clear();
1709                         
1710         }
1711                 
1714 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID, 
1715                 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1716                 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1717                 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1718                 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1720         wxString ProcessData = "";
1721                 
1722         for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1723                 PicturesIter != PicturesList->end(); PicturesIter++){
1725                 ProcessData.Append("PHOTO");
1726                         
1727                 // Check if there is a value for TYPE.
1728                 
1729                 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1730                 
1731                         ProcessData.Append(";TYPE=");
1732                         ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1733                         
1734                 }
1735                 
1736                 // Check if there is a value for ALTID.
1737                 
1738                 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1739                 
1740                         ProcessData.Append(";ALTID=");
1741                         ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1742                         
1743                 }
1745                 // Check if there is a value for MEDIATYPE..
1746                 
1747                 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1748                 
1749                         ProcessData.Append(";MEDIATYPE=");
1750                         ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1751                         
1752                 }
1753                 
1754                 // Check if there is a value for PID.
1756                 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1757                 
1758                         ProcessData.Append(";PID=");
1759                         ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1760                         
1761                 }
1763                 // Check if there is a value for PREF.
1765                 if ((*PicturesListPref)[PicturesIter->first] > 0){
1766                 
1767                         ProcessData.Append(";PREF=");
1768                         ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1769                         
1770                 }
1772                 // Check if there is a value for tokens.
1774                 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1775                 
1776                         ProcessData.Append(";");
1777                         ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1778                         
1779                 }
1780                 
1781                 ProcessData.Append(":data:");
1782                 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1783                 ProcessData.Append(";");
1784                 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1785                 ProcessData.Append(",");
1786                 ProcessData.Append(PicturesIter->second);
1787                 ProcessData.Append("\n");
1789                 ProcessData = OutputText(&ProcessData);
1790                 
1791                 SaveData->Append(ProcessData);
1792                 ProcessData.clear();
1793                         
1794         }
1795                         
1798 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID, 
1799         map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
1800         map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
1801         map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
1802         map<int, wxString> *LogosListTokens, wxString *SaveData){
1804         wxString ProcessData = "";
1805                 
1806         for (std::map<int, string>::iterator LogosIter = LogosList->begin();
1807                 LogosIter != LogosList->end(); LogosIter++){
1809                 ProcessData.Append("LOGO");
1810                         
1811                 // Check if there is a value for TYPE.
1812                 
1813                 if ((*LogosListType)[LogosIter->first].size() > 0){
1814                 
1815                         ProcessData.Append(";TYPE=");
1816                         ProcessData.Append((*LogosListType)[LogosIter->first]);
1817                         
1818                 }
1819                 
1820                 // Check if there is a value for ALTID.
1821                 
1822                 if ((*LogosListAltID)[LogosIter->first].size() > 0){
1823                 
1824                         ProcessData.Append(";ALTID=");
1825                         ProcessData.Append((*LogosListAltID)[LogosIter->first]);
1826                         
1827                 }
1829                 // Check if there is a value for MEDIATYPE..
1830                 
1831                 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
1832                 
1833                         ProcessData.Append(";MEDIATYPE=");
1834                         ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
1835                         
1836                 }
1837                 
1838                 // Check if there is a value for PID.
1840                 if ((*LogosListPID)[LogosIter->first].size() > 0){
1841                 
1842                         ProcessData.Append(";PID=");
1843                         ProcessData.Append((*LogosListPID)[LogosIter->first]);
1844                         
1845                 }
1847                 // Check if there is a value for PREF.
1849                 if ((*LogosListPref)[LogosIter->first] > 0){
1850                 
1851                         ProcessData.Append(";PREF=");
1852                         ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
1853                         
1854                 }
1856                 // Check if there is a value for tokens.
1858                 if ((*LogosListTokens)[LogosIter->first].size() > 0){
1859                 
1860                         ProcessData.Append(";");
1861                         ProcessData.Append((*LogosListTokens)[LogosIter->first]);
1862                         
1863                 }
1864                 
1865                 ProcessData.Append(":data:");
1866                 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
1867                 ProcessData.Append(";");
1868                 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
1869                 ProcessData.Append(",");
1870                 ProcessData.Append(LogosIter->second);
1871                 ProcessData.Append("\n");
1873                 ProcessData = OutputText(&ProcessData);
1874                 
1875                 SaveData->Append(ProcessData);
1876                 ProcessData.clear();
1877                         
1878         }
1879                 
1882 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID, 
1883         map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
1884         map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
1885         map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage, 
1886         map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens, 
1887         wxString *SaveData){
1889         wxString ProcessData = "";
1890                 
1891         for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
1892                 SoundsIter != SoundsList->end(); SoundsIter++){
1894                 ProcessData.Append("SOUND");
1895                         
1896                 // Check if there is a value for TYPE.
1897                 
1898                 if ((*SoundsListType)[SoundsIter->first].size() > 0){
1899                 
1900                         ProcessData.Append(";TYPE=");
1901                         ProcessData.Append((*SoundsListType)[SoundsIter->first]);
1902                         
1903                 }
1904                 
1905                 // Check if there is a value for ALTID.
1906                 
1907                 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
1908                 
1909                         ProcessData.Append(";ALTID=");
1910                         ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
1911                         
1912                 }
1914                 // Check if there is a value for LANGUAGE.
1915                 
1916                 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
1917                 
1918                         ProcessData.Append(";LANGUAGE=");
1919                         ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
1920                         
1921                 }
1922                 
1923                 // Check if there is a value for MEDIATYPE.
1924                 
1925                 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
1926                 
1927                         ProcessData.Append(";MEDIATYPE=");
1928                         ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
1929                         
1930                 }
1931                 
1932                 // Check if there is a value for PID.
1934                 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
1935                 
1936                         ProcessData.Append(";PID=");
1937                         ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
1938                         
1939                 }
1941                 // Check if there is a value for PREF.
1943                 if ((*SoundsListPref)[SoundsIter->first] > 0){
1944                 
1945                         ProcessData.Append(";PREF=");
1946                         ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
1947                         
1948                 }
1950                 // Check if there is a value for tokens.
1952                 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
1953                 
1954                         ProcessData.Append(";");
1955                         ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
1956                         
1957                 }
1958                 
1959                 ProcessData.Append(":data:");
1960                 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
1961                 ProcessData.Append(";");
1962                 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
1963                 ProcessData.Append(",");
1964                 ProcessData.Append(SoundsIter->second);
1965                 ProcessData.Append("\n");
1967                 ProcessData = OutputText(&ProcessData);
1968                 
1969                 SaveData->Append(ProcessData);
1970                 ProcessData.clear();
1971                         
1972         }
1973                 
1976 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
1977         map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
1978         map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
1979         map<int, wxString> *CalendarListTokens, wxString *SaveData){
1981         wxString ProcessData = "";
1982                 
1983         for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
1984                 CalendarIter != CalendarList->end(); CalendarIter++){
1986                 ProcessData.Append("CALURI");
1987                         
1988                 // Check if there is a value for TYPE.
1989                 
1990                 if ((*CalendarListType)[CalendarIter->first].size() > 0){
1991                 
1992                         ProcessData.Append(";TYPE=");
1993                         ProcessData.Append((*CalendarListType)[CalendarIter->first]);
1994                         
1995                 }
1996                 
1997                 // Check if there is a value for ALTID.
1998                 
1999                 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2000                 
2001                         ProcessData.Append(";ALTID=");
2002                         ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2003                         
2004                 }
2006                 // Check if there is a value for MEDIATYPE.
2007                 
2008                 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2009                 
2010                         ProcessData.Append(";MEDIATYPE=");
2011                         ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2012                         
2013                 }
2014                 
2015                 // Check if there is a value for PID.
2017                 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2018                 
2019                         ProcessData.Append(";PID=");
2020                         ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2021                         
2022                 }
2024                 // Check if there is a value for PREF.
2026                 if ((*CalendarListPref)[CalendarIter->first] > 0){
2027                 
2028                         ProcessData.Append(";PREF=");
2029                         ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2030                         
2031                 }
2033                 // Check if there is a value for tokens.
2035                 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2036                 
2037                         ProcessData.Append(";");
2038                         ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2039                         
2040                 }
2041                         
2042                 ProcessData.Append(":");
2043                 ProcessData.Append(CalendarIter->second);
2044                 ProcessData.Append("\n");
2046                 ProcessData = OutputText(&ProcessData);
2047                 
2048                 SaveData->Append(ProcessData);
2049                 ProcessData.clear();
2050                         
2051         }
2052                 
2055 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2056         map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2057         map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2058         map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2060         wxString ProcessData = "";
2061                 
2062         for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2063                 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2065                 ProcessData.Append("CALADRURI");
2066                         
2067                 // Check if there is a value for TYPE.
2068                 
2069                 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2070                 
2071                         ProcessData.Append(";TYPE=");
2072                         ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2073                         
2074                 }
2075                 
2076                 // Check if there is a value for ALTID.
2077                 
2078                 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2079                 
2080                         ProcessData.Append(";ALTID=");
2081                         ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2082                         
2083                 }
2085                 // Check if there is a value for MEDIATYPE.
2086                 
2087                 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2088                 
2089                         ProcessData.Append(";MEDIATYPE=");
2090                         ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2091                         
2092                 }
2093                 
2094                 // Check if there is a value for PID.
2096                 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2097                 
2098                         ProcessData.Append(";PID=");
2099                         ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2100                         
2101                 }
2103                 // Check if there is a value for PREF.
2105                 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2106                 
2107                         ProcessData.Append(";PREF=");
2108                         ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2109                         
2110                 }
2112                 // Check if there is a value for tokens.
2114                 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2115                 
2116                         ProcessData.Append(";");
2117                         ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2118                         
2119                 }
2120                         
2121                 ProcessData.Append(":");
2122                 ProcessData.Append(CalendarRequestIter->second);
2123                 ProcessData.Append("\n");
2125                 ProcessData = OutputText(&ProcessData);
2126                 
2127                 SaveData->Append(ProcessData);
2128                 ProcessData.clear();
2129                         
2130         }
2131                 
2134 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID, 
2135         std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2136         std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref, 
2137         std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2139         wxString ProcessData = "";
2140                 
2141         for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2142                 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2144                 ProcessData.Append("FBURL");
2145                         
2146                 // Check if there is a value for TYPE.
2147                 
2148                 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2149                 
2150                         ProcessData.Append(";TYPE=");
2151                         ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2152                         
2153                 }
2154                 
2155                 // Check if there is a value for ALTID.
2156                 
2157                 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2158                 
2159                         ProcessData.Append(";ALTID=");
2160                         ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2161                         
2162                 }
2164                 // Check if there is a value for MEDIATYPE.
2165                 
2166                 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2167                 
2168                         ProcessData.Append(";MEDIATYPE=");
2169                         ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2170                         
2171                 }
2172                 
2173                 // Check if there is a value for PID.
2175                 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2176                 
2177                         ProcessData.Append(";PID=");
2178                         ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2179                         
2180                 }
2182                 // Check if there is a value for PREF.
2184                 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2185                 
2186                         ProcessData.Append(";PREF=");
2187                         ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2188                         
2189                 }
2191                 // Check if there is a value for tokens.
2193                 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2194                 
2195                         ProcessData.Append(";");
2196                         ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2197                         
2198                 }
2199                         
2200                 ProcessData.Append(":");
2201                 ProcessData.Append(FreeBusyIter->second);
2202                 ProcessData.Append("\n");
2204                 ProcessData = OutputText(&ProcessData);
2205                 
2206                 SaveData->Append(ProcessData);
2207                 ProcessData.clear();
2208                         
2209         }
2210                 
2213 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID, 
2214         map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2215         map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType, 
2216         map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref, 
2217         map<int, wxString> *KeyListTokens, wxString *SaveData){
2219         wxString ProcessData = "";
2220                 
2221         for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2222                 KeyIter != KeyList->end(); KeyIter++){
2224                 ProcessData.Append("KEY");
2225                         
2226                 // Check if there is a value for TYPE.
2227                 
2228                 if ((*KeyListType)[KeyIter->first].size() > 0){
2229                 
2230                         ProcessData.Append(";TYPE=");
2231                         ProcessData.Append((*KeyListType)[KeyIter->first]);
2232                         
2233                 }
2234                 
2235                 // Check if there is a value for ALTID.
2236                 
2237                 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2238                 
2239                         ProcessData.Append(";ALTID=");
2240                         ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2241                         
2242                 }
2243                 
2244                 // Check if there is a value for PID.
2246                 if ((*KeyListPID)[KeyIter->first].size() > 0){
2247                 
2248                         ProcessData.Append(";PID=");
2249                         ProcessData.Append((*KeyListPID)[KeyIter->first]);
2250                         
2251                 }
2253                 // Check if there is a value for PREF.
2255                 if ((*KeyListPref)[KeyIter->first] > 0){
2256                 
2257                         ProcessData.Append(";PREF=");
2258                         ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2259                         
2260                 }
2262                 // Check if there is a value for tokens.
2264                 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2265                 
2266                         ProcessData.Append(";");
2267                         ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2268                         
2269                 }
2270                         
2271                 ProcessData.Append(":data:");
2272                 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2273                 ProcessData.Append(";");
2274                 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2275                 ProcessData.Append(",");
2276                 ProcessData.Append(KeyIter->second);
2277                 ProcessData.Append("\n");
2279                 ProcessData = OutputText(&ProcessData);
2280                 
2281                 SaveData->Append(ProcessData);
2282                 ProcessData.clear();
2283                         
2284         }
2285                 
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