Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added SOUND to the SaveString function of ContactDataObject
[xestiaab/.git] / source / contacteditor / cdo / ContactDataObject-Save.cpp
1 // ContactDataObject-Save.cpp - Client Data Object.
2 //
3 // (c) 2012-2016 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
10 //
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "ContactDataObject.h"
20 #include "../../version.h"
22 ContactSaveStatus ContactDataObject::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         // TODO: Sortout REV.
83         
84         // Process XML.
86         for (std::map<int, wxString>::iterator XMLIter = XMLList.begin();
87                 XMLIter != XMLList.end(); XMLIter++){
88         
89                 ProcessData.Append("XML");
90                         
91                 if (XMLListAltID[XMLIter->first].size() > 0){
92                 
93                         ProcessData.Append(";ALTID=");
94                         ProcessData.Append(XMLListAltID[XMLIter->first]);
95                         
96                 }
97                         
98                 ProcessData.Append(":");
99                 ProcessData.Append(XMLIter->second);
100                 ProcessData.Append("\n");
101                 
102                 ProcessData = OutputText(&ProcessData);
103                 
104                 SaveData->Append(ProcessData);
105                 ProcessData.clear();
106                         
107         }
108         
109         // Process SOURCE.
110         
111         SaveSource(&SourceList, &SourceListAltID, 
112                 &SourceListPID, &SourceListType,
113                 &SourceListMediatype, &SourceListPref, 
114                 &SourceListTokens, SaveData);
115         
116         // Process CLIENTPIDMAP.
117         
118         for (std::map<int, wxString>::iterator CPIDIter = ClientPIDList.begin();
119                 CPIDIter != ClientPIDList.end(); CPIDIter++){
120         
121                 ProcessData.Append("CLIENTPIDMAP");
122                         
123                 if (ClientPIDListTokens[CPIDIter->first].size() > 0){
124                 
125                         ProcessData.Append(";");
126                         ProcessData.Append(ClientPIDListTokens[CPIDIter->first]);
127                         
128                 }
129                         
130                 ProcessData.Append(":");
131                 ProcessData.Append(CPIDIter->second);
132                 ProcessData.Append("\n");
133                 
134                 ProcessData = OutputText(&ProcessData);
135                 
136                 SaveData->Append(ProcessData);
137                 ProcessData.clear();
138                         
139         }
140         
141         // Process FN.
142         
143         for (std::map<int, wxString>::iterator FNIter = FullNamesList.begin();
144                 FNIter != FullNamesList.end(); FNIter++){
145                 
146                 ProcessData.Append("FN");
148                 // Check if there is a value for TYPE.
149                 
150                 if (FullNamesListType[FNIter->first].size() > 0){
151                 
152                         ProcessData.Append(";TYPE=");
153                         ProcessData.Append(FullNamesListType[FNIter->first]);
154                         
155                 }
157                 // Check if there is a value for LANGUAGE.
158                 
159                 if (FullNamesListLanguage[FNIter->first].size() > 0){
160                 
161                         ProcessData.Append(";LANGUAGE=");
162                         ProcessData.Append(FullNamesListLanguage[FNIter->first]);
163                         
164                 }
165                 
166                 // Check if there is a value for ALTID.
167                 
168                 if (FullNamesListAltID[FNIter->first].size() > 0){
169                 
170                         ProcessData.Append(";ALTID=");
171                         ProcessData.Append(FullNamesListAltID[FNIter->first]);
172                         
173                 }
174                 
175                 // Check if there is a value for PID.
177                 if (FullNamesListPID[FNIter->first].size() > 0){
178                 
179                         ProcessData.Append(";PID=");
180                         ProcessData.Append(FullNamesListPID[FNIter->first]);
181                         
182                 }
184                 // Check if there is a value for PREF.
186                 if (FullNamesListPref[FNIter->first] > 0){
187                 
188                         ProcessData.Append(";PREF=");
189                         ProcessData.Append(wxString::Format("%i", FullNamesListPref[FNIter->first]));
190                         
191                 }
193                 // Check if there is a value for tokens.
195                 if (FullNamesListTokens[FNIter->first].size() > 0){
196                 
197                         ProcessData.Append(";");
198                         ProcessData.Append(FullNamesListTokens[FNIter->first]);
199                         
200                 }
201                 
202                 ProcessData.Append(":");
203                 ProcessData.Append(FNIter->second);
204                 ProcessData.Append("\n");
205                 
206                 ProcessData = OutputText(&ProcessData);
207                 
208                 SaveData->Append(ProcessData);
209                 ProcessData.clear();
210                         
211         }
212         
213         // Process NICKNAME.
214         
215         SaveNickname(&GeneralNicknamesList, &GeneralNicknamesListAltID, 
216                 &GeneralNicknamesListPID, &GeneralNicknamesListType,
217                 &GeneralNicknamesListLanguage, &GeneralNicknamesListPref, 
218                 &GeneralNicknamesListTokens, SaveData, "");
219         SaveNickname(&HomeNicknamesList, &HomeNicknamesListAltID, 
220                 &HomeNicknamesListPID, &HomeNicknamesListType,
221                 &HomeNicknamesListLanguage, &HomeNicknamesListPref, 
222                 &HomeNicknamesListTokens, SaveData, "home");
223         SaveNickname(&BusinessNicknamesList, &BusinessNicknamesListAltID, 
224                 &BusinessNicknamesListPID, &BusinessNicknamesListType,
225                 &BusinessNicknamesListLanguage, &BusinessNicknamesListPref, 
226                 &BusinessNicknamesListTokens, SaveData, "work");
227         
228         // Process TITLE.
230         SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
231                 &GeneralTitleListAltID, &GeneralTitleListPID,
232                 &GeneralTitleListType, &GeneralTitleListPref,
233                 &GeneralTitleListTokens, SaveData, "");
234         SaveTitle(&HomeTitleList, &HomeTitleListLanguage,
235                 &HomeTitleListAltID, &HomeTitleListPID,
236                 &HomeTitleListType, &HomeTitleListPref,
237                 &HomeTitleListTokens, SaveData, "home");
238         SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage,
239                 &BusinessTitleListAltID, &BusinessTitleListPID,
240                 &BusinessTitleListType, &BusinessTitleListPref,
241                 &BusinessTitleListTokens, SaveData, "work");
242         
243         // Process TZ.
244         
245         SaveTimezone(&GeneralTZList, &GeneralTZListAltID, 
246                 &GeneralTZListPID, &GeneralTZListType,
247                 &GeneralTZListMediatype, &GeneralTZListPref, 
248                 &GeneralTZListTokens, SaveData, "");
249         SaveTimezone(&HomeTZList, &HomeTZListAltID, 
250                 &HomeTZListPID, &HomeTZListType,
251                 &HomeTZListMediatype, &HomeTZListPref, 
252                 &HomeTZListTokens, SaveData, "home");
253         SaveTimezone(&BusinessTZList, &BusinessTZListAltID, 
254                 &BusinessTZListPID, &BusinessTZListType,
255                 &BusinessTZListMediatype, &BusinessTZListPref, 
256                 &BusinessTZListTokens, SaveData, "work");
258         // Process ADR.
259         
260         SaveAddress(&GeneralAddressList, &GeneralAddressListTown,
261                 &GeneralAddressListCounty, &GeneralAddressListPostCode,
262                 &GeneralAddressListCountry, &GeneralAddressListLabel,
263                 &GeneralAddressListLang, &GeneralAddressListAltID,
264                 &GeneralAddressListPID, &GeneralAddressListGeo, 
265                 &GeneralAddressListTimezone, &GeneralAddressListType, 
266                 &GeneralAddressListMediatype, &GeneralAddressListPref,
267                 &GeneralAddressListTokens, SaveData, "");
268         SaveAddress(&HomeAddressList, &HomeAddressListTown,
269                 &HomeAddressListCounty, &HomeAddressListPostCode,
270                 &HomeAddressListCountry, &HomeAddressListLabel,
271                 &HomeAddressListLang, &HomeAddressListAltID,
272                 &HomeAddressListPID, &HomeAddressListGeo, 
273                 &HomeAddressListTimezone, &HomeAddressListType, 
274                 &HomeAddressListMediatype, &HomeAddressListPref,
275                 &HomeAddressListTokens, SaveData, "home");
276         SaveAddress(&BusinessAddressList, &BusinessAddressListTown,
277                 &BusinessAddressListCounty, &BusinessAddressListPostCode,
278                 &BusinessAddressListCountry, &BusinessAddressListLabel,
279                 &BusinessAddressListLang, &BusinessAddressListAltID,
280                 &BusinessAddressListPID, &BusinessAddressListGeo, 
281                 &BusinessAddressListTimezone, &BusinessAddressListType, 
282                 &BusinessAddressListMediatype, &BusinessAddressListPref,
283                 &BusinessAddressListTokens, SaveData, "work");
285         // Process EMAIL.
286         
287         SaveEmail(&GeneralEmailList, &GeneralEmailListAltID, 
288                 &GeneralEmailListPID, &GeneralEmailListType,
289                 &GeneralEmailListPref, &GeneralEmailListTokens, 
290                 SaveData, "");
291         SaveEmail(&HomeEmailList, &HomeEmailListAltID, 
292                 &HomeEmailListPID, &HomeEmailListType,
293                 &HomeEmailListPref, &HomeEmailListTokens, 
294                 SaveData, "home");
295         SaveEmail(&BusinessEmailList, &BusinessEmailListAltID, 
296                 &BusinessEmailListPID, &BusinessEmailListType,
297                 &BusinessEmailListPref, &BusinessEmailListTokens, 
298                 SaveData, "work");
300         // TODO: Process IMPP.
301         
302         // TODO: Process TEL.
303         
304         // Process LANG.
305         
306         SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID, 
307                 &GeneralLanguageListPID, &GeneralLanguageListType,
308                 &GeneralLanguageListPref, &GeneralLanguageListTokens, 
309                 SaveData, "");
310         SaveLanguage(&HomeLanguageList, &HomeLanguageListAltID, 
311                 &HomeLanguageListPID, &HomeLanguageListType,
312                 &HomeLanguageListPref, &HomeLanguageListTokens, 
313                 SaveData, "home");
314         SaveLanguage(&BusinessLanguageList, &BusinessLanguageListAltID, 
315                 &BusinessLanguageListPID, &BusinessLanguageListType,
316                 &BusinessLanguageListPref, &BusinessLanguageListTokens, 
317                 SaveData, "work");
319         // Process GEO.
320         
321         SaveGeoposition(&GeneralGeographyList, &GeneralGeographyListAltID, 
322                 &GeneralGeographyListPID, &GeneralGeographyListType,
323                 &GeneralGeographyListMediatype, &GeneralGeographyListDataType,
324                 &GeneralGeographyListPref, &GeneralGeographyListTokens, 
325                 SaveData, "");
326         SaveGeoposition(&HomeGeographyList, &HomeGeographyListAltID, 
327                 &HomeGeographyListPID, &HomeGeographyListType,
328                 &HomeGeographyListMediatype, &HomeGeographyListDataType,
329                 &HomeGeographyListPref, &HomeGeographyListTokens, 
330                 SaveData, "home");
331         SaveGeoposition(&BusinessGeographyList, &BusinessGeographyListAltID, 
332                 &BusinessGeographyListPID, &BusinessGeographyListType,
333                 &BusinessGeographyListMediatype, &BusinessGeographyListDataType,
334                 &BusinessGeographyListPref, &BusinessGeographyListTokens, 
335                 SaveData, "work");
337         // Process RELATED.
338         
339         int Moo = 0;
341         for (std::map<int, wxString>::iterator RelatedIter = GeneralRelatedList.begin();
342                 RelatedIter != GeneralRelatedList.end(); RelatedIter++){
343                 
344                 ProcessData.Append("RELATED");
346                 // Check if there is a value for TYPE.
347                 
348                 if (GeneralRelatedListRelType[RelatedIter->first].size() > 0){
349                 
350                         wxString RelatedType = "";
351                         
352                         ProcessData.Append(";TYPE=");
353                         
354                         if (GeneralRelatedListRelType[RelatedIter->first] == _("Contact")){
356                                 RelatedType = wxT("contact");
358                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Acquaintance")){
360                                 RelatedType = wxT("acquaintance");
362                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Friend")){
364                                 RelatedType = wxT("friend");
366                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Met")){
368                                 RelatedType = wxT("met");
370                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-worker")){
372                                 RelatedType = wxT("co-worker");
374                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Colleague")){
376                                 RelatedType = wxT("colleague");
378                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Co-resident")){
380                                 RelatedType = wxT("co-resident");
382                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Neighbour")){
384                                 RelatedType = wxT("neighbor");
386                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Child")){
388                                 RelatedType = wxT("child");
390                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Parent")){
392                                 RelatedType = wxT("parent");
394                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Sibling")){
396                                 RelatedType = wxT("sibling");
398                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Spouse")){
400                                 RelatedType = wxT("spouse");
402                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Kin")){
404                                 RelatedType = wxT("kin");
406                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Muse")){
408                                 RelatedType = wxT("muse");
410                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Crush")){
412                                 RelatedType = wxT("crush");
414                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Date")){
416                                 RelatedType = wxT("date");
418                         } else if (GeneralRelatedListRelType[RelatedIter->first]== _("Sweetheart")){
420                                 RelatedType = wxT("sweetheart");
422                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Me")){
424                                 RelatedType = wxT("me");
426                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Agent")){
428                                 RelatedType = wxT("agent");
430                         } else if (GeneralRelatedListRelType[RelatedIter->first] == _("Emergency")){
432                                 RelatedType = wxT("emergency");
434                         } else {
436                                 RelatedType = GeneralRelatedListRelType[RelatedIter->first];
438                         }
439                         
440                         ProcessData.Append(RelatedType);
441                         
442                 }
444                 // Check if there is a value for LANGUAGE.
445                 
446                 if (GeneralRelatedListLanguage[RelatedIter->first].size() > 0){
447                 
448                         ProcessData.Append(";LANGUAGE=");
449                         ProcessData.Append(GeneralRelatedListLanguage[RelatedIter->first]);
450                         
451                 }
452                 
453                 // Check if there is a value for ALTID.
454                 
455                 if (GeneralRelatedListAltID[RelatedIter->first].size() > 0){
456                 
457                         ProcessData.Append(";ALTID=");
458                         ProcessData.Append(GeneralRelatedListAltID[RelatedIter->first]);
459                         
460                 }
461                 
462                 // Check if there is a value for PID.
464                 if (GeneralRelatedListPID[RelatedIter->first].size() > 0){
465                 
466                         ProcessData.Append(";PID=");
467                         ProcessData.Append(GeneralRelatedListPID[RelatedIter->first]);
468                         
469                 }
471                 // Check if there is a value for PREF.
473                 if (GeneralRelatedListPref[RelatedIter->first] > 0){
474                 
475                         ProcessData.Append(";PREF=");
476                         ProcessData.Append(wxString::Format("%i", GeneralRelatedListPref[RelatedIter->first]));
477                         
478                 }
480                 // Check if there is a value for tokens.
482                 if (GeneralRelatedListTokens[RelatedIter->first].size() > 0){
483                 
484                         ProcessData.Append(";");
485                         ProcessData.Append(GeneralRelatedListTokens[RelatedIter->first]);
486                         
487                 }
488                 
489                 ProcessData.Append(":");
490                 ProcessData.Append(RelatedIter->second);
491                 ProcessData.Append("\n");
492                 
493                 ProcessData = OutputText(&ProcessData);
494                 
495                 SaveData->Append(ProcessData);
496                 ProcessData.clear();
497                         
498         }
499         
500         // Process URL.
501         
502         SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID, 
503                 &GeneralWebsiteListPID, &GeneralWebsiteListType,
504                 &GeneralWebsiteListMediatype, &GeneralWebsiteListPref, 
505                 &GeneralWebsiteListTokens, SaveData, "");
506         SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID, 
507                 &HomeWebsiteListPID, &HomeWebsiteListType,
508                 &HomeWebsiteListMediatype, &HomeWebsiteListPref, 
509                 &HomeWebsiteListTokens, SaveData, "home");
510         SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID, 
511                 &BusinessWebsiteListPID, &BusinessWebsiteListType,
512                 &BusinessWebsiteListMediatype, &BusinessWebsiteListPref, 
513                 &BusinessWebsiteListTokens, SaveData, "work");
515         // Process ROLE.
516         
517         SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
518                 &GeneralRoleListAltID, &GeneralRoleListPID,
519                 &GeneralRoleListType, &GeneralRoleListPref,
520                 &GeneralRoleListTokens, SaveData, "");
521         SaveRole(&HomeRoleList, &HomeRoleListLanguage,
522                 &HomeRoleListAltID, &HomeRoleListPID,
523                 &HomeRoleListType, &HomeRoleListPref,
524                 &HomeRoleListTokens, SaveData, "home");
525         SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
526                 &BusinessRoleListAltID, &BusinessRoleListPID,
527                 &BusinessRoleListType, &BusinessRoleListPref,
528                 &BusinessRoleListTokens, SaveData, "work");
530         // Process ORG.
531         
532         SaveOrganisation(&GeneralOrganisationsList, &GeneralOrganisationsListAltID,
533                 &GeneralOrganisationsListPID, &GeneralOrganisationsListLanguage, 
534                 &GeneralOrganisationsListSortAs, &GeneralOrganisationsListType, 
535                 &GeneralOrganisationsListPref, &GeneralOrganisationsListTokens, 
536                 SaveData, "");
537         SaveOrganisation(&HomeOrganisationsList, &HomeOrganisationsListAltID,
538                 &HomeOrganisationsListPID, &HomeOrganisationsListLanguage, 
539                 &HomeOrganisationsListSortAs, &HomeOrganisationsListType, 
540                 &HomeOrganisationsListPref, &HomeOrganisationsListTokens, 
541                 SaveData, "home");
542         SaveOrganisation(&BusinessOrganisationsList, &BusinessOrganisationsListAltID,
543                 &BusinessOrganisationsListPID, &BusinessOrganisationsListLanguage, 
544                 &BusinessOrganisationsListSortAs, &BusinessOrganisationsListType, 
545                 &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens, 
546                 SaveData, "work");
548         // Process NOTE.
549         
550         SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
551                 &GeneralNoteListAltID, &GeneralNoteListPID,
552                 &GeneralNoteListType, &GeneralNoteListPref,
553                 &GeneralNoteListTokens, SaveData, "");
554         SaveNote(&HomeNoteList, &HomeNoteListLanguage,
555                 &HomeNoteListAltID, &HomeNoteListPID,
556                 &HomeNoteListType, &HomeNoteListPref,
557                 &HomeNoteListTokens, SaveData, "home");
558         SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
559                 &BusinessNoteListAltID, &BusinessNoteListPID,
560                 &BusinessNoteListType, &BusinessNoteListPref,
561                 &BusinessNoteListTokens, SaveData, "work");
563         // Process CATEGORIES.
564         
565         SaveCategory(&CategoriesList, &CategoriesListLanguage,
566                 &CategoriesListAltID, &CategoriesListPID,
567                 &CategoriesListType, &CategoriesListPref,
568                 &CategoriesListTokens, SaveData);
570         // Process PHOTO.
571         
572         SavePhoto(&PicturesList, &PicturesListAltID, 
573                 &PicturesListPID, &PicturesListType,
574                 &PicturesListPicEncType, &PicturesListPictureType,
575                 &PicturesListMediatype, &PicturesListPref,
576                 &PicturesListTokens, SaveData);
577         
578         // Process LOGO.
579         
580         SaveLogo(&LogosList, &LogosListAltID, 
581                 &LogosListPID, &LogosListType,
582                 &LogosListPicEncType, &LogosListPictureType,
583                 &LogosListMediatype, &LogosListPref,
584                 &LogosListTokens, SaveData);
585         
586         // Process SOUND.
588         SaveSound(&SoundsList, &SoundsListAltID, 
589                 &SoundsListPID, &SoundsListType,
590                 &SoundsListAudioEncType, &SoundsListAudioType,
591                 &SoundsListMediatype, &SoundsListLanguage, 
592                 &SoundsListPref, &SoundsListTokens, 
593                 SaveData);
595         // Write the end part of the vCard data file.
596         
597         SaveData->Append("END:VCARD");
598         
599         SaveDataStatus = CONTACTSAVE_OK;
600         
601         return SaveDataStatus;
602         
605 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
606         map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
607         map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
608         map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
610         wxString ProcessData = "";
611                 
612         for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
613                 TitleIter != TitleList->end(); TitleIter++){
615                 ProcessData.Append("TITLE");
616                         
617                 // Check if there is a value for TYPE.
618                 
619                 if (DataType.size() > 0){
620                 
621                         ProcessData.Append(";TYPE=");
622                         ProcessData.Append(DataType);
623                         
624                 }
625                 
626                 // Check if there is a value for ALTID.
627                 
628                 if ((*TitleListAltID)[TitleIter->first].size() > 0){
629                 
630                         ProcessData.Append(";ALTID=");
631                         ProcessData.Append((*TitleListAltID)[TitleIter->first]);
632                         
633                 }
635                 // Check if there is a value for LANGUAGE.
636                 
637                 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
638                 
639                         ProcessData.Append(";LANGUAGE=");
640                         ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
641                         
642                 }
643                 
644                 // Check if there is a value for PID.
646                 if ((*TitleListPID)[TitleIter->first].size() > 0){
647                 
648                         ProcessData.Append(";PID=");
649                         ProcessData.Append((*TitleListPID)[TitleIter->first]);
650                         
651                 }
653                 // Check if there is a value for PREF.
655                 if ((*TitleListPref)[TitleIter->first] > 0){
656                 
657                         ProcessData.Append(";PREF=");
658                         ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
659                         
660                 }
662                 // Check if there is a value for tokens.
664                 if ((*TitleListTokens)[TitleIter->first].size() > 0){
665                 
666                         ProcessData.Append(";");
667                         ProcessData.Append((*TitleListTokens)[TitleIter->first]);
668                         
669                 }
670                         
671                 ProcessData.Append(":");
672                 ProcessData.Append(TitleIter->second);
673                 ProcessData.Append("\n");
675                 ProcessData = OutputText(&ProcessData);
676                         
677                 SaveData->Append(ProcessData);
678                 ProcessData.clear();
679                         
680         }
681                 
684 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID, 
685         map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
686         map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref, 
687         map<int, wxString> *SourceListTokens, wxString *SaveData){
689         wxString ProcessData = "";
690         
691         for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
692                 SourceIter != SourceList->end(); SourceIter++){
694                 ProcessData.Append("SOURCE");
695                         
696                 // Check if there is a value for TYPE.
697                 
698                 if ((*SourceListType)[SourceIter->first].size() > 0){
699                 
700                         ProcessData.Append(";TYPE=");
701                         ProcessData.Append((*SourceListType)[SourceIter->first]);
702                         
703                 }
704                 
705                 // Check if there is a value for ALTID.
706                 
707                 if ((*SourceListAltID)[SourceIter->first].size() > 0){
708                 
709                         ProcessData.Append(";ALTID=");
710                         ProcessData.Append((*SourceListAltID)[SourceIter->first]);
711                         
712                 }
714                 // Check if there is a value for MEDIATYPE.
715                 
716                 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
717                 
718                         ProcessData.Append(";MEDIATYPE=");
719                         ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
720                         
721                 }
722                 
723                 // Check if there is a value for PID.
725                 if ((*SourceListPID)[SourceIter->first].size() > 0){
726                 
727                         ProcessData.Append(";PID=");
728                         ProcessData.Append((*SourceListPID)[SourceIter->first]);
729                         
730                 }
732                 // Check if there is a value for PREF.
734                 if ((*SourceListPref)[SourceIter->first] > 0){
735                 
736                         ProcessData.Append(";PREF=");
737                         ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
738                         
739                 }
741                 // Check if there is a value for tokens.
743                 if ((*SourceListTokens)[SourceIter->first].size() > 0){
744                 
745                         ProcessData.Append(";");
746                         ProcessData.Append((*SourceListTokens)[SourceIter->first]);
747                         
748                 }
749                         
750                 ProcessData.Append(":");
751                 ProcessData.Append(SourceIter->second);
752                 ProcessData.Append("\n");
754                 ProcessData = OutputText(&ProcessData);
755                         
756                 SaveData->Append(ProcessData);
757                 ProcessData.clear();
758                         
759         }
760                 
763 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID, 
764         map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
765         map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref, 
766         map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
768         wxString ProcessData = "";
769         
770         for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
771                 NicknameIter != NicknameList->end(); NicknameIter++){
773                 ProcessData.Append("NICKNAME");
774                         
775                 // Check if there is a value for TYPE.
776                 
777                 if (DataType.size() > 0){
778                 
779                         ProcessData.Append(";TYPE=");
780                         ProcessData.Append(DataType);
781                         
782                 }
783                 
784                 // Check if there is a value for ALTID.
785                 
786                 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
787                 
788                         ProcessData.Append(";ALTID=");
789                         ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
790                         
791                 }
793                 // Check if there is a value for MEDIATYPE.
794                 
795                 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
796                 
797                         ProcessData.Append(";LANGUAGE=");
798                         ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
799                         
800                 }
801                 
802                 // Check if there is a value for PID.
804                 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
805                 
806                         ProcessData.Append(";PID=");
807                         ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
808                         
809                 }
811                 // Check if there is a value for PREF.
813                 if ((*NicknameListPref)[NicknameIter->first] > 0){
814                 
815                         ProcessData.Append(";PREF=");
816                         ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
817                         
818                 }
820                 // Check if there is a value for tokens.
822                 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
823                 
824                         ProcessData.Append(";");
825                         ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
826                         
827                 }
828                         
829                 ProcessData.Append(":");
830                 ProcessData.Append(NicknameIter->second);
831                 ProcessData.Append("\n");
833                 ProcessData = OutputText(&ProcessData);
834                         
835                 SaveData->Append(ProcessData);
836                 ProcessData.clear();
837                         
838         }
839                 
842 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID, 
843         map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
844         map<int, wxString> *TZListMediatype, map<int, int> *TZListPref, 
845         map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
847         wxString ProcessData = "";
848         
849         for (std::map<int, wxString>::iterator TZIter = TZList->begin();
850                 TZIter != TZList->end(); TZIter++){
852                 ProcessData.Append("TZ");
853                         
854                 // Check if there is a value for TYPE.
855                 
856                 if (DataType.size() > 0){
857                 
858                         ProcessData.Append(";TYPE=");
859                         ProcessData.Append(DataType);
860                         
861                 }
862                 
863                 // Check if there is a value for ALTID.
864                 
865                 if ((*TZListAltID)[TZIter->first].size() > 0){
866                 
867                         ProcessData.Append(";ALTID=");
868                         ProcessData.Append((*TZListAltID)[TZIter->first]);
869                         
870                 }
872                 // Check if there is a value for MEDIATYPE.
873                 
874                 if ((*TZListMediatype)[TZIter->first].size() > 0){
875                 
876                         ProcessData.Append(";MEDIATYPE=");
877                         ProcessData.Append((*TZListMediatype)[TZIter->first]);
878                         
879                 }
880                 
881                 // Check if there is a value for PID.
883                 if ((*TZListPID)[TZIter->first].size() > 0){
884                 
885                         ProcessData.Append(";PID=");
886                         ProcessData.Append((*TZListPID)[TZIter->first]);
887                         
888                 }
890                 // Check if there is a value for PREF.
892                 if ((*TZListPref)[TZIter->first] > 0){
893                 
894                         ProcessData.Append(";PREF=");
895                         ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
896                         
897                 }
899                 // Check if there is a value for tokens.
901                 if ((*TZListTokens)[TZIter->first].size() > 0){
902                 
903                         ProcessData.Append(";");
904                         ProcessData.Append((*TZListTokens)[TZIter->first]);
905                         
906                 }
907                         
908                 ProcessData.Append(":");
909                 ProcessData.Append(TZIter->second);
910                 ProcessData.Append("\n");
912                 ProcessData = OutputText(&ProcessData);
913                         
914                 SaveData->Append(ProcessData);
915                 ProcessData.clear();
916                         
917         }
918                 
921 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
922                 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
923                 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
924                 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
925                 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo, 
926                 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType, 
927                 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref, 
928                 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
930         wxString ProcessData = "";
931                         
932         for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
933                 AddressIter != AddressList->end(); AddressIter++){
934                         
935                 ProcessData.Append("ADR");
936                         
937                 // Check if there is a value for TYPE.
938                 
939                 if (DataType.size() > 0){
940                 
941                         ProcessData.Append(";TYPE=");
942                         ProcessData.Append(DataType);
943                         
944                 }
945                 
946                 // Check if there is a value for ALTID.
947                 
948                 if ((*AddressListAltID)[AddressIter->first].size() > 0){
949                 
950                         ProcessData.Append(";ALTID=");
951                         ProcessData.Append((*AddressListAltID)[AddressIter->first]);
952                         
953                 }
955                 // Check if there is a value for GEO.
956                 
957                 if ((*AddressListGeo)[AddressIter->first].size() > 0){
958                 
959                         ProcessData.Append(";GEO=\"");
960                         ProcessData.Append((*AddressListGeo)[AddressIter->first]);
961                         ProcessData.Append("\"");
962                         
963                 }
965                 // Check if there is a value for LABEL.
967                 if ((*AddressListLabel)[AddressIter->first].size() > 0){
968                 
969                         wxString AddressProcessed = "";
970                         AddressProcessed = (*AddressListLabel)[AddressIter->first];
971                         
972                         AddressProcessed.Replace("\n", "\\n", true);
973                         
974                         ProcessData.Append(";LABEL=");
975                         ProcessData.Append(AddressProcessed);
976                         
977                 }
978                 
979                 // Check if there is a value for LANGUAGE.
980                 
981                 if ((*AddressListLang)[AddressIter->first].size() > 0){
982                 
983                         ProcessData.Append(";LANGUAGE=");
984                         ProcessData.Append((*AddressListLang)[AddressIter->first]);
985                         
986                 }
987                 
988                 // Check if there is a value for MEDIATYPE.
989                 
990                 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
991                 
992                         ProcessData.Append(";MEDIATYPE=");
993                         ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
994                         
995                 }
996                 
997                 // Check if there is a value for PID.
999                 if ((*AddressListPID)[AddressIter->first].size() > 0){
1000                 
1001                         ProcessData.Append(";PID=");
1002                         ProcessData.Append((*AddressListPID)[AddressIter->first]);
1003                         
1004                 }
1006                 // Check if there is a value for PREF.
1008                 if ((*AddressListPref)[AddressIter->first] > 0){
1009                 
1010                         ProcessData.Append(";PREF=");
1011                         ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1012                         
1013                 }
1015                 // Check if there is a value for TZ.
1017                 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1018                 
1019                         ProcessData.Append(";TZ=");
1020                         ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1021                         
1022                 }
1023                 
1024                 // Check if there is a value for tokens.
1026                 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1027                 
1028                         ProcessData.Append(";");
1029                         ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1030                         
1031                 }
1032                 
1033                 // Build the address.
1034                 
1035                 ProcessData.Append(":;;");
1036                 ProcessData.Append((*AddressList)[AddressIter->first]);
1037                 ProcessData.Append(";");
1038                 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1039                 ProcessData.Append(";");
1040                 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1041                 ProcessData.Append(";");
1042                 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1043                 ProcessData.Append(";");
1044                 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1045                 ProcessData.Append("\n");
1046                 
1047                 ProcessData = OutputText(&ProcessData);
1048                         
1049                 SaveData->Append(ProcessData);
1050                 ProcessData.clear();
1051                         
1052         }
1053                         
1056 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID, 
1057         map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1058         map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens, 
1059         wxString *SaveData, wxString DataType){
1061         wxString ProcessData = "";
1062         
1063         for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1064                 EmailIter != EmailList->end(); EmailIter++){
1066                 ProcessData.Append("EMAIL");
1067                         
1068                 // Check if there is a value for TYPE.
1069                 
1070                 if (DataType.size() > 0){
1071                 
1072                         ProcessData.Append(";TYPE=");
1073                         ProcessData.Append(DataType);
1074                         
1075                 }
1076                 
1077                 // Check if there is a value for ALTID.
1078                 
1079                 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1080                 
1081                         ProcessData.Append(";ALTID=");
1082                         ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1083                         
1084                 }
1085                 
1086                 // Check if there is a value for PID.
1088                 if ((*EmailListPID)[EmailIter->first].size() > 0){
1089                 
1090                         ProcessData.Append(";PID=");
1091                         ProcessData.Append((*EmailListPID)[EmailIter->first]);
1092                         
1093                 }
1095                 // Check if there is a value for PREF.
1097                 if ((*EmailListPref)[EmailIter->first] > 0){
1098                 
1099                         ProcessData.Append(";PREF=");
1100                         ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1101                         
1102                 }
1104                 // Check if there is a value for tokens.
1106                 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1107                 
1108                         ProcessData.Append(";");
1109                         ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1110                         
1111                 }
1112                         
1113                 ProcessData.Append(":");
1114                 ProcessData.Append(EmailIter->second);
1115                 ProcessData.Append("\n");
1117                 ProcessData = OutputText(&ProcessData);
1118                         
1119                 SaveData->Append(ProcessData);
1120                 ProcessData.clear();
1121                         
1122         }
1123                 
1126 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID, 
1127         map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1128         map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens, 
1129         wxString *SaveData, wxString DataType){
1131         wxString ProcessData = "";
1132         
1133         for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1134                 LanguageIter != LanguageList->end(); LanguageIter++){
1136                 ProcessData.Append("LANG");
1137                         
1138                 // Check if there is a value for TYPE.
1139                 
1140                 if (DataType.size() > 0){
1141                 
1142                         ProcessData.Append(";TYPE=");
1143                         ProcessData.Append(DataType);
1144                         
1145                 }
1146                 
1147                 // Check if there is a value for ALTID.
1148                 
1149                 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1150                 
1151                         ProcessData.Append(";ALTID=");
1152                         ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1153                         
1154                 }
1155                 
1156                 // Check if there is a value for PID.
1158                 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1159                 
1160                         ProcessData.Append(";PID=");
1161                         ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1162                         
1163                 }
1165                 // Check if there is a value for PREF.
1167                 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1168                 
1169                         ProcessData.Append(";PREF=");
1170                         ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1171                         
1172                 }
1174                 // Check if there is a value for tokens.
1176                 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1177                 
1178                         ProcessData.Append(";");
1179                         ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1180                         
1181                 }
1182                         
1183                 ProcessData.Append(":");
1184                 ProcessData.Append(LanguageIter->second);
1185                 ProcessData.Append("\n");
1187                 ProcessData = OutputText(&ProcessData);
1188                         
1189                 SaveData->Append(ProcessData);
1190                 ProcessData.clear();
1191                         
1192         }
1193                 
1196 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID, 
1197         map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1198         map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1199         map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens, 
1200         wxString *SaveData, wxString DataType){
1202         wxString ProcessData = "";
1203         
1204         for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1205                 GeographyIter != GeographyList->end(); GeographyIter++){
1207                 ProcessData.Append("GEO");
1208                         
1209                 // Check if there is a value for TYPE.
1210                 
1211                 if (DataType.size() > 0){
1212                 
1213                         ProcessData.Append(";TYPE=");
1214                         ProcessData.Append(DataType);
1215                         
1216                 }
1217                 
1218                 // Check if there is a value for ALTID.
1219                 
1220                 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1221                 
1222                         ProcessData.Append(";ALTID=");
1223                         ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1224                         
1225                 }
1226                 
1227                 // Check if there is a value for MEDIATYPE.
1228                 
1229                 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1230                 
1231                         ProcessData.Append(";MEDIATYPE=");
1232                         ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1233                         
1234                 }
1235                 
1236                 // Check if there is a value for PID.
1238                 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1239                 
1240                         ProcessData.Append(";PID=");
1241                         ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1242                         
1243                 }
1245                 // Check if there is a value for PREF.
1247                 if ((*GeographyListPref)[GeographyIter->first] > 0){
1248                 
1249                         ProcessData.Append(";PREF=");
1250                         ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1251                         
1252                 }
1254                 // Check if there is a value for tokens.
1256                 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1257                 
1258                         ProcessData.Append(";");
1259                         ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1260                         
1261                 }
1262                         
1263                 ProcessData.Append(":");
1264                 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1265                 ProcessData.Append(":");
1266                 ProcessData.Append(GeographyIter->second);
1267                 ProcessData.Append("\n");
1269                 ProcessData = OutputText(&ProcessData);
1270                         
1271                 SaveData->Append(ProcessData);
1272                 ProcessData.clear();
1273                         
1274         }
1275                 
1278 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID, 
1279                 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1280                 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref, 
1281                 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1283         wxString ProcessData = "";
1284         
1285         for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1286                 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1288                 ProcessData.Append("URL");
1289                         
1290                 // Check if there is a value for TYPE.
1291                 
1292                 if (DataType.size() > 0){
1293                 
1294                         ProcessData.Append(";TYPE=");
1295                         ProcessData.Append(DataType);
1296                         
1297                 }
1298                 
1299                 // Check if there is a value for ALTID.
1300                 
1301                 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1302                 
1303                         ProcessData.Append(";ALTID=");
1304                         ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1305                         
1306                 }
1307                 
1308                 // Check if there is a value for MEDIATYPE.
1309                 
1310                 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1311                 
1312                         ProcessData.Append(";MEDIATYPE=");
1313                         ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1314                         
1315                 }
1316                 
1317                 // Check if there is a value for PID.
1319                 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1320                 
1321                         ProcessData.Append(";PID=");
1322                         ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1323                         
1324                 }
1326                 // Check if there is a value for PREF.
1328                 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1329                 
1330                         ProcessData.Append(";PREF=");
1331                         ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1332                         
1333                 }
1335                 // Check if there is a value for tokens.
1337                 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1338                 
1339                         ProcessData.Append(";");
1340                         ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1341                         
1342                 }
1343                         
1344                 ProcessData.Append(":");
1345                 ProcessData.Append(WebsiteIter->second);
1346                 ProcessData.Append("\n");
1348                 ProcessData = OutputText(&ProcessData);
1349                         
1350                 SaveData->Append(ProcessData);
1351                 ProcessData.clear();
1352                         
1353         }
1354                         
1357 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1358         map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1359         map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1360         map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1362         wxString ProcessData = "";
1363                 
1364         for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1365                 RoleIter != RoleList->end(); RoleIter++){
1367                 ProcessData.Append("ROLE");
1368                         
1369                 // Check if there is a value for TYPE.
1370                 
1371                 if (DataType.size() > 0){
1372                 
1373                         ProcessData.Append(";TYPE=");
1374                         ProcessData.Append(DataType);
1375                         
1376                 }
1377                 
1378                 // Check if there is a value for ALTID.
1379                 
1380                 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1381                 
1382                         ProcessData.Append(";ALTID=");
1383                         ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1384                         
1385                 }
1387                 // Check if there is a value for LANGUAGE.
1388                 
1389                 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1390                 
1391                         ProcessData.Append(";LANGUAGE=");
1392                         ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1393                         
1394                 }
1395                 
1396                 // Check if there is a value for PID.
1398                 if ((*RoleListPID)[RoleIter->first].size() > 0){
1399                 
1400                         ProcessData.Append(";PID=");
1401                         ProcessData.Append((*RoleListPID)[RoleIter->first]);
1402                         
1403                 }
1405                 // Check if there is a value for PREF.
1407                 if ((*RoleListPref)[RoleIter->first] > 0){
1408                 
1409                         ProcessData.Append(";PREF=");
1410                         ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1411                         
1412                 }
1414                 // Check if there is a value for tokens.
1416                 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1417                 
1418                         ProcessData.Append(";");
1419                         ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1420                         
1421                 }
1422                         
1423                 ProcessData.Append(":");
1424                 ProcessData.Append(RoleIter->second);
1425                 ProcessData.Append("\n");
1427                 ProcessData = OutputText(&ProcessData);
1428                 
1429                 SaveData->Append(ProcessData);
1430                 ProcessData.clear();
1431                         
1432         }
1433                 
1436 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1437         map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage, 
1438         map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType, 
1439         map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens, 
1440         wxString *SaveData, wxString DataType){
1442         wxString ProcessData = "";
1443                 
1444         for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1445                 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1447                 ProcessData.Append("ORG");
1448                         
1449                 // Check if there is a value for TYPE.
1450                 
1451                 if (DataType.size() > 0){
1452                 
1453                         ProcessData.Append(";TYPE=");
1454                         ProcessData.Append(DataType);
1455                         
1456                 }
1457                 
1458                 // Check if there is a value for ALTID.
1459                 
1460                 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1461                 
1462                         ProcessData.Append(";ALTID=");
1463                         ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1464                         
1465                 }
1467                 // Check if there is a value for LANGUAGE.
1468                 
1469                 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1470                 
1471                         ProcessData.Append(";LANGUAGE=");
1472                         ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1473                         
1474                 }
1475                 
1476                 // Check if there is a value for PID.
1478                 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1479                 
1480                         ProcessData.Append(";PID=");
1481                         ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1482                         
1483                 }
1485                 // Check if there is a value for PREF.
1487                 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1488                 
1489                         ProcessData.Append(";PREF=");
1490                         ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1491                         
1492                 }
1493                 
1494                 // Check if there is a value for SORT-AS.
1495                 
1496                 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1497                 
1498                         ProcessData.Append(";SORT-AS=\"");
1499                         ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1500                         ProcessData.Append("\"");
1501                         
1502                 }
1504                 // Check if there is a value for tokens.
1506                 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1507                 
1508                         ProcessData.Append(";");
1509                         ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1510                         
1511                 }
1512                         
1513                 ProcessData.Append(":");
1514                 ProcessData.Append(OrganisationIter->second);
1515                 ProcessData.Append("\n");
1517                 ProcessData = OutputText(&ProcessData);
1518                 
1519                 SaveData->Append(ProcessData);
1520                 ProcessData.clear();
1521                         
1522         }
1523                 
1526 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1527         map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1528         map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1529         map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1531         wxString ProcessData = "";
1532                 
1533         for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1534                 NoteIter != NoteList->end(); NoteIter++){
1536                 ProcessData.Append("NOTE");
1537                         
1538                 // Check if there is a value for TYPE.
1539                 
1540                 if (DataType.size() > 0){
1541                 
1542                         ProcessData.Append(";TYPE=");
1543                         ProcessData.Append(DataType);
1544                         
1545                 }
1546                 
1547                 // Check if there is a value for ALTID.
1548                 
1549                 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1550                 
1551                         ProcessData.Append(";ALTID=");
1552                         ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1553                         
1554                 }
1556                 // Check if there is a value for LANGUAGE.
1557                 
1558                 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1559                 
1560                         ProcessData.Append(";LANGUAGE=");
1561                         ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1562                         
1563                 }
1564                 
1565                 // Check if there is a value for PID.
1567                 if ((*NoteListPID)[NoteIter->first].size() > 0){
1568                 
1569                         ProcessData.Append(";PID=");
1570                         ProcessData.Append((*NoteListPID)[NoteIter->first]);
1571                         
1572                 }
1574                 // Check if there is a value for PREF.
1576                 if ((*NoteListPref)[NoteIter->first] > 0){
1577                 
1578                         ProcessData.Append(";PREF=");
1579                         ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1580                         
1581                 }
1583                 // Check if there is a value for tokens.
1585                 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1586                 
1587                         ProcessData.Append(";");
1588                         ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1589                         
1590                 }
1591                         
1592                 ProcessData.Append(":");
1593                 ProcessData.Append(NoteIter->second);
1594                 ProcessData.Replace("\n", "\\n", true);
1595                 ProcessData.Append("\n");
1597                 ProcessData = OutputText(&ProcessData);
1598                 
1599                 SaveData->Append(ProcessData);
1600                 ProcessData.clear();
1601                         
1602         }
1603                 
1606 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1607         map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1608         map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1609         map<int, wxString> *CategoryListTokens, wxString *SaveData){
1611         wxString ProcessData = "";
1612                 
1613         for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1614                 CategoryIter != CategoryList->end(); CategoryIter++){
1616                 ProcessData.Append("CATEGORIES");
1617                         
1618                 // Check if there is a value for TYPE.
1619                 
1620                 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1621                 
1622                         ProcessData.Append(";TYPE=");
1623                         ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1624                         
1625                 }
1626                 
1627                 // Check if there is a value for ALTID.
1628                 
1629                 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1630                 
1631                         ProcessData.Append(";ALTID=");
1632                         ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1633                         
1634                 }
1636                 // Check if there is a value for LANGUAGE.
1637                 
1638                 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1639                 
1640                         ProcessData.Append(";LANGUAGE=");
1641                         ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1642                         
1643                 }
1644                 
1645                 // Check if there is a value for PID.
1647                 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1648                 
1649                         ProcessData.Append(";PID=");
1650                         ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1651                         
1652                 }
1654                 // Check if there is a value for PREF.
1656                 if ((*CategoryListPref)[CategoryIter->first] > 0){
1657                 
1658                         ProcessData.Append(";PREF=");
1659                         ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1660                         
1661                 }
1663                 // Check if there is a value for tokens.
1665                 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1666                 
1667                         ProcessData.Append(";");
1668                         ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1669                         
1670                 }
1671                         
1672                 ProcessData.Append(":");
1673                 ProcessData.Append(CategoryIter->second);
1674                 ProcessData.Append("\n");
1676                 ProcessData = OutputText(&ProcessData);
1677                 
1678                 SaveData->Append(ProcessData);
1679                 ProcessData.clear();
1680                         
1681         }
1682                 
1685 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID, 
1686                 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1687                 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1688                 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1689                 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1691         wxString ProcessData = "";
1692                 
1693         for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1694                 PicturesIter != PicturesList->end(); PicturesIter++){
1696                 ProcessData.Append("PHOTO");
1697                         
1698                 // Check if there is a value for TYPE.
1699                 
1700                 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1701                 
1702                         ProcessData.Append(";TYPE=");
1703                         ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1704                         
1705                 }
1706                 
1707                 // Check if there is a value for ALTID.
1708                 
1709                 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1710                 
1711                         ProcessData.Append(";ALTID=");
1712                         ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1713                         
1714                 }
1716                 // Check if there is a value for MEDIATYPE..
1717                 
1718                 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1719                 
1720                         ProcessData.Append(";MEDIATYPE=");
1721                         ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1722                         
1723                 }
1724                 
1725                 // Check if there is a value for PID.
1727                 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1728                 
1729                         ProcessData.Append(";PID=");
1730                         ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1731                         
1732                 }
1734                 // Check if there is a value for PREF.
1736                 if ((*PicturesListPref)[PicturesIter->first] > 0){
1737                 
1738                         ProcessData.Append(";PREF=");
1739                         ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1740                         
1741                 }
1743                 // Check if there is a value for tokens.
1745                 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1746                 
1747                         ProcessData.Append(";");
1748                         ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1749                         
1750                 }
1751                 
1752                 ProcessData.Append(":data:");
1753                 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1754                 ProcessData.Append(";");
1755                 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1756                 ProcessData.Append(",");
1757                 ProcessData.Append(PicturesIter->second);
1758                 ProcessData.Append("\n");
1760                 ProcessData = OutputText(&ProcessData);
1761                 
1762                 SaveData->Append(ProcessData);
1763                 ProcessData.clear();
1764                         
1765         }
1766                         
1769 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID, 
1770         map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
1771         map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
1772         map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
1773         map<int, wxString> *LogosListTokens, wxString *SaveData){
1775         wxString ProcessData = "";
1776                 
1777         for (std::map<int, string>::iterator LogosIter = LogosList->begin();
1778                 LogosIter != LogosList->end(); LogosIter++){
1780                 ProcessData.Append("LOGO");
1781                         
1782                 // Check if there is a value for TYPE.
1783                 
1784                 if ((*LogosListType)[LogosIter->first].size() > 0){
1785                 
1786                         ProcessData.Append(";TYPE=");
1787                         ProcessData.Append((*LogosListType)[LogosIter->first]);
1788                         
1789                 }
1790                 
1791                 // Check if there is a value for ALTID.
1792                 
1793                 if ((*LogosListAltID)[LogosIter->first].size() > 0){
1794                 
1795                         ProcessData.Append(";ALTID=");
1796                         ProcessData.Append((*LogosListAltID)[LogosIter->first]);
1797                         
1798                 }
1800                 // Check if there is a value for MEDIATYPE..
1801                 
1802                 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
1803                 
1804                         ProcessData.Append(";MEDIATYPE=");
1805                         ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
1806                         
1807                 }
1808                 
1809                 // Check if there is a value for PID.
1811                 if ((*LogosListPID)[LogosIter->first].size() > 0){
1812                 
1813                         ProcessData.Append(";PID=");
1814                         ProcessData.Append((*LogosListPID)[LogosIter->first]);
1815                         
1816                 }
1818                 // Check if there is a value for PREF.
1820                 if ((*LogosListPref)[LogosIter->first] > 0){
1821                 
1822                         ProcessData.Append(";PREF=");
1823                         ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
1824                         
1825                 }
1827                 // Check if there is a value for tokens.
1829                 if ((*LogosListTokens)[LogosIter->first].size() > 0){
1830                 
1831                         ProcessData.Append(";");
1832                         ProcessData.Append((*LogosListTokens)[LogosIter->first]);
1833                         
1834                 }
1835                 
1836                 ProcessData.Append(":data:");
1837                 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
1838                 ProcessData.Append(";");
1839                 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
1840                 ProcessData.Append(",");
1841                 ProcessData.Append(LogosIter->second);
1842                 ProcessData.Append("\n");
1844                 ProcessData = OutputText(&ProcessData);
1845                 
1846                 SaveData->Append(ProcessData);
1847                 ProcessData.clear();
1848                         
1849         }
1850                 
1853 void ContactDataObject::SaveSound(map<int, string> *SoundsList, map<int, wxString> *SoundsListAltID, 
1854         map<int, wxString> *SoundsListPID, map<int, wxString> *SoundsListType,
1855         map<int, wxString> *SoundsListAudioEncType, map<int, wxString> *SoundsListAudioType,
1856         map<int, wxString> *SoundsListMediatype, map<int, wxString> *SoundsListLanguage, 
1857         map<int, int> *SoundsListPref, map<int, wxString> *SoundsListTokens, 
1858         wxString *SaveData){
1860         wxString ProcessData = "";
1861                 
1862         for (std::map<int, string>::iterator SoundsIter = SoundsList->begin();
1863                 SoundsIter != SoundsList->end(); SoundsIter++){
1865                 ProcessData.Append("SOUND");
1866                         
1867                 // Check if there is a value for TYPE.
1868                 
1869                 if ((*SoundsListType)[SoundsIter->first].size() > 0){
1870                 
1871                         ProcessData.Append(";TYPE=");
1872                         ProcessData.Append((*SoundsListType)[SoundsIter->first]);
1873                         
1874                 }
1875                 
1876                 // Check if there is a value for ALTID.
1877                 
1878                 if ((*SoundsListAltID)[SoundsIter->first].size() > 0){
1879                 
1880                         ProcessData.Append(";ALTID=");
1881                         ProcessData.Append((*SoundsListAltID)[SoundsIter->first]);
1882                         
1883                 }
1885                 // Check if there is a value for LANGUAGE.
1886                 
1887                 if ((*SoundsListLanguage)[SoundsIter->first].size() > 0){
1888                 
1889                         ProcessData.Append(";LANGUAGE=");
1890                         ProcessData.Append((*SoundsListLanguage)[SoundsIter->first]);
1891                         
1892                 }
1893                 
1894                 // Check if there is a value for MEDIATYPE.
1895                 
1896                 if ((*SoundsListMediatype)[SoundsIter->first].size() > 0){
1897                 
1898                         ProcessData.Append(";MEDIATYPE=");
1899                         ProcessData.Append((*SoundsListMediatype)[SoundsIter->first]);
1900                         
1901                 }
1902                 
1903                 // Check if there is a value for PID.
1905                 if ((*SoundsListPID)[SoundsIter->first].size() > 0){
1906                 
1907                         ProcessData.Append(";PID=");
1908                         ProcessData.Append((*SoundsListPID)[SoundsIter->first]);
1909                         
1910                 }
1912                 // Check if there is a value for PREF.
1914                 if ((*SoundsListPref)[SoundsIter->first] > 0){
1915                 
1916                         ProcessData.Append(";PREF=");
1917                         ProcessData.Append(wxString::Format("%i", (*SoundsListPref)[SoundsIter->first]));
1918                         
1919                 }
1921                 // Check if there is a value for tokens.
1923                 if ((*SoundsListTokens)[SoundsIter->first].size() > 0){
1924                 
1925                         ProcessData.Append(";");
1926                         ProcessData.Append((*SoundsListTokens)[SoundsIter->first]);
1927                         
1928                 }
1929                 
1930                 ProcessData.Append(":data:");
1931                 ProcessData.Append((*SoundsListAudioType)[SoundsIter->first]);
1932                 ProcessData.Append(";");
1933                 ProcessData.Append((*SoundsListAudioEncType)[SoundsIter->first]);
1934                 ProcessData.Append(",");
1935                 ProcessData.Append(SoundsIter->second);
1936                 ProcessData.Append("\n");
1938                 ProcessData = OutputText(&ProcessData);
1939                 
1940                 SaveData->Append(ProcessData);
1941                 ProcessData.clear();
1942                         
1943         }
1944                 
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