Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added BDAY 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         // Process BDAY.
412         
413         if (Birthday.size() > 0){
414                 
415                 ProcessData.Append("BDAY");
417                 // Check if there is a value for ALTID.
418                 
419                 if (BirthdayAltID.size() > 0){
420                         
421                         ProcessData.Append(";ALTID=");
422                         ProcessData.Append(BirthdayAltID);
423                         
424                 }
426                 // Check if there is a value for CALSCALE.
427                 
428                 if (BirthdayAltID.size() > 0){
429                         
430                         ProcessData.Append(";CALSCALE=");
431                         ProcessData.Append(BirthdayCalScale);
432                         
433                 }
434                 
435                 // Check if there is a value for tokens.
436                 
437                 if (BirthdayTokens.size() > 0){
438                 
439                         ProcessData.Append(";");
440                         ProcessData.Append(BirthdayTokens);
441                         
442                 }
443                 
444                 ProcessData.Append(":");
445                 ProcessData.Append(Birthday);
446                 ProcessData.Append("\n");
447                 
448                 ProcessData = OutputText(&ProcessData);
449                 
450                 SaveData->Append(ProcessData);
451                 ProcessData.clear();
452                 
453         }
454         
455         // Process TITLE.
457         SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
458                 &GeneralTitleListAltID, &GeneralTitleListPID,
459                 &GeneralTitleListType, &GeneralTitleListPref,
460                 &GeneralTitleListTokens, SaveData, "");
461         SaveTitle(&HomeTitleList, &HomeTitleListLanguage,
462                 &HomeTitleListAltID, &HomeTitleListPID,
463                 &HomeTitleListType, &HomeTitleListPref,
464                 &HomeTitleListTokens, SaveData, "home");
465         SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage,
466                 &BusinessTitleListAltID, &BusinessTitleListPID,
467                 &BusinessTitleListType, &BusinessTitleListPref,
468                 &BusinessTitleListTokens, SaveData, "work");
469         
470         // Process TZ.
471         
472         SaveTimezone(&GeneralTZList, &GeneralTZListAltID, 
473                 &GeneralTZListPID, &GeneralTZListType,
474                 &GeneralTZListMediatype, &GeneralTZListPref, 
475                 &GeneralTZListTokens, SaveData, "");
476         SaveTimezone(&HomeTZList, &HomeTZListAltID, 
477                 &HomeTZListPID, &HomeTZListType,
478                 &HomeTZListMediatype, &HomeTZListPref, 
479                 &HomeTZListTokens, SaveData, "home");
480         SaveTimezone(&BusinessTZList, &BusinessTZListAltID, 
481                 &BusinessTZListPID, &BusinessTZListType,
482                 &BusinessTZListMediatype, &BusinessTZListPref, 
483                 &BusinessTZListTokens, SaveData, "work");
485         // Process ADR.
486         
487         SaveAddress(&GeneralAddressList, &GeneralAddressListTown,
488                 &GeneralAddressListCounty, &GeneralAddressListPostCode,
489                 &GeneralAddressListCountry, &GeneralAddressListLabel,
490                 &GeneralAddressListLang, &GeneralAddressListAltID,
491                 &GeneralAddressListPID, &GeneralAddressListGeo, 
492                 &GeneralAddressListTimezone, &GeneralAddressListType, 
493                 &GeneralAddressListMediatype, &GeneralAddressListPref,
494                 &GeneralAddressListTokens, SaveData, "");
495         SaveAddress(&HomeAddressList, &HomeAddressListTown,
496                 &HomeAddressListCounty, &HomeAddressListPostCode,
497                 &HomeAddressListCountry, &HomeAddressListLabel,
498                 &HomeAddressListLang, &HomeAddressListAltID,
499                 &HomeAddressListPID, &HomeAddressListGeo, 
500                 &HomeAddressListTimezone, &HomeAddressListType, 
501                 &HomeAddressListMediatype, &HomeAddressListPref,
502                 &HomeAddressListTokens, SaveData, "home");
503         SaveAddress(&BusinessAddressList, &BusinessAddressListTown,
504                 &BusinessAddressListCounty, &BusinessAddressListPostCode,
505                 &BusinessAddressListCountry, &BusinessAddressListLabel,
506                 &BusinessAddressListLang, &BusinessAddressListAltID,
507                 &BusinessAddressListPID, &BusinessAddressListGeo, 
508                 &BusinessAddressListTimezone, &BusinessAddressListType, 
509                 &BusinessAddressListMediatype, &BusinessAddressListPref,
510                 &BusinessAddressListTokens, SaveData, "work");
512         // Process EMAIL.
513         
514         SaveEmail(&GeneralEmailList, &GeneralEmailListAltID, 
515                 &GeneralEmailListPID, &GeneralEmailListType,
516                 &GeneralEmailListPref, &GeneralEmailListTokens, 
517                 SaveData, "");
518         SaveEmail(&HomeEmailList, &HomeEmailListAltID, 
519                 &HomeEmailListPID, &HomeEmailListType,
520                 &HomeEmailListPref, &HomeEmailListTokens, 
521                 SaveData, "home");
522         SaveEmail(&BusinessEmailList, &BusinessEmailListAltID, 
523                 &BusinessEmailListPID, &BusinessEmailListType,
524                 &BusinessEmailListPref, &BusinessEmailListTokens, 
525                 SaveData, "work");
527         // Process IMPP.
528         
529         SaveIMPP(&GeneralIMList, &GeneralIMListAltID, 
530                 &GeneralIMListPID, &GeneralIMListType,
531                 &GeneralIMListTypeInfo, &GeneralIMListMediatype, 
532                 &GeneralIMListPref, &GeneralIMListTokens,
533                 SaveData, "");
534         SaveIMPP(&HomeIMList, &HomeIMListAltID, 
535                 &HomeIMListPID, &HomeIMListType,
536                 &HomeIMListTypeInfo, &HomeIMListMediatype, 
537                 &HomeIMListPref, &HomeIMListTokens,
538                 SaveData, "home");
539         SaveIMPP(&BusinessIMList, &BusinessIMListAltID, 
540                 &BusinessIMListPID, &BusinessIMListType,
541                 &BusinessIMListTypeInfo, &BusinessIMListMediatype, 
542                 &BusinessIMListPref, &BusinessIMListTokens,
543                 SaveData, "work");
545         // Process TEL.
546         
547         SaveTelephone(&GeneralTelephoneList, &GeneralTelephoneListAltID, 
548                 &GeneralTelephoneListPID, &GeneralTelephoneListType,
549                 &GeneralTelephoneListTypeInfo, &GeneralTelephoneListDataType, 
550                 &GeneralTelephoneListPref, &GeneralTelephoneListTokens, 
551                 SaveData, "");
552         SaveTelephone(&HomeTelephoneList, &HomeTelephoneListAltID, 
553                 &HomeTelephoneListPID, &HomeTelephoneListType,
554                 &HomeTelephoneListTypeInfo, &HomeTelephoneListDataType, 
555                 &HomeTelephoneListPref, &HomeTelephoneListTokens, 
556                 SaveData, "home");
557         SaveTelephone(&BusinessTelephoneList, &BusinessTelephoneListAltID, 
558                 &BusinessTelephoneListPID, &BusinessTelephoneListType,
559                 &BusinessTelephoneListTypeInfo, &BusinessTelephoneListDataType, 
560                 &BusinessTelephoneListPref, &BusinessTelephoneListTokens, 
561                 SaveData, "work");
563         // Process LANG.
564         
565         SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID, 
566                 &GeneralLanguageListPID, &GeneralLanguageListType,
567                 &GeneralLanguageListPref, &GeneralLanguageListTokens, 
568                 SaveData, "");
569         SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID, 
570                 &HomeLanguageListPID, &HomeLanguageListType,
571                 &HomeLanguageListPref, &HomeLanguageListTokens, 
572                 SaveData, "home");
573         SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID, 
574                 &BusinessLanguageListPID, &BusinessLanguageListType,
575                 &BusinessLanguageListPref, &BusinessLanguageListTokens, 
576                 SaveData, "work");
578         // Process GEO.
579         
580         SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID, 
581                 &GeneralGeographyListPID, &GeneralGeographyListType,
582                 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
583                 &GeneralGeographyListPref, &GeneralGeographyListTokens, 
584                 SaveData, "");
585         SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID, 
586                 &HomeGeographyListPID, &HomeGeographyListType,
587                 &HomeGeographyListMediatype, &HomeGeographyListDataType,
588                 &HomeGeographyListPref, &HomeGeographyListTokens, 
589                 SaveData, "home");
590         SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID, 
591                 &BusinessGeographyListPID, &BusinessGeographyListType,
592                 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
593                 &BusinessGeographyListPref, &BusinessGeographyListTokens, 
594                 SaveData, "work");
596         // Process RELATED.
597         
598         int Moo = 0;
600         for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
601                 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
602                 
603                 ProcessData.Append("RELATED");
605                 // Check if there is a value for TYPE.
606                 
607                 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
608                 
609                         wxString RelatedType = "";
610                         
611                         ProcessData.Append(";TYPE=");
612                         
613                         if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
615                                 RelatedType = wxT("contact");
617                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
619                                 RelatedType = wxT("acquaintance");
621                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
623                                 RelatedType = wxT("friend");
625                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
627                                 RelatedType = wxT("met");
629                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
631                                 RelatedType = wxT("co-worker");
633                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
635                                 RelatedType = wxT("colleague");
637                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
639                                 RelatedType = wxT("co-resident");
641                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
643                                 RelatedType = wxT("neighbor");
645                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
647                                 RelatedType = wxT("child");
649                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
651                                 RelatedType = wxT("parent");
653                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
655                                 RelatedType = wxT("sibling");
657                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
659                                 RelatedType = wxT("spouse");
661                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
663                                 RelatedType = wxT("kin");
665                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
667                                 RelatedType = wxT("muse");
669                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
671                                 RelatedType = wxT("crush");
673                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
675                                 RelatedType = wxT("date");
677                         } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
679                                 RelatedType = wxT("sweetheart");
681                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
683                                 RelatedType = wxT("me");
685                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
687                                 RelatedType = wxT("agent");
689                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
691                                 RelatedType = wxT("emergency");
693                         } else {
695                                 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
697                         }
698                         
699                         ProcessData.Append(RelatedType);
700                         
701                 }
703                 // Check if there is a value for LANGUAGE.
704                 
705                 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
706                 
707                         ProcessData.Append(";LANGUAGE=");
708                         ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
709                         
710                 }
711                 
712                 // Check if there is a value for ALTID.
713                 
714                 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
715                 
716                         ProcessData.Append(";ALTID=");
717                         ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
718                         
719                 }
720                 
721                 // Check if there is a value for PID.
723                 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
724                 
725                         ProcessData.Append(";PID=");
726                         ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
727                         
728                 }
730                 // Check if there is a value for PREF.
732                 if (GeneralRelatedListPref[RelatedIter->first] > 0){
733                 
734                         ProcessData.Append(";PREF=");
735                         ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
736                         
737                 }
739                 // Check if there is a value for tokens.
741                 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
742                 
743                         ProcessData.Append(";");
744                         ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
745                         
746                 }
747                 
748                 ProcessData.Append(":");
749                 ProcessData.Append(RelatedIter->second);
750                 ProcessData.Append("\n");
751                 
752                 ProcessData = OutputText(&ProcessData);
753                 
754                 SaveData->Append(ProcessData);
755                 ProcessData.clear();
756                         
757         }
758         
759         // Process URL.
760         
761         SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID, 
762                 &GeneralWebsiteListPID, &GeneralWebsiteListType,
763                 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref, 
764                 &GeneralWebsiteListTokens, SaveData, "");
765         SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID, 
766                 &HomeWebsiteListPID, &HomeWebsiteListType,
767                 &HomeWebsiteListMediatype, &HomeWebsiteListPref, 
768                 &HomeWebsiteListTokens, SaveData, "home");
769         SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID, 
770                 &BusinessWebsiteListPID, &BusinessWebsiteListType,
771                 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref, 
772                 &BusinessWebsiteListTokens, SaveData, "work");
774         // Process ROLE.
775         
776         SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
777                 &GeneralRoleListAltID, &GeneralRoleListPID,
778                 &GeneralRoleListType, &GeneralRoleListPref,
779                 &GeneralRoleListTokens, SaveData, "");
780         SaveRole(&HomeRoleList, &HomeRoleListLanguage,
781                 &HomeRoleListAltID, &HomeRoleListPID,
782                 &HomeRoleListType, &HomeRoleListPref,
783                 &HomeRoleListTokens, SaveData, "home");
784         SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
785                 &BusinessRoleListAltID, &BusinessRoleListPID,
786                 &BusinessRoleListType, &BusinessRoleListPref,
787                 &BusinessRoleListTokens, SaveData, "work");
789         // Process ORG.
790         
791         SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
792                 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage, 
793                 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType, 
794                 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens, 
795                 SaveData, "");
796         SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
797                 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage, 
798                 &HomeOrganisationsListSortAs, &HomeOrganisationsListType, 
799                 &HomeOrganisationsListPref, &HomeOrganisationsListTokens, 
800                 SaveData, "home");
801         SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
802                 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage, 
803                 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType, 
804                 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens, 
805                 SaveData, "work");
807         // Process NOTE.
808         
809         SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
810                 &GeneralNoteListAltID, &GeneralNoteListPID,
811                 &GeneralNoteListType, &GeneralNoteListPref,
812                 &GeneralNoteListTokens, SaveData, "");
813         SaveNote(&HomeNoteList, &HomeNoteListLanguage,
814                 &HomeNoteListAltID, &HomeNoteListPID,
815                 &HomeNoteListType, &HomeNoteListPref,
816                 &HomeNoteListTokens, SaveData, "home");
817         SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
818                 &BusinessNoteListAltID, &BusinessNoteListPID,
819                 &BusinessNoteListType, &BusinessNoteListPref,
820                 &BusinessNoteListTokens, SaveData, "work");
822         // Process CATEGORIES.
823         
824         SaveCategory(&CategoriesList, &CategoriesListLanguage,
825                 &CategoriesListAltID, &CategoriesListPID,
826                 &CategoriesListType, &CategoriesListPref,
827                 &CategoriesListTokens, SaveData);
829         // Process PHOTO.
830         
831         SavePhoto(&PicturesList, &PicturesListAltID, 
832                 &PicturesListPID, &PicturesListType,
833                 &PicturesListPicEncType, &PicturesListPictureType,
834                 &PicturesListMediatype, &PicturesListPref,
835                 &PicturesListTokens, SaveData);
836         
837         // Process LOGO.
838         
839         SaveLogo(&LogosList, &LogosListAltID, 
840                 &LogosListPID, &LogosListType,
841                 &LogosListPicEncType, &LogosListPictureType,
842                 &LogosListMediatype, &LogosListPref,
843                 &LogosListTokens, SaveData);
844         
845         // Process SOUND.
847         SaveSound(&SoundsList, &SoundsListAltID, 
848                 &SoundsListPID, &SoundsListType,
849                 &SoundsListAudioEncType, &SoundsListAudioType,
850                 &SoundsListMediatype, &SoundsListLanguage, 
851                 &SoundsListPref, &SoundsListTokens, 
852                 SaveData);
854         // Process CALURI.
855         
856         SaveCalendarURI(&CalendarList, &CalendarListMediatype,
857                 &CalendarListAltID, &CalendarListPID,
858                 &CalendarListType, &CalendarListPref,
859                 &CalendarListTokens, SaveData);
860         
861         // Process CALADRURI.
862         
863         SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
864                 &CalendarRequestListAltID, &CalendarRequestListPID,
865                 &CalendarRequestListType, &CalendarRequestListPref,
866                 &CalendarRequestListTokens, SaveData);
868         // Process FBURL.
869         
870         SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID, 
871                 &FreeBusyListPID, &FreeBusyListType,
872                 &FreeBusyListMediatype, &FreeBusyListPref, 
873                 &FreeBusyListTokens, SaveData);
875         // Process KEY.
876         
877         SaveKey(&KeyList, &KeyListAltID, 
878                 &KeyListPID, &KeyListType,
879                 &KeyListKeyType, &KeyListDataEncType, 
880                 &KeyListDataType, &KeyListPref, 
881                 &KeyListTokens, SaveData);
883         // Process VND-*
884         
885         SaveVendor(&VendorList, &VendorListPEN, 
886                 &VendorListElement, SaveData);
888         // Process X-Tokens.
889         
890         SaveXToken(&XTokenList, &XTokenListTokens, 
891                 SaveData);
893         // Write the end part of the vCard data file.
894         
895         SaveData->Append("END:VCARD");
896         
897         SaveDataStatus = CONTACTSAVE_OK;
898         
899         return SaveDataStatus;
900         
903 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
904         map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
905         map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
906         map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
908         wxString ProcessData = "";
909                 
910         for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
911                 TitleIter != TitleList->end(); TitleIter++){
913                 ProcessData.Append("TITLE");
914                         
915                 // Check if there is a value for TYPE.
916                 
917                 if (DataType.size() > 0){
918                 
919                         ProcessData.Append(";TYPE=");
920                         ProcessData.Append(DataType);
921                         
922                 }
923                 
924                 // Check if there is a value for ALTID.
925                 
926                 if ((*TitleListAltID)[TitleIter->first].size() > 0){
927                 
928                         ProcessData.Append(";ALTID=");
929                         ProcessData.Append((*TitleListAltID)[TitleIter->first]);
930                         
931                 }
933                 // Check if there is a value for LANGUAGE.
934                 
935                 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
936                 
937                         ProcessData.Append(";LANGUAGE=");
938                         ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
939                         
940                 }
941                 
942                 // Check if there is a value for PID.
944                 if ((*TitleListPID)[TitleIter->first].size() > 0){
945                 
946                         ProcessData.Append(";PID=");
947                         ProcessData.Append((*TitleListPID)[TitleIter->first]);
948                         
949                 }
951                 // Check if there is a value for PREF.
953                 if ((*TitleListPref)[TitleIter->first] > 0){
954                 
955                         ProcessData.Append(";PREF=");
956                         ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
957                         
958                 }
960                 // Check if there is a value for tokens.
962                 if ((*TitleListTokens)[TitleIter->first].size() > 0){
963                 
964                         ProcessData.Append(";");
965                         ProcessData.Append((*TitleListTokens)[TitleIter->first]);
966                         
967                 }
968                         
969                 ProcessData.Append(":");
970                 ProcessData.Append(TitleIter->second);
971                 ProcessData.Append("\n");
973                 ProcessData = OutputText(&ProcessData);
974                         
975                 SaveData->Append(ProcessData);
976                 ProcessData.clear();
977                         
978         }
979                 
982 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID, 
983         map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
984         map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref, 
985         map<int, wxString> *SourceListTokens, wxString *SaveData){
987         wxString ProcessData = "";
988         
989         for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
990                 SourceIter != SourceList->end(); SourceIter++){
992                 ProcessData.Append("SOURCE");
993                         
994                 // Check if there is a value for TYPE.
995                 
996                 if ((*SourceListType)[SourceIter->first].size() > 0){
997                 
998                         ProcessData.Append(";TYPE=");
999                         ProcessData.Append((*SourceListType)[SourceIter->first]);
1000                         
1001                 }
1002                 
1003                 // Check if there is a value for ALTID.
1004                 
1005                 if ((*SourceListAltID)[SourceIter->first].size() > 0){
1006                 
1007                         ProcessData.Append(";ALTID=");
1008                         ProcessData.Append((*SourceListAltID)[SourceIter->first]);
1009                         
1010                 }
1012                 // Check if there is a value for MEDIATYPE.
1013                 
1014                 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
1015                 
1016                         ProcessData.Append(";MEDIATYPE=");
1017                         ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
1018                         
1019                 }
1020                 
1021                 // Check if there is a value for PID.
1023                 if ((*SourceListPID)[SourceIter->first].size() > 0){
1024                 
1025                         ProcessData.Append(";PID=");
1026                         ProcessData.Append((*SourceListPID)[SourceIter->first]);
1027                         
1028                 }
1030                 // Check if there is a value for PREF.
1032                 if ((*SourceListPref)[SourceIter->first] > 0){
1033                 
1034                         ProcessData.Append(";PREF=");
1035                         ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
1036                         
1037                 }
1039                 // Check if there is a value for tokens.
1041                 if ((*SourceListTokens)[SourceIter->first].size() > 0){
1042                 
1043                         ProcessData.Append(";");
1044                         ProcessData.Append((*SourceListTokens)[SourceIter->first]);
1045                         
1046                 }
1047                         
1048                 ProcessData.Append(":");
1049                 ProcessData.Append(SourceIter->second);
1050                 ProcessData.Append("\n");
1052                 ProcessData = OutputText(&ProcessData);
1053                         
1054                 SaveData->Append(ProcessData);
1055                 ProcessData.clear();
1056                         
1057         }
1058                 
1061 void ContactDataObject::SaveMember(std::map<int, wxString> *GroupsList, std::map<int, wxString> *GroupsListAltID, 
1062         std::map<int, wxString> *GroupsListPID, std::map<int, wxString> *GroupsListType,
1063         std::map<int, wxString> *GroupsListMediaType, std::map<int, int> *GroupsListPref, 
1064         std::map<int, wxString> *GroupsListTokens, wxString *SaveData){
1066         wxString ProcessData = "";
1067                 
1068         for (std::map<int, wxString>::iterator GroupsIter = GroupsList->begin();
1069                 GroupsIter != GroupsList->end(); GroupsIter++){
1071                 ProcessData.Append("MEMBER");
1072                         
1073                 // Check if there is a value for TYPE.
1074                 
1075                 if ((*GroupsListType)[GroupsIter->first].size() > 0){
1076                 
1077                         ProcessData.Append(";TYPE=");
1078                         ProcessData.Append((*GroupsListType)[GroupsIter->first]);
1079                         
1080                 }
1081                 
1082                 // Check if there is a value for ALTID.
1083                 
1084                 if ((*GroupsListAltID)[GroupsIter->first].size() > 0){
1085                 
1086                         ProcessData.Append(";ALTID=");
1087                         ProcessData.Append((*GroupsListAltID)[GroupsIter->first]);
1088                         
1089                 }
1091                 // Check if there is a value for MEDIATYPE.
1092                 
1093                 if ((*GroupsListMediaType)[GroupsIter->first].size() > 0){
1094                 
1095                         ProcessData.Append(";MEDIATYPE=");
1096                         ProcessData.Append((*GroupsListMediaType)[GroupsIter->first]);
1097                         
1098                 }
1099                 
1100                 // Check if there is a value for PID.
1102                 if ((*GroupsListPID)[GroupsIter->first].size() > 0){
1103                 
1104                         ProcessData.Append(";PID=");
1105                         ProcessData.Append((*GroupsListPID)[GroupsIter->first]);
1106                         
1107                 }
1109                 // Check if there is a value for PREF.
1111                 if ((*GroupsListPref)[GroupsIter->first] > 0){
1112                 
1113                         ProcessData.Append(";PREF=");
1114                         ProcessData.Append(wxString::Format("%i", (*GroupsListPref)[GroupsIter->first]));
1115                         
1116                 }
1118                 // Check if there is a value for tokens.
1120                 if ((*GroupsListTokens)[GroupsIter->first].size() > 0){
1121                 
1122                         ProcessData.Append(";");
1123                         ProcessData.Append((*GroupsListTokens)[GroupsIter->first]);
1124                         
1125                 }
1126                         
1127                 ProcessData.Append(":");
1128                 ProcessData.Append(GroupsIter->second);
1129                 ProcessData.Append("\n");
1131                 ProcessData = OutputText(&ProcessData);
1132                 
1133                 SaveData->Append(ProcessData);
1134                 ProcessData.clear();
1135                         
1136         }
1137                 
1140 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID, 
1141         map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
1142         map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref, 
1143         map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
1145         wxString ProcessData = "";
1146         
1147         for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
1148                 NicknameIter != NicknameList->end(); NicknameIter++){
1150                 ProcessData.Append("NICKNAME");
1151                         
1152                 // Check if there is a value for TYPE.
1153                 
1154                 if (DataType.size() > 0){
1155                 
1156                         ProcessData.Append(";TYPE=");
1157                         ProcessData.Append(DataType);
1158                         
1159                 }
1160                 
1161                 // Check if there is a value for ALTID.
1162                 
1163                 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
1164                 
1165                         ProcessData.Append(";ALTID=");
1166                         ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
1167                         
1168                 }
1170                 // Check if there is a value for MEDIATYPE.
1171                 
1172                 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
1173                 
1174                         ProcessData.Append(";LANGUAGE=");
1175                         ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
1176                         
1177                 }
1178                 
1179                 // Check if there is a value for PID.
1181                 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
1182                 
1183                         ProcessData.Append(";PID=");
1184                         ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
1185                         
1186                 }
1188                 // Check if there is a value for PREF.
1190                 if ((*NicknameListPref)[NicknameIter->first] > 0){
1191                 
1192                         ProcessData.Append(";PREF=");
1193                         ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
1194                         
1195                 }
1197                 // Check if there is a value for tokens.
1199                 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
1200                 
1201                         ProcessData.Append(";");
1202                         ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
1203                         
1204                 }
1205                         
1206                 ProcessData.Append(":");
1207                 ProcessData.Append(NicknameIter->second);
1208                 ProcessData.Append("\n");
1210                 ProcessData = OutputText(&ProcessData);
1211                         
1212                 SaveData->Append(ProcessData);
1213                 ProcessData.clear();
1214                         
1215         }
1216                 
1219 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID, 
1220         map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
1221         map<int, wxString> *TZListMediatype, map<int, int> *TZListPref, 
1222         map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
1224         wxString ProcessData = "";
1225         
1226         for (std::map<int, wxString>::iterator TZIter = TZList->begin();
1227                 TZIter != TZList->end(); TZIter++){
1229                 ProcessData.Append("TZ");
1230                         
1231                 // Check if there is a value for TYPE.
1232                 
1233                 if (DataType.size() > 0){
1234                 
1235                         ProcessData.Append(";TYPE=");
1236                         ProcessData.Append(DataType);
1237                         
1238                 }
1239                 
1240                 // Check if there is a value for ALTID.
1241                 
1242                 if ((*TZListAltID)[TZIter->first].size() > 0){
1243                 
1244                         ProcessData.Append(";ALTID=");
1245                         ProcessData.Append((*TZListAltID)[TZIter->first]);
1246                         
1247                 }
1249                 // Check if there is a value for MEDIATYPE.
1250                 
1251                 if ((*TZListMediatype)[TZIter->first].size() > 0){
1252                 
1253                         ProcessData.Append(";MEDIATYPE=");
1254                         ProcessData.Append((*TZListMediatype)[TZIter->first]);
1255                         
1256                 }
1257                 
1258                 // Check if there is a value for PID.
1260                 if ((*TZListPID)[TZIter->first].size() > 0){
1261                 
1262                         ProcessData.Append(";PID=");
1263                         ProcessData.Append((*TZListPID)[TZIter->first]);
1264                         
1265                 }
1267                 // Check if there is a value for PREF.
1269                 if ((*TZListPref)[TZIter->first] > 0){
1270                 
1271                         ProcessData.Append(";PREF=");
1272                         ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
1273                         
1274                 }
1276                 // Check if there is a value for tokens.
1278                 if ((*TZListTokens)[TZIter->first].size() > 0){
1279                 
1280                         ProcessData.Append(";");
1281                         ProcessData.Append((*TZListTokens)[TZIter->first]);
1282                         
1283                 }
1284                         
1285                 ProcessData.Append(":");
1286                 ProcessData.Append(TZIter->second);
1287                 ProcessData.Append("\n");
1289                 ProcessData = OutputText(&ProcessData);
1290                         
1291                 SaveData->Append(ProcessData);
1292                 ProcessData.clear();
1293                         
1294         }
1295                 
1298 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
1299                 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
1300                 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
1301                 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
1302                 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo, 
1303                 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType, 
1304                 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref, 
1305                 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
1307         wxString ProcessData = "";
1308                         
1309         for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
1310                 AddressIter != AddressList->end(); AddressIter++){
1311                         
1312                 ProcessData.Append("ADR");
1313                         
1314                 // Check if there is a value for TYPE.
1315                 
1316                 if (DataType.size() > 0){
1317                 
1318                         ProcessData.Append(";TYPE=");
1319                         ProcessData.Append(DataType);
1320                         
1321                 }
1322                 
1323                 // Check if there is a value for ALTID.
1324                 
1325                 if ((*AddressListAltID)[AddressIter->first].size() > 0){
1326                 
1327                         ProcessData.Append(";ALTID=");
1328                         ProcessData.Append((*AddressListAltID)[AddressIter->first]);
1329                         
1330                 }
1332                 // Check if there is a value for GEO.
1333                 
1334                 if ((*AddressListGeo)[AddressIter->first].size() > 0){
1335                 
1336                         ProcessData.Append(";GEO=\"");
1337                         ProcessData.Append((*AddressListGeo)[AddressIter->first]);
1338                         ProcessData.Append("\"");
1339                         
1340                 }
1342                 // Check if there is a value for LABEL.
1344                 if ((*AddressListLabel)[AddressIter->first].size() > 0){
1345                 
1346                         wxString AddressProcessed = "";
1347                         AddressProcessed = (*AddressListLabel)[AddressIter->first];
1348                         
1349                         AddressProcessed.Replace("\n", "\\n", true);
1350                         
1351                         ProcessData.Append(";LABEL=");
1352                         ProcessData.Append(AddressProcessed);
1353                         
1354                 }
1355                 
1356                 // Check if there is a value for LANGUAGE.
1357                 
1358                 if ((*AddressListLang)[AddressIter->first].size() > 0){
1359                 
1360                         ProcessData.Append(";LANGUAGE=");
1361                         ProcessData.Append((*AddressListLang)[AddressIter->first]);
1362                         
1363                 }
1364                 
1365                 // Check if there is a value for MEDIATYPE.
1366                 
1367                 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1368                 
1369                         ProcessData.Append(";MEDIATYPE=");
1370                         ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1371                         
1372                 }
1373                 
1374                 // Check if there is a value for PID.
1376                 if ((*AddressListPID)[AddressIter->first].size() > 0){
1377                 
1378                         ProcessData.Append(";PID=");
1379                         ProcessData.Append((*AddressListPID)[AddressIter->first]);
1380                         
1381                 }
1383                 // Check if there is a value for PREF.
1385                 if ((*AddressListPref)[AddressIter->first] > 0){
1386                 
1387                         ProcessData.Append(";PREF=");
1388                         ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1389                         
1390                 }
1392                 // Check if there is a value for TZ.
1394                 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1395                 
1396                         ProcessData.Append(";TZ=");
1397                         ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1398                         
1399                 }
1400                 
1401                 // Check if there is a value for tokens.
1403                 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1404                 
1405                         ProcessData.Append(";");
1406                         ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1407                         
1408                 }
1409                 
1410                 // Build the address.
1411                 
1412                 ProcessData.Append(":;;");
1413                 ProcessData.Append((*AddressList)[AddressIter->first]);
1414                 ProcessData.Append(";");
1415                 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1416                 ProcessData.Append(";");
1417                 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1418                 ProcessData.Append(";");
1419                 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1420                 ProcessData.Append(";");
1421                 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1422                 ProcessData.Append("\n");
1423                 
1424                 ProcessData = OutputText(&ProcessData);
1425                         
1426                 SaveData->Append(ProcessData);
1427                 ProcessData.clear();
1428                         
1429         }
1430                         
1433 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID, 
1434         map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1435         map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens, 
1436         wxString *SaveData, wxString DataType){
1438         wxString ProcessData = "";
1439         
1440         for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1441                 EmailIter != EmailList->end(); EmailIter++){
1443                 ProcessData.Append("EMAIL");
1444                         
1445                 // Check if there is a value for TYPE.
1446                 
1447                 if (DataType.size() > 0){
1448                 
1449                         ProcessData.Append(";TYPE=");
1450                         ProcessData.Append(DataType);
1451                         
1452                 }
1453                 
1454                 // Check if there is a value for ALTID.
1455                 
1456                 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1457                 
1458                         ProcessData.Append(";ALTID=");
1459                         ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1460                         
1461                 }
1462                 
1463                 // Check if there is a value for PID.
1465                 if ((*EmailListPID)[EmailIter->first].size() > 0){
1466                 
1467                         ProcessData.Append(";PID=");
1468                         ProcessData.Append((*EmailListPID)[EmailIter->first]);
1469                         
1470                 }
1472                 // Check if there is a value for PREF.
1474                 if ((*EmailListPref)[EmailIter->first] > 0){
1475                 
1476                         ProcessData.Append(";PREF=");
1477                         ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1478                         
1479                 }
1481                 // Check if there is a value for tokens.
1483                 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1484                 
1485                         ProcessData.Append(";");
1486                         ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1487                         
1488                 }
1489                         
1490                 ProcessData.Append(":");
1491                 ProcessData.Append(EmailIter->second);
1492                 ProcessData.Append("\n");
1494                 ProcessData = OutputText(&ProcessData);
1495                         
1496                 SaveData->Append(ProcessData);
1497                 ProcessData.clear();
1498                         
1499         }
1500                 
1503 void ContactDataObject::SaveIMPP(map<int, wxString> *IMList, map<int, wxString> *IMListAltID, 
1504         map<int, wxString> *IMListPID, map<int, wxString> *IMListType,
1505         map<int, wxString> *IMListTypeInfo, map<int, wxString> *IMListMediatype, 
1506         map<int, int> *IMListPref, map<int, wxString> *IMListTokens, 
1507         wxString *SaveData, wxString DataType){
1509         wxString ProcessData = "";
1510         
1511         for (std::map<int, wxString>::iterator IMIter = IMList->begin();
1512                 IMIter != IMList->end(); IMIter++){
1514                 ProcessData.Append("IMPP");
1515                         
1516                 // Check if there is a value for TYPE.
1517                 
1518                 if (DataType.size() > 0){
1519                 
1520                         ProcessData.Append(";TYPE=");
1521                         ProcessData.Append(DataType);
1522                         
1523                 }
1524                 
1525                 // Check if there is a value for ALTID.
1526                 
1527                 if ((*IMListAltID)[IMIter->first].size() > 0){
1528                 
1529                         ProcessData.Append(";ALTID=");
1530                         ProcessData.Append((*IMListAltID)[IMIter->first]);
1531                         
1532                 }
1533                 
1534                 // Check if there is a value for MEDIATYPE.
1535                 
1536                 if ((*IMListMediatype)[IMIter->first].size() > 0){
1537                 
1538                         ProcessData.Append(";MEDIATYPE=");
1539                         ProcessData.Append((*IMListMediatype)[IMIter->first]);
1540                         
1541                 }
1542                 
1543                 // Check if there is a value for PID.
1545                 if ((*IMListPID)[IMIter->first].size() > 0){
1546                 
1547                         ProcessData.Append(";PID=");
1548                         ProcessData.Append((*IMListPID)[IMIter->first]);
1549                         
1550                 }
1552                 // Check if there is a value for PREF.
1554                 if ((*IMListPref)[IMIter->first] > 0){
1555                 
1556                         ProcessData.Append(";PREF=");
1557                         ProcessData.Append(wxString::Format("%i", (*IMListPref)[IMIter->first]));
1558                         
1559                 }
1561                 // Check if there is a value for tokens.
1563                 if ((*IMListTokens)[IMIter->first].size() > 0){
1564                 
1565                         ProcessData.Append(";");
1566                         ProcessData.Append((*IMListTokens)[IMIter->first]);
1567                         
1568                 }
1570                 ProcessData.Append(":");
1571                 ProcessData.Append((*IMListTypeInfo)[IMIter->first]);
1572                 ProcessData.Append(":");
1573                 ProcessData.Append(IMIter->second);
1574                 ProcessData.Append("\n");
1576                 ProcessData = OutputText(&ProcessData);
1577                         
1578                 SaveData->Append(ProcessData);
1579                 ProcessData.clear();
1580                         
1581         }
1582                 
1585 void ContactDataObject::SaveTelephone(map<int, wxString> *TelephoneList, map<int, wxString> *TelephoneListAltID, 
1586         map<int, wxString> *TelephoneListPID, map<int, wxString> *TelephoneListType,
1587         map<int, wxString> *TelephoneListTypeInfo, map<int, wxString> *TelephoneListDataType, 
1588         map<int, int> *TelephoneListPref, map<int, wxString> *TelephoneListTokens, 
1589         wxString *SaveData, wxString DataType){
1591         wxString ProcessData = "";
1592         
1593         for (std::map<int, wxString>::iterator TelephoneIter = TelephoneList->begin();
1594                 TelephoneIter != TelephoneList->end(); TelephoneIter++){
1596                 ProcessData.Append("TEL");
1597                         
1598                 // Check if there is a value for TYPE.
1600                 if (DataType.size() > 0 || (*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1602                         ProcessData.Append(";TYPE=\"");
1603                         
1604                         bool ProcessedType = false;
1605                         
1606                         if (DataType.size() > 0){
1607                 
1608                                 ProcessData.Append(DataType);
1609                                 ProcessedType = true;
1610                         
1611                         }
1612                         
1613                         if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1614                                 
1615                                 if (ProcessedType == true){
1616                                         ProcessData.Append(",");
1617                                 }
1618                                 ProcessData.Append((*TelephoneListTypeInfo)[TelephoneIter->first]);
1619                                 
1620                         }
1621                         
1622                         ProcessData.Append("\"");
1623                 
1624                 }
1625                 
1626                 // Check if there is a value for ALTID.
1627                 
1628                 if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
1629                 
1630                         ProcessData.Append(";ALTID=");
1631                         ProcessData.Append((*TelephoneListAltID)[TelephoneIter->first]);
1632                         
1633                 }
1634                 
1635                 // Check if there is a value for PID.
1637                 if ((*TelephoneListPID)[TelephoneIter->first].size() > 0){
1638                 
1639                         ProcessData.Append(";PID=");
1640                         ProcessData.Append((*TelephoneListPID)[TelephoneIter->first]);
1641                         
1642                 }
1644                 // Check if there is a value for PREF.
1646                 if ((*TelephoneListPref)[TelephoneIter->first] > 0){
1647                 
1648                         ProcessData.Append(";PREF=");
1649                         ProcessData.Append(wxString::Format("%i", (*TelephoneListPref)[TelephoneIter->first]));
1650                         
1651                 }
1653                 // Check if there is a value for tokens.
1655                 if ((*TelephoneListTokens)[TelephoneIter->first].size() > 0){
1656                 
1657                         ProcessData.Append(";");
1658                         ProcessData.Append((*TelephoneListTokens)[TelephoneIter->first]);
1659                         
1660                 }
1662                 ProcessData.Append(":");
1663                 ProcessData.Append((*TelephoneListDataType)[TelephoneIter->first]);
1664                 ProcessData.Append(":");
1665                 ProcessData.Append(TelephoneIter->second);
1666                 ProcessData.Append("\n");
1668                 ProcessData = OutputText(&ProcessData);
1669                         
1670                 SaveData->Append(ProcessData);
1671                 ProcessData.clear();
1672                         
1673         }
1674                 
1677 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID, 
1678         map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1679         map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens, 
1680         wxString *SaveData, wxString DataType){
1682         wxString ProcessData = "";
1683         
1684         for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1685                 LanguageIter != LanguageList->end(); LanguageIter++){
1687                 ProcessData.Append("LANG");
1688                         
1689                 // Check if there is a value for TYPE.
1690                 
1691                 if (DataType.size() > 0){
1692                 
1693                         ProcessData.Append(";TYPE=");
1694                         ProcessData.Append(DataType);
1695                         
1696                 }
1697                 
1698                 // Check if there is a value for ALTID.
1699                 
1700                 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1701                 
1702                         ProcessData.Append(";ALTID=");
1703                         ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1704                         
1705                 }
1706                 
1707                 // Check if there is a value for PID.
1709                 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1710                 
1711                         ProcessData.Append(";PID=");
1712                         ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1713                         
1714                 }
1716                 // Check if there is a value for PREF.
1718                 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1719                 
1720                         ProcessData.Append(";PREF=");
1721                         ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1722                         
1723                 }
1725                 // Check if there is a value for tokens.
1727                 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1728                 
1729                         ProcessData.Append(";");
1730                         ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1731                         
1732                 }
1733                         
1734                 ProcessData.Append(":");
1735                 ProcessData.Append(LanguageIter->second);
1736                 ProcessData.Append("\n");
1738                 ProcessData = OutputText(&ProcessData);
1739                         
1740                 SaveData->Append(ProcessData);
1741                 ProcessData.clear();
1742                         
1743         }
1744                 
1747 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID, 
1748         map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1749         map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1750         map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens, 
1751         wxString *SaveData, wxString DataType){
1753         wxString ProcessData = "";
1754         
1755         for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1756                 GeographyIter != GeographyList->end(); GeographyIter++){
1758                 ProcessData.Append("GEO");
1759                         
1760                 // Check if there is a value for TYPE.
1761                 
1762                 if (DataType.size() > 0){
1763                 
1764                         ProcessData.Append(";TYPE=");
1765                         ProcessData.Append(DataType);
1766                         
1767                 }
1768                 
1769                 // Check if there is a value for ALTID.
1770                 
1771                 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1772                 
1773                         ProcessData.Append(";ALTID=");
1774                         ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1775                         
1776                 }
1777                 
1778                 // Check if there is a value for MEDIATYPE.
1779                 
1780                 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1781                 
1782                         ProcessData.Append(";MEDIATYPE=");
1783                         ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1784                         
1785                 }
1786                 
1787                 // Check if there is a value for PID.
1789                 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1790                 
1791                         ProcessData.Append(";PID=");
1792                         ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1793                         
1794                 }
1796                 // Check if there is a value for PREF.
1798                 if ((*GeographyListPref)[GeographyIter->first] > 0){
1799                 
1800                         ProcessData.Append(";PREF=");
1801                         ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1802                         
1803                 }
1805                 // Check if there is a value for tokens.
1807                 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1808                 
1809                         ProcessData.Append(";");
1810                         ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1811                         
1812                 }
1813                         
1814                 ProcessData.Append(":");
1815                 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1816                 ProcessData.Append(":");
1817                 ProcessData.Append(GeographyIter->second);
1818                 ProcessData.Append("\n");
1820                 ProcessData = OutputText(&ProcessData);
1821                         
1822                 SaveData->Append(ProcessData);
1823                 ProcessData.clear();
1824                         
1825         }
1826                 
1829 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID, 
1830                 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1831                 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref, 
1832                 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1834         wxString ProcessData = "";
1835         
1836         for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1837                 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1839                 ProcessData.Append("URL");
1840                         
1841                 // Check if there is a value for TYPE.
1842                 
1843                 if (DataType.size() > 0){
1844                 
1845                         ProcessData.Append(";TYPE=");
1846                         ProcessData.Append(DataType);
1847                         
1848                 }
1849                 
1850                 // Check if there is a value for ALTID.
1851                 
1852                 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1853                 
1854                         ProcessData.Append(";ALTID=");
1855                         ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1856                         
1857                 }
1858                 
1859                 // Check if there is a value for MEDIATYPE.
1860                 
1861                 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1862                 
1863                         ProcessData.Append(";MEDIATYPE=");
1864                         ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1865                         
1866                 }
1867                 
1868                 // Check if there is a value for PID.
1870                 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1871                 
1872                         ProcessData.Append(";PID=");
1873                         ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1874                         
1875                 }
1877                 // Check if there is a value for PREF.
1879                 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1880                 
1881                         ProcessData.Append(";PREF=");
1882                         ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1883                         
1884                 }
1886                 // Check if there is a value for tokens.
1888                 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1889                 
1890                         ProcessData.Append(";");
1891                         ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1892                         
1893                 }
1894                         
1895                 ProcessData.Append(":");
1896                 ProcessData.Append(WebsiteIter->second);
1897                 ProcessData.Append("\n");
1899                 ProcessData = OutputText(&ProcessData);
1900                         
1901                 SaveData->Append(ProcessData);
1902                 ProcessData.clear();
1903                         
1904         }
1905                         
1908 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1909         map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1910         map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1911         map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1913         wxString ProcessData = "";
1914                 
1915         for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1916                 RoleIter != RoleList->end(); RoleIter++){
1918                 ProcessData.Append("ROLE");
1919                         
1920                 // Check if there is a value for TYPE.
1921                 
1922                 if (DataType.size() > 0){
1923                 
1924                         ProcessData.Append(";TYPE=");
1925                         ProcessData.Append(DataType);
1926                         
1927                 }
1928                 
1929                 // Check if there is a value for ALTID.
1930                 
1931                 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1932                 
1933                         ProcessData.Append(";ALTID=");
1934                         ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1935                         
1936                 }
1938                 // Check if there is a value for LANGUAGE.
1939                 
1940                 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1941                 
1942                         ProcessData.Append(";LANGUAGE=");
1943                         ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1944                         
1945                 }
1946                 
1947                 // Check if there is a value for PID.
1949                 if ((*RoleListPID)[RoleIter->first].size() > 0){
1950                 
1951                         ProcessData.Append(";PID=");
1952                         ProcessData.Append((*RoleListPID)[RoleIter->first]);
1953                         
1954                 }
1956                 // Check if there is a value for PREF.
1958                 if ((*RoleListPref)[RoleIter->first] > 0){
1959                 
1960                         ProcessData.Append(";PREF=");
1961                         ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1962                         
1963                 }
1965                 // Check if there is a value for tokens.
1967                 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1968                 
1969                         ProcessData.Append(";");
1970                         ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1971                         
1972                 }
1973                         
1974                 ProcessData.Append(":");
1975                 ProcessData.Append(RoleIter->second);
1976                 ProcessData.Append("\n");
1978                 ProcessData = OutputText(&ProcessData);
1979                 
1980                 SaveData->Append(ProcessData);
1981                 ProcessData.clear();
1982                         
1983         }
1984                 
1987 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1988         map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage, 
1989         map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType, 
1990         map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens, 
1991         wxString *SaveData, wxString DataType){
1993         wxString ProcessData = "";
1994                 
1995         for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1996                 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1998                 ProcessData.Append("ORG");
1999                         
2000                 // Check if there is a value for TYPE.
2001                 
2002                 if (DataType.size() > 0){
2003                 
2004                         ProcessData.Append(";TYPE=");
2005                         ProcessData.Append(DataType);
2006                         
2007                 }
2008                 
2009                 // Check if there is a value for ALTID.
2010                 
2011                 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
2012                 
2013                         ProcessData.Append(";ALTID=");
2014                         ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
2015                         
2016                 }
2018                 // Check if there is a value for LANGUAGE.
2019                 
2020                 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
2021                 
2022                         ProcessData.Append(";LANGUAGE=");
2023                         ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
2024                         
2025                 }
2026                 
2027                 // Check if there is a value for PID.
2029                 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
2030                 
2031                         ProcessData.Append(";PID=");
2032                         ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
2033                         
2034                 }
2036                 // Check if there is a value for PREF.
2038                 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
2039                 
2040                         ProcessData.Append(";PREF=");
2041                         ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
2042                         
2043                 }
2044                 
2045                 // Check if there is a value for SORT-AS.
2046                 
2047                 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
2048                 
2049                         ProcessData.Append(";SORT-AS=\"");
2050                         ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
2051                         ProcessData.Append("\"");
2052                         
2053                 }
2055                 // Check if there is a value for tokens.
2057                 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
2058                 
2059                         ProcessData.Append(";");
2060                         ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
2061                         
2062                 }
2063                         
2064                 ProcessData.Append(":");
2065                 ProcessData.Append(OrganisationIter->second);
2066                 ProcessData.Append("\n");
2068                 ProcessData = OutputText(&ProcessData);
2069                 
2070                 SaveData->Append(ProcessData);
2071                 ProcessData.clear();
2072                         
2073         }
2074                 
2077 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
2078         map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
2079         map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
2080         map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
2082         wxString ProcessData = "";
2083                 
2084         for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
2085                 NoteIter != NoteList->end(); NoteIter++){
2087                 ProcessData.Append("NOTE");
2088                         
2089                 // Check if there is a value for TYPE.
2090                 
2091                 if (DataType.size() > 0){
2092                 
2093                         ProcessData.Append(";TYPE=");
2094                         ProcessData.Append(DataType);
2095                         
2096                 }
2097                 
2098                 // Check if there is a value for ALTID.
2099                 
2100                 if ((*NoteListAltID)[NoteIter->first].size() > 0){
2101                 
2102                         ProcessData.Append(";ALTID=");
2103                         ProcessData.Append((*NoteListAltID)[NoteIter->first]);
2104                         
2105                 }
2107                 // Check if there is a value for LANGUAGE.
2108                 
2109                 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
2110                 
2111                         ProcessData.Append(";LANGUAGE=");
2112                         ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
2113                         
2114                 }
2115                 
2116                 // Check if there is a value for PID.
2118                 if ((*NoteListPID)[NoteIter->first].size() > 0){
2119                 
2120                         ProcessData.Append(";PID=");
2121                         ProcessData.Append((*NoteListPID)[NoteIter->first]);
2122                         
2123                 }
2125                 // Check if there is a value for PREF.
2127                 if ((*NoteListPref)[NoteIter->first] > 0){
2128                 
2129                         ProcessData.Append(";PREF=");
2130                         ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
2131                         
2132                 }
2134                 // Check if there is a value for tokens.
2136                 if ((*NoteListTokens)[NoteIter->first].size() > 0){
2137                 
2138                         ProcessData.Append(";");
2139                         ProcessData.Append((*NoteListTokens)[NoteIter->first]);
2140                         
2141                 }
2142                         
2143                 ProcessData.Append(":");
2144                 ProcessData.Append(NoteIter->second);
2145                 ProcessData.Replace("\n", "\\n", true);
2146                 ProcessData.Append("\n");
2148                 ProcessData = OutputText(&ProcessData);
2149                 
2150                 SaveData->Append(ProcessData);
2151                 ProcessData.clear();
2152                         
2153         }
2154                 
2157 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
2158         map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
2159         map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
2160         map<int, wxString> *CategoryListTokens, wxString *SaveData){
2162         wxString ProcessData = "";
2163                 
2164         for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
2165                 CategoryIter != CategoryList->end(); CategoryIter++){
2167                 ProcessData.Append("CATEGORIES");
2168                         
2169                 // Check if there is a value for TYPE.
2170                 
2171                 if ((*CategoryListType)[CategoryIter->first].size() > 0){
2172                 
2173                         ProcessData.Append(";TYPE=");
2174                         ProcessData.Append((*CategoryListType)[CategoryIter->first]);
2175                         
2176                 }
2177                 
2178                 // Check if there is a value for ALTID.
2179                 
2180                 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
2181                 
2182                         ProcessData.Append(";ALTID=");
2183                         ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
2184                         
2185                 }
2187                 // Check if there is a value for LANGUAGE.
2188                 
2189                 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
2190                 
2191                         ProcessData.Append(";LANGUAGE=");
2192                         ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
2193                         
2194                 }
2195                 
2196                 // Check if there is a value for PID.
2198                 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
2199                 
2200                         ProcessData.Append(";PID=");
2201                         ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
2202                         
2203                 }
2205                 // Check if there is a value for PREF.
2207                 if ((*CategoryListPref)[CategoryIter->first] > 0){
2208                 
2209                         ProcessData.Append(";PREF=");
2210                         ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
2211                         
2212                 }
2214                 // Check if there is a value for tokens.
2216                 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
2217                 
2218                         ProcessData.Append(";");
2219                         ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
2220                         
2221                 }
2222                         
2223                 ProcessData.Append(":");
2224                 ProcessData.Append(CategoryIter->second);
2225                 ProcessData.Append("\n");
2227                 ProcessData = OutputText(&ProcessData);
2228                 
2229                 SaveData->Append(ProcessData);
2230                 ProcessData.clear();
2231                         
2232         }
2233                 
2236 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID, 
2237                 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
2238                 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
2239                 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
2240                 map<int, wxString> *PicturesListTokens, wxString *SaveData){
2242         wxString ProcessData = "";
2243                 
2244         for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
2245                 PicturesIter != PicturesList->end(); PicturesIter++){
2247                 ProcessData.Append("PHOTO");
2248                         
2249                 // Check if there is a value for TYPE.
2250                 
2251                 if ((*PicturesListType)[PicturesIter->first].size() > 0){
2252                 
2253                         ProcessData.Append(";TYPE=");
2254                         ProcessData.Append((*PicturesListType)[PicturesIter->first]);
2255                         
2256                 }
2257                 
2258                 // Check if there is a value for ALTID.
2259                 
2260                 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
2261                 
2262                         ProcessData.Append(";ALTID=");
2263                         ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
2264                         
2265                 }
2267                 // Check if there is a value for MEDIATYPE..
2268                 
2269                 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
2270                 
2271                         ProcessData.Append(";MEDIATYPE=");
2272                         ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
2273                         
2274                 }
2275                 
2276                 // Check if there is a value for PID.
2278                 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
2279                 
2280                         ProcessData.Append(";PID=");
2281                         ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
2282                         
2283                 }
2285                 // Check if there is a value for PREF.
2287                 if ((*PicturesListPref)[PicturesIter->first] > 0){
2288                 
2289                         ProcessData.Append(";PREF=");
2290                         ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
2291                         
2292                 }
2294                 // Check if there is a value for tokens.
2296                 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
2297                 
2298                         ProcessData.Append(";");
2299                         ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
2300                         
2301                 }
2302                 
2303                 ProcessData.Append(":data:");
2304                 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
2305                 ProcessData.Append(";");
2306                 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
2307                 ProcessData.Append(",");
2308                 ProcessData.Append(PicturesIter->second);
2309                 ProcessData.Append("\n");
2311                 ProcessData = OutputText(&ProcessData);
2312                 
2313                 SaveData->Append(ProcessData);
2314                 ProcessData.clear();
2315                         
2316         }
2317                         
2320 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID, 
2321         map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
2322         map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
2323         map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
2324         map<int, wxString> *LogosListTokens, wxString *SaveData){
2326         wxString ProcessData = "";
2327                 
2328         for (std::map<int, string>::iterator LogosIter = LogosList->begin();
2329                 LogosIter != LogosList->end(); LogosIter++){
2331                 ProcessData.Append("LOGO");
2332                         
2333                 // Check if there is a value for TYPE.
2334                 
2335                 if ((*LogosListType)[LogosIter->first].size() > 0){
2336                 
2337                         ProcessData.Append(";TYPE=");
2338                         ProcessData.Append((*LogosListType)[LogosIter->first]);
2339                         
2340                 }
2341                 
2342                 // Check if there is a value for ALTID.
2343                 
2344                 if ((*LogosListAltID)[LogosIter->first].size() > 0){
2345                 
2346                         ProcessData.Append(";ALTID=");
2347                         ProcessData.Append((*LogosListAltID)[LogosIter->first]);
2348                         
2349                 }
2351                 // Check if there is a value for MEDIATYPE..
2352                 
2353                 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
2354                 
2355                         ProcessData.Append(";MEDIATYPE=");
2356                         ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
2357                         
2358                 }
2359                 
2360                 // Check if there is a value for PID.
2362                 if ((*LogosListPID)[LogosIter->first].size() > 0){
2363                 
2364                         ProcessData.Append(";PID=");
2365                         ProcessData.Append((*LogosListPID)[LogosIter->first]);
2366                         
2367                 }
2369                 // Check if there is a value for PREF.
2371                 if ((*LogosListPref)[LogosIter->first] > 0){
2372                 
2373                         ProcessData.Append(";PREF=");
2374                         ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
2375                         
2376                 }
2378                 // Check if there is a value for tokens.
2380                 if ((*LogosListTokens)[LogosIter->first].size() > 0){
2381                 
2382                         ProcessData.Append(";");
2383                         ProcessData.Append((*LogosListTokens)[LogosIter->first]);
2384                         
2385                 }
2386                 
2387                 ProcessData.Append(":data:");
2388                 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
2389                 ProcessData.Append(";");
2390                 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
2391                 ProcessData.Append(",");
2392                 ProcessData.Append(LogosIter->second);
2393                 ProcessData.Append("\n");
2395                 ProcessData = OutputText(&ProcessData);
2396                 
2397                 SaveData->Append(ProcessData);
2398                 ProcessData.clear();
2399                         
2400         }
2401                 
2404 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID, 
2405         map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
2406         map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
2407         map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage, 
2408         map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens, 
2409         wxString *SaveData){
2411         wxString ProcessData = "";
2412                 
2413         for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
2414                 SoundsIter != SoundsList->end(); SoundsIter++){
2416                 ProcessData.Append("SOUND");
2417                         
2418                 // Check if there is a value for TYPE.
2419                 
2420                 if ((*SoundsListType)[SoundsIter->first].size() > 0){
2421                 
2422                         ProcessData.Append(";TYPE=");
2423                         ProcessData.Append((*SoundsListType)[SoundsIter->first]);
2424                         
2425                 }
2426                 
2427                 // Check if there is a value for ALTID.
2428                 
2429                 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
2430                 
2431                         ProcessData.Append(";ALTID=");
2432                         ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
2433                         
2434                 }
2436                 // Check if there is a value for LANGUAGE.
2437                 
2438                 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
2439                 
2440                         ProcessData.Append(";LANGUAGE=");
2441                         ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
2442                         
2443                 }
2444                 
2445                 // Check if there is a value for MEDIATYPE.
2446                 
2447                 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
2448                 
2449                         ProcessData.Append(";MEDIATYPE=");
2450                         ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
2451                         
2452                 }
2453                 
2454                 // Check if there is a value for PID.
2456                 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
2457                 
2458                         ProcessData.Append(";PID=");
2459                         ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
2460                         
2461                 }
2463                 // Check if there is a value for PREF.
2465                 if ((*SoundsListPref)[SoundsIter->first] > 0){
2466                 
2467                         ProcessData.Append(";PREF=");
2468                         ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
2469                         
2470                 }
2472                 // Check if there is a value for tokens.
2474                 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
2475                 
2476                         ProcessData.Append(";");
2477                         ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
2478                         
2479                 }
2480                 
2481                 ProcessData.Append(":data:");
2482                 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
2483                 ProcessData.Append(";");
2484                 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
2485                 ProcessData.Append(",");
2486                 ProcessData.Append(SoundsIter->second);
2487                 ProcessData.Append("\n");
2489                 ProcessData = OutputText(&ProcessData);
2490                 
2491                 SaveData->Append(ProcessData);
2492                 ProcessData.clear();
2493                         
2494         }
2495                 
2498 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
2499         map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
2500         map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
2501         map<int, wxString> *CalendarListTokens, wxString *SaveData){
2503         wxString ProcessData = "";
2504                 
2505         for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
2506                 CalendarIter != CalendarList->end(); CalendarIter++){
2508                 ProcessData.Append("CALURI");
2509                         
2510                 // Check if there is a value for TYPE.
2511                 
2512                 if ((*CalendarListType)[CalendarIter->first].size() > 0){
2513                 
2514                         ProcessData.Append(";TYPE=");
2515                         ProcessData.Append((*CalendarListType)[CalendarIter->first]);
2516                         
2517                 }
2518                 
2519                 // Check if there is a value for ALTID.
2520                 
2521                 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2522                 
2523                         ProcessData.Append(";ALTID=");
2524                         ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2525                         
2526                 }
2528                 // Check if there is a value for MEDIATYPE.
2529                 
2530                 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2531                 
2532                         ProcessData.Append(";MEDIATYPE=");
2533                         ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2534                         
2535                 }
2536                 
2537                 // Check if there is a value for PID.
2539                 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2540                 
2541                         ProcessData.Append(";PID=");
2542                         ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2543                         
2544                 }
2546                 // Check if there is a value for PREF.
2548                 if ((*CalendarListPref)[CalendarIter->first] > 0){
2549                 
2550                         ProcessData.Append(";PREF=");
2551                         ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2552                         
2553                 }
2555                 // Check if there is a value for tokens.
2557                 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2558                 
2559                         ProcessData.Append(";");
2560                         ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2561                         
2562                 }
2563                         
2564                 ProcessData.Append(":");
2565                 ProcessData.Append(CalendarIter->second);
2566                 ProcessData.Append("\n");
2568                 ProcessData = OutputText(&ProcessData);
2569                 
2570                 SaveData->Append(ProcessData);
2571                 ProcessData.clear();
2572                         
2573         }
2574                 
2577 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2578         map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2579         map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2580         map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2582         wxString ProcessData = "";
2583                 
2584         for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2585                 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2587                 ProcessData.Append("CALADRURI");
2588                         
2589                 // Check if there is a value for TYPE.
2590                 
2591                 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2592                 
2593                         ProcessData.Append(";TYPE=");
2594                         ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2595                         
2596                 }
2597                 
2598                 // Check if there is a value for ALTID.
2599                 
2600                 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2601                 
2602                         ProcessData.Append(";ALTID=");
2603                         ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2604                         
2605                 }
2607                 // Check if there is a value for MEDIATYPE.
2608                 
2609                 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2610                 
2611                         ProcessData.Append(";MEDIATYPE=");
2612                         ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2613                         
2614                 }
2615                 
2616                 // Check if there is a value for PID.
2618                 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2619                 
2620                         ProcessData.Append(";PID=");
2621                         ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2622                         
2623                 }
2625                 // Check if there is a value for PREF.
2627                 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2628                 
2629                         ProcessData.Append(";PREF=");
2630                         ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2631                         
2632                 }
2634                 // Check if there is a value for tokens.
2636                 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2637                 
2638                         ProcessData.Append(";");
2639                         ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2640                         
2641                 }
2642                         
2643                 ProcessData.Append(":");
2644                 ProcessData.Append(CalendarRequestIter->second);
2645                 ProcessData.Append("\n");
2647                 ProcessData = OutputText(&ProcessData);
2648                 
2649                 SaveData->Append(ProcessData);
2650                 ProcessData.clear();
2651                         
2652         }
2653                 
2656 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID, 
2657         std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2658         std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref, 
2659         std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2661         wxString ProcessData = "";
2662                 
2663         for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2664                 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2666                 ProcessData.Append("FBURL");
2667                         
2668                 // Check if there is a value for TYPE.
2669                 
2670                 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2671                 
2672                         ProcessData.Append(";TYPE=");
2673                         ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2674                         
2675                 }
2676                 
2677                 // Check if there is a value for ALTID.
2678                 
2679                 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2680                 
2681                         ProcessData.Append(";ALTID=");
2682                         ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2683                         
2684                 }
2686                 // Check if there is a value for MEDIATYPE.
2687                 
2688                 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2689                 
2690                         ProcessData.Append(";MEDIATYPE=");
2691                         ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2692                         
2693                 }
2694                 
2695                 // Check if there is a value for PID.
2697                 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2698                 
2699                         ProcessData.Append(";PID=");
2700                         ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2701                         
2702                 }
2704                 // Check if there is a value for PREF.
2706                 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2707                 
2708                         ProcessData.Append(";PREF=");
2709                         ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2710                         
2711                 }
2713                 // Check if there is a value for tokens.
2715                 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2716                 
2717                         ProcessData.Append(";");
2718                         ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2719                         
2720                 }
2721                         
2722                 ProcessData.Append(":");
2723                 ProcessData.Append(FreeBusyIter->second);
2724                 ProcessData.Append("\n");
2726                 ProcessData = OutputText(&ProcessData);
2727                 
2728                 SaveData->Append(ProcessData);
2729                 ProcessData.clear();
2730                         
2731         }
2732                 
2735 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID, 
2736         map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2737         map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType, 
2738         map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref, 
2739         map<int, wxString> *KeyListTokens, wxString *SaveData){
2741         wxString ProcessData = "";
2742                 
2743         for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2744                 KeyIter != KeyList->end(); KeyIter++){
2746                 ProcessData.Append("KEY");
2747                         
2748                 // Check if there is a value for TYPE.
2749                 
2750                 if ((*KeyListType)[KeyIter->first].size() > 0){
2751                 
2752                         ProcessData.Append(";TYPE=");
2753                         ProcessData.Append((*KeyListType)[KeyIter->first]);
2754                         
2755                 }
2756                 
2757                 // Check if there is a value for ALTID.
2758                 
2759                 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2760                 
2761                         ProcessData.Append(";ALTID=");
2762                         ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2763                         
2764                 }
2765                 
2766                 // Check if there is a value for PID.
2768                 if ((*KeyListPID)[KeyIter->first].size() > 0){
2769                 
2770                         ProcessData.Append(";PID=");
2771                         ProcessData.Append((*KeyListPID)[KeyIter->first]);
2772                         
2773                 }
2775                 // Check if there is a value for PREF.
2777                 if ((*KeyListPref)[KeyIter->first] > 0){
2778                 
2779                         ProcessData.Append(";PREF=");
2780                         ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2781                         
2782                 }
2784                 // Check if there is a value for tokens.
2786                 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2787                 
2788                         ProcessData.Append(";");
2789                         ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2790                         
2791                 }
2792                         
2793                 ProcessData.Append(":data:");
2794                 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2795                 ProcessData.Append(";");
2796                 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2797                 ProcessData.Append(",");
2798                 ProcessData.Append(KeyIter->second);
2799                 ProcessData.Append("\n");
2801                 ProcessData = OutputText(&ProcessData);
2802                 
2803                 SaveData->Append(ProcessData);
2804                 ProcessData.clear();
2805                         
2806         }
2807                 
2810 void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN, 
2811         map<int, wxString> *VendorListElement, wxString *SaveData){
2813         wxString ProcessData = "";
2814                 
2815         for (std::map<int, wxString>::iterator VendorIter = VendorList->begin();
2816                 VendorIter != VendorList->end(); VendorIter++){
2818                 ProcessData.Append("VND-");
2819                 ProcessData.Append((*VendorListPEN)[VendorIter->first]);
2820                 ProcessData.Append("-");
2821                 ProcessData.Append((*VendorListElement)[VendorIter->first]);
2822                 ProcessData.Append(":");
2823                 ProcessData.Append(VendorIter->second);
2824                 ProcessData.Append("\n");
2826                 ProcessData = OutputText(&ProcessData);
2827                 
2828                 SaveData->Append(ProcessData);
2829                 ProcessData.clear();
2830                         
2831         }
2832                 
2835 void ContactDataObject::SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens, 
2836         wxString *SaveData){
2838         wxString ProcessData = "";
2839                 
2840         for (std::map<int, wxString>::iterator XTokenIter = XTokenList->begin();
2841                 XTokenIter != XTokenList->end(); XTokenIter++){
2843                 ProcessData.Append("X-");
2844                 ProcessData.Append((*XTokenListTokens)[XTokenIter->first]);
2845                 ProcessData.Append(":");
2846                 ProcessData.Append(XTokenIter->second);
2847                 ProcessData.Append("\n");
2849                 ProcessData = OutputText(&ProcessData);
2850                 
2851                 SaveData->Append(ProcessData);
2852                 ProcessData.clear();
2853                         
2854         }       
2855                 
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