Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
59b67adec67e514c0fde83807125132b8cbdbf7b
[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         // Process REV.
83         
84         wxDateTime DateTimeSave;
85         DateTimeSave = DateTimeSave.SetToCurrent();
86         wxString DateTimeSaveValue;
87         
88 #ifdef XAB_UNITTEST
89         
90         DateTimeSaveValue += "20160703T091000Z";
91         
92 #else
93     
94         DateTimeSaveValue += wxString::Format("%04i", DateTimeSave.GetYear());
95         DateTimeSaveValue += wxString::Format("%02i", (DateTimeSave.GetMonth() + 1));
96         DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetDay());
97         DateTimeSaveValue += "T";
98         DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetHour());
99         DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetMinute());
100         DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetSecond());
101         DateTimeSaveValue += "Z";
102     
103 #endif
104         
105         if (!RevisionTokens.IsEmpty()){
106                 
107                 ProcessData.Append("REV;");
108                 ProcessData.Append(RevisionTokens);
109                 ProcessData.Append(":");
110                 ProcessData.Append(DateTimeSaveValue);
111                 ProcessData.Append("\n");
112                 
113                 ProcessData = OutputText(&ProcessData);
114                 
115                 SaveData->Append(ProcessData);
116                 ProcessData.clear();            
117                 
118         } else {
119         
120                 ProcessData.Append("REV:");
121                 ProcessData.Append(DateTimeSaveValue);
122                 ProcessData.Append("\n");
123                 
124                 ProcessData = OutputText(&ProcessData);
125                 
126                 SaveData->Append(ProcessData);
127                 ProcessData.clear();
128                 
129         }
130         
131         // Process XML.
133         for (std::map<int, wxString>::iterator XMLIter = XMLList.begin();
134                 XMLIter != XMLList.end(); XMLIter++){
135         
136                 ProcessData.Append("XML");
137                         
138                 if (XMLListAltID[XMLIter->first].size() > 0){
139                 
140                         ProcessData.Append(";ALTID=");
141                         ProcessData.Append(XMLListAltID[XMLIter->first]);
142                         
143                 }
144                         
145                 ProcessData.Append(":");
146                 ProcessData.Append(XMLIter->second);
147                 ProcessData.Append("\n");
148                 
149                 ProcessData = OutputText(&ProcessData);
150                 
151                 SaveData->Append(ProcessData);
152                 ProcessData.clear();
153                         
154         }
155         
156         // Process SOURCE.
157         
158         SaveSource(&SourceList, &SourceListAltID, 
159                 &SourceListPID, &SourceListType,
160                 &SourceListMediatype, &SourceListPref, 
161                 &SourceListTokens, SaveData);
162         
163         // Process MEMBER (if contact kind is CONTACTKIND_GROUP).
164         
165         if (ContactKind == CONTACTKIND_GROUP){
166                 
167                 SaveMember(&GroupsList, &GroupsListAltID, 
168                         &GroupsListPID, &GroupsListType,
169                         &GroupsListMediaType, &GroupsListPref, 
170                         &GroupsListTokens, SaveData);
171                 
172         }
173         
174         // Process CLIENTPIDMAP.
175         
176         for (std::map<int, wxString>::iterator CPIDIter = ClientPIDList.begin();
177                 CPIDIter != ClientPIDList.end(); CPIDIter++){
178         
179                 ProcessData.Append("CLIENTPIDMAP");
180                         
181                 if (ClientPIDListTokens[CPIDIter->first].size() > 0){
182                 
183                         ProcessData.Append(";");
184                         ProcessData.Append(ClientPIDListTokens[CPIDIter->first]);
185                         
186                 }
187                         
188                 ProcessData.Append(":");
189                 ProcessData.Append(CPIDIter->second);
190                 ProcessData.Append("\n");
191                 
192                 ProcessData = OutputText(&ProcessData);
193                 
194                 SaveData->Append(ProcessData);
195                 ProcessData.clear();
196                         
197         }
198         
199         // Process FN.
200         
201         for (std::map<int, wxString>::iterator FNIter = FullNamesList.begin();
202                 FNIter != FullNamesList.end(); FNIter++){
203                 
204                 ProcessData.Append("FN");
206                 // Check if there is a value for TYPE.
207                 
208                 if (FullNamesListType[FNIter->first].size() > 0){
209                 
210                         ProcessData.Append(";TYPE=");
211                         ProcessData.Append(FullNamesListType[FNIter->first]);
212                         
213                 }
215                 // Check if there is a value for LANGUAGE.
216                 
217                 if (FullNamesListLanguage[FNIter->first].size() > 0){
218                 
219                         ProcessData.Append(";LANGUAGE=");
220                         ProcessData.Append(FullNamesListLanguage[FNIter->first]);
221                         
222                 }
223                 
224                 // Check if there is a value for ALTID.
225                 
226                 if (FullNamesListAltID[FNIter->first].size() > 0){
227                 
228                         ProcessData.Append(";ALTID=");
229                         ProcessData.Append(FullNamesListAltID[FNIter->first]);
230                         
231                 }
232                 
233                 // Check if there is a value for PID.
235                 if (FullNamesListPID[FNIter->first].size() > 0){
236                 
237                         ProcessData.Append(";PID=");
238                         ProcessData.Append(FullNamesListPID[FNIter->first]);
239                         
240                 }
242                 // Check if there is a value for PREF.
244                 if (FullNamesListPref[FNIter->first] > 0){
245                 
246                         ProcessData.Append(";PREF=");
247                         ProcessData.Append(wxString::Format("%i", FullNamesListPref[FNIter->first]));
248                         
249                 }
251                 // Check if there is a value for tokens.
253                 if (FullNamesListTokens[FNIter->first].size() > 0){
254                 
255                         ProcessData.Append(";");
256                         ProcessData.Append(FullNamesListTokens[FNIter->first]);
257                         
258                 }
259                 
260                 ProcessData.Append(":");
261                 ProcessData.Append(FNIter->second);
262                 ProcessData.Append("\n");
263                 
264                 ProcessData = OutputText(&ProcessData);
265                 
266                 SaveData->Append(ProcessData);
267                 ProcessData.clear();
268                         
269         }
270         
271         // Process NICKNAME.
272         
273         SaveNickname(&GeneralNicknamesList, &GeneralNicknamesListAltID, 
274                 &GeneralNicknamesListPID, &GeneralNicknamesListType,
275                 &GeneralNicknamesListLanguage, &GeneralNicknamesListPref, 
276                 &GeneralNicknamesListTokens, SaveData, "");
277         SaveNickname(&HomeNicknamesList, &HomeNicknamesListAltID, 
278                 &HomeNicknamesListPID, &HomeNicknamesListType,
279                 &HomeNicknamesListLanguage, &HomeNicknamesListPref, 
280                 &HomeNicknamesListTokens, SaveData, "home");
281         SaveNickname(&BusinessNicknamesList, &BusinessNicknamesListAltID, 
282                 &BusinessNicknamesListPID, &BusinessNicknamesListType,
283                 &BusinessNicknamesListLanguage, &BusinessNicknamesListPref, 
284                 &BusinessNicknamesListTokens, SaveData, "work");
285         
286         // Process TITLE.
288         SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
289                 &GeneralTitleListAltID, &GeneralTitleListPID,
290                 &GeneralTitleListType, &GeneralTitleListPref,
291                 &GeneralTitleListTokens, SaveData, "");
292         SaveTitle(&HomeTitleList, &HomeTitleListLanguage,
293                 &HomeTitleListAltID, &HomeTitleListPID,
294                 &HomeTitleListType, &HomeTitleListPref,
295                 &HomeTitleListTokens, SaveData, "home");
296         SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage,
297                 &BusinessTitleListAltID, &BusinessTitleListPID,
298                 &BusinessTitleListType, &BusinessTitleListPref,
299                 &BusinessTitleListTokens, SaveData, "work");
300         
301         // Process TZ.
302         
303         SaveTimezone(&GeneralTZList, &GeneralTZListAltID, 
304                 &GeneralTZListPID, &GeneralTZListType,
305                 &GeneralTZListMediatype, &GeneralTZListPref, 
306                 &GeneralTZListTokens, SaveData, "");
307         SaveTimezone(&HomeTZList, &HomeTZListAltID, 
308                 &HomeTZListPID, &HomeTZListType,
309                 &HomeTZListMediatype, &HomeTZListPref, 
310                 &HomeTZListTokens, SaveData, "home");
311         SaveTimezone(&BusinessTZList, &BusinessTZListAltID, 
312                 &BusinessTZListPID, &BusinessTZListType,
313                 &BusinessTZListMediatype, &BusinessTZListPref, 
314                 &BusinessTZListTokens, SaveData, "work");
316         // Process ADR.
317         
318         SaveAddress(&GeneralAddressList, &GeneralAddressListTown,
319                 &GeneralAddressListCounty, &GeneralAddressListPostCode,
320                 &GeneralAddressListCountry, &GeneralAddressListLabel,
321                 &GeneralAddressListLang, &GeneralAddressListAltID,
322                 &GeneralAddressListPID, &GeneralAddressListGeo, 
323                 &GeneralAddressListTimezone, &GeneralAddressListType, 
324                 &GeneralAddressListMediatype, &GeneralAddressListPref,
325                 &GeneralAddressListTokens, SaveData, "");
326         SaveAddress(&HomeAddressList, &HomeAddressListTown,
327                 &HomeAddressListCounty, &HomeAddressListPostCode,
328                 &HomeAddressListCountry, &HomeAddressListLabel,
329                 &HomeAddressListLang, &HomeAddressListAltID,
330                 &HomeAddressListPID, &HomeAddressListGeo, 
331                 &HomeAddressListTimezone, &HomeAddressListType, 
332                 &HomeAddressListMediatype, &HomeAddressListPref,
333                 &HomeAddressListTokens, SaveData, "home");
334         SaveAddress(&BusinessAddressList, &BusinessAddressListTown,
335                 &BusinessAddressListCounty, &BusinessAddressListPostCode,
336                 &BusinessAddressListCountry, &BusinessAddressListLabel,
337                 &BusinessAddressListLang, &BusinessAddressListAltID,
338                 &BusinessAddressListPID, &BusinessAddressListGeo, 
339                 &BusinessAddressListTimezone, &BusinessAddressListType, 
340                 &BusinessAddressListMediatype, &BusinessAddressListPref,
341                 &BusinessAddressListTokens, SaveData, "work");
343         // Process EMAIL.
344         
345         SaveEmail(&GeneralEmailList, &GeneralEmailListAltID, 
346                 &GeneralEmailListPID, &GeneralEmailListType,
347                 &GeneralEmailListPref, &GeneralEmailListTokens, 
348                 SaveData, "");
349         SaveEmail(&HomeEmailList, &HomeEmailListAltID, 
350                 &HomeEmailListPID, &HomeEmailListType,
351                 &HomeEmailListPref, &HomeEmailListTokens, 
352                 SaveData, "home");
353         SaveEmail(&BusinessEmailList, &BusinessEmailListAltID, 
354                 &BusinessEmailListPID, &BusinessEmailListType,
355                 &BusinessEmailListPref, &BusinessEmailListTokens, 
356                 SaveData, "work");
358         // Process IMPP.
359         
360         SaveIMPP(&GeneralIMList, &GeneralIMListAltID, 
361                 &GeneralIMListPID, &GeneralIMListType,
362                 &GeneralIMListTypeInfo, &GeneralIMListMediatype, 
363                 &GeneralIMListPref, &GeneralIMListTokens,
364                 SaveData, "");
365         SaveIMPP(&HomeIMList, &HomeIMListAltID, 
366                 &HomeIMListPID, &HomeIMListType,
367                 &HomeIMListTypeInfo, &HomeIMListMediatype, 
368                 &HomeIMListPref, &HomeIMListTokens,
369                 SaveData, "home");
370         SaveIMPP(&BusinessIMList, &BusinessIMListAltID, 
371                 &BusinessIMListPID, &BusinessIMListType,
372                 &BusinessIMListTypeInfo, &BusinessIMListMediatype, 
373                 &BusinessIMListPref, &BusinessIMListTokens,
374                 SaveData, "work");
376         // TODO: Process TEL.
377         
378         
379         
380         // Process LANG.
381         
382         SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID, 
383                 &GeneralLanguageListPID, &GeneralLanguageListType,
384                 &GeneralLanguageListPref, &GeneralLanguageListTokens, 
385                 SaveData, "");
386         SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID, 
387                 &HomeLanguageListPID, &HomeLanguageListType,
388                 &HomeLanguageListPref, &HomeLanguageListTokens, 
389                 SaveData, "home");
390         SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID, 
391                 &BusinessLanguageListPID, &BusinessLanguageListType,
392                 &BusinessLanguageListPref, &BusinessLanguageListTokens, 
393                 SaveData, "work");
395         // Process GEO.
396         
397         SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID, 
398                 &GeneralGeographyListPID, &GeneralGeographyListType,
399                 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
400                 &GeneralGeographyListPref, &GeneralGeographyListTokens, 
401                 SaveData, "");
402         SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID, 
403                 &HomeGeographyListPID, &HomeGeographyListType,
404                 &HomeGeographyListMediatype, &HomeGeographyListDataType,
405                 &HomeGeographyListPref, &HomeGeographyListTokens, 
406                 SaveData, "home");
407         SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID, 
408                 &BusinessGeographyListPID, &BusinessGeographyListType,
409                 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
410                 &BusinessGeographyListPref, &BusinessGeographyListTokens, 
411                 SaveData, "work");
413         // Process RELATED.
414         
415         int Moo = 0;
417         for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
418                 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
419                 
420                 ProcessData.Append("RELATED");
422                 // Check if there is a value for TYPE.
423                 
424                 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
425                 
426                         wxString RelatedType = "";
427                         
428                         ProcessData.Append(";TYPE=");
429                         
430                         if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
432                                 RelatedType = wxT("contact");
434                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
436                                 RelatedType = wxT("acquaintance");
438                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
440                                 RelatedType = wxT("friend");
442                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
444                                 RelatedType = wxT("met");
446                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
448                                 RelatedType = wxT("co-worker");
450                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
452                                 RelatedType = wxT("colleague");
454                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
456                                 RelatedType = wxT("co-resident");
458                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
460                                 RelatedType = wxT("neighbor");
462                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
464                                 RelatedType = wxT("child");
466                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
468                                 RelatedType = wxT("parent");
470                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
472                                 RelatedType = wxT("sibling");
474                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
476                                 RelatedType = wxT("spouse");
478                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
480                                 RelatedType = wxT("kin");
482                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
484                                 RelatedType = wxT("muse");
486                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
488                                 RelatedType = wxT("crush");
490                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
492                                 RelatedType = wxT("date");
494                         } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
496                                 RelatedType = wxT("sweetheart");
498                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
500                                 RelatedType = wxT("me");
502                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
504                                 RelatedType = wxT("agent");
506                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
508                                 RelatedType = wxT("emergency");
510                         } else {
512                                 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
514                         }
515                         
516                         ProcessData.Append(RelatedType);
517                         
518                 }
520                 // Check if there is a value for LANGUAGE.
521                 
522                 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
523                 
524                         ProcessData.Append(";LANGUAGE=");
525                         ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
526                         
527                 }
528                 
529                 // Check if there is a value for ALTID.
530                 
531                 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
532                 
533                         ProcessData.Append(";ALTID=");
534                         ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
535                         
536                 }
537                 
538                 // Check if there is a value for PID.
540                 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
541                 
542                         ProcessData.Append(";PID=");
543                         ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
544                         
545                 }
547                 // Check if there is a value for PREF.
549                 if (GeneralRelatedListPref[RelatedIter->first] > 0){
550                 
551                         ProcessData.Append(";PREF=");
552                         ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
553                         
554                 }
556                 // Check if there is a value for tokens.
558                 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
559                 
560                         ProcessData.Append(";");
561                         ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
562                         
563                 }
564                 
565                 ProcessData.Append(":");
566                 ProcessData.Append(RelatedIter->second);
567                 ProcessData.Append("\n");
568                 
569                 ProcessData = OutputText(&ProcessData);
570                 
571                 SaveData->Append(ProcessData);
572                 ProcessData.clear();
573                         
574         }
575         
576         // Process URL.
577         
578         SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID, 
579                 &GeneralWebsiteListPID, &GeneralWebsiteListType,
580                 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref, 
581                 &GeneralWebsiteListTokens, SaveData, "");
582         SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID, 
583                 &HomeWebsiteListPID, &HomeWebsiteListType,
584                 &HomeWebsiteListMediatype, &HomeWebsiteListPref, 
585                 &HomeWebsiteListTokens, SaveData, "home");
586         SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID, 
587                 &BusinessWebsiteListPID, &BusinessWebsiteListType,
588                 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref, 
589                 &BusinessWebsiteListTokens, SaveData, "work");
591         // Process ROLE.
592         
593         SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
594                 &GeneralRoleListAltID, &GeneralRoleListPID,
595                 &GeneralRoleListType, &GeneralRoleListPref,
596                 &GeneralRoleListTokens, SaveData, "");
597         SaveRole(&HomeRoleList, &HomeRoleListLanguage,
598                 &HomeRoleListAltID, &HomeRoleListPID,
599                 &HomeRoleListType, &HomeRoleListPref,
600                 &HomeRoleListTokens, SaveData, "home");
601         SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
602                 &BusinessRoleListAltID, &BusinessRoleListPID,
603                 &BusinessRoleListType, &BusinessRoleListPref,
604                 &BusinessRoleListTokens, SaveData, "work");
606         // Process ORG.
607         
608         SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
609                 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage, 
610                 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType, 
611                 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens, 
612                 SaveData, "");
613         SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
614                 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage, 
615                 &HomeOrganisationsListSortAs, &HomeOrganisationsListType, 
616                 &HomeOrganisationsListPref, &HomeOrganisationsListTokens, 
617                 SaveData, "home");
618         SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
619                 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage, 
620                 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType, 
621                 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens, 
622                 SaveData, "work");
624         // Process NOTE.
625         
626         SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
627                 &GeneralNoteListAltID, &GeneralNoteListPID,
628                 &GeneralNoteListType, &GeneralNoteListPref,
629                 &GeneralNoteListTokens, SaveData, "");
630         SaveNote(&HomeNoteList, &HomeNoteListLanguage,
631                 &HomeNoteListAltID, &HomeNoteListPID,
632                 &HomeNoteListType, &HomeNoteListPref,
633                 &HomeNoteListTokens, SaveData, "home");
634         SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
635                 &BusinessNoteListAltID, &BusinessNoteListPID,
636                 &BusinessNoteListType, &BusinessNoteListPref,
637                 &BusinessNoteListTokens, SaveData, "work");
639         // Process CATEGORIES.
640         
641         SaveCategory(&CategoriesList, &CategoriesListLanguage,
642                 &CategoriesListAltID, &CategoriesListPID,
643                 &CategoriesListType, &CategoriesListPref,
644                 &CategoriesListTokens, SaveData);
646         // Process PHOTO.
647         
648         SavePhoto(&PicturesList, &PicturesListAltID, 
649                 &PicturesListPID, &PicturesListType,
650                 &PicturesListPicEncType, &PicturesListPictureType,
651                 &PicturesListMediatype, &PicturesListPref,
652                 &PicturesListTokens, SaveData);
653         
654         // Process LOGO.
655         
656         SaveLogo(&LogosList, &LogosListAltID, 
657                 &LogosListPID, &LogosListType,
658                 &LogosListPicEncType, &LogosListPictureType,
659                 &LogosListMediatype, &LogosListPref,
660                 &LogosListTokens, SaveData);
661         
662         // Process SOUND.
664         SaveSound(&SoundsList, &SoundsListAltID, 
665                 &SoundsListPID, &SoundsListType,
666                 &SoundsListAudioEncType, &SoundsListAudioType,
667                 &SoundsListMediatype, &SoundsListLanguage, 
668                 &SoundsListPref, &SoundsListTokens, 
669                 SaveData);
671         // Process CALURI.
672         
673         SaveCalendarURI(&CalendarList, &CalendarListMediatype,
674                 &CalendarListAltID, &CalendarListPID,
675                 &CalendarListType, &CalendarListPref,
676                 &CalendarListTokens, SaveData);
677         
678         // Process CALADRURI.
679         
680         SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
681                 &CalendarRequestListAltID, &CalendarRequestListPID,
682                 &CalendarRequestListType, &CalendarRequestListPref,
683                 &CalendarRequestListTokens, SaveData);
685         // Process FBURL.
686         
687         SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID, 
688                 &FreeBusyListPID, &FreeBusyListType,
689                 &FreeBusyListMediatype, &FreeBusyListPref, 
690                 &FreeBusyListTokens, SaveData);
692         // Process KEY.
693         
694         SaveKey(&KeyList, &KeyListAltID, 
695                 &KeyListPID, &KeyListType,
696                 &KeyListKeyType, &KeyListDataEncType, 
697                 &KeyListDataType, &KeyListPref, 
698                 &KeyListTokens, SaveData);
700         // Process VND-*
701         
702         SaveVendor(&VendorList, &VendorListPEN, 
703                 &VendorListElement, SaveData);
705         // Process X-Tokens.
706         
707         SaveXToken(&XTokenList, &XTokenListTokens, 
708                 SaveData);
710         // Write the end part of the vCard data file.
711         
712         SaveData->Append("END:VCARD");
713         
714         SaveDataStatus = CONTACTSAVE_OK;
715         
716         return SaveDataStatus;
717         
720 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
721         map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
722         map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
723         map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
725         wxString ProcessData = "";
726                 
727         for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
728                 TitleIter != TitleList->end(); TitleIter++){
730                 ProcessData.Append("TITLE");
731                         
732                 // Check if there is a value for TYPE.
733                 
734                 if (DataType.size() > 0){
735                 
736                         ProcessData.Append(";TYPE=");
737                         ProcessData.Append(DataType);
738                         
739                 }
740                 
741                 // Check if there is a value for ALTID.
742                 
743                 if ((*TitleListAltID)[TitleIter->first].size() > 0){
744                 
745                         ProcessData.Append(";ALTID=");
746                         ProcessData.Append((*TitleListAltID)[TitleIter->first]);
747                         
748                 }
750                 // Check if there is a value for LANGUAGE.
751                 
752                 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
753                 
754                         ProcessData.Append(";LANGUAGE=");
755                         ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
756                         
757                 }
758                 
759                 // Check if there is a value for PID.
761                 if ((*TitleListPID)[TitleIter->first].size() > 0){
762                 
763                         ProcessData.Append(";PID=");
764                         ProcessData.Append((*TitleListPID)[TitleIter->first]);
765                         
766                 }
768                 // Check if there is a value for PREF.
770                 if ((*TitleListPref)[TitleIter->first] > 0){
771                 
772                         ProcessData.Append(";PREF=");
773                         ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
774                         
775                 }
777                 // Check if there is a value for tokens.
779                 if ((*TitleListTokens)[TitleIter->first].size() > 0){
780                 
781                         ProcessData.Append(";");
782                         ProcessData.Append((*TitleListTokens)[TitleIter->first]);
783                         
784                 }
785                         
786                 ProcessData.Append(":");
787                 ProcessData.Append(TitleIter->second);
788                 ProcessData.Append("\n");
790                 ProcessData = OutputText(&ProcessData);
791                         
792                 SaveData->Append(ProcessData);
793                 ProcessData.clear();
794                         
795         }
796                 
799 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID, 
800         map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
801         map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref, 
802         map<int, wxString> *SourceListTokens, wxString *SaveData){
804         wxString ProcessData = "";
805         
806         for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
807                 SourceIter != SourceList->end(); SourceIter++){
809                 ProcessData.Append("SOURCE");
810                         
811                 // Check if there is a value for TYPE.
812                 
813                 if ((*SourceListType)[SourceIter->first].size() > 0){
814                 
815                         ProcessData.Append(";TYPE=");
816                         ProcessData.Append((*SourceListType)[SourceIter->first]);
817                         
818                 }
819                 
820                 // Check if there is a value for ALTID.
821                 
822                 if ((*SourceListAltID)[SourceIter->first].size() > 0){
823                 
824                         ProcessData.Append(";ALTID=");
825                         ProcessData.Append((*SourceListAltID)[SourceIter->first]);
826                         
827                 }
829                 // Check if there is a value for MEDIATYPE.
830                 
831                 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
832                 
833                         ProcessData.Append(";MEDIATYPE=");
834                         ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
835                         
836                 }
837                 
838                 // Check if there is a value for PID.
840                 if ((*SourceListPID)[SourceIter->first].size() > 0){
841                 
842                         ProcessData.Append(";PID=");
843                         ProcessData.Append((*SourceListPID)[SourceIter->first]);
844                         
845                 }
847                 // Check if there is a value for PREF.
849                 if ((*SourceListPref)[SourceIter->first] > 0){
850                 
851                         ProcessData.Append(";PREF=");
852                         ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
853                         
854                 }
856                 // Check if there is a value for tokens.
858                 if ((*SourceListTokens)[SourceIter->first].size() > 0){
859                 
860                         ProcessData.Append(";");
861                         ProcessData.Append((*SourceListTokens)[SourceIter->first]);
862                         
863                 }
864                         
865                 ProcessData.Append(":");
866                 ProcessData.Append(SourceIter->second);
867                 ProcessData.Append("\n");
869                 ProcessData = OutputText(&ProcessData);
870                         
871                 SaveData->Append(ProcessData);
872                 ProcessData.clear();
873                         
874         }
875                 
878 void ContactDataObject::SaveMember(std::map<int, wxString> *GroupsList, std::map<int, wxString> *GroupsListAltID, 
879         std::map<int, wxString> *GroupsListPID, std::map<int, wxString> *GroupsListType,
880         std::map<int, wxString> *GroupsListMediaType, std::map<int, int> *GroupsListPref, 
881         std::map<int, wxString> *GroupsListTokens, wxString *SaveData){
883         wxString ProcessData = "";
884                 
885         for (std::map<int, wxString>::iterator GroupsIter = GroupsList->begin();
886                 GroupsIter != GroupsList->end(); GroupsIter++){
888                 ProcessData.Append("MEMBER");
889                         
890                 // Check if there is a value for TYPE.
891                 
892                 if ((*GroupsListType)[GroupsIter->first].size() > 0){
893                 
894                         ProcessData.Append(";TYPE=");
895                         ProcessData.Append((*GroupsListType)[GroupsIter->first]);
896                         
897                 }
898                 
899                 // Check if there is a value for ALTID.
900                 
901                 if ((*GroupsListAltID)[GroupsIter->first].size() > 0){
902                 
903                         ProcessData.Append(";ALTID=");
904                         ProcessData.Append((*GroupsListAltID)[GroupsIter->first]);
905                         
906                 }
908                 // Check if there is a value for MEDIATYPE.
909                 
910                 if ((*GroupsListMediaType)[GroupsIter->first].size() > 0){
911                 
912                         ProcessData.Append(";MEDIATYPE=");
913                         ProcessData.Append((*GroupsListMediaType)[GroupsIter->first]);
914                         
915                 }
916                 
917                 // Check if there is a value for PID.
919                 if ((*GroupsListPID)[GroupsIter->first].size() > 0){
920                 
921                         ProcessData.Append(";PID=");
922                         ProcessData.Append((*GroupsListPID)[GroupsIter->first]);
923                         
924                 }
926                 // Check if there is a value for PREF.
928                 if ((*GroupsListPref)[GroupsIter->first] > 0){
929                 
930                         ProcessData.Append(";PREF=");
931                         ProcessData.Append(wxString::Format("%i", (*GroupsListPref)[GroupsIter->first]));
932                         
933                 }
935                 // Check if there is a value for tokens.
937                 if ((*GroupsListTokens)[GroupsIter->first].size() > 0){
938                 
939                         ProcessData.Append(";");
940                         ProcessData.Append((*GroupsListTokens)[GroupsIter->first]);
941                         
942                 }
943                         
944                 ProcessData.Append(":");
945                 ProcessData.Append(GroupsIter->second);
946                 ProcessData.Append("\n");
948                 ProcessData = OutputText(&ProcessData);
949                 
950                 SaveData->Append(ProcessData);
951                 ProcessData.clear();
952                         
953         }
954                 
957 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID, 
958         map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
959         map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref, 
960         map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
962         wxString ProcessData = "";
963         
964         for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
965                 NicknameIter != NicknameList->end(); NicknameIter++){
967                 ProcessData.Append("NICKNAME");
968                         
969                 // Check if there is a value for TYPE.
970                 
971                 if (DataType.size() > 0){
972                 
973                         ProcessData.Append(";TYPE=");
974                         ProcessData.Append(DataType);
975                         
976                 }
977                 
978                 // Check if there is a value for ALTID.
979                 
980                 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
981                 
982                         ProcessData.Append(";ALTID=");
983                         ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
984                         
985                 }
987                 // Check if there is a value for MEDIATYPE.
988                 
989                 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
990                 
991                         ProcessData.Append(";LANGUAGE=");
992                         ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
993                         
994                 }
995                 
996                 // Check if there is a value for PID.
998                 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
999                 
1000                         ProcessData.Append(";PID=");
1001                         ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
1002                         
1003                 }
1005                 // Check if there is a value for PREF.
1007                 if ((*NicknameListPref)[NicknameIter->first] > 0){
1008                 
1009                         ProcessData.Append(";PREF=");
1010                         ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
1011                         
1012                 }
1014                 // Check if there is a value for tokens.
1016                 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
1017                 
1018                         ProcessData.Append(";");
1019                         ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
1020                         
1021                 }
1022                         
1023                 ProcessData.Append(":");
1024                 ProcessData.Append(NicknameIter->second);
1025                 ProcessData.Append("\n");
1027                 ProcessData = OutputText(&ProcessData);
1028                         
1029                 SaveData->Append(ProcessData);
1030                 ProcessData.clear();
1031                         
1032         }
1033                 
1036 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID, 
1037         map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
1038         map<int, wxString> *TZListMediatype, map<int, int> *TZListPref, 
1039         map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
1041         wxString ProcessData = "";
1042         
1043         for (std::map<int, wxString>::iterator TZIter = TZList->begin();
1044                 TZIter != TZList->end(); TZIter++){
1046                 ProcessData.Append("TZ");
1047                         
1048                 // Check if there is a value for TYPE.
1049                 
1050                 if (DataType.size() > 0){
1051                 
1052                         ProcessData.Append(";TYPE=");
1053                         ProcessData.Append(DataType);
1054                         
1055                 }
1056                 
1057                 // Check if there is a value for ALTID.
1058                 
1059                 if ((*TZListAltID)[TZIter->first].size() > 0){
1060                 
1061                         ProcessData.Append(";ALTID=");
1062                         ProcessData.Append((*TZListAltID)[TZIter->first]);
1063                         
1064                 }
1066                 // Check if there is a value for MEDIATYPE.
1067                 
1068                 if ((*TZListMediatype)[TZIter->first].size() > 0){
1069                 
1070                         ProcessData.Append(";MEDIATYPE=");
1071                         ProcessData.Append((*TZListMediatype)[TZIter->first]);
1072                         
1073                 }
1074                 
1075                 // Check if there is a value for PID.
1077                 if ((*TZListPID)[TZIter->first].size() > 0){
1078                 
1079                         ProcessData.Append(";PID=");
1080                         ProcessData.Append((*TZListPID)[TZIter->first]);
1081                         
1082                 }
1084                 // Check if there is a value for PREF.
1086                 if ((*TZListPref)[TZIter->first] > 0){
1087                 
1088                         ProcessData.Append(";PREF=");
1089                         ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
1090                         
1091                 }
1093                 // Check if there is a value for tokens.
1095                 if ((*TZListTokens)[TZIter->first].size() > 0){
1096                 
1097                         ProcessData.Append(";");
1098                         ProcessData.Append((*TZListTokens)[TZIter->first]);
1099                         
1100                 }
1101                         
1102                 ProcessData.Append(":");
1103                 ProcessData.Append(TZIter->second);
1104                 ProcessData.Append("\n");
1106                 ProcessData = OutputText(&ProcessData);
1107                         
1108                 SaveData->Append(ProcessData);
1109                 ProcessData.clear();
1110                         
1111         }
1112                 
1115 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
1116                 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
1117                 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
1118                 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
1119                 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo, 
1120                 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType, 
1121                 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref, 
1122                 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
1124         wxString ProcessData = "";
1125                         
1126         for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
1127                 AddressIter != AddressList->end(); AddressIter++){
1128                         
1129                 ProcessData.Append("ADR");
1130                         
1131                 // Check if there is a value for TYPE.
1132                 
1133                 if (DataType.size() > 0){
1134                 
1135                         ProcessData.Append(";TYPE=");
1136                         ProcessData.Append(DataType);
1137                         
1138                 }
1139                 
1140                 // Check if there is a value for ALTID.
1141                 
1142                 if ((*AddressListAltID)[AddressIter->first].size() > 0){
1143                 
1144                         ProcessData.Append(";ALTID=");
1145                         ProcessData.Append((*AddressListAltID)[AddressIter->first]);
1146                         
1147                 }
1149                 // Check if there is a value for GEO.
1150                 
1151                 if ((*AddressListGeo)[AddressIter->first].size() > 0){
1152                 
1153                         ProcessData.Append(";GEO=\"");
1154                         ProcessData.Append((*AddressListGeo)[AddressIter->first]);
1155                         ProcessData.Append("\"");
1156                         
1157                 }
1159                 // Check if there is a value for LABEL.
1161                 if ((*AddressListLabel)[AddressIter->first].size() > 0){
1162                 
1163                         wxString AddressProcessed = "";
1164                         AddressProcessed = (*AddressListLabel)[AddressIter->first];
1165                         
1166                         AddressProcessed.Replace("\n", "\\n", true);
1167                         
1168                         ProcessData.Append(";LABEL=");
1169                         ProcessData.Append(AddressProcessed);
1170                         
1171                 }
1172                 
1173                 // Check if there is a value for LANGUAGE.
1174                 
1175                 if ((*AddressListLang)[AddressIter->first].size() > 0){
1176                 
1177                         ProcessData.Append(";LANGUAGE=");
1178                         ProcessData.Append((*AddressListLang)[AddressIter->first]);
1179                         
1180                 }
1181                 
1182                 // Check if there is a value for MEDIATYPE.
1183                 
1184                 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1185                 
1186                         ProcessData.Append(";MEDIATYPE=");
1187                         ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1188                         
1189                 }
1190                 
1191                 // Check if there is a value for PID.
1193                 if ((*AddressListPID)[AddressIter->first].size() > 0){
1194                 
1195                         ProcessData.Append(";PID=");
1196                         ProcessData.Append((*AddressListPID)[AddressIter->first]);
1197                         
1198                 }
1200                 // Check if there is a value for PREF.
1202                 if ((*AddressListPref)[AddressIter->first] > 0){
1203                 
1204                         ProcessData.Append(";PREF=");
1205                         ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1206                         
1207                 }
1209                 // Check if there is a value for TZ.
1211                 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1212                 
1213                         ProcessData.Append(";TZ=");
1214                         ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1215                         
1216                 }
1217                 
1218                 // Check if there is a value for tokens.
1220                 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1221                 
1222                         ProcessData.Append(";");
1223                         ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1224                         
1225                 }
1226                 
1227                 // Build the address.
1228                 
1229                 ProcessData.Append(":;;");
1230                 ProcessData.Append((*AddressList)[AddressIter->first]);
1231                 ProcessData.Append(";");
1232                 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1233                 ProcessData.Append(";");
1234                 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1235                 ProcessData.Append(";");
1236                 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1237                 ProcessData.Append(";");
1238                 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1239                 ProcessData.Append("\n");
1240                 
1241                 ProcessData = OutputText(&ProcessData);
1242                         
1243                 SaveData->Append(ProcessData);
1244                 ProcessData.clear();
1245                         
1246         }
1247                         
1250 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID, 
1251         map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1252         map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens, 
1253         wxString *SaveData, wxString DataType){
1255         wxString ProcessData = "";
1256         
1257         for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1258                 EmailIter != EmailList->end(); EmailIter++){
1260                 ProcessData.Append("EMAIL");
1261                         
1262                 // Check if there is a value for TYPE.
1263                 
1264                 if (DataType.size() > 0){
1265                 
1266                         ProcessData.Append(";TYPE=");
1267                         ProcessData.Append(DataType);
1268                         
1269                 }
1270                 
1271                 // Check if there is a value for ALTID.
1272                 
1273                 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1274                 
1275                         ProcessData.Append(";ALTID=");
1276                         ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1277                         
1278                 }
1279                 
1280                 // Check if there is a value for PID.
1282                 if ((*EmailListPID)[EmailIter->first].size() > 0){
1283                 
1284                         ProcessData.Append(";PID=");
1285                         ProcessData.Append((*EmailListPID)[EmailIter->first]);
1286                         
1287                 }
1289                 // Check if there is a value for PREF.
1291                 if ((*EmailListPref)[EmailIter->first] > 0){
1292                 
1293                         ProcessData.Append(";PREF=");
1294                         ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1295                         
1296                 }
1298                 // Check if there is a value for tokens.
1300                 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1301                 
1302                         ProcessData.Append(";");
1303                         ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1304                         
1305                 }
1306                         
1307                 ProcessData.Append(":");
1308                 ProcessData.Append(EmailIter->second);
1309                 ProcessData.Append("\n");
1311                 ProcessData = OutputText(&ProcessData);
1312                         
1313                 SaveData->Append(ProcessData);
1314                 ProcessData.clear();
1315                         
1316         }
1317                 
1320 void ContactDataObject::SaveIMPP(map<int, wxString> *IMList, map<int, wxString> *IMListAltID, 
1321         map<int, wxString> *IMListPID, map<int, wxString> *IMListType,
1322         map<int, wxString> *IMListTypeInfo, map<int, wxString> *IMListMediatype, 
1323         map<int, int> *IMListPref, map<int, wxString> *IMListTokens, 
1324         wxString *SaveData, wxString DataType){
1326         wxString ProcessData = "";
1327         
1328         for (std::map<int, wxString>::iterator IMIter = IMList->begin();
1329                 IMIter != IMList->end(); IMIter++){
1331                 ProcessData.Append("IMPP");
1332                         
1333                 // Check if there is a value for TYPE.
1334                 
1335                 if (DataType.size() > 0){
1336                 
1337                         ProcessData.Append(";TYPE=");
1338                         ProcessData.Append(DataType);
1339                         
1340                 }
1341                 
1342                 // Check if there is a value for ALTID.
1343                 
1344                 if ((*IMListAltID)[IMIter->first].size() > 0){
1345                 
1346                         ProcessData.Append(";ALTID=");
1347                         ProcessData.Append((*IMListAltID)[IMIter->first]);
1348                         
1349                 }
1350                 
1351                 // Check if there is a value for MEDIATYPE.
1352                 
1353                 if ((*IMListMediatype)[IMIter->first].size() > 0){
1354                 
1355                         ProcessData.Append(";MEDIATYPE=");
1356                         ProcessData.Append((*IMListMediatype)[IMIter->first]);
1357                         
1358                 }
1359                 
1360                 // Check if there is a value for PID.
1362                 if ((*IMListPID)[IMIter->first].size() > 0){
1363                 
1364                         ProcessData.Append(";PID=");
1365                         ProcessData.Append((*IMListPID)[IMIter->first]);
1366                         
1367                 }
1369                 // Check if there is a value for PREF.
1371                 if ((*IMListPref)[IMIter->first] > 0){
1372                 
1373                         ProcessData.Append(";PREF=");
1374                         ProcessData.Append(wxString::Format("%i", (*IMListPref)[IMIter->first]));
1375                         
1376                 }
1378                 // Check if there is a value for tokens.
1380                 if ((*IMListTokens)[IMIter->first].size() > 0){
1381                 
1382                         ProcessData.Append(";");
1383                         ProcessData.Append((*IMListTokens)[IMIter->first]);
1384                         
1385                 }
1387                 ProcessData.Append(":");
1388                 ProcessData.Append((*IMListTypeInfo)[IMIter->first]);
1389                 ProcessData.Append(":");
1390                 ProcessData.Append(IMIter->second);
1391                 ProcessData.Append("\n");
1393                 ProcessData = OutputText(&ProcessData);
1394                         
1395                 SaveData->Append(ProcessData);
1396                 ProcessData.clear();
1397                         
1398         }
1399                 
1402 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID, 
1403         map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1404         map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens, 
1405         wxString *SaveData, wxString DataType){
1407         wxString ProcessData = "";
1408         
1409         for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1410                 LanguageIter != LanguageList->end(); LanguageIter++){
1412                 ProcessData.Append("LANG");
1413                         
1414                 // Check if there is a value for TYPE.
1415                 
1416                 if (DataType.size() > 0){
1417                 
1418                         ProcessData.Append(";TYPE=");
1419                         ProcessData.Append(DataType);
1420                         
1421                 }
1422                 
1423                 // Check if there is a value for ALTID.
1424                 
1425                 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1426                 
1427                         ProcessData.Append(";ALTID=");
1428                         ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1429                         
1430                 }
1431                 
1432                 // Check if there is a value for PID.
1434                 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1435                 
1436                         ProcessData.Append(";PID=");
1437                         ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1438                         
1439                 }
1441                 // Check if there is a value for PREF.
1443                 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1444                 
1445                         ProcessData.Append(";PREF=");
1446                         ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1447                         
1448                 }
1450                 // Check if there is a value for tokens.
1452                 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1453                 
1454                         ProcessData.Append(";");
1455                         ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1456                         
1457                 }
1458                         
1459                 ProcessData.Append(":");
1460                 ProcessData.Append(LanguageIter->second);
1461                 ProcessData.Append("\n");
1463                 ProcessData = OutputText(&ProcessData);
1464                         
1465                 SaveData->Append(ProcessData);
1466                 ProcessData.clear();
1467                         
1468         }
1469                 
1472 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID, 
1473         map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1474         map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1475         map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens, 
1476         wxString *SaveData, wxString DataType){
1478         wxString ProcessData = "";
1479         
1480         for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1481                 GeographyIter != GeographyList->end(); GeographyIter++){
1483                 ProcessData.Append("GEO");
1484                         
1485                 // Check if there is a value for TYPE.
1486                 
1487                 if (DataType.size() > 0){
1488                 
1489                         ProcessData.Append(";TYPE=");
1490                         ProcessData.Append(DataType);
1491                         
1492                 }
1493                 
1494                 // Check if there is a value for ALTID.
1495                 
1496                 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1497                 
1498                         ProcessData.Append(";ALTID=");
1499                         ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1500                         
1501                 }
1502                 
1503                 // Check if there is a value for MEDIATYPE.
1504                 
1505                 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1506                 
1507                         ProcessData.Append(";MEDIATYPE=");
1508                         ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1509                         
1510                 }
1511                 
1512                 // Check if there is a value for PID.
1514                 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1515                 
1516                         ProcessData.Append(";PID=");
1517                         ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1518                         
1519                 }
1521                 // Check if there is a value for PREF.
1523                 if ((*GeographyListPref)[GeographyIter->first] > 0){
1524                 
1525                         ProcessData.Append(";PREF=");
1526                         ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1527                         
1528                 }
1530                 // Check if there is a value for tokens.
1532                 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1533                 
1534                         ProcessData.Append(";");
1535                         ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1536                         
1537                 }
1538                         
1539                 ProcessData.Append(":");
1540                 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1541                 ProcessData.Append(":");
1542                 ProcessData.Append(GeographyIter->second);
1543                 ProcessData.Append("\n");
1545                 ProcessData = OutputText(&ProcessData);
1546                         
1547                 SaveData->Append(ProcessData);
1548                 ProcessData.clear();
1549                         
1550         }
1551                 
1554 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID, 
1555                 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1556                 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref, 
1557                 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1559         wxString ProcessData = "";
1560         
1561         for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1562                 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1564                 ProcessData.Append("URL");
1565                         
1566                 // Check if there is a value for TYPE.
1567                 
1568                 if (DataType.size() > 0){
1569                 
1570                         ProcessData.Append(";TYPE=");
1571                         ProcessData.Append(DataType);
1572                         
1573                 }
1574                 
1575                 // Check if there is a value for ALTID.
1576                 
1577                 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1578                 
1579                         ProcessData.Append(";ALTID=");
1580                         ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1581                         
1582                 }
1583                 
1584                 // Check if there is a value for MEDIATYPE.
1585                 
1586                 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1587                 
1588                         ProcessData.Append(";MEDIATYPE=");
1589                         ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1590                         
1591                 }
1592                 
1593                 // Check if there is a value for PID.
1595                 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1596                 
1597                         ProcessData.Append(";PID=");
1598                         ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1599                         
1600                 }
1602                 // Check if there is a value for PREF.
1604                 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1605                 
1606                         ProcessData.Append(";PREF=");
1607                         ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1608                         
1609                 }
1611                 // Check if there is a value for tokens.
1613                 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1614                 
1615                         ProcessData.Append(";");
1616                         ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1617                         
1618                 }
1619                         
1620                 ProcessData.Append(":");
1621                 ProcessData.Append(WebsiteIter->second);
1622                 ProcessData.Append("\n");
1624                 ProcessData = OutputText(&ProcessData);
1625                         
1626                 SaveData->Append(ProcessData);
1627                 ProcessData.clear();
1628                         
1629         }
1630                         
1633 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1634         map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1635         map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1636         map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1638         wxString ProcessData = "";
1639                 
1640         for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1641                 RoleIter != RoleList->end(); RoleIter++){
1643                 ProcessData.Append("ROLE");
1644                         
1645                 // Check if there is a value for TYPE.
1646                 
1647                 if (DataType.size() > 0){
1648                 
1649                         ProcessData.Append(";TYPE=");
1650                         ProcessData.Append(DataType);
1651                         
1652                 }
1653                 
1654                 // Check if there is a value for ALTID.
1655                 
1656                 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1657                 
1658                         ProcessData.Append(";ALTID=");
1659                         ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1660                         
1661                 }
1663                 // Check if there is a value for LANGUAGE.
1664                 
1665                 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1666                 
1667                         ProcessData.Append(";LANGUAGE=");
1668                         ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1669                         
1670                 }
1671                 
1672                 // Check if there is a value for PID.
1674                 if ((*RoleListPID)[RoleIter->first].size() > 0){
1675                 
1676                         ProcessData.Append(";PID=");
1677                         ProcessData.Append((*RoleListPID)[RoleIter->first]);
1678                         
1679                 }
1681                 // Check if there is a value for PREF.
1683                 if ((*RoleListPref)[RoleIter->first] > 0){
1684                 
1685                         ProcessData.Append(";PREF=");
1686                         ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1687                         
1688                 }
1690                 // Check if there is a value for tokens.
1692                 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1693                 
1694                         ProcessData.Append(";");
1695                         ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1696                         
1697                 }
1698                         
1699                 ProcessData.Append(":");
1700                 ProcessData.Append(RoleIter->second);
1701                 ProcessData.Append("\n");
1703                 ProcessData = OutputText(&ProcessData);
1704                 
1705                 SaveData->Append(ProcessData);
1706                 ProcessData.clear();
1707                         
1708         }
1709                 
1712 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1713         map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage, 
1714         map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType, 
1715         map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens, 
1716         wxString *SaveData, wxString DataType){
1718         wxString ProcessData = "";
1719                 
1720         for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1721                 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1723                 ProcessData.Append("ORG");
1724                         
1725                 // Check if there is a value for TYPE.
1726                 
1727                 if (DataType.size() > 0){
1728                 
1729                         ProcessData.Append(";TYPE=");
1730                         ProcessData.Append(DataType);
1731                         
1732                 }
1733                 
1734                 // Check if there is a value for ALTID.
1735                 
1736                 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1737                 
1738                         ProcessData.Append(";ALTID=");
1739                         ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1740                         
1741                 }
1743                 // Check if there is a value for LANGUAGE.
1744                 
1745                 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1746                 
1747                         ProcessData.Append(";LANGUAGE=");
1748                         ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1749                         
1750                 }
1751                 
1752                 // Check if there is a value for PID.
1754                 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1755                 
1756                         ProcessData.Append(";PID=");
1757                         ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1758                         
1759                 }
1761                 // Check if there is a value for PREF.
1763                 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1764                 
1765                         ProcessData.Append(";PREF=");
1766                         ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1767                         
1768                 }
1769                 
1770                 // Check if there is a value for SORT-AS.
1771                 
1772                 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1773                 
1774                         ProcessData.Append(";SORT-AS=\"");
1775                         ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1776                         ProcessData.Append("\"");
1777                         
1778                 }
1780                 // Check if there is a value for tokens.
1782                 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1783                 
1784                         ProcessData.Append(";");
1785                         ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1786                         
1787                 }
1788                         
1789                 ProcessData.Append(":");
1790                 ProcessData.Append(OrganisationIter->second);
1791                 ProcessData.Append("\n");
1793                 ProcessData = OutputText(&ProcessData);
1794                 
1795                 SaveData->Append(ProcessData);
1796                 ProcessData.clear();
1797                         
1798         }
1799                 
1802 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1803         map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1804         map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1805         map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1807         wxString ProcessData = "";
1808                 
1809         for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1810                 NoteIter != NoteList->end(); NoteIter++){
1812                 ProcessData.Append("NOTE");
1813                         
1814                 // Check if there is a value for TYPE.
1815                 
1816                 if (DataType.size() > 0){
1817                 
1818                         ProcessData.Append(";TYPE=");
1819                         ProcessData.Append(DataType);
1820                         
1821                 }
1822                 
1823                 // Check if there is a value for ALTID.
1824                 
1825                 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1826                 
1827                         ProcessData.Append(";ALTID=");
1828                         ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1829                         
1830                 }
1832                 // Check if there is a value for LANGUAGE.
1833                 
1834                 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1835                 
1836                         ProcessData.Append(";LANGUAGE=");
1837                         ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1838                         
1839                 }
1840                 
1841                 // Check if there is a value for PID.
1843                 if ((*NoteListPID)[NoteIter->first].size() > 0){
1844                 
1845                         ProcessData.Append(";PID=");
1846                         ProcessData.Append((*NoteListPID)[NoteIter->first]);
1847                         
1848                 }
1850                 // Check if there is a value for PREF.
1852                 if ((*NoteListPref)[NoteIter->first] > 0){
1853                 
1854                         ProcessData.Append(";PREF=");
1855                         ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1856                         
1857                 }
1859                 // Check if there is a value for tokens.
1861                 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1862                 
1863                         ProcessData.Append(";");
1864                         ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1865                         
1866                 }
1867                         
1868                 ProcessData.Append(":");
1869                 ProcessData.Append(NoteIter->second);
1870                 ProcessData.Replace("\n", "\\n", true);
1871                 ProcessData.Append("\n");
1873                 ProcessData = OutputText(&ProcessData);
1874                 
1875                 SaveData->Append(ProcessData);
1876                 ProcessData.clear();
1877                         
1878         }
1879                 
1882 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1883         map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1884         map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1885         map<int, wxString> *CategoryListTokens, wxString *SaveData){
1887         wxString ProcessData = "";
1888                 
1889         for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1890                 CategoryIter != CategoryList->end(); CategoryIter++){
1892                 ProcessData.Append("CATEGORIES");
1893                         
1894                 // Check if there is a value for TYPE.
1895                 
1896                 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1897                 
1898                         ProcessData.Append(";TYPE=");
1899                         ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1900                         
1901                 }
1902                 
1903                 // Check if there is a value for ALTID.
1904                 
1905                 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1906                 
1907                         ProcessData.Append(";ALTID=");
1908                         ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1909                         
1910                 }
1912                 // Check if there is a value for LANGUAGE.
1913                 
1914                 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1915                 
1916                         ProcessData.Append(";LANGUAGE=");
1917                         ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1918                         
1919                 }
1920                 
1921                 // Check if there is a value for PID.
1923                 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1924                 
1925                         ProcessData.Append(";PID=");
1926                         ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1927                         
1928                 }
1930                 // Check if there is a value for PREF.
1932                 if ((*CategoryListPref)[CategoryIter->first] > 0){
1933                 
1934                         ProcessData.Append(";PREF=");
1935                         ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1936                         
1937                 }
1939                 // Check if there is a value for tokens.
1941                 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1942                 
1943                         ProcessData.Append(";");
1944                         ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1945                         
1946                 }
1947                         
1948                 ProcessData.Append(":");
1949                 ProcessData.Append(CategoryIter->second);
1950                 ProcessData.Append("\n");
1952                 ProcessData = OutputText(&ProcessData);
1953                 
1954                 SaveData->Append(ProcessData);
1955                 ProcessData.clear();
1956                         
1957         }
1958                 
1961 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID, 
1962                 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1963                 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1964                 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1965                 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1967         wxString ProcessData = "";
1968                 
1969         for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1970                 PicturesIter != PicturesList->end(); PicturesIter++){
1972                 ProcessData.Append("PHOTO");
1973                         
1974                 // Check if there is a value for TYPE.
1975                 
1976                 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1977                 
1978                         ProcessData.Append(";TYPE=");
1979                         ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1980                         
1981                 }
1982                 
1983                 // Check if there is a value for ALTID.
1984                 
1985                 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1986                 
1987                         ProcessData.Append(";ALTID=");
1988                         ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1989                         
1990                 }
1992                 // Check if there is a value for MEDIATYPE..
1993                 
1994                 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1995                 
1996                         ProcessData.Append(";MEDIATYPE=");
1997                         ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1998                         
1999                 }
2000                 
2001                 // Check if there is a value for PID.
2003                 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
2004                 
2005                         ProcessData.Append(";PID=");
2006                         ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
2007                         
2008                 }
2010                 // Check if there is a value for PREF.
2012                 if ((*PicturesListPref)[PicturesIter->first] > 0){
2013                 
2014                         ProcessData.Append(";PREF=");
2015                         ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
2016                         
2017                 }
2019                 // Check if there is a value for tokens.
2021                 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
2022                 
2023                         ProcessData.Append(";");
2024                         ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
2025                         
2026                 }
2027                 
2028                 ProcessData.Append(":data:");
2029                 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
2030                 ProcessData.Append(";");
2031                 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
2032                 ProcessData.Append(",");
2033                 ProcessData.Append(PicturesIter->second);
2034                 ProcessData.Append("\n");
2036                 ProcessData = OutputText(&ProcessData);
2037                 
2038                 SaveData->Append(ProcessData);
2039                 ProcessData.clear();
2040                         
2041         }
2042                         
2045 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID, 
2046         map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
2047         map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
2048         map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
2049         map<int, wxString> *LogosListTokens, wxString *SaveData){
2051         wxString ProcessData = "";
2052                 
2053         for (std::map<int, string>::iterator LogosIter = LogosList->begin();
2054                 LogosIter != LogosList->end(); LogosIter++){
2056                 ProcessData.Append("LOGO");
2057                         
2058                 // Check if there is a value for TYPE.
2059                 
2060                 if ((*LogosListType)[LogosIter->first].size() > 0){
2061                 
2062                         ProcessData.Append(";TYPE=");
2063                         ProcessData.Append((*LogosListType)[LogosIter->first]);
2064                         
2065                 }
2066                 
2067                 // Check if there is a value for ALTID.
2068                 
2069                 if ((*LogosListAltID)[LogosIter->first].size() > 0){
2070                 
2071                         ProcessData.Append(";ALTID=");
2072                         ProcessData.Append((*LogosListAltID)[LogosIter->first]);
2073                         
2074                 }
2076                 // Check if there is a value for MEDIATYPE..
2077                 
2078                 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
2079                 
2080                         ProcessData.Append(";MEDIATYPE=");
2081                         ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
2082                         
2083                 }
2084                 
2085                 // Check if there is a value for PID.
2087                 if ((*LogosListPID)[LogosIter->first].size() > 0){
2088                 
2089                         ProcessData.Append(";PID=");
2090                         ProcessData.Append((*LogosListPID)[LogosIter->first]);
2091                         
2092                 }
2094                 // Check if there is a value for PREF.
2096                 if ((*LogosListPref)[LogosIter->first] > 0){
2097                 
2098                         ProcessData.Append(";PREF=");
2099                         ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
2100                         
2101                 }
2103                 // Check if there is a value for tokens.
2105                 if ((*LogosListTokens)[LogosIter->first].size() > 0){
2106                 
2107                         ProcessData.Append(";");
2108                         ProcessData.Append((*LogosListTokens)[LogosIter->first]);
2109                         
2110                 }
2111                 
2112                 ProcessData.Append(":data:");
2113                 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
2114                 ProcessData.Append(";");
2115                 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
2116                 ProcessData.Append(",");
2117                 ProcessData.Append(LogosIter->second);
2118                 ProcessData.Append("\n");
2120                 ProcessData = OutputText(&ProcessData);
2121                 
2122                 SaveData->Append(ProcessData);
2123                 ProcessData.clear();
2124                         
2125         }
2126                 
2129 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID, 
2130         map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
2131         map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
2132         map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage, 
2133         map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens, 
2134         wxString *SaveData){
2136         wxString ProcessData = "";
2137                 
2138         for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
2139                 SoundsIter != SoundsList->end(); SoundsIter++){
2141                 ProcessData.Append("SOUND");
2142                         
2143                 // Check if there is a value for TYPE.
2144                 
2145                 if ((*SoundsListType)[SoundsIter->first].size() > 0){
2146                 
2147                         ProcessData.Append(";TYPE=");
2148                         ProcessData.Append((*SoundsListType)[SoundsIter->first]);
2149                         
2150                 }
2151                 
2152                 // Check if there is a value for ALTID.
2153                 
2154                 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
2155                 
2156                         ProcessData.Append(";ALTID=");
2157                         ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
2158                         
2159                 }
2161                 // Check if there is a value for LANGUAGE.
2162                 
2163                 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
2164                 
2165                         ProcessData.Append(";LANGUAGE=");
2166                         ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
2167                         
2168                 }
2169                 
2170                 // Check if there is a value for MEDIATYPE.
2171                 
2172                 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
2173                 
2174                         ProcessData.Append(";MEDIATYPE=");
2175                         ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
2176                         
2177                 }
2178                 
2179                 // Check if there is a value for PID.
2181                 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
2182                 
2183                         ProcessData.Append(";PID=");
2184                         ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
2185                         
2186                 }
2188                 // Check if there is a value for PREF.
2190                 if ((*SoundsListPref)[SoundsIter->first] > 0){
2191                 
2192                         ProcessData.Append(";PREF=");
2193                         ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
2194                         
2195                 }
2197                 // Check if there is a value for tokens.
2199                 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
2200                 
2201                         ProcessData.Append(";");
2202                         ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
2203                         
2204                 }
2205                 
2206                 ProcessData.Append(":data:");
2207                 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
2208                 ProcessData.Append(";");
2209                 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
2210                 ProcessData.Append(",");
2211                 ProcessData.Append(SoundsIter->second);
2212                 ProcessData.Append("\n");
2214                 ProcessData = OutputText(&ProcessData);
2215                 
2216                 SaveData->Append(ProcessData);
2217                 ProcessData.clear();
2218                         
2219         }
2220                 
2223 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
2224         map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
2225         map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
2226         map<int, wxString> *CalendarListTokens, wxString *SaveData){
2228         wxString ProcessData = "";
2229                 
2230         for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
2231                 CalendarIter != CalendarList->end(); CalendarIter++){
2233                 ProcessData.Append("CALURI");
2234                         
2235                 // Check if there is a value for TYPE.
2236                 
2237                 if ((*CalendarListType)[CalendarIter->first].size() > 0){
2238                 
2239                         ProcessData.Append(";TYPE=");
2240                         ProcessData.Append((*CalendarListType)[CalendarIter->first]);
2241                         
2242                 }
2243                 
2244                 // Check if there is a value for ALTID.
2245                 
2246                 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2247                 
2248                         ProcessData.Append(";ALTID=");
2249                         ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2250                         
2251                 }
2253                 // Check if there is a value for MEDIATYPE.
2254                 
2255                 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2256                 
2257                         ProcessData.Append(";MEDIATYPE=");
2258                         ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2259                         
2260                 }
2261                 
2262                 // Check if there is a value for PID.
2264                 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2265                 
2266                         ProcessData.Append(";PID=");
2267                         ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2268                         
2269                 }
2271                 // Check if there is a value for PREF.
2273                 if ((*CalendarListPref)[CalendarIter->first] > 0){
2274                 
2275                         ProcessData.Append(";PREF=");
2276                         ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2277                         
2278                 }
2280                 // Check if there is a value for tokens.
2282                 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2283                 
2284                         ProcessData.Append(";");
2285                         ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2286                         
2287                 }
2288                         
2289                 ProcessData.Append(":");
2290                 ProcessData.Append(CalendarIter->second);
2291                 ProcessData.Append("\n");
2293                 ProcessData = OutputText(&ProcessData);
2294                 
2295                 SaveData->Append(ProcessData);
2296                 ProcessData.clear();
2297                         
2298         }
2299                 
2302 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2303         map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2304         map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2305         map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2307         wxString ProcessData = "";
2308                 
2309         for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2310                 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2312                 ProcessData.Append("CALADRURI");
2313                         
2314                 // Check if there is a value for TYPE.
2315                 
2316                 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2317                 
2318                         ProcessData.Append(";TYPE=");
2319                         ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2320                         
2321                 }
2322                 
2323                 // Check if there is a value for ALTID.
2324                 
2325                 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2326                 
2327                         ProcessData.Append(";ALTID=");
2328                         ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2329                         
2330                 }
2332                 // Check if there is a value for MEDIATYPE.
2333                 
2334                 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2335                 
2336                         ProcessData.Append(";MEDIATYPE=");
2337                         ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2338                         
2339                 }
2340                 
2341                 // Check if there is a value for PID.
2343                 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2344                 
2345                         ProcessData.Append(";PID=");
2346                         ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2347                         
2348                 }
2350                 // Check if there is a value for PREF.
2352                 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2353                 
2354                         ProcessData.Append(";PREF=");
2355                         ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2356                         
2357                 }
2359                 // Check if there is a value for tokens.
2361                 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2362                 
2363                         ProcessData.Append(";");
2364                         ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2365                         
2366                 }
2367                         
2368                 ProcessData.Append(":");
2369                 ProcessData.Append(CalendarRequestIter->second);
2370                 ProcessData.Append("\n");
2372                 ProcessData = OutputText(&ProcessData);
2373                 
2374                 SaveData->Append(ProcessData);
2375                 ProcessData.clear();
2376                         
2377         }
2378                 
2381 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID, 
2382         std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2383         std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref, 
2384         std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2386         wxString ProcessData = "";
2387                 
2388         for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2389                 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2391                 ProcessData.Append("FBURL");
2392                         
2393                 // Check if there is a value for TYPE.
2394                 
2395                 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2396                 
2397                         ProcessData.Append(";TYPE=");
2398                         ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2399                         
2400                 }
2401                 
2402                 // Check if there is a value for ALTID.
2403                 
2404                 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2405                 
2406                         ProcessData.Append(";ALTID=");
2407                         ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2408                         
2409                 }
2411                 // Check if there is a value for MEDIATYPE.
2412                 
2413                 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2414                 
2415                         ProcessData.Append(";MEDIATYPE=");
2416                         ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2417                         
2418                 }
2419                 
2420                 // Check if there is a value for PID.
2422                 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2423                 
2424                         ProcessData.Append(";PID=");
2425                         ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2426                         
2427                 }
2429                 // Check if there is a value for PREF.
2431                 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2432                 
2433                         ProcessData.Append(";PREF=");
2434                         ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2435                         
2436                 }
2438                 // Check if there is a value for tokens.
2440                 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2441                 
2442                         ProcessData.Append(";");
2443                         ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2444                         
2445                 }
2446                         
2447                 ProcessData.Append(":");
2448                 ProcessData.Append(FreeBusyIter->second);
2449                 ProcessData.Append("\n");
2451                 ProcessData = OutputText(&ProcessData);
2452                 
2453                 SaveData->Append(ProcessData);
2454                 ProcessData.clear();
2455                         
2456         }
2457                 
2460 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID, 
2461         map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2462         map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType, 
2463         map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref, 
2464         map<int, wxString> *KeyListTokens, wxString *SaveData){
2466         wxString ProcessData = "";
2467                 
2468         for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2469                 KeyIter != KeyList->end(); KeyIter++){
2471                 ProcessData.Append("KEY");
2472                         
2473                 // Check if there is a value for TYPE.
2474                 
2475                 if ((*KeyListType)[KeyIter->first].size() > 0){
2476                 
2477                         ProcessData.Append(";TYPE=");
2478                         ProcessData.Append((*KeyListType)[KeyIter->first]);
2479                         
2480                 }
2481                 
2482                 // Check if there is a value for ALTID.
2483                 
2484                 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2485                 
2486                         ProcessData.Append(";ALTID=");
2487                         ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2488                         
2489                 }
2490                 
2491                 // Check if there is a value for PID.
2493                 if ((*KeyListPID)[KeyIter->first].size() > 0){
2494                 
2495                         ProcessData.Append(";PID=");
2496                         ProcessData.Append((*KeyListPID)[KeyIter->first]);
2497                         
2498                 }
2500                 // Check if there is a value for PREF.
2502                 if ((*KeyListPref)[KeyIter->first] > 0){
2503                 
2504                         ProcessData.Append(";PREF=");
2505                         ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2506                         
2507                 }
2509                 // Check if there is a value for tokens.
2511                 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2512                 
2513                         ProcessData.Append(";");
2514                         ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2515                         
2516                 }
2517                         
2518                 ProcessData.Append(":data:");
2519                 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2520                 ProcessData.Append(";");
2521                 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2522                 ProcessData.Append(",");
2523                 ProcessData.Append(KeyIter->second);
2524                 ProcessData.Append("\n");
2526                 ProcessData = OutputText(&ProcessData);
2527                 
2528                 SaveData->Append(ProcessData);
2529                 ProcessData.clear();
2530                         
2531         }
2532                 
2535 void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN, 
2536         map<int, wxString> *VendorListElement, wxString *SaveData){
2538         wxString ProcessData = "";
2539                 
2540         for (std::map<int, wxString>::iterator VendorIter = VendorList->begin();
2541                 VendorIter != VendorList->end(); VendorIter++){
2543                 ProcessData.Append("VND-");
2544                 ProcessData.Append((*VendorListPEN)[VendorIter->first]);
2545                 ProcessData.Append("-");
2546                 ProcessData.Append((*VendorListElement)[VendorIter->first]);
2547                 ProcessData.Append(":");
2548                 ProcessData.Append(VendorIter->second);
2549                 ProcessData.Append("\n");
2551                 ProcessData = OutputText(&ProcessData);
2552                 
2553                 SaveData->Append(ProcessData);
2554                 ProcessData.clear();
2555                         
2556         }
2557                 
2560 void ContactDataObject::SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens, 
2561         wxString *SaveData){
2563         wxString ProcessData = "";
2564                 
2565         for (std::map<int, wxString>::iterator XTokenIter = XTokenList->begin();
2566                 XTokenIter != XTokenList->end(); XTokenIter++){
2568                 ProcessData.Append("X-");
2569                 ProcessData.Append((*XTokenListTokens)[XTokenIter->first]);
2570                 ProcessData.Append(":");
2571                 ProcessData.Append(XTokenIter->second);
2572                 ProcessData.Append("\n");
2574                 ProcessData = OutputText(&ProcessData);
2575                 
2576                 SaveData->Append(ProcessData);
2577                 ProcessData.clear();
2578                         
2579         }       
2580                 
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