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