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