Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added GENDER to the SaveString function of ContactDataObject
[xestiaab/.git] / source / contacteditor / cdo / ContactDataObject-Save.cpp
1 // ContactDataObject-Save.cpp - Client Data Object.
2 //
3 // (c) 2012-2016 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
10 //
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "ContactDataObject.h"
20 #include "../../version.h"
22 ContactSaveStatus ContactDataObject::SaveFile(wxString SaveFilename){
23         
24         // Get the data using SaveString.
25         
26         wxString SaveData = "";
27         SaveString(&SaveData);
28         
29         // Open a file and try to write into it.
30         
31         wxFile ContactFile;
32         
33         if (!ContactFile.Open(SaveFilename, wxFile::write, wxS_DEFAULT)){
34         
35                 return CONTACTSAVE_FILEERROR;
36         
37         }
38         
39         if (ContactFile.Write(SaveData, wxConvUTF8) == false){
40                 
41                 return CONTACTSAVE_WRITEERROR;
42                 
43         }
44         
45         ContactFile.Close();
46         
47         return CONTACTSAVE_OK;
48         
49 }
51 ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
52         
53         ContactSaveStatus SaveDataStatus = CONTACTSAVE_UNITTESTFAIL;
54         
55         // Write the header for the vCard data file.
56         
57         SaveData->Append("BEGIN:VCARD\n");
58         SaveData->Append("VERSION:4.0\n");
59         
60         // Write the product ID.
61         
62 #ifdef XAB_UNITTEST
63         
64         SaveData->Append("PRODID:-//Xestia//Address Book Unit Testing//KW\n");
65         
66 #else
67         
68         SaveData->Append(wxT("PRODID:-//Xestia//Address Book Version "));
69         SaveData->Append(wxT(XSDAB_VERSION));
70         SaveData->Append(wxT("//KW\n"));
71         
72 #endif
74         wxString ProcessData = "";
76         // Process UID.
78         if (UIDToken.size() > 0){
79                 
80                 ProcessData.Append("UID:");
81                 ProcessData.Append(UIDToken);
82                 ProcessData.Append("\n");
83                 SaveData->Append(ProcessData);
84                 ProcessData.clear();
85                 
86         }
87         
88         // Process KIND.
89         
90         switch(ContactKind){
92                 case CONTACTKIND_NONE:
93                         break;
94                 case CONTACTKIND_INDIVIDUAL:
95                         SaveData->Append("KIND:individual\n");
96                         break;
97                 case CONTACTKIND_GROUP:
98                         SaveData->Append("KIND:group\n");
99                         break;
100                 case CONTACTKIND_ORGANISATION:
101                         SaveData->Append("KIND:org\n");
102                         break;
103                 case CONTACTKIND_LOCATION:
104                         SaveData->Append("KIND:location\n");
105                         break;
106                 default:
107                         break;
108                 
109         }
110         
111         // Process REV.
112         
113         wxDateTime DateTimeSave;
114         DateTimeSave = DateTimeSave.SetToCurrent();
115         wxString DateTimeSaveValue;
116         
117 #ifdef XAB_UNITTEST
118         
119         DateTimeSaveValue += "20160703T091000Z";
120         
121 #else
122     
123         DateTimeSaveValue += wxString::Format("%04i", DateTimeSave.GetYear());
124         DateTimeSaveValue += wxString::Format("%02i", (DateTimeSave.GetMonth() + 1));
125         DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetDay());
126         DateTimeSaveValue += "T";
127         DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetHour());
128         DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetMinute());
129         DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetSecond());
130         DateTimeSaveValue += "Z";
131     
132 #endif
133         
134         if (!RevisionTokens.IsEmpty()){
135                 
136                 ProcessData.Append("REV;");
137                 ProcessData.Append(RevisionTokens);
138                 ProcessData.Append(":");
139                 ProcessData.Append(DateTimeSaveValue);
140                 ProcessData.Append("\n");
141                 
142                 ProcessData = OutputText(&ProcessData);
143                 
144                 SaveData->Append(ProcessData);
145                 ProcessData.clear();            
146                 
147         } else {
148         
149                 ProcessData.Append("REV:");
150                 ProcessData.Append(DateTimeSaveValue);
151                 ProcessData.Append("\n");
152                 
153                 ProcessData = OutputText(&ProcessData);
154                 
155                 SaveData->Append(ProcessData);
156                 ProcessData.clear();
157                 
158         }
159         
160         // Process XML.
162         for (std::map<int, wxString>::iterator XMLIter = XMLList.begin();
163                 XMLIter != XMLList.end(); XMLIter++){
164         
165                 ProcessData.Append("XML");
166                         
167                 if (XMLListAltID[XMLIter->first].size() > 0){
168                 
169                         ProcessData.Append(";ALTID=");
170                         ProcessData.Append(XMLListAltID[XMLIter->first]);
171                         
172                 }
173                         
174                 ProcessData.Append(":");
175                 ProcessData.Append(XMLIter->second);
176                 ProcessData.Append("\n");
177                 
178                 ProcessData = OutputText(&ProcessData);
179                 
180                 SaveData->Append(ProcessData);
181                 ProcessData.clear();
182                         
183         }
184         
185         // Process SOURCE.
186         
187         SaveSource(&SourceList, &SourceListAltID, 
188                 &SourceListPID, &SourceListType,
189                 &SourceListMediatype, &SourceListPref, 
190                 &SourceListTokens, SaveData);
191         
192         // Process MEMBER (if contact kind is CONTACTKIND_GROUP).
193         
194         if (ContactKind == CONTACTKIND_GROUP){
195                 
196                 SaveMember(&GroupsList, &GroupsListAltID, 
197                         &GroupsListPID, &GroupsListType,
198                         &GroupsListMediaType, &GroupsListPref, 
199                         &GroupsListTokens, SaveData);
200                 
201         }
202         
203         // Process CLIENTPIDMAP.
204         
205         for (std::map<int, wxString>::iterator CPIDIter = ClientPIDList.begin();
206                 CPIDIter != ClientPIDList.end(); CPIDIter++){
207         
208                 ProcessData.Append("CLIENTPIDMAP");
209                         
210                 if (ClientPIDListTokens[CPIDIter->first].size() > 0){
211                 
212                         ProcessData.Append(";");
213                         ProcessData.Append(ClientPIDListTokens[CPIDIter->first]);
214                         
215                 }
216                         
217                 ProcessData.Append(":");
218                 ProcessData.Append(CPIDIter->second);
219                 ProcessData.Append("\n");
220                 
221                 ProcessData = OutputText(&ProcessData);
222                 
223                 SaveData->Append(ProcessData);
224                 ProcessData.clear();
225                         
226         }
227         
228         // Process FN.
229         
230         for (std::map<int, wxString>::iterator FNIter = FullNamesList.begin();
231                 FNIter != FullNamesList.end(); FNIter++){
232                 
233                 ProcessData.Append("FN");
235                 // Check if there is a value for TYPE.
236                 
237                 if (FullNamesListType[FNIter->first].size() > 0){
238                 
239                         ProcessData.Append(";TYPE=");
240                         ProcessData.Append(FullNamesListType[FNIter->first]);
241                         
242                 }
244                 // Check if there is a value for LANGUAGE.
245                 
246                 if (FullNamesListLanguage[FNIter->first].size() > 0){
247                 
248                         ProcessData.Append(";LANGUAGE=");
249                         ProcessData.Append(FullNamesListLanguage[FNIter->first]);
250                         
251                 }
252                 
253                 // Check if there is a value for ALTID.
254                 
255                 if (FullNamesListAltID[FNIter->first].size() > 0){
256                 
257                         ProcessData.Append(";ALTID=");
258                         ProcessData.Append(FullNamesListAltID[FNIter->first]);
259                         
260                 }
261                 
262                 // Check if there is a value for PID.
264                 if (FullNamesListPID[FNIter->first].size() > 0){
265                 
266                         ProcessData.Append(";PID=");
267                         ProcessData.Append(FullNamesListPID[FNIter->first]);
268                         
269                 }
271                 // Check if there is a value for PREF.
273                 if (FullNamesListPref[FNIter->first] > 0){
274                 
275                         ProcessData.Append(";PREF=");
276                         ProcessData.Append(wxString::Format("%i", FullNamesListPref[FNIter->first]));
277                         
278                 }
280                 // Check if there is a value for tokens.
282                 if (FullNamesListTokens[FNIter->first].size() > 0){
283                 
284                         ProcessData.Append(";");
285                         ProcessData.Append(FullNamesListTokens[FNIter->first]);
286                         
287                 }
288                 
289                 ProcessData.Append(":");
290                 ProcessData.Append(FNIter->second);
291                 ProcessData.Append("\n");
292                 
293                 ProcessData = OutputText(&ProcessData);
294                 
295                 SaveData->Append(ProcessData);
296                 ProcessData.clear();
297                         
298         }
299         
300         // Process N.
301         
302         if (!NameTitle.IsEmpty() || !NameForename.IsEmpty() || !NameSurname.IsEmpty() ||
303                 !NameOtherNames.IsEmpty() || !NameSuffix.IsEmpty()){
304                 
305                 ProcessData.Append("N");
306                 
307                 // Check if there is a value for ALTID.
308                 
309                 if (NameAltID.size() > 0){
310                 
311                         ProcessData.Append(";ALTID=");
312                         ProcessData.Append(NameAltID);
313                         
314                 }
316                 // Check if there is a value for LANGUAGE.
317                 
318                 if (NameLanguage.size() > 0){
319                 
320                         ProcessData.Append(";LANGUAGE=");
321                         ProcessData.Append(NameLanguage);
322                         
323                 }
324                 
325                 // Check if there is a value for SORT-AS.
326                 
327                 if (NameDisplayAs.size() > 0){
328                 
329                         ProcessData.Append(";SORT-AS=\"");
330                         ProcessData.Append(NameDisplayAs);
331                         ProcessData.Append("\"");
332                         
333                 }
335                 // Check if there is a value for tokens.
337                 if (NameTokens.size() > 0){
338                 
339                         ProcessData.Append(";");
340                         ProcessData.Append(NameTokens);
341                         
342                 }
343                         
344                 ProcessData.Append(":");
345                 ProcessData.Append(NameSurname);
346                 ProcessData.Append(";");
347                 ProcessData.Append(NameForename);
348                 ProcessData.Append(";");
349                 ProcessData.Append(NameOtherNames);
350                 ProcessData.Append(";");
351                 ProcessData.Append(NameTitle);
352                 ProcessData.Append(";");
353                 ProcessData.Append(NameSuffix);
354                 
355                 ProcessData.Append("\n");
357                 ProcessData = OutputText(&ProcessData);
358                 
359                 SaveData->Append(ProcessData);
360                 ProcessData.clear();
361                         
362         }
363         
364         // Process NICKNAME.
365         
366         SaveNickname(&GeneralNicknamesList, &GeneralNicknamesListAltID, 
367                 &GeneralNicknamesListPID, &GeneralNicknamesListType,
368                 &GeneralNicknamesListLanguage, &GeneralNicknamesListPref, 
369                 &GeneralNicknamesListTokens, SaveData, "");
370         SaveNickname(&HomeNicknamesList, &HomeNicknamesListAltID, 
371                 &HomeNicknamesListPID, &HomeNicknamesListType,
372                 &HomeNicknamesListLanguage, &HomeNicknamesListPref, 
373                 &HomeNicknamesListTokens, SaveData, "home");
374         SaveNickname(&BusinessNicknamesList, &BusinessNicknamesListAltID, 
375                 &BusinessNicknamesListPID, &BusinessNicknamesListType,
376                 &BusinessNicknamesListLanguage, &BusinessNicknamesListPref, 
377                 &BusinessNicknamesListTokens, SaveData, "work");
378         
379         // Process GENDER.
380         
381         if (Gender.size() > 0){
382                 
383                 ProcessData.Append("GENDER");
384                 
385                 if (GenderTokens.size() > 0){
386                         
387                         ProcessData.Append(";");
388                         ProcessData.Append(GenderTokens);
389                         
390                 }
391                 
392                 ProcessData.Append(":");
393                 ProcessData.Append(Gender);
394                 
395                 if (GenderDetails.size() > 0){
396                         
397                         ProcessData.Append(";");
398                         ProcessData.Append(GenderDetails);
399                         
400                 }
401                 
402                 ProcessData.Append("\n");
404                 ProcessData = OutputText(&ProcessData);
405                 
406                 SaveData->Append(ProcessData);
407                 ProcessData.clear();
408                 
409         }
410         
411         // TODO: Process BDAY.
412         
413         // TODO: Process ANNIVERSARY.
414         
415         // Process TITLE.
417         SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
418                 &GeneralTitleListAltID, &GeneralTitleListPID,
419                 &GeneralTitleListType, &GeneralTitleListPref,
420                 &GeneralTitleListTokens, SaveData, "");
421         SaveTitle(&HomeTitleList, &HomeTitleListLanguage,
422                 &HomeTitleListAltID, &HomeTitleListPID,
423                 &HomeTitleListType, &HomeTitleListPref,
424                 &HomeTitleListTokens, SaveData, "home");
425         SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage,
426                 &BusinessTitleListAltID, &BusinessTitleListPID,
427                 &BusinessTitleListType, &BusinessTitleListPref,
428                 &BusinessTitleListTokens, SaveData, "work");
429         
430         // Process TZ.
431         
432         SaveTimezone(&GeneralTZList, &GeneralTZListAltID, 
433                 &GeneralTZListPID, &GeneralTZListType,
434                 &GeneralTZListMediatype, &GeneralTZListPref, 
435                 &GeneralTZListTokens, SaveData, "");
436         SaveTimezone(&HomeTZList, &HomeTZListAltID, 
437                 &HomeTZListPID, &HomeTZListType,
438                 &HomeTZListMediatype, &HomeTZListPref, 
439                 &HomeTZListTokens, SaveData, "home");
440         SaveTimezone(&BusinessTZList, &BusinessTZListAltID, 
441                 &BusinessTZListPID, &BusinessTZListType,
442                 &BusinessTZListMediatype, &BusinessTZListPref, 
443                 &BusinessTZListTokens, SaveData, "work");
445         // Process ADR.
446         
447         SaveAddress(&GeneralAddressList, &GeneralAddressListTown,
448                 &GeneralAddressListCounty, &GeneralAddressListPostCode,
449                 &GeneralAddressListCountry, &GeneralAddressListLabel,
450                 &GeneralAddressListLang, &GeneralAddressListAltID,
451                 &GeneralAddressListPID, &GeneralAddressListGeo, 
452                 &GeneralAddressListTimezone, &GeneralAddressListType, 
453                 &GeneralAddressListMediatype, &GeneralAddressListPref,
454                 &GeneralAddressListTokens, SaveData, "");
455         SaveAddress(&HomeAddressList, &HomeAddressListTown,
456                 &HomeAddressListCounty, &HomeAddressListPostCode,
457                 &HomeAddressListCountry, &HomeAddressListLabel,
458                 &HomeAddressListLang, &HomeAddressListAltID,
459                 &HomeAddressListPID, &HomeAddressListGeo, 
460                 &HomeAddressListTimezone, &HomeAddressListType, 
461                 &HomeAddressListMediatype, &HomeAddressListPref,
462                 &HomeAddressListTokens, SaveData, "home");
463         SaveAddress(&BusinessAddressList, &BusinessAddressListTown,
464                 &BusinessAddressListCounty, &BusinessAddressListPostCode,
465                 &BusinessAddressListCountry, &BusinessAddressListLabel,
466                 &BusinessAddressListLang, &BusinessAddressListAltID,
467                 &BusinessAddressListPID, &BusinessAddressListGeo, 
468                 &BusinessAddressListTimezone, &BusinessAddressListType, 
469                 &BusinessAddressListMediatype, &BusinessAddressListPref,
470                 &BusinessAddressListTokens, SaveData, "work");
472         // Process EMAIL.
473         
474         SaveEmail(&GeneralEmailList, &GeneralEmailListAltID, 
475                 &GeneralEmailListPID, &GeneralEmailListType,
476                 &GeneralEmailListPref, &GeneralEmailListTokens, 
477                 SaveData, "");
478         SaveEmail(&HomeEmailList, &HomeEmailListAltID, 
479                 &HomeEmailListPID, &HomeEmailListType,
480                 &HomeEmailListPref, &HomeEmailListTokens, 
481                 SaveData, "home");
482         SaveEmail(&BusinessEmailList, &BusinessEmailListAltID, 
483                 &BusinessEmailListPID, &BusinessEmailListType,
484                 &BusinessEmailListPref, &BusinessEmailListTokens, 
485                 SaveData, "work");
487         // Process IMPP.
488         
489         SaveIMPP(&GeneralIMList, &GeneralIMListAltID, 
490                 &GeneralIMListPID, &GeneralIMListType,
491                 &GeneralIMListTypeInfo, &GeneralIMListMediatype, 
492                 &GeneralIMListPref, &GeneralIMListTokens,
493                 SaveData, "");
494         SaveIMPP(&HomeIMList, &HomeIMListAltID, 
495                 &HomeIMListPID, &HomeIMListType,
496                 &HomeIMListTypeInfo, &HomeIMListMediatype, 
497                 &HomeIMListPref, &HomeIMListTokens,
498                 SaveData, "home");
499         SaveIMPP(&BusinessIMList, &BusinessIMListAltID, 
500                 &BusinessIMListPID, &BusinessIMListType,
501                 &BusinessIMListTypeInfo, &BusinessIMListMediatype, 
502                 &BusinessIMListPref, &BusinessIMListTokens,
503                 SaveData, "work");
505         // Process TEL.
506         
507         SaveTelephone(&GeneralTelephoneList, &GeneralTelephoneListAltID, 
508                 &GeneralTelephoneListPID, &GeneralTelephoneListType,
509                 &GeneralTelephoneListTypeInfo, &GeneralTelephoneListDataType, 
510                 &GeneralTelephoneListPref, &GeneralTelephoneListTokens, 
511                 SaveData, "");
512         SaveTelephone(&HomeTelephoneList, &HomeTelephoneListAltID, 
513                 &HomeTelephoneListPID, &HomeTelephoneListType,
514                 &HomeTelephoneListTypeInfo, &HomeTelephoneListDataType, 
515                 &HomeTelephoneListPref, &HomeTelephoneListTokens, 
516                 SaveData, "home");
517         SaveTelephone(&BusinessTelephoneList, &BusinessTelephoneListAltID, 
518                 &BusinessTelephoneListPID, &BusinessTelephoneListType,
519                 &BusinessTelephoneListTypeInfo, &BusinessTelephoneListDataType, 
520                 &BusinessTelephoneListPref, &BusinessTelephoneListTokens, 
521                 SaveData, "work");
523         // Process LANG.
524         
525         SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID, 
526                 &GeneralLanguageListPID, &GeneralLanguageListType,
527                 &GeneralLanguageListPref, &GeneralLanguageListTokens, 
528                 SaveData, "");
529         SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID, 
530                 &HomeLanguageListPID, &HomeLanguageListType,
531                 &HomeLanguageListPref, &HomeLanguageListTokens, 
532                 SaveData, "home");
533         SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID, 
534                 &BusinessLanguageListPID, &BusinessLanguageListType,
535                 &BusinessLanguageListPref, &BusinessLanguageListTokens, 
536                 SaveData, "work");
538         // Process GEO.
539         
540         SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID, 
541                 &GeneralGeographyListPID, &GeneralGeographyListType,
542                 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
543                 &GeneralGeographyListPref, &GeneralGeographyListTokens, 
544                 SaveData, "");
545         SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID, 
546                 &HomeGeographyListPID, &HomeGeographyListType,
547                 &HomeGeographyListMediatype, &HomeGeographyListDataType,
548                 &HomeGeographyListPref, &HomeGeographyListTokens, 
549                 SaveData, "home");
550         SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID, 
551                 &BusinessGeographyListPID, &BusinessGeographyListType,
552                 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
553                 &BusinessGeographyListPref, &BusinessGeographyListTokens, 
554                 SaveData, "work");
556         // Process RELATED.
557         
558         int Moo = 0;
560         for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
561                 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
562                 
563                 ProcessData.Append("RELATED");
565                 // Check if there is a value for TYPE.
566                 
567                 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
568                 
569                         wxString RelatedType = "";
570                         
571                         ProcessData.Append(";TYPE=");
572                         
573                         if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
575                                 RelatedType = wxT("contact");
577                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
579                                 RelatedType = wxT("acquaintance");
581                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
583                                 RelatedType = wxT("friend");
585                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
587                                 RelatedType = wxT("met");
589                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
591                                 RelatedType = wxT("co-worker");
593                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
595                                 RelatedType = wxT("colleague");
597                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
599                                 RelatedType = wxT("co-resident");
601                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
603                                 RelatedType = wxT("neighbor");
605                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
607                                 RelatedType = wxT("child");
609                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
611                                 RelatedType = wxT("parent");
613                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
615                                 RelatedType = wxT("sibling");
617                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
619                                 RelatedType = wxT("spouse");
621                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
623                                 RelatedType = wxT("kin");
625                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
627                                 RelatedType = wxT("muse");
629                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
631                                 RelatedType = wxT("crush");
633                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
635                                 RelatedType = wxT("date");
637                         } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
639                                 RelatedType = wxT("sweetheart");
641                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
643                                 RelatedType = wxT("me");
645                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
647                                 RelatedType = wxT("agent");
649                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
651                                 RelatedType = wxT("emergency");
653                         } else {
655                                 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
657                         }
658                         
659                         ProcessData.Append(RelatedType);
660                         
661                 }
663                 // Check if there is a value for LANGUAGE.
664                 
665                 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
666                 
667                         ProcessData.Append(";LANGUAGE=");
668                         ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
669                         
670                 }
671                 
672                 // Check if there is a value for ALTID.
673                 
674                 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
675                 
676                         ProcessData.Append(";ALTID=");
677                         ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
678                         
679                 }
680                 
681                 // Check if there is a value for PID.
683                 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
684                 
685                         ProcessData.Append(";PID=");
686                         ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
687                         
688                 }
690                 // Check if there is a value for PREF.
692                 if (GeneralRelatedListPref[RelatedIter->first] > 0){
693                 
694                         ProcessData.Append(";PREF=");
695                         ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
696                         
697                 }
699                 // Check if there is a value for tokens.
701                 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
702                 
703                         ProcessData.Append(";");
704                         ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
705                         
706                 }
707                 
708                 ProcessData.Append(":");
709                 ProcessData.Append(RelatedIter->second);
710                 ProcessData.Append("\n");
711                 
712                 ProcessData = OutputText(&ProcessData);
713                 
714                 SaveData->Append(ProcessData);
715                 ProcessData.clear();
716                         
717         }
718         
719         // Process URL.
720         
721         SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID, 
722                 &GeneralWebsiteListPID, &GeneralWebsiteListType,
723                 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref, 
724                 &GeneralWebsiteListTokens, SaveData, "");
725         SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID, 
726                 &HomeWebsiteListPID, &HomeWebsiteListType,
727                 &HomeWebsiteListMediatype, &HomeWebsiteListPref, 
728                 &HomeWebsiteListTokens, SaveData, "home");
729         SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID, 
730                 &BusinessWebsiteListPID, &BusinessWebsiteListType,
731                 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref, 
732                 &BusinessWebsiteListTokens, SaveData, "work");
734         // Process ROLE.
735         
736         SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
737                 &GeneralRoleListAltID, &GeneralRoleListPID,
738                 &GeneralRoleListType, &GeneralRoleListPref,
739                 &GeneralRoleListTokens, SaveData, "");
740         SaveRole(&HomeRoleList, &HomeRoleListLanguage,
741                 &HomeRoleListAltID, &HomeRoleListPID,
742                 &HomeRoleListType, &HomeRoleListPref,
743                 &HomeRoleListTokens, SaveData, "home");
744         SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
745                 &BusinessRoleListAltID, &BusinessRoleListPID,
746                 &BusinessRoleListType, &BusinessRoleListPref,
747                 &BusinessRoleListTokens, SaveData, "work");
749         // Process ORG.
750         
751         SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
752                 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage, 
753                 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType, 
754                 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens, 
755                 SaveData, "");
756         SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
757                 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage, 
758                 &HomeOrganisationsListSortAs, &HomeOrganisationsListType, 
759                 &HomeOrganisationsListPref, &HomeOrganisationsListTokens, 
760                 SaveData, "home");
761         SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
762                 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage, 
763                 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType, 
764                 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens, 
765                 SaveData, "work");
767         // Process NOTE.
768         
769         SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
770                 &GeneralNoteListAltID, &GeneralNoteListPID,
771                 &GeneralNoteListType, &GeneralNoteListPref,
772                 &GeneralNoteListTokens, SaveData, "");
773         SaveNote(&HomeNoteList, &HomeNoteListLanguage,
774                 &HomeNoteListAltID, &HomeNoteListPID,
775                 &HomeNoteListType, &HomeNoteListPref,
776                 &HomeNoteListTokens, SaveData, "home");
777         SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
778                 &BusinessNoteListAltID, &BusinessNoteListPID,
779                 &BusinessNoteListType, &BusinessNoteListPref,
780                 &BusinessNoteListTokens, SaveData, "work");
782         // Process CATEGORIES.
783         
784         SaveCategory(&CategoriesList, &CategoriesListLanguage,
785                 &CategoriesListAltID, &CategoriesListPID,
786                 &CategoriesListType, &CategoriesListPref,
787                 &CategoriesListTokens, SaveData);
789         // Process PHOTO.
790         
791         SavePhoto(&PicturesList, &PicturesListAltID, 
792                 &PicturesListPID, &PicturesListType,
793                 &PicturesListPicEncType, &PicturesListPictureType,
794                 &PicturesListMediatype, &PicturesListPref,
795                 &PicturesListTokens, SaveData);
796         
797         // Process LOGO.
798         
799         SaveLogo(&LogosList, &LogosListAltID, 
800                 &LogosListPID, &LogosListType,
801                 &LogosListPicEncType, &LogosListPictureType,
802                 &LogosListMediatype, &LogosListPref,
803                 &LogosListTokens, SaveData);
804         
805         // Process SOUND.
807         SaveSound(&SoundsList, &SoundsListAltID, 
808                 &SoundsListPID, &SoundsListType,
809                 &SoundsListAudioEncType, &SoundsListAudioType,
810                 &SoundsListMediatype, &SoundsListLanguage, 
811                 &SoundsListPref, &SoundsListTokens, 
812                 SaveData);
814         // Process CALURI.
815         
816         SaveCalendarURI(&CalendarList, &CalendarListMediatype,
817                 &CalendarListAltID, &CalendarListPID,
818                 &CalendarListType, &CalendarListPref,
819                 &CalendarListTokens, SaveData);
820         
821         // Process CALADRURI.
822         
823         SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
824                 &CalendarRequestListAltID, &CalendarRequestListPID,
825                 &CalendarRequestListType, &CalendarRequestListPref,
826                 &CalendarRequestListTokens, SaveData);
828         // Process FBURL.
829         
830         SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID, 
831                 &FreeBusyListPID, &FreeBusyListType,
832                 &FreeBusyListMediatype, &FreeBusyListPref, 
833                 &FreeBusyListTokens, SaveData);
835         // Process KEY.
836         
837         SaveKey(&KeyList, &KeyListAltID, 
838                 &KeyListPID, &KeyListType,
839                 &KeyListKeyType, &KeyListDataEncType, 
840                 &KeyListDataType, &KeyListPref, 
841                 &KeyListTokens, SaveData);
843         // Process VND-*
844         
845         SaveVendor(&VendorList, &VendorListPEN, 
846                 &VendorListElement, SaveData);
848         // Process X-Tokens.
849         
850         SaveXToken(&XTokenList, &XTokenListTokens, 
851                 SaveData);
853         // Write the end part of the vCard data file.
854         
855         SaveData->Append("END:VCARD");
856         
857         SaveDataStatus = CONTACTSAVE_OK;
858         
859         return SaveDataStatus;
860         
863 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
864         map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
865         map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
866         map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
868         wxString ProcessData = "";
869                 
870         for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
871                 TitleIter != TitleList->end(); TitleIter++){
873                 ProcessData.Append("TITLE");
874                         
875                 // Check if there is a value for TYPE.
876                 
877                 if (DataType.size() > 0){
878                 
879                         ProcessData.Append(";TYPE=");
880                         ProcessData.Append(DataType);
881                         
882                 }
883                 
884                 // Check if there is a value for ALTID.
885                 
886                 if ((*TitleListAltID)[TitleIter->first].size() > 0){
887                 
888                         ProcessData.Append(";ALTID=");
889                         ProcessData.Append((*TitleListAltID)[TitleIter->first]);
890                         
891                 }
893                 // Check if there is a value for LANGUAGE.
894                 
895                 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
896                 
897                         ProcessData.Append(";LANGUAGE=");
898                         ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
899                         
900                 }
901                 
902                 // Check if there is a value for PID.
904                 if ((*TitleListPID)[TitleIter->first].size() > 0){
905                 
906                         ProcessData.Append(";PID=");
907                         ProcessData.Append((*TitleListPID)[TitleIter->first]);
908                         
909                 }
911                 // Check if there is a value for PREF.
913                 if ((*TitleListPref)[TitleIter->first] > 0){
914                 
915                         ProcessData.Append(";PREF=");
916                         ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
917                         
918                 }
920                 // Check if there is a value for tokens.
922                 if ((*TitleListTokens)[TitleIter->first].size() > 0){
923                 
924                         ProcessData.Append(";");
925                         ProcessData.Append((*TitleListTokens)[TitleIter->first]);
926                         
927                 }
928                         
929                 ProcessData.Append(":");
930                 ProcessData.Append(TitleIter->second);
931                 ProcessData.Append("\n");
933                 ProcessData = OutputText(&ProcessData);
934                         
935                 SaveData->Append(ProcessData);
936                 ProcessData.clear();
937                         
938         }
939                 
942 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID, 
943         map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
944         map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref, 
945         map<int, wxString> *SourceListTokens, wxString *SaveData){
947         wxString ProcessData = "";
948         
949         for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
950                 SourceIter != SourceList->end(); SourceIter++){
952                 ProcessData.Append("SOURCE");
953                         
954                 // Check if there is a value for TYPE.
955                 
956                 if ((*SourceListType)[SourceIter->first].size() > 0){
957                 
958                         ProcessData.Append(";TYPE=");
959                         ProcessData.Append((*SourceListType)[SourceIter->first]);
960                         
961                 }
962                 
963                 // Check if there is a value for ALTID.
964                 
965                 if ((*SourceListAltID)[SourceIter->first].size() > 0){
966                 
967                         ProcessData.Append(";ALTID=");
968                         ProcessData.Append((*SourceListAltID)[SourceIter->first]);
969                         
970                 }
972                 // Check if there is a value for MEDIATYPE.
973                 
974                 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
975                 
976                         ProcessData.Append(";MEDIATYPE=");
977                         ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
978                         
979                 }
980                 
981                 // Check if there is a value for PID.
983                 if ((*SourceListPID)[SourceIter->first].size() > 0){
984                 
985                         ProcessData.Append(";PID=");
986                         ProcessData.Append((*SourceListPID)[SourceIter->first]);
987                         
988                 }
990                 // Check if there is a value for PREF.
992                 if ((*SourceListPref)[SourceIter->first] > 0){
993                 
994                         ProcessData.Append(";PREF=");
995                         ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
996                         
997                 }
999                 // Check if there is a value for tokens.
1001                 if ((*SourceListTokens)[SourceIter->first].size() > 0){
1002                 
1003                         ProcessData.Append(";");
1004                         ProcessData.Append((*SourceListTokens)[SourceIter->first]);
1005                         
1006                 }
1007                         
1008                 ProcessData.Append(":");
1009                 ProcessData.Append(SourceIter->second);
1010                 ProcessData.Append("\n");
1012                 ProcessData = OutputText(&ProcessData);
1013                         
1014                 SaveData->Append(ProcessData);
1015                 ProcessData.clear();
1016                         
1017         }
1018                 
1021 void ContactDataObject::SaveMember(std::map<int, wxString> *GroupsList, std::map<int, wxString> *GroupsListAltID, 
1022         std::map<int, wxString> *GroupsListPID, std::map<int, wxString> *GroupsListType,
1023         std::map<int, wxString> *GroupsListMediaType, std::map<int, int> *GroupsListPref, 
1024         std::map<int, wxString> *GroupsListTokens, wxString *SaveData){
1026         wxString ProcessData = "";
1027                 
1028         for (std::map<int, wxString>::iterator GroupsIter = GroupsList->begin();
1029                 GroupsIter != GroupsList->end(); GroupsIter++){
1031                 ProcessData.Append("MEMBER");
1032                         
1033                 // Check if there is a value for TYPE.
1034                 
1035                 if ((*GroupsListType)[GroupsIter->first].size() > 0){
1036                 
1037                         ProcessData.Append(";TYPE=");
1038                         ProcessData.Append((*GroupsListType)[GroupsIter->first]);
1039                         
1040                 }
1041                 
1042                 // Check if there is a value for ALTID.
1043                 
1044                 if ((*GroupsListAltID)[GroupsIter->first].size() > 0){
1045                 
1046                         ProcessData.Append(";ALTID=");
1047                         ProcessData.Append((*GroupsListAltID)[GroupsIter->first]);
1048                         
1049                 }
1051                 // Check if there is a value for MEDIATYPE.
1052                 
1053                 if ((*GroupsListMediaType)[GroupsIter->first].size() > 0){
1054                 
1055                         ProcessData.Append(";MEDIATYPE=");
1056                         ProcessData.Append((*GroupsListMediaType)[GroupsIter->first]);
1057                         
1058                 }
1059                 
1060                 // Check if there is a value for PID.
1062                 if ((*GroupsListPID)[GroupsIter->first].size() > 0){
1063                 
1064                         ProcessData.Append(";PID=");
1065                         ProcessData.Append((*GroupsListPID)[GroupsIter->first]);
1066                         
1067                 }
1069                 // Check if there is a value for PREF.
1071                 if ((*GroupsListPref)[GroupsIter->first] > 0){
1072                 
1073                         ProcessData.Append(";PREF=");
1074                         ProcessData.Append(wxString::Format("%i", (*GroupsListPref)[GroupsIter->first]));
1075                         
1076                 }
1078                 // Check if there is a value for tokens.
1080                 if ((*GroupsListTokens)[GroupsIter->first].size() > 0){
1081                 
1082                         ProcessData.Append(";");
1083                         ProcessData.Append((*GroupsListTokens)[GroupsIter->first]);
1084                         
1085                 }
1086                         
1087                 ProcessData.Append(":");
1088                 ProcessData.Append(GroupsIter->second);
1089                 ProcessData.Append("\n");
1091                 ProcessData = OutputText(&ProcessData);
1092                 
1093                 SaveData->Append(ProcessData);
1094                 ProcessData.clear();
1095                         
1096         }
1097                 
1100 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID, 
1101         map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
1102         map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref, 
1103         map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
1105         wxString ProcessData = "";
1106         
1107         for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
1108                 NicknameIter != NicknameList->end(); NicknameIter++){
1110                 ProcessData.Append("NICKNAME");
1111                         
1112                 // Check if there is a value for TYPE.
1113                 
1114                 if (DataType.size() > 0){
1115                 
1116                         ProcessData.Append(";TYPE=");
1117                         ProcessData.Append(DataType);
1118                         
1119                 }
1120                 
1121                 // Check if there is a value for ALTID.
1122                 
1123                 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
1124                 
1125                         ProcessData.Append(";ALTID=");
1126                         ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
1127                         
1128                 }
1130                 // Check if there is a value for MEDIATYPE.
1131                 
1132                 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
1133                 
1134                         ProcessData.Append(";LANGUAGE=");
1135                         ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
1136                         
1137                 }
1138                 
1139                 // Check if there is a value for PID.
1141                 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
1142                 
1143                         ProcessData.Append(";PID=");
1144                         ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
1145                         
1146                 }
1148                 // Check if there is a value for PREF.
1150                 if ((*NicknameListPref)[NicknameIter->first] > 0){
1151                 
1152                         ProcessData.Append(";PREF=");
1153                         ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
1154                         
1155                 }
1157                 // Check if there is a value for tokens.
1159                 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
1160                 
1161                         ProcessData.Append(";");
1162                         ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
1163                         
1164                 }
1165                         
1166                 ProcessData.Append(":");
1167                 ProcessData.Append(NicknameIter->second);
1168                 ProcessData.Append("\n");
1170                 ProcessData = OutputText(&ProcessData);
1171                         
1172                 SaveData->Append(ProcessData);
1173                 ProcessData.clear();
1174                         
1175         }
1176                 
1179 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID, 
1180         map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
1181         map<int, wxString> *TZListMediatype, map<int, int> *TZListPref, 
1182         map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
1184         wxString ProcessData = "";
1185         
1186         for (std::map<int, wxString>::iterator TZIter = TZList->begin();
1187                 TZIter != TZList->end(); TZIter++){
1189                 ProcessData.Append("TZ");
1190                         
1191                 // Check if there is a value for TYPE.
1192                 
1193                 if (DataType.size() > 0){
1194                 
1195                         ProcessData.Append(";TYPE=");
1196                         ProcessData.Append(DataType);
1197                         
1198                 }
1199                 
1200                 // Check if there is a value for ALTID.
1201                 
1202                 if ((*TZListAltID)[TZIter->first].size() > 0){
1203                 
1204                         ProcessData.Append(";ALTID=");
1205                         ProcessData.Append((*TZListAltID)[TZIter->first]);
1206                         
1207                 }
1209                 // Check if there is a value for MEDIATYPE.
1210                 
1211                 if ((*TZListMediatype)[TZIter->first].size() > 0){
1212                 
1213                         ProcessData.Append(";MEDIATYPE=");
1214                         ProcessData.Append((*TZListMediatype)[TZIter->first]);
1215                         
1216                 }
1217                 
1218                 // Check if there is a value for PID.
1220                 if ((*TZListPID)[TZIter->first].size() > 0){
1221                 
1222                         ProcessData.Append(";PID=");
1223                         ProcessData.Append((*TZListPID)[TZIter->first]);
1224                         
1225                 }
1227                 // Check if there is a value for PREF.
1229                 if ((*TZListPref)[TZIter->first] > 0){
1230                 
1231                         ProcessData.Append(";PREF=");
1232                         ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
1233                         
1234                 }
1236                 // Check if there is a value for tokens.
1238                 if ((*TZListTokens)[TZIter->first].size() > 0){
1239                 
1240                         ProcessData.Append(";");
1241                         ProcessData.Append((*TZListTokens)[TZIter->first]);
1242                         
1243                 }
1244                         
1245                 ProcessData.Append(":");
1246                 ProcessData.Append(TZIter->second);
1247                 ProcessData.Append("\n");
1249                 ProcessData = OutputText(&ProcessData);
1250                         
1251                 SaveData->Append(ProcessData);
1252                 ProcessData.clear();
1253                         
1254         }
1255                 
1258 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
1259                 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
1260                 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
1261                 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
1262                 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo, 
1263                 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType, 
1264                 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref, 
1265                 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
1267         wxString ProcessData = "";
1268                         
1269         for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
1270                 AddressIter != AddressList->end(); AddressIter++){
1271                         
1272                 ProcessData.Append("ADR");
1273                         
1274                 // Check if there is a value for TYPE.
1275                 
1276                 if (DataType.size() > 0){
1277                 
1278                         ProcessData.Append(";TYPE=");
1279                         ProcessData.Append(DataType);
1280                         
1281                 }
1282                 
1283                 // Check if there is a value for ALTID.
1284                 
1285                 if ((*AddressListAltID)[AddressIter->first].size() > 0){
1286                 
1287                         ProcessData.Append(";ALTID=");
1288                         ProcessData.Append((*AddressListAltID)[AddressIter->first]);
1289                         
1290                 }
1292                 // Check if there is a value for GEO.
1293                 
1294                 if ((*AddressListGeo)[AddressIter->first].size() > 0){
1295                 
1296                         ProcessData.Append(";GEO=\"");
1297                         ProcessData.Append((*AddressListGeo)[AddressIter->first]);
1298                         ProcessData.Append("\"");
1299                         
1300                 }
1302                 // Check if there is a value for LABEL.
1304                 if ((*AddressListLabel)[AddressIter->first].size() > 0){
1305                 
1306                         wxString AddressProcessed = "";
1307                         AddressProcessed = (*AddressListLabel)[AddressIter->first];
1308                         
1309                         AddressProcessed.Replace("\n", "\\n", true);
1310                         
1311                         ProcessData.Append(";LABEL=");
1312                         ProcessData.Append(AddressProcessed);
1313                         
1314                 }
1315                 
1316                 // Check if there is a value for LANGUAGE.
1317                 
1318                 if ((*AddressListLang)[AddressIter->first].size() > 0){
1319                 
1320                         ProcessData.Append(";LANGUAGE=");
1321                         ProcessData.Append((*AddressListLang)[AddressIter->first]);
1322                         
1323                 }
1324                 
1325                 // Check if there is a value for MEDIATYPE.
1326                 
1327                 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1328                 
1329                         ProcessData.Append(";MEDIATYPE=");
1330                         ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1331                         
1332                 }
1333                 
1334                 // Check if there is a value for PID.
1336                 if ((*AddressListPID)[AddressIter->first].size() > 0){
1337                 
1338                         ProcessData.Append(";PID=");
1339                         ProcessData.Append((*AddressListPID)[AddressIter->first]);
1340                         
1341                 }
1343                 // Check if there is a value for PREF.
1345                 if ((*AddressListPref)[AddressIter->first] > 0){
1346                 
1347                         ProcessData.Append(";PREF=");
1348                         ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1349                         
1350                 }
1352                 // Check if there is a value for TZ.
1354                 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1355                 
1356                         ProcessData.Append(";TZ=");
1357                         ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1358                         
1359                 }
1360                 
1361                 // Check if there is a value for tokens.
1363                 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1364                 
1365                         ProcessData.Append(";");
1366                         ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1367                         
1368                 }
1369                 
1370                 // Build the address.
1371                 
1372                 ProcessData.Append(":;;");
1373                 ProcessData.Append((*AddressList)[AddressIter->first]);
1374                 ProcessData.Append(";");
1375                 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1376                 ProcessData.Append(";");
1377                 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1378                 ProcessData.Append(";");
1379                 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1380                 ProcessData.Append(";");
1381                 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1382                 ProcessData.Append("\n");
1383                 
1384                 ProcessData = OutputText(&ProcessData);
1385                         
1386                 SaveData->Append(ProcessData);
1387                 ProcessData.clear();
1388                         
1389         }
1390                         
1393 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID, 
1394         map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1395         map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens, 
1396         wxString *SaveData, wxString DataType){
1398         wxString ProcessData = "";
1399         
1400         for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1401                 EmailIter != EmailList->end(); EmailIter++){
1403                 ProcessData.Append("EMAIL");
1404                         
1405                 // Check if there is a value for TYPE.
1406                 
1407                 if (DataType.size() > 0){
1408                 
1409                         ProcessData.Append(";TYPE=");
1410                         ProcessData.Append(DataType);
1411                         
1412                 }
1413                 
1414                 // Check if there is a value for ALTID.
1415                 
1416                 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1417                 
1418                         ProcessData.Append(";ALTID=");
1419                         ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1420                         
1421                 }
1422                 
1423                 // Check if there is a value for PID.
1425                 if ((*EmailListPID)[EmailIter->first].size() > 0){
1426                 
1427                         ProcessData.Append(";PID=");
1428                         ProcessData.Append((*EmailListPID)[EmailIter->first]);
1429                         
1430                 }
1432                 // Check if there is a value for PREF.
1434                 if ((*EmailListPref)[EmailIter->first] > 0){
1435                 
1436                         ProcessData.Append(";PREF=");
1437                         ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1438                         
1439                 }
1441                 // Check if there is a value for tokens.
1443                 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1444                 
1445                         ProcessData.Append(";");
1446                         ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1447                         
1448                 }
1449                         
1450                 ProcessData.Append(":");
1451                 ProcessData.Append(EmailIter->second);
1452                 ProcessData.Append("\n");
1454                 ProcessData = OutputText(&ProcessData);
1455                         
1456                 SaveData->Append(ProcessData);
1457                 ProcessData.clear();
1458                         
1459         }
1460                 
1463 void ContactDataObject::SaveIMPP(map<int, wxString> *IMList, map<int, wxString> *IMListAltID, 
1464         map<int, wxString> *IMListPID, map<int, wxString> *IMListType,
1465         map<int, wxString> *IMListTypeInfo, map<int, wxString> *IMListMediatype, 
1466         map<int, int> *IMListPref, map<int, wxString> *IMListTokens, 
1467         wxString *SaveData, wxString DataType){
1469         wxString ProcessData = "";
1470         
1471         for (std::map<int, wxString>::iterator IMIter = IMList->begin();
1472                 IMIter != IMList->end(); IMIter++){
1474                 ProcessData.Append("IMPP");
1475                         
1476                 // Check if there is a value for TYPE.
1477                 
1478                 if (DataType.size() > 0){
1479                 
1480                         ProcessData.Append(";TYPE=");
1481                         ProcessData.Append(DataType);
1482                         
1483                 }
1484                 
1485                 // Check if there is a value for ALTID.
1486                 
1487                 if ((*IMListAltID)[IMIter->first].size() > 0){
1488                 
1489                         ProcessData.Append(";ALTID=");
1490                         ProcessData.Append((*IMListAltID)[IMIter->first]);
1491                         
1492                 }
1493                 
1494                 // Check if there is a value for MEDIATYPE.
1495                 
1496                 if ((*IMListMediatype)[IMIter->first].size() > 0){
1497                 
1498                         ProcessData.Append(";MEDIATYPE=");
1499                         ProcessData.Append((*IMListMediatype)[IMIter->first]);
1500                         
1501                 }
1502                 
1503                 // Check if there is a value for PID.
1505                 if ((*IMListPID)[IMIter->first].size() > 0){
1506                 
1507                         ProcessData.Append(";PID=");
1508                         ProcessData.Append((*IMListPID)[IMIter->first]);
1509                         
1510                 }
1512                 // Check if there is a value for PREF.
1514                 if ((*IMListPref)[IMIter->first] > 0){
1515                 
1516                         ProcessData.Append(";PREF=");
1517                         ProcessData.Append(wxString::Format("%i", (*IMListPref)[IMIter->first]));
1518                         
1519                 }
1521                 // Check if there is a value for tokens.
1523                 if ((*IMListTokens)[IMIter->first].size() > 0){
1524                 
1525                         ProcessData.Append(";");
1526                         ProcessData.Append((*IMListTokens)[IMIter->first]);
1527                         
1528                 }
1530                 ProcessData.Append(":");
1531                 ProcessData.Append((*IMListTypeInfo)[IMIter->first]);
1532                 ProcessData.Append(":");
1533                 ProcessData.Append(IMIter->second);
1534                 ProcessData.Append("\n");
1536                 ProcessData = OutputText(&ProcessData);
1537                         
1538                 SaveData->Append(ProcessData);
1539                 ProcessData.clear();
1540                         
1541         }
1542                 
1545 void ContactDataObject::SaveTelephone(map<int, wxString> *TelephoneList, map<int, wxString> *TelephoneListAltID, 
1546         map<int, wxString> *TelephoneListPID, map<int, wxString> *TelephoneListType,
1547         map<int, wxString> *TelephoneListTypeInfo, map<int, wxString> *TelephoneListDataType, 
1548         map<int, int> *TelephoneListPref, map<int, wxString> *TelephoneListTokens, 
1549         wxString *SaveData, wxString DataType){
1551         wxString ProcessData = "";
1552         
1553         for (std::map<int, wxString>::iterator TelephoneIter = TelephoneList->begin();
1554                 TelephoneIter != TelephoneList->end(); TelephoneIter++){
1556                 ProcessData.Append("TEL");
1557                         
1558                 // Check if there is a value for TYPE.
1560                 if (DataType.size() > 0 || (*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1562                         ProcessData.Append(";TYPE=\"");
1563                         
1564                         bool ProcessedType = false;
1565                         
1566                         if (DataType.size() > 0){
1567                 
1568                                 ProcessData.Append(DataType);
1569                                 ProcessedType = true;
1570                         
1571                         }
1572                         
1573                         if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1574                                 
1575                                 if (ProcessedType == true){
1576                                         ProcessData.Append(",");
1577                                 }
1578                                 ProcessData.Append((*TelephoneListTypeInfo)[TelephoneIter->first]);
1579                                 
1580                         }
1581                         
1582                         ProcessData.Append("\"");
1583                 
1584                 }
1585                 
1586                 // Check if there is a value for ALTID.
1587                 
1588                 if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1589                 
1590                         ProcessData.Append(";ALTID=");
1591                         ProcessData.Append((*TelephoneListAltID)[TelephoneIter->first]);
1592                         
1593                 }
1594                 
1595                 // Check if there is a value for PID.
1597                 if ((*TelephoneListPID)[TelephoneIter->first].size() > 0){
1598                 
1599                         ProcessData.Append(";PID=");
1600                         ProcessData.Append((*TelephoneListPID)[TelephoneIter->first]);
1601                         
1602                 }
1604                 // Check if there is a value for PREF.
1606                 if ((*TelephoneListPref)[TelephoneIter->first] > 0){
1607                 
1608                         ProcessData.Append(";PREF=");
1609                         ProcessData.Append(wxString::Format("%i", (*TelephoneListPref)[TelephoneIter->first]));
1610                         
1611                 }
1613                 // Check if there is a value for tokens.
1615                 if ((*TelephoneListTokens)[TelephoneIter->first].size() > 0){
1616                 
1617                         ProcessData.Append(";");
1618                         ProcessData.Append((*TelephoneListTokens)[TelephoneIter->first]);
1619                         
1620                 }
1622                 ProcessData.Append(":");
1623                 ProcessData.Append((*TelephoneListDataType)[TelephoneIter->first]);
1624                 ProcessData.Append(":");
1625                 ProcessData.Append(TelephoneIter->second);
1626                 ProcessData.Append("\n");
1628                 ProcessData = OutputText(&ProcessData);
1629                         
1630                 SaveData->Append(ProcessData);
1631                 ProcessData.clear();
1632                         
1633         }
1634                 
1637 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID, 
1638         map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1639         map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens, 
1640         wxString *SaveData, wxString DataType){
1642         wxString ProcessData = "";
1643         
1644         for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1645                 LanguageIter != LanguageList->end(); LanguageIter++){
1647                 ProcessData.Append("LANG");
1648                         
1649                 // Check if there is a value for TYPE.
1650                 
1651                 if (DataType.size() > 0){
1652                 
1653                         ProcessData.Append(";TYPE=");
1654                         ProcessData.Append(DataType);
1655                         
1656                 }
1657                 
1658                 // Check if there is a value for ALTID.
1659                 
1660                 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1661                 
1662                         ProcessData.Append(";ALTID=");
1663                         ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1664                         
1665                 }
1666                 
1667                 // Check if there is a value for PID.
1669                 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1670                 
1671                         ProcessData.Append(";PID=");
1672                         ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1673                         
1674                 }
1676                 // Check if there is a value for PREF.
1678                 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1679                 
1680                         ProcessData.Append(";PREF=");
1681                         ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1682                         
1683                 }
1685                 // Check if there is a value for tokens.
1687                 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1688                 
1689                         ProcessData.Append(";");
1690                         ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1691                         
1692                 }
1693                         
1694                 ProcessData.Append(":");
1695                 ProcessData.Append(LanguageIter->second);
1696                 ProcessData.Append("\n");
1698                 ProcessData = OutputText(&ProcessData);
1699                         
1700                 SaveData->Append(ProcessData);
1701                 ProcessData.clear();
1702                         
1703         }
1704                 
1707 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID, 
1708         map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1709         map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1710         map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens, 
1711         wxString *SaveData, wxString DataType){
1713         wxString ProcessData = "";
1714         
1715         for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1716                 GeographyIter != GeographyList->end(); GeographyIter++){
1718                 ProcessData.Append("GEO");
1719                         
1720                 // Check if there is a value for TYPE.
1721                 
1722                 if (DataType.size() > 0){
1723                 
1724                         ProcessData.Append(";TYPE=");
1725                         ProcessData.Append(DataType);
1726                         
1727                 }
1728                 
1729                 // Check if there is a value for ALTID.
1730                 
1731                 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1732                 
1733                         ProcessData.Append(";ALTID=");
1734                         ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1735                         
1736                 }
1737                 
1738                 // Check if there is a value for MEDIATYPE.
1739                 
1740                 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1741                 
1742                         ProcessData.Append(";MEDIATYPE=");
1743                         ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1744                         
1745                 }
1746                 
1747                 // Check if there is a value for PID.
1749                 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1750                 
1751                         ProcessData.Append(";PID=");
1752                         ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1753                         
1754                 }
1756                 // Check if there is a value for PREF.
1758                 if ((*GeographyListPref)[GeographyIter->first] > 0){
1759                 
1760                         ProcessData.Append(";PREF=");
1761                         ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1762                         
1763                 }
1765                 // Check if there is a value for tokens.
1767                 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1768                 
1769                         ProcessData.Append(";");
1770                         ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1771                         
1772                 }
1773                         
1774                 ProcessData.Append(":");
1775                 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1776                 ProcessData.Append(":");
1777                 ProcessData.Append(GeographyIter->second);
1778                 ProcessData.Append("\n");
1780                 ProcessData = OutputText(&ProcessData);
1781                         
1782                 SaveData->Append(ProcessData);
1783                 ProcessData.clear();
1784                         
1785         }
1786                 
1789 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID, 
1790                 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1791                 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref, 
1792                 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1794         wxString ProcessData = "";
1795         
1796         for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1797                 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1799                 ProcessData.Append("URL");
1800                         
1801                 // Check if there is a value for TYPE.
1802                 
1803                 if (DataType.size() > 0){
1804                 
1805                         ProcessData.Append(";TYPE=");
1806                         ProcessData.Append(DataType);
1807                         
1808                 }
1809                 
1810                 // Check if there is a value for ALTID.
1811                 
1812                 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1813                 
1814                         ProcessData.Append(";ALTID=");
1815                         ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1816                         
1817                 }
1818                 
1819                 // Check if there is a value for MEDIATYPE.
1820                 
1821                 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1822                 
1823                         ProcessData.Append(";MEDIATYPE=");
1824                         ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1825                         
1826                 }
1827                 
1828                 // Check if there is a value for PID.
1830                 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1831                 
1832                         ProcessData.Append(";PID=");
1833                         ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1834                         
1835                 }
1837                 // Check if there is a value for PREF.
1839                 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1840                 
1841                         ProcessData.Append(";PREF=");
1842                         ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1843                         
1844                 }
1846                 // Check if there is a value for tokens.
1848                 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1849                 
1850                         ProcessData.Append(";");
1851                         ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1852                         
1853                 }
1854                         
1855                 ProcessData.Append(":");
1856                 ProcessData.Append(WebsiteIter->second);
1857                 ProcessData.Append("\n");
1859                 ProcessData = OutputText(&ProcessData);
1860                         
1861                 SaveData->Append(ProcessData);
1862                 ProcessData.clear();
1863                         
1864         }
1865                         
1868 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1869         map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1870         map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1871         map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1873         wxString ProcessData = "";
1874                 
1875         for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1876                 RoleIter != RoleList->end(); RoleIter++){
1878                 ProcessData.Append("ROLE");
1879                         
1880                 // Check if there is a value for TYPE.
1881                 
1882                 if (DataType.size() > 0){
1883                 
1884                         ProcessData.Append(";TYPE=");
1885                         ProcessData.Append(DataType);
1886                         
1887                 }
1888                 
1889                 // Check if there is a value for ALTID.
1890                 
1891                 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1892                 
1893                         ProcessData.Append(";ALTID=");
1894                         ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1895                         
1896                 }
1898                 // Check if there is a value for LANGUAGE.
1899                 
1900                 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1901                 
1902                         ProcessData.Append(";LANGUAGE=");
1903                         ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1904                         
1905                 }
1906                 
1907                 // Check if there is a value for PID.
1909                 if ((*RoleListPID)[RoleIter->first].size() > 0){
1910                 
1911                         ProcessData.Append(";PID=");
1912                         ProcessData.Append((*RoleListPID)[RoleIter->first]);
1913                         
1914                 }
1916                 // Check if there is a value for PREF.
1918                 if ((*RoleListPref)[RoleIter->first] > 0){
1919                 
1920                         ProcessData.Append(";PREF=");
1921                         ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1922                         
1923                 }
1925                 // Check if there is a value for tokens.
1927                 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1928                 
1929                         ProcessData.Append(";");
1930                         ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1931                         
1932                 }
1933                         
1934                 ProcessData.Append(":");
1935                 ProcessData.Append(RoleIter->second);
1936                 ProcessData.Append("\n");
1938                 ProcessData = OutputText(&ProcessData);
1939                 
1940                 SaveData->Append(ProcessData);
1941                 ProcessData.clear();
1942                         
1943         }
1944                 
1947 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1948         map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage, 
1949         map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType, 
1950         map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens, 
1951         wxString *SaveData, wxString DataType){
1953         wxString ProcessData = "";
1954                 
1955         for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1956                 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1958                 ProcessData.Append("ORG");
1959                         
1960                 // Check if there is a value for TYPE.
1961                 
1962                 if (DataType.size() > 0){
1963                 
1964                         ProcessData.Append(";TYPE=");
1965                         ProcessData.Append(DataType);
1966                         
1967                 }
1968                 
1969                 // Check if there is a value for ALTID.
1970                 
1971                 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1972                 
1973                         ProcessData.Append(";ALTID=");
1974                         ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1975                         
1976                 }
1978                 // Check if there is a value for LANGUAGE.
1979                 
1980                 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1981                 
1982                         ProcessData.Append(";LANGUAGE=");
1983                         ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1984                         
1985                 }
1986                 
1987                 // Check if there is a value for PID.
1989                 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1990                 
1991                         ProcessData.Append(";PID=");
1992                         ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1993                         
1994                 }
1996                 // Check if there is a value for PREF.
1998                 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1999                 
2000                         ProcessData.Append(";PREF=");
2001                         ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
2002                         
2003                 }
2004                 
2005                 // Check if there is a value for SORT-AS.
2006                 
2007                 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
2008                 
2009                         ProcessData.Append(";SORT-AS=\"");
2010                         ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
2011                         ProcessData.Append("\"");
2012                         
2013                 }
2015                 // Check if there is a value for tokens.
2017                 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
2018                 
2019                         ProcessData.Append(";");
2020                         ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
2021                         
2022                 }
2023                         
2024                 ProcessData.Append(":");
2025                 ProcessData.Append(OrganisationIter->second);
2026                 ProcessData.Append("\n");
2028                 ProcessData = OutputText(&ProcessData);
2029                 
2030                 SaveData->Append(ProcessData);
2031                 ProcessData.clear();
2032                         
2033         }
2034                 
2037 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
2038         map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
2039         map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
2040         map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
2042         wxString ProcessData = "";
2043                 
2044         for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
2045                 NoteIter != NoteList->end(); NoteIter++){
2047                 ProcessData.Append("NOTE");
2048                         
2049                 // Check if there is a value for TYPE.
2050                 
2051                 if (DataType.size() > 0){
2052                 
2053                         ProcessData.Append(";TYPE=");
2054                         ProcessData.Append(DataType);
2055                         
2056                 }
2057                 
2058                 // Check if there is a value for ALTID.
2059                 
2060                 if ((*NoteListAltID)[NoteIter->first].size() > 0){
2061                 
2062                         ProcessData.Append(";ALTID=");
2063                         ProcessData.Append((*NoteListAltID)[NoteIter->first]);
2064                         
2065                 }
2067                 // Check if there is a value for LANGUAGE.
2068                 
2069                 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
2070                 
2071                         ProcessData.Append(";LANGUAGE=");
2072                         ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
2073                         
2074                 }
2075                 
2076                 // Check if there is a value for PID.
2078                 if ((*NoteListPID)[NoteIter->first].size() > 0){
2079                 
2080                         ProcessData.Append(";PID=");
2081                         ProcessData.Append((*NoteListPID)[NoteIter->first]);
2082                         
2083                 }
2085                 // Check if there is a value for PREF.
2087                 if ((*NoteListPref)[NoteIter->first] > 0){
2088                 
2089                         ProcessData.Append(";PREF=");
2090                         ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
2091                         
2092                 }
2094                 // Check if there is a value for tokens.
2096                 if ((*NoteListTokens)[NoteIter->first].size() > 0){
2097                 
2098                         ProcessData.Append(";");
2099                         ProcessData.Append((*NoteListTokens)[NoteIter->first]);
2100                         
2101                 }
2102                         
2103                 ProcessData.Append(":");
2104                 ProcessData.Append(NoteIter->second);
2105                 ProcessData.Replace("\n", "\\n", true);
2106                 ProcessData.Append("\n");
2108                 ProcessData = OutputText(&ProcessData);
2109                 
2110                 SaveData->Append(ProcessData);
2111                 ProcessData.clear();
2112                         
2113         }
2114                 
2117 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
2118         map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
2119         map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
2120         map<int, wxString> *CategoryListTokens, wxString *SaveData){
2122         wxString ProcessData = "";
2123                 
2124         for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
2125                 CategoryIter != CategoryList->end(); CategoryIter++){
2127                 ProcessData.Append("CATEGORIES");
2128                         
2129                 // Check if there is a value for TYPE.
2130                 
2131                 if ((*CategoryListType)[CategoryIter->first].size() > 0){
2132                 
2133                         ProcessData.Append(";TYPE=");
2134                         ProcessData.Append((*CategoryListType)[CategoryIter->first]);
2135                         
2136                 }
2137                 
2138                 // Check if there is a value for ALTID.
2139                 
2140                 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
2141                 
2142                         ProcessData.Append(";ALTID=");
2143                         ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
2144                         
2145                 }
2147                 // Check if there is a value for LANGUAGE.
2148                 
2149                 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
2150                 
2151                         ProcessData.Append(";LANGUAGE=");
2152                         ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
2153                         
2154                 }
2155                 
2156                 // Check if there is a value for PID.
2158                 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
2159                 
2160                         ProcessData.Append(";PID=");
2161                         ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
2162                         
2163                 }
2165                 // Check if there is a value for PREF.
2167                 if ((*CategoryListPref)[CategoryIter->first] > 0){
2168                 
2169                         ProcessData.Append(";PREF=");
2170                         ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
2171                         
2172                 }
2174                 // Check if there is a value for tokens.
2176                 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
2177                 
2178                         ProcessData.Append(";");
2179                         ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
2180                         
2181                 }
2182                         
2183                 ProcessData.Append(":");
2184                 ProcessData.Append(CategoryIter->second);
2185                 ProcessData.Append("\n");
2187                 ProcessData = OutputText(&ProcessData);
2188                 
2189                 SaveData->Append(ProcessData);
2190                 ProcessData.clear();
2191                         
2192         }
2193                 
2196 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID, 
2197                 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
2198                 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
2199                 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
2200                 map<int, wxString> *PicturesListTokens, wxString *SaveData){
2202         wxString ProcessData = "";
2203                 
2204         for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
2205                 PicturesIter != PicturesList->end(); PicturesIter++){
2207                 ProcessData.Append("PHOTO");
2208                         
2209                 // Check if there is a value for TYPE.
2210                 
2211                 if ((*PicturesListType)[PicturesIter->first].size() > 0){
2212                 
2213                         ProcessData.Append(";TYPE=");
2214                         ProcessData.Append((*PicturesListType)[PicturesIter->first]);
2215                         
2216                 }
2217                 
2218                 // Check if there is a value for ALTID.
2219                 
2220                 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
2221                 
2222                         ProcessData.Append(";ALTID=");
2223                         ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
2224                         
2225                 }
2227                 // Check if there is a value for MEDIATYPE..
2228                 
2229                 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
2230                 
2231                         ProcessData.Append(";MEDIATYPE=");
2232                         ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
2233                         
2234                 }
2235                 
2236                 // Check if there is a value for PID.
2238                 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
2239                 
2240                         ProcessData.Append(";PID=");
2241                         ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
2242                         
2243                 }
2245                 // Check if there is a value for PREF.
2247                 if ((*PicturesListPref)[PicturesIter->first] > 0){
2248                 
2249                         ProcessData.Append(";PREF=");
2250                         ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
2251                         
2252                 }
2254                 // Check if there is a value for tokens.
2256                 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
2257                 
2258                         ProcessData.Append(";");
2259                         ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
2260                         
2261                 }
2262                 
2263                 ProcessData.Append(":data:");
2264                 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
2265                 ProcessData.Append(";");
2266                 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
2267                 ProcessData.Append(",");
2268                 ProcessData.Append(PicturesIter->second);
2269                 ProcessData.Append("\n");
2271                 ProcessData = OutputText(&ProcessData);
2272                 
2273                 SaveData->Append(ProcessData);
2274                 ProcessData.clear();
2275                         
2276         }
2277                         
2280 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID, 
2281         map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
2282         map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
2283         map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
2284         map<int, wxString> *LogosListTokens, wxString *SaveData){
2286         wxString ProcessData = "";
2287                 
2288         for (std::map<int, string>::iterator LogosIter = LogosList->begin();
2289                 LogosIter != LogosList->end(); LogosIter++){
2291                 ProcessData.Append("LOGO");
2292                         
2293                 // Check if there is a value for TYPE.
2294                 
2295                 if ((*LogosListType)[LogosIter->first].size() > 0){
2296                 
2297                         ProcessData.Append(";TYPE=");
2298                         ProcessData.Append((*LogosListType)[LogosIter->first]);
2299                         
2300                 }
2301                 
2302                 // Check if there is a value for ALTID.
2303                 
2304                 if ((*LogosListAltID)[LogosIter->first].size() > 0){
2305                 
2306                         ProcessData.Append(";ALTID=");
2307                         ProcessData.Append((*LogosListAltID)[LogosIter->first]);
2308                         
2309                 }
2311                 // Check if there is a value for MEDIATYPE..
2312                 
2313                 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
2314                 
2315                         ProcessData.Append(";MEDIATYPE=");
2316                         ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
2317                         
2318                 }
2319                 
2320                 // Check if there is a value for PID.
2322                 if ((*LogosListPID)[LogosIter->first].size() > 0){
2323                 
2324                         ProcessData.Append(";PID=");
2325                         ProcessData.Append((*LogosListPID)[LogosIter->first]);
2326                         
2327                 }
2329                 // Check if there is a value for PREF.
2331                 if ((*LogosListPref)[LogosIter->first] > 0){
2332                 
2333                         ProcessData.Append(";PREF=");
2334                         ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
2335                         
2336                 }
2338                 // Check if there is a value for tokens.
2340                 if ((*LogosListTokens)[LogosIter->first].size() > 0){
2341                 
2342                         ProcessData.Append(";");
2343                         ProcessData.Append((*LogosListTokens)[LogosIter->first]);
2344                         
2345                 }
2346                 
2347                 ProcessData.Append(":data:");
2348                 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
2349                 ProcessData.Append(";");
2350                 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
2351                 ProcessData.Append(",");
2352                 ProcessData.Append(LogosIter->second);
2353                 ProcessData.Append("\n");
2355                 ProcessData = OutputText(&ProcessData);
2356                 
2357                 SaveData->Append(ProcessData);
2358                 ProcessData.clear();
2359                         
2360         }
2361                 
2364 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID, 
2365         map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
2366         map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
2367         map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage, 
2368         map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens, 
2369         wxString *SaveData){
2371         wxString ProcessData = "";
2372                 
2373         for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
2374                 SoundsIter != SoundsList->end(); SoundsIter++){
2376                 ProcessData.Append("SOUND");
2377                         
2378                 // Check if there is a value for TYPE.
2379                 
2380                 if ((*SoundsListType)[SoundsIter->first].size() > 0){
2381                 
2382                         ProcessData.Append(";TYPE=");
2383                         ProcessData.Append((*SoundsListType)[SoundsIter->first]);
2384                         
2385                 }
2386                 
2387                 // Check if there is a value for ALTID.
2388                 
2389                 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
2390                 
2391                         ProcessData.Append(";ALTID=");
2392                         ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
2393                         
2394                 }
2396                 // Check if there is a value for LANGUAGE.
2397                 
2398                 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
2399                 
2400                         ProcessData.Append(";LANGUAGE=");
2401                         ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
2402                         
2403                 }
2404                 
2405                 // Check if there is a value for MEDIATYPE.
2406                 
2407                 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
2408                 
2409                         ProcessData.Append(";MEDIATYPE=");
2410                         ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
2411                         
2412                 }
2413                 
2414                 // Check if there is a value for PID.
2416                 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
2417                 
2418                         ProcessData.Append(";PID=");
2419                         ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
2420                         
2421                 }
2423                 // Check if there is a value for PREF.
2425                 if ((*SoundsListPref)[SoundsIter->first] > 0){
2426                 
2427                         ProcessData.Append(";PREF=");
2428                         ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
2429                         
2430                 }
2432                 // Check if there is a value for tokens.
2434                 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
2435                 
2436                         ProcessData.Append(";");
2437                         ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
2438                         
2439                 }
2440                 
2441                 ProcessData.Append(":data:");
2442                 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
2443                 ProcessData.Append(";");
2444                 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
2445                 ProcessData.Append(",");
2446                 ProcessData.Append(SoundsIter->second);
2447                 ProcessData.Append("\n");
2449                 ProcessData = OutputText(&ProcessData);
2450                 
2451                 SaveData->Append(ProcessData);
2452                 ProcessData.clear();
2453                         
2454         }
2455                 
2458 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
2459         map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
2460         map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
2461         map<int, wxString> *CalendarListTokens, wxString *SaveData){
2463         wxString ProcessData = "";
2464                 
2465         for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
2466                 CalendarIter != CalendarList->end(); CalendarIter++){
2468                 ProcessData.Append("CALURI");
2469                         
2470                 // Check if there is a value for TYPE.
2471                 
2472                 if ((*CalendarListType)[CalendarIter->first].size() > 0){
2473                 
2474                         ProcessData.Append(";TYPE=");
2475                         ProcessData.Append((*CalendarListType)[CalendarIter->first]);
2476                         
2477                 }
2478                 
2479                 // Check if there is a value for ALTID.
2480                 
2481                 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2482                 
2483                         ProcessData.Append(";ALTID=");
2484                         ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2485                         
2486                 }
2488                 // Check if there is a value for MEDIATYPE.
2489                 
2490                 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2491                 
2492                         ProcessData.Append(";MEDIATYPE=");
2493                         ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2494                         
2495                 }
2496                 
2497                 // Check if there is a value for PID.
2499                 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2500                 
2501                         ProcessData.Append(";PID=");
2502                         ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2503                         
2504                 }
2506                 // Check if there is a value for PREF.
2508                 if ((*CalendarListPref)[CalendarIter->first] > 0){
2509                 
2510                         ProcessData.Append(";PREF=");
2511                         ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2512                         
2513                 }
2515                 // Check if there is a value for tokens.
2517                 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2518                 
2519                         ProcessData.Append(";");
2520                         ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2521                         
2522                 }
2523                         
2524                 ProcessData.Append(":");
2525                 ProcessData.Append(CalendarIter->second);
2526                 ProcessData.Append("\n");
2528                 ProcessData = OutputText(&ProcessData);
2529                 
2530                 SaveData->Append(ProcessData);
2531                 ProcessData.clear();
2532                         
2533         }
2534                 
2537 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2538         map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2539         map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2540         map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2542         wxString ProcessData = "";
2543                 
2544         for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2545                 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2547                 ProcessData.Append("CALADRURI");
2548                         
2549                 // Check if there is a value for TYPE.
2550                 
2551                 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2552                 
2553                         ProcessData.Append(";TYPE=");
2554                         ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2555                         
2556                 }
2557                 
2558                 // Check if there is a value for ALTID.
2559                 
2560                 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2561                 
2562                         ProcessData.Append(";ALTID=");
2563                         ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2564                         
2565                 }
2567                 // Check if there is a value for MEDIATYPE.
2568                 
2569                 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2570                 
2571                         ProcessData.Append(";MEDIATYPE=");
2572                         ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2573                         
2574                 }
2575                 
2576                 // Check if there is a value for PID.
2578                 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2579                 
2580                         ProcessData.Append(";PID=");
2581                         ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2582                         
2583                 }
2585                 // Check if there is a value for PREF.
2587                 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2588                 
2589                         ProcessData.Append(";PREF=");
2590                         ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2591                         
2592                 }
2594                 // Check if there is a value for tokens.
2596                 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2597                 
2598                         ProcessData.Append(";");
2599                         ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2600                         
2601                 }
2602                         
2603                 ProcessData.Append(":");
2604                 ProcessData.Append(CalendarRequestIter->second);
2605                 ProcessData.Append("\n");
2607                 ProcessData = OutputText(&ProcessData);
2608                 
2609                 SaveData->Append(ProcessData);
2610                 ProcessData.clear();
2611                         
2612         }
2613                 
2616 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID, 
2617         std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2618         std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref, 
2619         std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2621         wxString ProcessData = "";
2622                 
2623         for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2624                 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2626                 ProcessData.Append("FBURL");
2627                         
2628                 // Check if there is a value for TYPE.
2629                 
2630                 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2631                 
2632                         ProcessData.Append(";TYPE=");
2633                         ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2634                         
2635                 }
2636                 
2637                 // Check if there is a value for ALTID.
2638                 
2639                 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2640                 
2641                         ProcessData.Append(";ALTID=");
2642                         ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2643                         
2644                 }
2646                 // Check if there is a value for MEDIATYPE.
2647                 
2648                 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2649                 
2650                         ProcessData.Append(";MEDIATYPE=");
2651                         ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2652                         
2653                 }
2654                 
2655                 // Check if there is a value for PID.
2657                 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2658                 
2659                         ProcessData.Append(";PID=");
2660                         ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2661                         
2662                 }
2664                 // Check if there is a value for PREF.
2666                 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2667                 
2668                         ProcessData.Append(";PREF=");
2669                         ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2670                         
2671                 }
2673                 // Check if there is a value for tokens.
2675                 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2676                 
2677                         ProcessData.Append(";");
2678                         ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2679                         
2680                 }
2681                         
2682                 ProcessData.Append(":");
2683                 ProcessData.Append(FreeBusyIter->second);
2684                 ProcessData.Append("\n");
2686                 ProcessData = OutputText(&ProcessData);
2687                 
2688                 SaveData->Append(ProcessData);
2689                 ProcessData.clear();
2690                         
2691         }
2692                 
2695 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID, 
2696         map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2697         map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType, 
2698         map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref, 
2699         map<int, wxString> *KeyListTokens, wxString *SaveData){
2701         wxString ProcessData = "";
2702                 
2703         for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2704                 KeyIter != KeyList->end(); KeyIter++){
2706                 ProcessData.Append("KEY");
2707                         
2708                 // Check if there is a value for TYPE.
2709                 
2710                 if ((*KeyListType)[KeyIter->first].size() > 0){
2711                 
2712                         ProcessData.Append(";TYPE=");
2713                         ProcessData.Append((*KeyListType)[KeyIter->first]);
2714                         
2715                 }
2716                 
2717                 // Check if there is a value for ALTID.
2718                 
2719                 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2720                 
2721                         ProcessData.Append(";ALTID=");
2722                         ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2723                         
2724                 }
2725                 
2726                 // Check if there is a value for PID.
2728                 if ((*KeyListPID)[KeyIter->first].size() > 0){
2729                 
2730                         ProcessData.Append(";PID=");
2731                         ProcessData.Append((*KeyListPID)[KeyIter->first]);
2732                         
2733                 }
2735                 // Check if there is a value for PREF.
2737                 if ((*KeyListPref)[KeyIter->first] > 0){
2738                 
2739                         ProcessData.Append(";PREF=");
2740                         ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2741                         
2742                 }
2744                 // Check if there is a value for tokens.
2746                 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2747                 
2748                         ProcessData.Append(";");
2749                         ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2750                         
2751                 }
2752                         
2753                 ProcessData.Append(":data:");
2754                 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2755                 ProcessData.Append(";");
2756                 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2757                 ProcessData.Append(",");
2758                 ProcessData.Append(KeyIter->second);
2759                 ProcessData.Append("\n");
2761                 ProcessData = OutputText(&ProcessData);
2762                 
2763                 SaveData->Append(ProcessData);
2764                 ProcessData.clear();
2765                         
2766         }
2767                 
2770 void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN, 
2771         map<int, wxString> *VendorListElement, wxString *SaveData){
2773         wxString ProcessData = "";
2774                 
2775         for (std::map<int, wxString>::iterator VendorIter = VendorList->begin();
2776                 VendorIter != VendorList->end(); VendorIter++){
2778                 ProcessData.Append("VND-");
2779                 ProcessData.Append((*VendorListPEN)[VendorIter->first]);
2780                 ProcessData.Append("-");
2781                 ProcessData.Append((*VendorListElement)[VendorIter->first]);
2782                 ProcessData.Append(":");
2783                 ProcessData.Append(VendorIter->second);
2784                 ProcessData.Append("\n");
2786                 ProcessData = OutputText(&ProcessData);
2787                 
2788                 SaveData->Append(ProcessData);
2789                 ProcessData.clear();
2790                         
2791         }
2792                 
2795 void ContactDataObject::SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens, 
2796         wxString *SaveData){
2798         wxString ProcessData = "";
2799                 
2800         for (std::map<int, wxString>::iterator XTokenIter = XTokenList->begin();
2801                 XTokenIter != XTokenList->end(); XTokenIter++){
2803                 ProcessData.Append("X-");
2804                 ProcessData.Append((*XTokenListTokens)[XTokenIter->first]);
2805                 ProcessData.Append(":");
2806                 ProcessData.Append(XTokenIter->second);
2807                 ProcessData.Append("\n");
2809                 ProcessData = OutputText(&ProcessData);
2810                 
2811                 SaveData->Append(ProcessData);
2812                 ProcessData.clear();
2813                         
2814         }       
2815                 
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