Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
9e14252464109dbebfd9ed884a87f16e229e4ce7
[xestiaab/.git] / source / contacteditor / cdo / ContactDataObject-Save.cpp
1 // ContactDataObject-Save.cpp - Client Data Object.
2 //
3 // (c) 2012-2016 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
10 //
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "ContactDataObject.h"
20 #include "../../version.h"
22 ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
23         
24         ContactSaveStatus SaveDataStatus = CONTACTSAVE_UNITTESTFAIL;
25         
26         // Write the header for the vCard data file.
27         
28         SaveData->Append("BEGIN:VCARD\n");
29         SaveData->Append("VERSION:4.0\n");
30         
31         // Write the product ID.
32         
33 #ifdef XAB_UNITTEST
34         
35         SaveData->Append("PRODID:-//Xestia//Address Book Unit Testing//KW\n");
36         
37 #else
38         
39         SaveData->Append(wxT("PRODID:-//Xestia//Address Book Version "));
40         SaveData->Append(wxT(XSDAB_VERSION));
41         SaveData->Append(wxT("//KW\n"));
42         
43 #endif
45         wxString ProcessData = "";
47         // Process UID.
49         if (UIDToken.size() > 0){
50                 
51                 ProcessData.Append("UID:");
52                 ProcessData.Append(UIDToken);
53                 ProcessData.Append("\n");
54                 SaveData->Append(ProcessData);
55                 ProcessData.clear();
56                 
57         }
58         
59         // Process KIND.
60         
61         switch(ContactKind){
63                 case CONTACTKIND_NONE:
64                         break;
65                 case CONTACTKIND_INDIVIDUAL:
66                         SaveData->Append("KIND:individual\n");
67                         break;
68                 case CONTACTKIND_GROUP:
69                         SaveData->Append("KIND:group\n");
70                         break;
71                 case CONTACTKIND_ORGANISATION:
72                         SaveData->Append("KIND:org\n");
73                         break;
74                 case CONTACTKIND_LOCATION:
75                         SaveData->Append("KIND:location\n");
76                         break;
77                 default:
78                         break;
79                 
80         }
81         
82         // Process REV.
83         
84         wxDateTime DateTimeSave;
85         DateTimeSave = DateTimeSave.SetToCurrent();
86         wxString DateTimeSaveValue;
87         
88 #ifdef XAB_UNITTEST
89         
90         DateTimeSaveValue += "20160703T091000Z";
91         
92 #else
93     
94         DateTimeSaveValue += wxString::Format("%04i", DateTimeSave.GetYear());
95         DateTimeSaveValue += wxString::Format("%02i", (DateTimeSave.GetMonth() + 1));
96         DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetDay());
97         DateTimeSaveValue += "T";
98         DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetHour());
99         DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetMinute());
100         DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetSecond());
101         DateTimeSaveValue += "Z";
102     
103 #endif
104         
105         if (!RevisionTokens.IsEmpty()){
106                 
107                 ProcessData.Append("REV;");
108                 ProcessData.Append(RevisionTokens);
109                 ProcessData.Append(":");
110                 ProcessData.Append(DateTimeSaveValue);
111                 ProcessData.Append("\n");
112                 
113                 ProcessData = OutputText(&ProcessData);
114                 
115                 SaveData->Append(ProcessData);
116                 ProcessData.clear();            
117                 
118         } else {
119         
120                 ProcessData.Append("REV:");
121                 ProcessData.Append(DateTimeSaveValue);
122                 ProcessData.Append("\n");
123                 
124                 ProcessData = OutputText(&ProcessData);
125                 
126                 SaveData->Append(ProcessData);
127                 ProcessData.clear();
128                 
129         }
130         
131         // Process XML.
133         for (std::map<int, wxString>::iterator XMLIter = XMLList.begin();
134                 XMLIter != XMLList.end(); XMLIter++){
135         
136                 ProcessData.Append("XML");
137                         
138                 if (XMLListAltID[XMLIter->first].size() > 0){
139                 
140                         ProcessData.Append(";ALTID=");
141                         ProcessData.Append(XMLListAltID[XMLIter->first]);
142                         
143                 }
144                         
145                 ProcessData.Append(":");
146                 ProcessData.Append(XMLIter->second);
147                 ProcessData.Append("\n");
148                 
149                 ProcessData = OutputText(&ProcessData);
150                 
151                 SaveData->Append(ProcessData);
152                 ProcessData.clear();
153                         
154         }
155         
156         // Process SOURCE.
157         
158         SaveSource(&SourceList, &SourceListAltID, 
159                 &SourceListPID, &SourceListType,
160                 &SourceListMediatype, &SourceListPref, 
161                 &SourceListTokens, SaveData);
162         
163         // Process MEMBER (if contact kind is CONTACTKIND_GROUP).
164         
165         if (ContactKind == CONTACTKIND_GROUP){
166                 
167                 SaveMember(&GroupsList, &GroupsListAltID, 
168                         &GroupsListPID, &GroupsListType,
169                         &GroupsListMediaType, &GroupsListPref, 
170                         &GroupsListTokens, SaveData);
171                 
172         }
173         
174         // Process CLIENTPIDMAP.
175         
176         for (std::map<int, wxString>::iterator CPIDIter = ClientPIDList.begin();
177                 CPIDIter != ClientPIDList.end(); CPIDIter++){
178         
179                 ProcessData.Append("CLIENTPIDMAP");
180                         
181                 if (ClientPIDListTokens[CPIDIter->first].size() > 0){
182                 
183                         ProcessData.Append(";");
184                         ProcessData.Append(ClientPIDListTokens[CPIDIter->first]);
185                         
186                 }
187                         
188                 ProcessData.Append(":");
189                 ProcessData.Append(CPIDIter->second);
190                 ProcessData.Append("\n");
191                 
192                 ProcessData = OutputText(&ProcessData);
193                 
194                 SaveData->Append(ProcessData);
195                 ProcessData.clear();
196                         
197         }
198         
199         // Process FN.
200         
201         for (std::map<int, wxString>::iterator FNIter = FullNamesList.begin();
202                 FNIter != FullNamesList.end(); FNIter++){
203                 
204                 ProcessData.Append("FN");
206                 // Check if there is a value for TYPE.
207                 
208                 if (FullNamesListType[FNIter->first].size() > 0){
209                 
210                         ProcessData.Append(";TYPE=");
211                         ProcessData.Append(FullNamesListType[FNIter->first]);
212                         
213                 }
215                 // Check if there is a value for LANGUAGE.
216                 
217                 if (FullNamesListLanguage[FNIter->first].size() > 0){
218                 
219                         ProcessData.Append(";LANGUAGE=");
220                         ProcessData.Append(FullNamesListLanguage[FNIter->first]);
221                         
222                 }
223                 
224                 // Check if there is a value for ALTID.
225                 
226                 if (FullNamesListAltID[FNIter->first].size() > 0){
227                 
228                         ProcessData.Append(";ALTID=");
229                         ProcessData.Append(FullNamesListAltID[FNIter->first]);
230                         
231                 }
232                 
233                 // Check if there is a value for PID.
235                 if (FullNamesListPID[FNIter->first].size() > 0){
236                 
237                         ProcessData.Append(";PID=");
238                         ProcessData.Append(FullNamesListPID[FNIter->first]);
239                         
240                 }
242                 // Check if there is a value for PREF.
244                 if (FullNamesListPref[FNIter->first] > 0){
245                 
246                         ProcessData.Append(";PREF=");
247                         ProcessData.Append(wxString::Format("%i", FullNamesListPref[FNIter->first]));
248                         
249                 }
251                 // Check if there is a value for tokens.
253                 if (FullNamesListTokens[FNIter->first].size() > 0){
254                 
255                         ProcessData.Append(";");
256                         ProcessData.Append(FullNamesListTokens[FNIter->first]);
257                         
258                 }
259                 
260                 ProcessData.Append(":");
261                 ProcessData.Append(FNIter->second);
262                 ProcessData.Append("\n");
263                 
264                 ProcessData = OutputText(&ProcessData);
265                 
266                 SaveData->Append(ProcessData);
267                 ProcessData.clear();
268                         
269         }
270         
271         // Process NICKNAME.
272         
273         SaveNickname(&GeneralNicknamesList, &GeneralNicknamesListAltID, 
274                 &GeneralNicknamesListPID, &GeneralNicknamesListType,
275                 &GeneralNicknamesListLanguage, &GeneralNicknamesListPref, 
276                 &GeneralNicknamesListTokens, SaveData, "");
277         SaveNickname(&HomeNicknamesList, &HomeNicknamesListAltID, 
278                 &HomeNicknamesListPID, &HomeNicknamesListType,
279                 &HomeNicknamesListLanguage, &HomeNicknamesListPref, 
280                 &HomeNicknamesListTokens, SaveData, "home");
281         SaveNickname(&BusinessNicknamesList, &BusinessNicknamesListAltID, 
282                 &BusinessNicknamesListPID, &BusinessNicknamesListType,
283                 &BusinessNicknamesListLanguage, &BusinessNicknamesListPref, 
284                 &BusinessNicknamesListTokens, SaveData, "work");
285         
286         // Process TITLE.
288         SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
289                 &GeneralTitleListAltID, &GeneralTitleListPID,
290                 &GeneralTitleListType, &GeneralTitleListPref,
291                 &GeneralTitleListTokens, SaveData, "");
292         SaveTitle(&HomeTitleList, &HomeTitleListLanguage,
293                 &HomeTitleListAltID, &HomeTitleListPID,
294                 &HomeTitleListType, &HomeTitleListPref,
295                 &HomeTitleListTokens, SaveData, "home");
296         SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage,
297                 &BusinessTitleListAltID, &BusinessTitleListPID,
298                 &BusinessTitleListType, &BusinessTitleListPref,
299                 &BusinessTitleListTokens, SaveData, "work");
300         
301         // Process TZ.
302         
303         SaveTimezone(&GeneralTZList, &GeneralTZListAltID, 
304                 &GeneralTZListPID, &GeneralTZListType,
305                 &GeneralTZListMediatype, &GeneralTZListPref, 
306                 &GeneralTZListTokens, SaveData, "");
307         SaveTimezone(&HomeTZList, &HomeTZListAltID, 
308                 &HomeTZListPID, &HomeTZListType,
309                 &HomeTZListMediatype, &HomeTZListPref, 
310                 &HomeTZListTokens, SaveData, "home");
311         SaveTimezone(&BusinessTZList, &BusinessTZListAltID, 
312                 &BusinessTZListPID, &BusinessTZListType,
313                 &BusinessTZListMediatype, &BusinessTZListPref, 
314                 &BusinessTZListTokens, SaveData, "work");
316         // Process ADR.
317         
318         SaveAddress(&GeneralAddressList, &GeneralAddressListTown,
319                 &GeneralAddressListCounty, &GeneralAddressListPostCode,
320                 &GeneralAddressListCountry, &GeneralAddressListLabel,
321                 &GeneralAddressListLang, &GeneralAddressListAltID,
322                 &GeneralAddressListPID, &GeneralAddressListGeo, 
323                 &GeneralAddressListTimezone, &GeneralAddressListType, 
324                 &GeneralAddressListMediatype, &GeneralAddressListPref,
325                 &GeneralAddressListTokens, SaveData, "");
326         SaveAddress(&HomeAddressList, &HomeAddressListTown,
327                 &HomeAddressListCounty, &HomeAddressListPostCode,
328                 &HomeAddressListCountry, &HomeAddressListLabel,
329                 &HomeAddressListLang, &HomeAddressListAltID,
330                 &HomeAddressListPID, &HomeAddressListGeo, 
331                 &HomeAddressListTimezone, &HomeAddressListType, 
332                 &HomeAddressListMediatype, &HomeAddressListPref,
333                 &HomeAddressListTokens, SaveData, "home");
334         SaveAddress(&BusinessAddressList, &BusinessAddressListTown,
335                 &BusinessAddressListCounty, &BusinessAddressListPostCode,
336                 &BusinessAddressListCountry, &BusinessAddressListLabel,
337                 &BusinessAddressListLang, &BusinessAddressListAltID,
338                 &BusinessAddressListPID, &BusinessAddressListGeo, 
339                 &BusinessAddressListTimezone, &BusinessAddressListType, 
340                 &BusinessAddressListMediatype, &BusinessAddressListPref,
341                 &BusinessAddressListTokens, SaveData, "work");
343         // Process EMAIL.
344         
345         SaveEmail(&GeneralEmailList, &GeneralEmailListAltID, 
346                 &GeneralEmailListPID, &GeneralEmailListType,
347                 &GeneralEmailListPref, &GeneralEmailListTokens, 
348                 SaveData, "");
349         SaveEmail(&HomeEmailList, &HomeEmailListAltID, 
350                 &HomeEmailListPID, &HomeEmailListType,
351                 &HomeEmailListPref, &HomeEmailListTokens, 
352                 SaveData, "home");
353         SaveEmail(&BusinessEmailList, &BusinessEmailListAltID, 
354                 &BusinessEmailListPID, &BusinessEmailListType,
355                 &BusinessEmailListPref, &BusinessEmailListTokens, 
356                 SaveData, "work");
358         // TODO: Process IMPP.
359         
360         
361         
362         // TODO: Process TEL.
363         
364         
365         
366         // Process LANG.
367         
368         SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID, 
369                 &GeneralLanguageListPID, &GeneralLanguageListType,
370                 &GeneralLanguageListPref, &GeneralLanguageListTokens, 
371                 SaveData, "");
372         SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID, 
373                 &HomeLanguageListPID, &HomeLanguageListType,
374                 &HomeLanguageListPref, &HomeLanguageListTokens, 
375                 SaveData, "home");
376         SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID, 
377                 &BusinessLanguageListPID, &BusinessLanguageListType,
378                 &BusinessLanguageListPref, &BusinessLanguageListTokens, 
379                 SaveData, "work");
381         // Process GEO.
382         
383         SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID, 
384                 &GeneralGeographyListPID, &GeneralGeographyListType,
385                 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
386                 &GeneralGeographyListPref, &GeneralGeographyListTokens, 
387                 SaveData, "");
388         SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID, 
389                 &HomeGeographyListPID, &HomeGeographyListType,
390                 &HomeGeographyListMediatype, &HomeGeographyListDataType,
391                 &HomeGeographyListPref, &HomeGeographyListTokens, 
392                 SaveData, "home");
393         SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID, 
394                 &BusinessGeographyListPID, &BusinessGeographyListType,
395                 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
396                 &BusinessGeographyListPref, &BusinessGeographyListTokens, 
397                 SaveData, "work");
399         // Process RELATED.
400         
401         int Moo = 0;
403         for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
404                 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
405                 
406                 ProcessData.Append("RELATED");
408                 // Check if there is a value for TYPE.
409                 
410                 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
411                 
412                         wxString RelatedType = "";
413                         
414                         ProcessData.Append(";TYPE=");
415                         
416                         if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
418                                 RelatedType = wxT("contact");
420                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
422                                 RelatedType = wxT("acquaintance");
424                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
426                                 RelatedType = wxT("friend");
428                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
430                                 RelatedType = wxT("met");
432                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
434                                 RelatedType = wxT("co-worker");
436                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
438                                 RelatedType = wxT("colleague");
440                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
442                                 RelatedType = wxT("co-resident");
444                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
446                                 RelatedType = wxT("neighbor");
448                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
450                                 RelatedType = wxT("child");
452                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
454                                 RelatedType = wxT("parent");
456                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
458                                 RelatedType = wxT("sibling");
460                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
462                                 RelatedType = wxT("spouse");
464                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
466                                 RelatedType = wxT("kin");
468                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
470                                 RelatedType = wxT("muse");
472                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
474                                 RelatedType = wxT("crush");
476                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
478                                 RelatedType = wxT("date");
480                         } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
482                                 RelatedType = wxT("sweetheart");
484                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
486                                 RelatedType = wxT("me");
488                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
490                                 RelatedType = wxT("agent");
492                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
494                                 RelatedType = wxT("emergency");
496                         } else {
498                                 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
500                         }
501                         
502                         ProcessData.Append(RelatedType);
503                         
504                 }
506                 // Check if there is a value for LANGUAGE.
507                 
508                 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
509                 
510                         ProcessData.Append(";LANGUAGE=");
511                         ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
512                         
513                 }
514                 
515                 // Check if there is a value for ALTID.
516                 
517                 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
518                 
519                         ProcessData.Append(";ALTID=");
520                         ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
521                         
522                 }
523                 
524                 // Check if there is a value for PID.
526                 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
527                 
528                         ProcessData.Append(";PID=");
529                         ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
530                         
531                 }
533                 // Check if there is a value for PREF.
535                 if (GeneralRelatedListPref[RelatedIter->first] > 0){
536                 
537                         ProcessData.Append(";PREF=");
538                         ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
539                         
540                 }
542                 // Check if there is a value for tokens.
544                 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
545                 
546                         ProcessData.Append(";");
547                         ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
548                         
549                 }
550                 
551                 ProcessData.Append(":");
552                 ProcessData.Append(RelatedIter->second);
553                 ProcessData.Append("\n");
554                 
555                 ProcessData = OutputText(&ProcessData);
556                 
557                 SaveData->Append(ProcessData);
558                 ProcessData.clear();
559                         
560         }
561         
562         // Process URL.
563         
564         SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID, 
565                 &GeneralWebsiteListPID, &GeneralWebsiteListType,
566                 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref, 
567                 &GeneralWebsiteListTokens, SaveData, "");
568         SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID, 
569                 &HomeWebsiteListPID, &HomeWebsiteListType,
570                 &HomeWebsiteListMediatype, &HomeWebsiteListPref, 
571                 &HomeWebsiteListTokens, SaveData, "home");
572         SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID, 
573                 &BusinessWebsiteListPID, &BusinessWebsiteListType,
574                 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref, 
575                 &BusinessWebsiteListTokens, SaveData, "work");
577         // Process ROLE.
578         
579         SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
580                 &GeneralRoleListAltID, &GeneralRoleListPID,
581                 &GeneralRoleListType, &GeneralRoleListPref,
582                 &GeneralRoleListTokens, SaveData, "");
583         SaveRole(&HomeRoleList, &HomeRoleListLanguage,
584                 &HomeRoleListAltID, &HomeRoleListPID,
585                 &HomeRoleListType, &HomeRoleListPref,
586                 &HomeRoleListTokens, SaveData, "home");
587         SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
588                 &BusinessRoleListAltID, &BusinessRoleListPID,
589                 &BusinessRoleListType, &BusinessRoleListPref,
590                 &BusinessRoleListTokens, SaveData, "work");
592         // Process ORG.
593         
594         SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
595                 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage, 
596                 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType, 
597                 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens, 
598                 SaveData, "");
599         SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
600                 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage, 
601                 &HomeOrganisationsListSortAs, &HomeOrganisationsListType, 
602                 &HomeOrganisationsListPref, &HomeOrganisationsListTokens, 
603                 SaveData, "home");
604         SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
605                 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage, 
606                 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType, 
607                 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens, 
608                 SaveData, "work");
610         // Process NOTE.
611         
612         SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
613                 &GeneralNoteListAltID, &GeneralNoteListPID,
614                 &GeneralNoteListType, &GeneralNoteListPref,
615                 &GeneralNoteListTokens, SaveData, "");
616         SaveNote(&HomeNoteList, &HomeNoteListLanguage,
617                 &HomeNoteListAltID, &HomeNoteListPID,
618                 &HomeNoteListType, &HomeNoteListPref,
619                 &HomeNoteListTokens, SaveData, "home");
620         SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
621                 &BusinessNoteListAltID, &BusinessNoteListPID,
622                 &BusinessNoteListType, &BusinessNoteListPref,
623                 &BusinessNoteListTokens, SaveData, "work");
625         // Process CATEGORIES.
626         
627         SaveCategory(&CategoriesList, &CategoriesListLanguage,
628                 &CategoriesListAltID, &CategoriesListPID,
629                 &CategoriesListType, &CategoriesListPref,
630                 &CategoriesListTokens, SaveData);
632         // Process PHOTO.
633         
634         SavePhoto(&PicturesList, &PicturesListAltID, 
635                 &PicturesListPID, &PicturesListType,
636                 &PicturesListPicEncType, &PicturesListPictureType,
637                 &PicturesListMediatype, &PicturesListPref,
638                 &PicturesListTokens, SaveData);
639         
640         // Process LOGO.
641         
642         SaveLogo(&LogosList, &LogosListAltID, 
643                 &LogosListPID, &LogosListType,
644                 &LogosListPicEncType, &LogosListPictureType,
645                 &LogosListMediatype, &LogosListPref,
646                 &LogosListTokens, SaveData);
647         
648         // Process SOUND.
650         SaveSound(&SoundsList, &SoundsListAltID, 
651                 &SoundsListPID, &SoundsListType,
652                 &SoundsListAudioEncType, &SoundsListAudioType,
653                 &SoundsListMediatype, &SoundsListLanguage, 
654                 &SoundsListPref, &SoundsListTokens, 
655                 SaveData);
657         // Process CALURI.
658         
659         SaveCalendarURI(&CalendarList, &CalendarListMediatype,
660                 &CalendarListAltID, &CalendarListPID,
661                 &CalendarListType, &CalendarListPref,
662                 &CalendarListTokens, SaveData);
663         
664         // Process CALADRURI.
665         
666         SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
667                 &CalendarRequestListAltID, &CalendarRequestListPID,
668                 &CalendarRequestListType, &CalendarRequestListPref,
669                 &CalendarRequestListTokens, SaveData);
671         // Process FBURL.
672         
673         SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID, 
674                 &FreeBusyListPID, &FreeBusyListType,
675                 &FreeBusyListMediatype, &FreeBusyListPref, 
676                 &FreeBusyListTokens, SaveData);
678         // Process KEY.
679         
680         SaveKey(&KeyList, &KeyListAltID, 
681                 &KeyListPID, &KeyListType,
682                 &KeyListKeyType, &KeyListDataEncType, 
683                 &KeyListDataType, &KeyListPref, 
684                 &KeyListTokens, SaveData);
686         // Process VND-*
687         
688         SaveVendor(&VendorList, &VendorListPEN, 
689                 &VendorListElement, SaveData);
691         // Process X-Tokens.
692         
693         SaveXToken(&XTokenList, &XTokenListTokens, 
694                 SaveData);
696         // Write the end part of the vCard data file.
697         
698         SaveData->Append("END:VCARD");
699         
700         SaveDataStatus = CONTACTSAVE_OK;
701         
702         return SaveDataStatus;
703         
706 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
707         map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
708         map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
709         map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
711         wxString ProcessData = "";
712                 
713         for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
714                 TitleIter != TitleList->end(); TitleIter++){
716                 ProcessData.Append("TITLE");
717                         
718                 // Check if there is a value for TYPE.
719                 
720                 if (DataType.size() > 0){
721                 
722                         ProcessData.Append(";TYPE=");
723                         ProcessData.Append(DataType);
724                         
725                 }
726                 
727                 // Check if there is a value for ALTID.
728                 
729                 if ((*TitleListAltID)[TitleIter->first].size() > 0){
730                 
731                         ProcessData.Append(";ALTID=");
732                         ProcessData.Append((*TitleListAltID)[TitleIter->first]);
733                         
734                 }
736                 // Check if there is a value for LANGUAGE.
737                 
738                 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
739                 
740                         ProcessData.Append(";LANGUAGE=");
741                         ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
742                         
743                 }
744                 
745                 // Check if there is a value for PID.
747                 if ((*TitleListPID)[TitleIter->first].size() > 0){
748                 
749                         ProcessData.Append(";PID=");
750                         ProcessData.Append((*TitleListPID)[TitleIter->first]);
751                         
752                 }
754                 // Check if there is a value for PREF.
756                 if ((*TitleListPref)[TitleIter->first] > 0){
757                 
758                         ProcessData.Append(";PREF=");
759                         ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
760                         
761                 }
763                 // Check if there is a value for tokens.
765                 if ((*TitleListTokens)[TitleIter->first].size() > 0){
766                 
767                         ProcessData.Append(";");
768                         ProcessData.Append((*TitleListTokens)[TitleIter->first]);
769                         
770                 }
771                         
772                 ProcessData.Append(":");
773                 ProcessData.Append(TitleIter->second);
774                 ProcessData.Append("\n");
776                 ProcessData = OutputText(&ProcessData);
777                         
778                 SaveData->Append(ProcessData);
779                 ProcessData.clear();
780                         
781         }
782                 
785 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID, 
786         map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
787         map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref, 
788         map<int, wxString> *SourceListTokens, wxString *SaveData){
790         wxString ProcessData = "";
791         
792         for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
793                 SourceIter != SourceList->end(); SourceIter++){
795                 ProcessData.Append("SOURCE");
796                         
797                 // Check if there is a value for TYPE.
798                 
799                 if ((*SourceListType)[SourceIter->first].size() > 0){
800                 
801                         ProcessData.Append(";TYPE=");
802                         ProcessData.Append((*SourceListType)[SourceIter->first]);
803                         
804                 }
805                 
806                 // Check if there is a value for ALTID.
807                 
808                 if ((*SourceListAltID)[SourceIter->first].size() > 0){
809                 
810                         ProcessData.Append(";ALTID=");
811                         ProcessData.Append((*SourceListAltID)[SourceIter->first]);
812                         
813                 }
815                 // Check if there is a value for MEDIATYPE.
816                 
817                 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
818                 
819                         ProcessData.Append(";MEDIATYPE=");
820                         ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
821                         
822                 }
823                 
824                 // Check if there is a value for PID.
826                 if ((*SourceListPID)[SourceIter->first].size() > 0){
827                 
828                         ProcessData.Append(";PID=");
829                         ProcessData.Append((*SourceListPID)[SourceIter->first]);
830                         
831                 }
833                 // Check if there is a value for PREF.
835                 if ((*SourceListPref)[SourceIter->first] > 0){
836                 
837                         ProcessData.Append(";PREF=");
838                         ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
839                         
840                 }
842                 // Check if there is a value for tokens.
844                 if ((*SourceListTokens)[SourceIter->first].size() > 0){
845                 
846                         ProcessData.Append(";");
847                         ProcessData.Append((*SourceListTokens)[SourceIter->first]);
848                         
849                 }
850                         
851                 ProcessData.Append(":");
852                 ProcessData.Append(SourceIter->second);
853                 ProcessData.Append("\n");
855                 ProcessData = OutputText(&ProcessData);
856                         
857                 SaveData->Append(ProcessData);
858                 ProcessData.clear();
859                         
860         }
861                 
864 void ContactDataObject::SaveMember(std::map<int, wxString> *GroupsList, std::map<int, wxString> *GroupsListAltID, 
865         std::map<int, wxString> *GroupsListPID, std::map<int, wxString> *GroupsListType,
866         std::map<int, wxString> *GroupsListMediaType, std::map<int, int> *GroupsListPref, 
867         std::map<int, wxString> *GroupsListTokens, wxString *SaveData){
869         wxString ProcessData = "";
870                 
871         for (std::map<int, wxString>::iterator GroupsIter = GroupsList->begin();
872                 GroupsIter != GroupsList->end(); GroupsIter++){
874                 ProcessData.Append("MEMBER");
875                         
876                 // Check if there is a value for TYPE.
877                 
878                 if ((*GroupsListType)[GroupsIter->first].size() > 0){
879                 
880                         ProcessData.Append(";TYPE=");
881                         ProcessData.Append((*GroupsListType)[GroupsIter->first]);
882                         
883                 }
884                 
885                 // Check if there is a value for ALTID.
886                 
887                 if ((*GroupsListAltID)[GroupsIter->first].size() > 0){
888                 
889                         ProcessData.Append(";ALTID=");
890                         ProcessData.Append((*GroupsListAltID)[GroupsIter->first]);
891                         
892                 }
894                 // Check if there is a value for MEDIATYPE.
895                 
896                 if ((*GroupsListMediaType)[GroupsIter->first].size() > 0){
897                 
898                         ProcessData.Append(";MEDIATYPE=");
899                         ProcessData.Append((*GroupsListMediaType)[GroupsIter->first]);
900                         
901                 }
902                 
903                 // Check if there is a value for PID.
905                 if ((*GroupsListPID)[GroupsIter->first].size() > 0){
906                 
907                         ProcessData.Append(";PID=");
908                         ProcessData.Append((*GroupsListPID)[GroupsIter->first]);
909                         
910                 }
912                 // Check if there is a value for PREF.
914                 if ((*GroupsListPref)[GroupsIter->first] > 0){
915                 
916                         ProcessData.Append(";PREF=");
917                         ProcessData.Append(wxString::Format("%i", (*GroupsListPref)[GroupsIter->first]));
918                         
919                 }
921                 // Check if there is a value for tokens.
923                 if ((*GroupsListTokens)[GroupsIter->first].size() > 0){
924                 
925                         ProcessData.Append(";");
926                         ProcessData.Append((*GroupsListTokens)[GroupsIter->first]);
927                         
928                 }
929                         
930                 ProcessData.Append(":");
931                 ProcessData.Append(GroupsIter->second);
932                 ProcessData.Append("\n");
934                 ProcessData = OutputText(&ProcessData);
935                 
936                 SaveData->Append(ProcessData);
937                 ProcessData.clear();
938                         
939         }
940                 
943 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID, 
944         map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
945         map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref, 
946         map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
948         wxString ProcessData = "";
949         
950         for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
951                 NicknameIter != NicknameList->end(); NicknameIter++){
953                 ProcessData.Append("NICKNAME");
954                         
955                 // Check if there is a value for TYPE.
956                 
957                 if (DataType.size() > 0){
958                 
959                         ProcessData.Append(";TYPE=");
960                         ProcessData.Append(DataType);
961                         
962                 }
963                 
964                 // Check if there is a value for ALTID.
965                 
966                 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
967                 
968                         ProcessData.Append(";ALTID=");
969                         ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
970                         
971                 }
973                 // Check if there is a value for MEDIATYPE.
974                 
975                 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
976                 
977                         ProcessData.Append(";LANGUAGE=");
978                         ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
979                         
980                 }
981                 
982                 // Check if there is a value for PID.
984                 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
985                 
986                         ProcessData.Append(";PID=");
987                         ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
988                         
989                 }
991                 // Check if there is a value for PREF.
993                 if ((*NicknameListPref)[NicknameIter->first] > 0){
994                 
995                         ProcessData.Append(";PREF=");
996                         ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
997                         
998                 }
1000                 // Check if there is a value for tokens.
1002                 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
1003                 
1004                         ProcessData.Append(";");
1005                         ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
1006                         
1007                 }
1008                         
1009                 ProcessData.Append(":");
1010                 ProcessData.Append(NicknameIter->second);
1011                 ProcessData.Append("\n");
1013                 ProcessData = OutputText(&ProcessData);
1014                         
1015                 SaveData->Append(ProcessData);
1016                 ProcessData.clear();
1017                         
1018         }
1019                 
1022 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID, 
1023         map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
1024         map<int, wxString> *TZListMediatype, map<int, int> *TZListPref, 
1025         map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
1027         wxString ProcessData = "";
1028         
1029         for (std::map<int, wxString>::iterator TZIter = TZList->begin();
1030                 TZIter != TZList->end(); TZIter++){
1032                 ProcessData.Append("TZ");
1033                         
1034                 // Check if there is a value for TYPE.
1035                 
1036                 if (DataType.size() > 0){
1037                 
1038                         ProcessData.Append(";TYPE=");
1039                         ProcessData.Append(DataType);
1040                         
1041                 }
1042                 
1043                 // Check if there is a value for ALTID.
1044                 
1045                 if ((*TZListAltID)[TZIter->first].size() > 0){
1046                 
1047                         ProcessData.Append(";ALTID=");
1048                         ProcessData.Append((*TZListAltID)[TZIter->first]);
1049                         
1050                 }
1052                 // Check if there is a value for MEDIATYPE.
1053                 
1054                 if ((*TZListMediatype)[TZIter->first].size() > 0){
1055                 
1056                         ProcessData.Append(";MEDIATYPE=");
1057                         ProcessData.Append((*TZListMediatype)[TZIter->first]);
1058                         
1059                 }
1060                 
1061                 // Check if there is a value for PID.
1063                 if ((*TZListPID)[TZIter->first].size() > 0){
1064                 
1065                         ProcessData.Append(";PID=");
1066                         ProcessData.Append((*TZListPID)[TZIter->first]);
1067                         
1068                 }
1070                 // Check if there is a value for PREF.
1072                 if ((*TZListPref)[TZIter->first] > 0){
1073                 
1074                         ProcessData.Append(";PREF=");
1075                         ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
1076                         
1077                 }
1079                 // Check if there is a value for tokens.
1081                 if ((*TZListTokens)[TZIter->first].size() > 0){
1082                 
1083                         ProcessData.Append(";");
1084                         ProcessData.Append((*TZListTokens)[TZIter->first]);
1085                         
1086                 }
1087                         
1088                 ProcessData.Append(":");
1089                 ProcessData.Append(TZIter->second);
1090                 ProcessData.Append("\n");
1092                 ProcessData = OutputText(&ProcessData);
1093                         
1094                 SaveData->Append(ProcessData);
1095                 ProcessData.clear();
1096                         
1097         }
1098                 
1101 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
1102                 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
1103                 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
1104                 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
1105                 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo, 
1106                 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType, 
1107                 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref, 
1108                 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
1110         wxString ProcessData = "";
1111                         
1112         for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
1113                 AddressIter != AddressList->end(); AddressIter++){
1114                         
1115                 ProcessData.Append("ADR");
1116                         
1117                 // Check if there is a value for TYPE.
1118                 
1119                 if (DataType.size() > 0){
1120                 
1121                         ProcessData.Append(";TYPE=");
1122                         ProcessData.Append(DataType);
1123                         
1124                 }
1125                 
1126                 // Check if there is a value for ALTID.
1127                 
1128                 if ((*AddressListAltID)[AddressIter->first].size() > 0){
1129                 
1130                         ProcessData.Append(";ALTID=");
1131                         ProcessData.Append((*AddressListAltID)[AddressIter->first]);
1132                         
1133                 }
1135                 // Check if there is a value for GEO.
1136                 
1137                 if ((*AddressListGeo)[AddressIter->first].size() > 0){
1138                 
1139                         ProcessData.Append(";GEO=\"");
1140                         ProcessData.Append((*AddressListGeo)[AddressIter->first]);
1141                         ProcessData.Append("\"");
1142                         
1143                 }
1145                 // Check if there is a value for LABEL.
1147                 if ((*AddressListLabel)[AddressIter->first].size() > 0){
1148                 
1149                         wxString AddressProcessed = "";
1150                         AddressProcessed = (*AddressListLabel)[AddressIter->first];
1151                         
1152                         AddressProcessed.Replace("\n", "\\n", true);
1153                         
1154                         ProcessData.Append(";LABEL=");
1155                         ProcessData.Append(AddressProcessed);
1156                         
1157                 }
1158                 
1159                 // Check if there is a value for LANGUAGE.
1160                 
1161                 if ((*AddressListLang)[AddressIter->first].size() > 0){
1162                 
1163                         ProcessData.Append(";LANGUAGE=");
1164                         ProcessData.Append((*AddressListLang)[AddressIter->first]);
1165                         
1166                 }
1167                 
1168                 // Check if there is a value for MEDIATYPE.
1169                 
1170                 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
1171                 
1172                         ProcessData.Append(";MEDIATYPE=");
1173                         ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
1174                         
1175                 }
1176                 
1177                 // Check if there is a value for PID.
1179                 if ((*AddressListPID)[AddressIter->first].size() > 0){
1180                 
1181                         ProcessData.Append(";PID=");
1182                         ProcessData.Append((*AddressListPID)[AddressIter->first]);
1183                         
1184                 }
1186                 // Check if there is a value for PREF.
1188                 if ((*AddressListPref)[AddressIter->first] > 0){
1189                 
1190                         ProcessData.Append(";PREF=");
1191                         ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1192                         
1193                 }
1195                 // Check if there is a value for TZ.
1197                 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1198                 
1199                         ProcessData.Append(";TZ=");
1200                         ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1201                         
1202                 }
1203                 
1204                 // Check if there is a value for tokens.
1206                 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1207                 
1208                         ProcessData.Append(";");
1209                         ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1210                         
1211                 }
1212                 
1213                 // Build the address.
1214                 
1215                 ProcessData.Append(":;;");
1216                 ProcessData.Append((*AddressList)[AddressIter->first]);
1217                 ProcessData.Append(";");
1218                 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1219                 ProcessData.Append(";");
1220                 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1221                 ProcessData.Append(";");
1222                 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1223                 ProcessData.Append(";");
1224                 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1225                 ProcessData.Append("\n");
1226                 
1227                 ProcessData = OutputText(&ProcessData);
1228                         
1229                 SaveData->Append(ProcessData);
1230                 ProcessData.clear();
1231                         
1232         }
1233                         
1236 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID, 
1237         map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1238         map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens, 
1239         wxString *SaveData, wxString DataType){
1241         wxString ProcessData = "";
1242         
1243         for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1244                 EmailIter != EmailList->end(); EmailIter++){
1246                 ProcessData.Append("EMAIL");
1247                         
1248                 // Check if there is a value for TYPE.
1249                 
1250                 if (DataType.size() > 0){
1251                 
1252                         ProcessData.Append(";TYPE=");
1253                         ProcessData.Append(DataType);
1254                         
1255                 }
1256                 
1257                 // Check if there is a value for ALTID.
1258                 
1259                 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1260                 
1261                         ProcessData.Append(";ALTID=");
1262                         ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1263                         
1264                 }
1265                 
1266                 // Check if there is a value for PID.
1268                 if ((*EmailListPID)[EmailIter->first].size() > 0){
1269                 
1270                         ProcessData.Append(";PID=");
1271                         ProcessData.Append((*EmailListPID)[EmailIter->first]);
1272                         
1273                 }
1275                 // Check if there is a value for PREF.
1277                 if ((*EmailListPref)[EmailIter->first] > 0){
1278                 
1279                         ProcessData.Append(";PREF=");
1280                         ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1281                         
1282                 }
1284                 // Check if there is a value for tokens.
1286                 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1287                 
1288                         ProcessData.Append(";");
1289                         ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1290                         
1291                 }
1292                         
1293                 ProcessData.Append(":");
1294                 ProcessData.Append(EmailIter->second);
1295                 ProcessData.Append("\n");
1297                 ProcessData = OutputText(&ProcessData);
1298                         
1299                 SaveData->Append(ProcessData);
1300                 ProcessData.clear();
1301                         
1302         }
1303                 
1306 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID, 
1307         map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1308         map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens, 
1309         wxString *SaveData, wxString DataType){
1311         wxString ProcessData = "";
1312         
1313         for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1314                 LanguageIter != LanguageList->end(); LanguageIter++){
1316                 ProcessData.Append("LANG");
1317                         
1318                 // Check if there is a value for TYPE.
1319                 
1320                 if (DataType.size() > 0){
1321                 
1322                         ProcessData.Append(";TYPE=");
1323                         ProcessData.Append(DataType);
1324                         
1325                 }
1326                 
1327                 // Check if there is a value for ALTID.
1328                 
1329                 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1330                 
1331                         ProcessData.Append(";ALTID=");
1332                         ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1333                         
1334                 }
1335                 
1336                 // Check if there is a value for PID.
1338                 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1339                 
1340                         ProcessData.Append(";PID=");
1341                         ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1342                         
1343                 }
1345                 // Check if there is a value for PREF.
1347                 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1348                 
1349                         ProcessData.Append(";PREF=");
1350                         ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1351                         
1352                 }
1354                 // Check if there is a value for tokens.
1356                 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1357                 
1358                         ProcessData.Append(";");
1359                         ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1360                         
1361                 }
1362                         
1363                 ProcessData.Append(":");
1364                 ProcessData.Append(LanguageIter->second);
1365                 ProcessData.Append("\n");
1367                 ProcessData = OutputText(&ProcessData);
1368                         
1369                 SaveData->Append(ProcessData);
1370                 ProcessData.clear();
1371                         
1372         }
1373                 
1376 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID, 
1377         map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1378         map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1379         map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens, 
1380         wxString *SaveData, wxString DataType){
1382         wxString ProcessData = "";
1383         
1384         for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1385                 GeographyIter != GeographyList->end(); GeographyIter++){
1387                 ProcessData.Append("GEO");
1388                         
1389                 // Check if there is a value for TYPE.
1390                 
1391                 if (DataType.size() > 0){
1392                 
1393                         ProcessData.Append(";TYPE=");
1394                         ProcessData.Append(DataType);
1395                         
1396                 }
1397                 
1398                 // Check if there is a value for ALTID.
1399                 
1400                 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1401                 
1402                         ProcessData.Append(";ALTID=");
1403                         ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1404                         
1405                 }
1406                 
1407                 // Check if there is a value for MEDIATYPE.
1408                 
1409                 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1410                 
1411                         ProcessData.Append(";MEDIATYPE=");
1412                         ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1413                         
1414                 }
1415                 
1416                 // Check if there is a value for PID.
1418                 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1419                 
1420                         ProcessData.Append(";PID=");
1421                         ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1422                         
1423                 }
1425                 // Check if there is a value for PREF.
1427                 if ((*GeographyListPref)[GeographyIter->first] > 0){
1428                 
1429                         ProcessData.Append(";PREF=");
1430                         ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1431                         
1432                 }
1434                 // Check if there is a value for tokens.
1436                 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1437                 
1438                         ProcessData.Append(";");
1439                         ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1440                         
1441                 }
1442                         
1443                 ProcessData.Append(":");
1444                 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1445                 ProcessData.Append(":");
1446                 ProcessData.Append(GeographyIter->second);
1447                 ProcessData.Append("\n");
1449                 ProcessData = OutputText(&ProcessData);
1450                         
1451                 SaveData->Append(ProcessData);
1452                 ProcessData.clear();
1453                         
1454         }
1455                 
1458 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID, 
1459                 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1460                 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref, 
1461                 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1463         wxString ProcessData = "";
1464         
1465         for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1466                 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1468                 ProcessData.Append("URL");
1469                         
1470                 // Check if there is a value for TYPE.
1471                 
1472                 if (DataType.size() > 0){
1473                 
1474                         ProcessData.Append(";TYPE=");
1475                         ProcessData.Append(DataType);
1476                         
1477                 }
1478                 
1479                 // Check if there is a value for ALTID.
1480                 
1481                 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1482                 
1483                         ProcessData.Append(";ALTID=");
1484                         ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1485                         
1486                 }
1487                 
1488                 // Check if there is a value for MEDIATYPE.
1489                 
1490                 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1491                 
1492                         ProcessData.Append(";MEDIATYPE=");
1493                         ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1494                         
1495                 }
1496                 
1497                 // Check if there is a value for PID.
1499                 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1500                 
1501                         ProcessData.Append(";PID=");
1502                         ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1503                         
1504                 }
1506                 // Check if there is a value for PREF.
1508                 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1509                 
1510                         ProcessData.Append(";PREF=");
1511                         ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1512                         
1513                 }
1515                 // Check if there is a value for tokens.
1517                 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1518                 
1519                         ProcessData.Append(";");
1520                         ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1521                         
1522                 }
1523                         
1524                 ProcessData.Append(":");
1525                 ProcessData.Append(WebsiteIter->second);
1526                 ProcessData.Append("\n");
1528                 ProcessData = OutputText(&ProcessData);
1529                         
1530                 SaveData->Append(ProcessData);
1531                 ProcessData.clear();
1532                         
1533         }
1534                         
1537 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1538         map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1539         map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1540         map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1542         wxString ProcessData = "";
1543                 
1544         for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1545                 RoleIter != RoleList->end(); RoleIter++){
1547                 ProcessData.Append("ROLE");
1548                         
1549                 // Check if there is a value for TYPE.
1550                 
1551                 if (DataType.size() > 0){
1552                 
1553                         ProcessData.Append(";TYPE=");
1554                         ProcessData.Append(DataType);
1555                         
1556                 }
1557                 
1558                 // Check if there is a value for ALTID.
1559                 
1560                 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1561                 
1562                         ProcessData.Append(";ALTID=");
1563                         ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1564                         
1565                 }
1567                 // Check if there is a value for LANGUAGE.
1568                 
1569                 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1570                 
1571                         ProcessData.Append(";LANGUAGE=");
1572                         ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1573                         
1574                 }
1575                 
1576                 // Check if there is a value for PID.
1578                 if ((*RoleListPID)[RoleIter->first].size() > 0){
1579                 
1580                         ProcessData.Append(";PID=");
1581                         ProcessData.Append((*RoleListPID)[RoleIter->first]);
1582                         
1583                 }
1585                 // Check if there is a value for PREF.
1587                 if ((*RoleListPref)[RoleIter->first] > 0){
1588                 
1589                         ProcessData.Append(";PREF=");
1590                         ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1591                         
1592                 }
1594                 // Check if there is a value for tokens.
1596                 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1597                 
1598                         ProcessData.Append(";");
1599                         ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1600                         
1601                 }
1602                         
1603                 ProcessData.Append(":");
1604                 ProcessData.Append(RoleIter->second);
1605                 ProcessData.Append("\n");
1607                 ProcessData = OutputText(&ProcessData);
1608                 
1609                 SaveData->Append(ProcessData);
1610                 ProcessData.clear();
1611                         
1612         }
1613                 
1616 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1617         map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage, 
1618         map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType, 
1619         map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens, 
1620         wxString *SaveData, wxString DataType){
1622         wxString ProcessData = "";
1623                 
1624         for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1625                 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1627                 ProcessData.Append("ORG");
1628                         
1629                 // Check if there is a value for TYPE.
1630                 
1631                 if (DataType.size() > 0){
1632                 
1633                         ProcessData.Append(";TYPE=");
1634                         ProcessData.Append(DataType);
1635                         
1636                 }
1637                 
1638                 // Check if there is a value for ALTID.
1639                 
1640                 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1641                 
1642                         ProcessData.Append(";ALTID=");
1643                         ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1644                         
1645                 }
1647                 // Check if there is a value for LANGUAGE.
1648                 
1649                 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1650                 
1651                         ProcessData.Append(";LANGUAGE=");
1652                         ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1653                         
1654                 }
1655                 
1656                 // Check if there is a value for PID.
1658                 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1659                 
1660                         ProcessData.Append(";PID=");
1661                         ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1662                         
1663                 }
1665                 // Check if there is a value for PREF.
1667                 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1668                 
1669                         ProcessData.Append(";PREF=");
1670                         ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1671                         
1672                 }
1673                 
1674                 // Check if there is a value for SORT-AS.
1675                 
1676                 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1677                 
1678                         ProcessData.Append(";SORT-AS=\"");
1679                         ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1680                         ProcessData.Append("\"");
1681                         
1682                 }
1684                 // Check if there is a value for tokens.
1686                 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1687                 
1688                         ProcessData.Append(";");
1689                         ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1690                         
1691                 }
1692                         
1693                 ProcessData.Append(":");
1694                 ProcessData.Append(OrganisationIter->second);
1695                 ProcessData.Append("\n");
1697                 ProcessData = OutputText(&ProcessData);
1698                 
1699                 SaveData->Append(ProcessData);
1700                 ProcessData.clear();
1701                         
1702         }
1703                 
1706 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1707         map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1708         map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1709         map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1711         wxString ProcessData = "";
1712                 
1713         for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1714                 NoteIter != NoteList->end(); NoteIter++){
1716                 ProcessData.Append("NOTE");
1717                         
1718                 // Check if there is a value for TYPE.
1719                 
1720                 if (DataType.size() > 0){
1721                 
1722                         ProcessData.Append(";TYPE=");
1723                         ProcessData.Append(DataType);
1724                         
1725                 }
1726                 
1727                 // Check if there is a value for ALTID.
1728                 
1729                 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1730                 
1731                         ProcessData.Append(";ALTID=");
1732                         ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1733                         
1734                 }
1736                 // Check if there is a value for LANGUAGE.
1737                 
1738                 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1739                 
1740                         ProcessData.Append(";LANGUAGE=");
1741                         ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1742                         
1743                 }
1744                 
1745                 // Check if there is a value for PID.
1747                 if ((*NoteListPID)[NoteIter->first].size() > 0){
1748                 
1749                         ProcessData.Append(";PID=");
1750                         ProcessData.Append((*NoteListPID)[NoteIter->first]);
1751                         
1752                 }
1754                 // Check if there is a value for PREF.
1756                 if ((*NoteListPref)[NoteIter->first] > 0){
1757                 
1758                         ProcessData.Append(";PREF=");
1759                         ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1760                         
1761                 }
1763                 // Check if there is a value for tokens.
1765                 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1766                 
1767                         ProcessData.Append(";");
1768                         ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1769                         
1770                 }
1771                         
1772                 ProcessData.Append(":");
1773                 ProcessData.Append(NoteIter->second);
1774                 ProcessData.Replace("\n", "\\n", true);
1775                 ProcessData.Append("\n");
1777                 ProcessData = OutputText(&ProcessData);
1778                 
1779                 SaveData->Append(ProcessData);
1780                 ProcessData.clear();
1781                         
1782         }
1783                 
1786 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1787         map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1788         map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1789         map<int, wxString> *CategoryListTokens, wxString *SaveData){
1791         wxString ProcessData = "";
1792                 
1793         for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1794                 CategoryIter != CategoryList->end(); CategoryIter++){
1796                 ProcessData.Append("CATEGORIES");
1797                         
1798                 // Check if there is a value for TYPE.
1799                 
1800                 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1801                 
1802                         ProcessData.Append(";TYPE=");
1803                         ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1804                         
1805                 }
1806                 
1807                 // Check if there is a value for ALTID.
1808                 
1809                 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1810                 
1811                         ProcessData.Append(";ALTID=");
1812                         ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1813                         
1814                 }
1816                 // Check if there is a value for LANGUAGE.
1817                 
1818                 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1819                 
1820                         ProcessData.Append(";LANGUAGE=");
1821                         ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1822                         
1823                 }
1824                 
1825                 // Check if there is a value for PID.
1827                 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1828                 
1829                         ProcessData.Append(";PID=");
1830                         ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1831                         
1832                 }
1834                 // Check if there is a value for PREF.
1836                 if ((*CategoryListPref)[CategoryIter->first] > 0){
1837                 
1838                         ProcessData.Append(";PREF=");
1839                         ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1840                         
1841                 }
1843                 // Check if there is a value for tokens.
1845                 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1846                 
1847                         ProcessData.Append(";");
1848                         ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1849                         
1850                 }
1851                         
1852                 ProcessData.Append(":");
1853                 ProcessData.Append(CategoryIter->second);
1854                 ProcessData.Append("\n");
1856                 ProcessData = OutputText(&ProcessData);
1857                 
1858                 SaveData->Append(ProcessData);
1859                 ProcessData.clear();
1860                         
1861         }
1862                 
1865 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID, 
1866                 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1867                 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1868                 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1869                 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1871         wxString ProcessData = "";
1872                 
1873         for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1874                 PicturesIter != PicturesList->end(); PicturesIter++){
1876                 ProcessData.Append("PHOTO");
1877                         
1878                 // Check if there is a value for TYPE.
1879                 
1880                 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1881                 
1882                         ProcessData.Append(";TYPE=");
1883                         ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1884                         
1885                 }
1886                 
1887                 // Check if there is a value for ALTID.
1888                 
1889                 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1890                 
1891                         ProcessData.Append(";ALTID=");
1892                         ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1893                         
1894                 }
1896                 // Check if there is a value for MEDIATYPE..
1897                 
1898                 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1899                 
1900                         ProcessData.Append(";MEDIATYPE=");
1901                         ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1902                         
1903                 }
1904                 
1905                 // Check if there is a value for PID.
1907                 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1908                 
1909                         ProcessData.Append(";PID=");
1910                         ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1911                         
1912                 }
1914                 // Check if there is a value for PREF.
1916                 if ((*PicturesListPref)[PicturesIter->first] > 0){
1917                 
1918                         ProcessData.Append(";PREF=");
1919                         ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1920                         
1921                 }
1923                 // Check if there is a value for tokens.
1925                 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1926                 
1927                         ProcessData.Append(";");
1928                         ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1929                         
1930                 }
1931                 
1932                 ProcessData.Append(":data:");
1933                 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1934                 ProcessData.Append(";");
1935                 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1936                 ProcessData.Append(",");
1937                 ProcessData.Append(PicturesIter->second);
1938                 ProcessData.Append("\n");
1940                 ProcessData = OutputText(&ProcessData);
1941                 
1942                 SaveData->Append(ProcessData);
1943                 ProcessData.clear();
1944                         
1945         }
1946                         
1949 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID, 
1950         map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
1951         map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
1952         map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
1953         map<int, wxString> *LogosListTokens, wxString *SaveData){
1955         wxString ProcessData = "";
1956                 
1957         for (std::map<int, string>::iterator LogosIter = LogosList->begin();
1958                 LogosIter != LogosList->end(); LogosIter++){
1960                 ProcessData.Append("LOGO");
1961                         
1962                 // Check if there is a value for TYPE.
1963                 
1964                 if ((*LogosListType)[LogosIter->first].size() > 0){
1965                 
1966                         ProcessData.Append(";TYPE=");
1967                         ProcessData.Append((*LogosListType)[LogosIter->first]);
1968                         
1969                 }
1970                 
1971                 // Check if there is a value for ALTID.
1972                 
1973                 if ((*LogosListAltID)[LogosIter->first].size() > 0){
1974                 
1975                         ProcessData.Append(";ALTID=");
1976                         ProcessData.Append((*LogosListAltID)[LogosIter->first]);
1977                         
1978                 }
1980                 // Check if there is a value for MEDIATYPE..
1981                 
1982                 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
1983                 
1984                         ProcessData.Append(";MEDIATYPE=");
1985                         ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
1986                         
1987                 }
1988                 
1989                 // Check if there is a value for PID.
1991                 if ((*LogosListPID)[LogosIter->first].size() > 0){
1992                 
1993                         ProcessData.Append(";PID=");
1994                         ProcessData.Append((*LogosListPID)[LogosIter->first]);
1995                         
1996                 }
1998                 // Check if there is a value for PREF.
2000                 if ((*LogosListPref)[LogosIter->first] > 0){
2001                 
2002                         ProcessData.Append(";PREF=");
2003                         ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
2004                         
2005                 }
2007                 // Check if there is a value for tokens.
2009                 if ((*LogosListTokens)[LogosIter->first].size() > 0){
2010                 
2011                         ProcessData.Append(";");
2012                         ProcessData.Append((*LogosListTokens)[LogosIter->first]);
2013                         
2014                 }
2015                 
2016                 ProcessData.Append(":data:");
2017                 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
2018                 ProcessData.Append(";");
2019                 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
2020                 ProcessData.Append(",");
2021                 ProcessData.Append(LogosIter->second);
2022                 ProcessData.Append("\n");
2024                 ProcessData = OutputText(&ProcessData);
2025                 
2026                 SaveData->Append(ProcessData);
2027                 ProcessData.clear();
2028                         
2029         }
2030                 
2033 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID, 
2034         map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
2035         map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
2036         map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage, 
2037         map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens, 
2038         wxString *SaveData){
2040         wxString ProcessData = "";
2041                 
2042         for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
2043                 SoundsIter != SoundsList->end(); SoundsIter++){
2045                 ProcessData.Append("SOUND");
2046                         
2047                 // Check if there is a value for TYPE.
2048                 
2049                 if ((*SoundsListType)[SoundsIter->first].size() > 0){
2050                 
2051                         ProcessData.Append(";TYPE=");
2052                         ProcessData.Append((*SoundsListType)[SoundsIter->first]);
2053                         
2054                 }
2055                 
2056                 // Check if there is a value for ALTID.
2057                 
2058                 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
2059                 
2060                         ProcessData.Append(";ALTID=");
2061                         ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
2062                         
2063                 }
2065                 // Check if there is a value for LANGUAGE.
2066                 
2067                 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
2068                 
2069                         ProcessData.Append(";LANGUAGE=");
2070                         ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
2071                         
2072                 }
2073                 
2074                 // Check if there is a value for MEDIATYPE.
2075                 
2076                 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
2077                 
2078                         ProcessData.Append(";MEDIATYPE=");
2079                         ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
2080                         
2081                 }
2082                 
2083                 // Check if there is a value for PID.
2085                 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
2086                 
2087                         ProcessData.Append(";PID=");
2088                         ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
2089                         
2090                 }
2092                 // Check if there is a value for PREF.
2094                 if ((*SoundsListPref)[SoundsIter->first] > 0){
2095                 
2096                         ProcessData.Append(";PREF=");
2097                         ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
2098                         
2099                 }
2101                 // Check if there is a value for tokens.
2103                 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
2104                 
2105                         ProcessData.Append(";");
2106                         ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
2107                         
2108                 }
2109                 
2110                 ProcessData.Append(":data:");
2111                 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
2112                 ProcessData.Append(";");
2113                 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
2114                 ProcessData.Append(",");
2115                 ProcessData.Append(SoundsIter->second);
2116                 ProcessData.Append("\n");
2118                 ProcessData = OutputText(&ProcessData);
2119                 
2120                 SaveData->Append(ProcessData);
2121                 ProcessData.clear();
2122                         
2123         }
2124                 
2127 void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<int, wxString> *CalendarListMediatype,
2128         map<int, wxString> *CalendarListAltID, map<int, wxString> *CalendarListPID,
2129         map<int, wxString> *CalendarListType, map<int, int> *CalendarListPref,
2130         map<int, wxString> *CalendarListTokens, wxString *SaveData){
2132         wxString ProcessData = "";
2133                 
2134         for (std::map<int, wxString>::iterator CalendarIter = CalendarList->begin();
2135                 CalendarIter != CalendarList->end(); CalendarIter++){
2137                 ProcessData.Append("CALURI");
2138                         
2139                 // Check if there is a value for TYPE.
2140                 
2141                 if ((*CalendarListType)[CalendarIter->first].size() > 0){
2142                 
2143                         ProcessData.Append(";TYPE=");
2144                         ProcessData.Append((*CalendarListType)[CalendarIter->first]);
2145                         
2146                 }
2147                 
2148                 // Check if there is a value for ALTID.
2149                 
2150                 if ((*CalendarListAltID)[CalendarIter->first].size() > 0){
2151                 
2152                         ProcessData.Append(";ALTID=");
2153                         ProcessData.Append((*CalendarListAltID)[CalendarIter->first]);
2154                         
2155                 }
2157                 // Check if there is a value for MEDIATYPE.
2158                 
2159                 if ((*CalendarListMediatype)[CalendarIter->first].size() > 0){
2160                 
2161                         ProcessData.Append(";MEDIATYPE=");
2162                         ProcessData.Append((*CalendarListMediatype)[CalendarIter->first]);
2163                         
2164                 }
2165                 
2166                 // Check if there is a value for PID.
2168                 if ((*CalendarListPID)[CalendarIter->first].size() > 0){
2169                 
2170                         ProcessData.Append(";PID=");
2171                         ProcessData.Append((*CalendarListPID)[CalendarIter->first]);
2172                         
2173                 }
2175                 // Check if there is a value for PREF.
2177                 if ((*CalendarListPref)[CalendarIter->first] > 0){
2178                 
2179                         ProcessData.Append(";PREF=");
2180                         ProcessData.Append(wxString::Format("%i", (*CalendarListPref)[CalendarIter->first]));
2181                         
2182                 }
2184                 // Check if there is a value for tokens.
2186                 if ((*CalendarListTokens)[CalendarIter->first].size() > 0){
2187                 
2188                         ProcessData.Append(";");
2189                         ProcessData.Append((*CalendarListTokens)[CalendarIter->first]);
2190                         
2191                 }
2192                         
2193                 ProcessData.Append(":");
2194                 ProcessData.Append(CalendarIter->second);
2195                 ProcessData.Append("\n");
2197                 ProcessData = OutputText(&ProcessData);
2198                 
2199                 SaveData->Append(ProcessData);
2200                 ProcessData.clear();
2201                         
2202         }
2203                 
2206 void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
2207         map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
2208         map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
2209         map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
2211         wxString ProcessData = "";
2212                 
2213         for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
2214                 CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
2216                 ProcessData.Append("CALADRURI");
2217                         
2218                 // Check if there is a value for TYPE.
2219                 
2220                 if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
2221                 
2222                         ProcessData.Append(";TYPE=");
2223                         ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
2224                         
2225                 }
2226                 
2227                 // Check if there is a value for ALTID.
2228                 
2229                 if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
2230                 
2231                         ProcessData.Append(";ALTID=");
2232                         ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
2233                         
2234                 }
2236                 // Check if there is a value for MEDIATYPE.
2237                 
2238                 if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
2239                 
2240                         ProcessData.Append(";MEDIATYPE=");
2241                         ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
2242                         
2243                 }
2244                 
2245                 // Check if there is a value for PID.
2247                 if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
2248                 
2249                         ProcessData.Append(";PID=");
2250                         ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
2251                         
2252                 }
2254                 // Check if there is a value for PREF.
2256                 if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
2257                 
2258                         ProcessData.Append(";PREF=");
2259                         ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
2260                         
2261                 }
2263                 // Check if there is a value for tokens.
2265                 if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
2266                 
2267                         ProcessData.Append(";");
2268                         ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
2269                         
2270                 }
2271                         
2272                 ProcessData.Append(":");
2273                 ProcessData.Append(CalendarRequestIter->second);
2274                 ProcessData.Append("\n");
2276                 ProcessData = OutputText(&ProcessData);
2277                 
2278                 SaveData->Append(ProcessData);
2279                 ProcessData.clear();
2280                         
2281         }
2282                 
2285 void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID, 
2286         std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
2287         std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref, 
2288         std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
2290         wxString ProcessData = "";
2291                 
2292         for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
2293                 FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
2295                 ProcessData.Append("FBURL");
2296                         
2297                 // Check if there is a value for TYPE.
2298                 
2299                 if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
2300                 
2301                         ProcessData.Append(";TYPE=");
2302                         ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
2303                         
2304                 }
2305                 
2306                 // Check if there is a value for ALTID.
2307                 
2308                 if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
2309                 
2310                         ProcessData.Append(";ALTID=");
2311                         ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
2312                         
2313                 }
2315                 // Check if there is a value for MEDIATYPE.
2316                 
2317                 if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
2318                 
2319                         ProcessData.Append(";MEDIATYPE=");
2320                         ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
2321                         
2322                 }
2323                 
2324                 // Check if there is a value for PID.
2326                 if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
2327                 
2328                         ProcessData.Append(";PID=");
2329                         ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
2330                         
2331                 }
2333                 // Check if there is a value for PREF.
2335                 if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
2336                 
2337                         ProcessData.Append(";PREF=");
2338                         ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
2339                         
2340                 }
2342                 // Check if there is a value for tokens.
2344                 if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
2345                 
2346                         ProcessData.Append(";");
2347                         ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
2348                         
2349                 }
2350                         
2351                 ProcessData.Append(":");
2352                 ProcessData.Append(FreeBusyIter->second);
2353                 ProcessData.Append("\n");
2355                 ProcessData = OutputText(&ProcessData);
2356                 
2357                 SaveData->Append(ProcessData);
2358                 ProcessData.clear();
2359                         
2360         }
2361                 
2364 void ContactDataObject::SaveKey(map<int, wxString> *KeyList, map<int, wxString> *KeyListAltID, 
2365         map<int, wxString> *KeyListPID, map<int, wxString> *KeyListType,
2366         map<int, bool> *KeyListKeyType, map<int, wxString> *KeyListDataEncType, 
2367         map<int, wxString> *KeyListDataType, map<int, int> *KeyListPref, 
2368         map<int, wxString> *KeyListTokens, wxString *SaveData){
2370         wxString ProcessData = "";
2371                 
2372         for (std::map<int, wxString>::iterator KeyIter = KeyList->begin();
2373                 KeyIter != KeyList->end(); KeyIter++){
2375                 ProcessData.Append("KEY");
2376                         
2377                 // Check if there is a value for TYPE.
2378                 
2379                 if ((*KeyListType)[KeyIter->first].size() > 0){
2380                 
2381                         ProcessData.Append(";TYPE=");
2382                         ProcessData.Append((*KeyListType)[KeyIter->first]);
2383                         
2384                 }
2385                 
2386                 // Check if there is a value for ALTID.
2387                 
2388                 if ((*KeyListAltID)[KeyIter->first].size() > 0){
2389                 
2390                         ProcessData.Append(";ALTID=");
2391                         ProcessData.Append((*KeyListAltID)[KeyIter->first]);
2392                         
2393                 }
2394                 
2395                 // Check if there is a value for PID.
2397                 if ((*KeyListPID)[KeyIter->first].size() > 0){
2398                 
2399                         ProcessData.Append(";PID=");
2400                         ProcessData.Append((*KeyListPID)[KeyIter->first]);
2401                         
2402                 }
2404                 // Check if there is a value for PREF.
2406                 if ((*KeyListPref)[KeyIter->first] > 0){
2407                 
2408                         ProcessData.Append(";PREF=");
2409                         ProcessData.Append(wxString::Format("%i", (*KeyListPref)[KeyIter->first]));
2410                         
2411                 }
2413                 // Check if there is a value for tokens.
2415                 if ((*KeyListTokens)[KeyIter->first].size() > 0){
2416                 
2417                         ProcessData.Append(";");
2418                         ProcessData.Append((*KeyListTokens)[KeyIter->first]);
2419                         
2420                 }
2421                         
2422                 ProcessData.Append(":data:");
2423                 ProcessData.Append((*KeyListDataType)[KeyIter->first]);
2424                 ProcessData.Append(";");
2425                 ProcessData.Append((*KeyListDataEncType)[KeyIter->first]);
2426                 ProcessData.Append(",");
2427                 ProcessData.Append(KeyIter->second);
2428                 ProcessData.Append("\n");
2430                 ProcessData = OutputText(&ProcessData);
2431                 
2432                 SaveData->Append(ProcessData);
2433                 ProcessData.clear();
2434                         
2435         }
2436                 
2439 void ContactDataObject::SaveVendor(map<int, wxString> *VendorList, map<int, wxString> *VendorListPEN, 
2440         map<int, wxString> *VendorListElement, wxString *SaveData){
2442         wxString ProcessData = "";
2443                 
2444         for (std::map<int, wxString>::iterator VendorIter = VendorList->begin();
2445                 VendorIter != VendorList->end(); VendorIter++){
2447                 ProcessData.Append("VND-");
2448                 ProcessData.Append((*VendorListPEN)[VendorIter->first]);
2449                 ProcessData.Append("-");
2450                 ProcessData.Append((*VendorListElement)[VendorIter->first]);
2451                 ProcessData.Append(":");
2452                 ProcessData.Append(VendorIter->second);
2453                 ProcessData.Append("\n");
2455                 ProcessData = OutputText(&ProcessData);
2456                 
2457                 SaveData->Append(ProcessData);
2458                 ProcessData.clear();
2459                         
2460         }
2461                 
2464 void ContactDataObject::SaveXToken(map<int, wxString> *XTokenList, map<int, wxString> *XTokenListTokens, 
2465         wxString *SaveData){
2467         wxString ProcessData = "";
2468                 
2469         for (std::map<int, wxString>::iterator XTokenIter = XTokenList->begin();
2470                 XTokenIter != XTokenList->end(); XTokenIter++){
2472                 ProcessData.Append("X-");
2473                 ProcessData.Append((*XTokenListTokens)[XTokenIter->first]);
2474                 ProcessData.Append(":");
2475                 ProcessData.Append(XTokenIter->second);
2476                 ProcessData.Append("\n");
2478                 ProcessData = OutputText(&ProcessData);
2479                 
2480                 SaveData->Append(ProcessData);
2481                 ProcessData.clear();
2482                         
2483         }       
2484                 
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