Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added PHOTO 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         // Process SOUND.
582         // Write the end part of the vCard data file.
583         
584         SaveData->Append("END:VCARD");
585         
586         SaveDataStatus = CONTACTSAVE_OK;
587         
588         return SaveDataStatus;
589         
592 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
593         map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
594         map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
595         map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
597         wxString ProcessData = "";
598                 
599         for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
600                 TitleIter != TitleList->end(); TitleIter++){
602                 ProcessData.Append("TITLE");
603                         
604                 // Check if there is a value for TYPE.
605                 
606                 if (DataType.size() > 0){
607                 
608                         ProcessData.Append(";TYPE=");
609                         ProcessData.Append(DataType);
610                         
611                 }
612                 
613                 // Check if there is a value for ALTID.
614                 
615                 if ((*TitleListAltID)[TitleIter->first].size() > 0){
616                 
617                         ProcessData.Append(";ALTID=");
618                         ProcessData.Append((*TitleListAltID)[TitleIter->first]);
619                         
620                 }
622                 // Check if there is a value for LANGUAGE.
623                 
624                 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
625                 
626                         ProcessData.Append(";LANGUAGE=");
627                         ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
628                         
629                 }
630                 
631                 // Check if there is a value for PID.
633                 if ((*TitleListPID)[TitleIter->first].size() > 0){
634                 
635                         ProcessData.Append(";PID=");
636                         ProcessData.Append((*TitleListPID)[TitleIter->first]);
637                         
638                 }
640                 // Check if there is a value for PREF.
642                 if ((*TitleListPref)[TitleIter->first] > 0){
643                 
644                         ProcessData.Append(";PREF=");
645                         ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
646                         
647                 }
649                 // Check if there is a value for tokens.
651                 if ((*TitleListTokens)[TitleIter->first].size() > 0){
652                 
653                         ProcessData.Append(";");
654                         ProcessData.Append((*TitleListTokens)[TitleIter->first]);
655                         
656                 }
657                         
658                 ProcessData.Append(":");
659                 ProcessData.Append(TitleIter->second);
660                 ProcessData.Append("\n");
662                 ProcessData = OutputText(&ProcessData);
663                         
664                 SaveData->Append(ProcessData);
665                 ProcessData.clear();
666                         
667         }
668                 
671 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID, 
672         map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
673         map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref, 
674         map<int, wxString> *SourceListTokens, wxString *SaveData){
676         wxString ProcessData = "";
677         
678         for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
679                 SourceIter != SourceList->end(); SourceIter++){
681                 ProcessData.Append("SOURCE");
682                         
683                 // Check if there is a value for TYPE.
684                 
685                 if ((*SourceListType)[SourceIter->first].size() > 0){
686                 
687                         ProcessData.Append(";TYPE=");
688                         ProcessData.Append((*SourceListType)[SourceIter->first]);
689                         
690                 }
691                 
692                 // Check if there is a value for ALTID.
693                 
694                 if ((*SourceListAltID)[SourceIter->first].size() > 0){
695                 
696                         ProcessData.Append(";ALTID=");
697                         ProcessData.Append((*SourceListAltID)[SourceIter->first]);
698                         
699                 }
701                 // Check if there is a value for MEDIATYPE.
702                 
703                 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
704                 
705                         ProcessData.Append(";MEDIATYPE=");
706                         ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
707                         
708                 }
709                 
710                 // Check if there is a value for PID.
712                 if ((*SourceListPID)[SourceIter->first].size() > 0){
713                 
714                         ProcessData.Append(";PID=");
715                         ProcessData.Append((*SourceListPID)[SourceIter->first]);
716                         
717                 }
719                 // Check if there is a value for PREF.
721                 if ((*SourceListPref)[SourceIter->first] > 0){
722                 
723                         ProcessData.Append(";PREF=");
724                         ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
725                         
726                 }
728                 // Check if there is a value for tokens.
730                 if ((*SourceListTokens)[SourceIter->first].size() > 0){
731                 
732                         ProcessData.Append(";");
733                         ProcessData.Append((*SourceListTokens)[SourceIter->first]);
734                         
735                 }
736                         
737                 ProcessData.Append(":");
738                 ProcessData.Append(SourceIter->second);
739                 ProcessData.Append("\n");
741                 ProcessData = OutputText(&ProcessData);
742                         
743                 SaveData->Append(ProcessData);
744                 ProcessData.clear();
745                         
746         }
747                 
750 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID, 
751         map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
752         map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref, 
753         map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
755         wxString ProcessData = "";
756         
757         for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
758                 NicknameIter != NicknameList->end(); NicknameIter++){
760                 ProcessData.Append("NICKNAME");
761                         
762                 // Check if there is a value for TYPE.
763                 
764                 if (DataType.size() > 0){
765                 
766                         ProcessData.Append(";TYPE=");
767                         ProcessData.Append(DataType);
768                         
769                 }
770                 
771                 // Check if there is a value for ALTID.
772                 
773                 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
774                 
775                         ProcessData.Append(";ALTID=");
776                         ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
777                         
778                 }
780                 // Check if there is a value for MEDIATYPE.
781                 
782                 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
783                 
784                         ProcessData.Append(";LANGUAGE=");
785                         ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
786                         
787                 }
788                 
789                 // Check if there is a value for PID.
791                 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
792                 
793                         ProcessData.Append(";PID=");
794                         ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
795                         
796                 }
798                 // Check if there is a value for PREF.
800                 if ((*NicknameListPref)[NicknameIter->first] > 0){
801                 
802                         ProcessData.Append(";PREF=");
803                         ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
804                         
805                 }
807                 // Check if there is a value for tokens.
809                 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
810                 
811                         ProcessData.Append(";");
812                         ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
813                         
814                 }
815                         
816                 ProcessData.Append(":");
817                 ProcessData.Append(NicknameIter->second);
818                 ProcessData.Append("\n");
820                 ProcessData = OutputText(&ProcessData);
821                         
822                 SaveData->Append(ProcessData);
823                 ProcessData.clear();
824                         
825         }
826                 
829 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID, 
830         map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
831         map<int, wxString> *TZListMediatype, map<int, int> *TZListPref, 
832         map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
834         wxString ProcessData = "";
835         
836         for (std::map<int, wxString>::iterator TZIter = TZList->begin();
837                 TZIter != TZList->end(); TZIter++){
839                 ProcessData.Append("TZ");
840                         
841                 // Check if there is a value for TYPE.
842                 
843                 if (DataType.size() > 0){
844                 
845                         ProcessData.Append(";TYPE=");
846                         ProcessData.Append(DataType);
847                         
848                 }
849                 
850                 // Check if there is a value for ALTID.
851                 
852                 if ((*TZListAltID)[TZIter->first].size() > 0){
853                 
854                         ProcessData.Append(";ALTID=");
855                         ProcessData.Append((*TZListAltID)[TZIter->first]);
856                         
857                 }
859                 // Check if there is a value for MEDIATYPE.
860                 
861                 if ((*TZListMediatype)[TZIter->first].size() > 0){
862                 
863                         ProcessData.Append(";MEDIATYPE=");
864                         ProcessData.Append((*TZListMediatype)[TZIter->first]);
865                         
866                 }
867                 
868                 // Check if there is a value for PID.
870                 if ((*TZListPID)[TZIter->first].size() > 0){
871                 
872                         ProcessData.Append(";PID=");
873                         ProcessData.Append((*TZListPID)[TZIter->first]);
874                         
875                 }
877                 // Check if there is a value for PREF.
879                 if ((*TZListPref)[TZIter->first] > 0){
880                 
881                         ProcessData.Append(";PREF=");
882                         ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
883                         
884                 }
886                 // Check if there is a value for tokens.
888                 if ((*TZListTokens)[TZIter->first].size() > 0){
889                 
890                         ProcessData.Append(";");
891                         ProcessData.Append((*TZListTokens)[TZIter->first]);
892                         
893                 }
894                         
895                 ProcessData.Append(":");
896                 ProcessData.Append(TZIter->second);
897                 ProcessData.Append("\n");
899                 ProcessData = OutputText(&ProcessData);
900                         
901                 SaveData->Append(ProcessData);
902                 ProcessData.clear();
903                         
904         }
905                 
908 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
909                 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
910                 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
911                 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
912                 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo, 
913                 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType, 
914                 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref, 
915                 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
917         wxString ProcessData = "";
918                         
919         for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
920                 AddressIter != AddressList->end(); AddressIter++){
921                         
922                 ProcessData.Append("ADR");
923                         
924                 // Check if there is a value for TYPE.
925                 
926                 if (DataType.size() > 0){
927                 
928                         ProcessData.Append(";TYPE=");
929                         ProcessData.Append(DataType);
930                         
931                 }
932                 
933                 // Check if there is a value for ALTID.
934                 
935                 if ((*AddressListAltID)[AddressIter->first].size() > 0){
936                 
937                         ProcessData.Append(";ALTID=");
938                         ProcessData.Append((*AddressListAltID)[AddressIter->first]);
939                         
940                 }
942                 // Check if there is a value for GEO.
943                 
944                 if ((*AddressListGeo)[AddressIter->first].size() > 0){
945                 
946                         ProcessData.Append(";GEO=\"");
947                         ProcessData.Append((*AddressListGeo)[AddressIter->first]);
948                         ProcessData.Append("\"");
949                         
950                 }
952                 // Check if there is a value for LABEL.
954                 if ((*AddressListLabel)[AddressIter->first].size() > 0){
955                 
956                         wxString AddressProcessed = "";
957                         AddressProcessed = (*AddressListLabel)[AddressIter->first];
958                         
959                         AddressProcessed.Replace("\n", "\\n", true);
960                         
961                         ProcessData.Append(";LABEL=");
962                         ProcessData.Append(AddressProcessed);
963                         
964                 }
965                 
966                 // Check if there is a value for LANGUAGE.
967                 
968                 if ((*AddressListLang)[AddressIter->first].size() > 0){
969                 
970                         ProcessData.Append(";LANGUAGE=");
971                         ProcessData.Append((*AddressListLang)[AddressIter->first]);
972                         
973                 }
974                 
975                 // Check if there is a value for MEDIATYPE.
976                 
977                 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
978                 
979                         ProcessData.Append(";MEDIATYPE=");
980                         ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
981                         
982                 }
983                 
984                 // Check if there is a value for PID.
986                 if ((*AddressListPID)[AddressIter->first].size() > 0){
987                 
988                         ProcessData.Append(";PID=");
989                         ProcessData.Append((*AddressListPID)[AddressIter->first]);
990                         
991                 }
993                 // Check if there is a value for PREF.
995                 if ((*AddressListPref)[AddressIter->first] > 0){
996                 
997                         ProcessData.Append(";PREF=");
998                         ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
999                         
1000                 }
1002                 // Check if there is a value for TZ.
1004                 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1005                 
1006                         ProcessData.Append(";TZ=");
1007                         ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1008                         
1009                 }
1010                 
1011                 // Check if there is a value for tokens.
1013                 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1014                 
1015                         ProcessData.Append(";");
1016                         ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1017                         
1018                 }
1019                 
1020                 // Build the address.
1021                 
1022                 ProcessData.Append(":;;");
1023                 ProcessData.Append((*AddressList)[AddressIter->first]);
1024                 ProcessData.Append(";");
1025                 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1026                 ProcessData.Append(";");
1027                 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1028                 ProcessData.Append(";");
1029                 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1030                 ProcessData.Append(";");
1031                 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1032                 ProcessData.Append("\n");
1033                 
1034                 ProcessData = OutputText(&ProcessData);
1035                         
1036                 SaveData->Append(ProcessData);
1037                 ProcessData.clear();
1038                         
1039         }
1040                         
1043 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID, 
1044         map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1045         map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens, 
1046         wxString *SaveData, wxString DataType){
1048         wxString ProcessData = "";
1049         
1050         for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1051                 EmailIter != EmailList->end(); EmailIter++){
1053                 ProcessData.Append("EMAIL");
1054                         
1055                 // Check if there is a value for TYPE.
1056                 
1057                 if (DataType.size() > 0){
1058                 
1059                         ProcessData.Append(";TYPE=");
1060                         ProcessData.Append(DataType);
1061                         
1062                 }
1063                 
1064                 // Check if there is a value for ALTID.
1065                 
1066                 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1067                 
1068                         ProcessData.Append(";ALTID=");
1069                         ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1070                         
1071                 }
1072                 
1073                 // Check if there is a value for PID.
1075                 if ((*EmailListPID)[EmailIter->first].size() > 0){
1076                 
1077                         ProcessData.Append(";PID=");
1078                         ProcessData.Append((*EmailListPID)[EmailIter->first]);
1079                         
1080                 }
1082                 // Check if there is a value for PREF.
1084                 if ((*EmailListPref)[EmailIter->first] > 0){
1085                 
1086                         ProcessData.Append(";PREF=");
1087                         ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1088                         
1089                 }
1091                 // Check if there is a value for tokens.
1093                 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1094                 
1095                         ProcessData.Append(";");
1096                         ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1097                         
1098                 }
1099                         
1100                 ProcessData.Append(":");
1101                 ProcessData.Append(EmailIter->second);
1102                 ProcessData.Append("\n");
1104                 ProcessData = OutputText(&ProcessData);
1105                         
1106                 SaveData->Append(ProcessData);
1107                 ProcessData.clear();
1108                         
1109         }
1110                 
1113 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID, 
1114         map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1115         map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens, 
1116         wxString *SaveData, wxString DataType){
1118         wxString ProcessData = "";
1119         
1120         for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1121                 LanguageIter != LanguageList->end(); LanguageIter++){
1123                 ProcessData.Append("LANG");
1124                         
1125                 // Check if there is a value for TYPE.
1126                 
1127                 if (DataType.size() > 0){
1128                 
1129                         ProcessData.Append(";TYPE=");
1130                         ProcessData.Append(DataType);
1131                         
1132                 }
1133                 
1134                 // Check if there is a value for ALTID.
1135                 
1136                 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1137                 
1138                         ProcessData.Append(";ALTID=");
1139                         ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1140                         
1141                 }
1142                 
1143                 // Check if there is a value for PID.
1145                 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1146                 
1147                         ProcessData.Append(";PID=");
1148                         ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1149                         
1150                 }
1152                 // Check if there is a value for PREF.
1154                 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1155                 
1156                         ProcessData.Append(";PREF=");
1157                         ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1158                         
1159                 }
1161                 // Check if there is a value for tokens.
1163                 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1164                 
1165                         ProcessData.Append(";");
1166                         ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1167                         
1168                 }
1169                         
1170                 ProcessData.Append(":");
1171                 ProcessData.Append(LanguageIter->second);
1172                 ProcessData.Append("\n");
1174                 ProcessData = OutputText(&ProcessData);
1175                         
1176                 SaveData->Append(ProcessData);
1177                 ProcessData.clear();
1178                         
1179         }
1180                 
1183 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID, 
1184         map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1185         map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1186         map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens, 
1187         wxString *SaveData, wxString DataType){
1189         wxString ProcessData = "";
1190         
1191         for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1192                 GeographyIter != GeographyList->end(); GeographyIter++){
1194                 ProcessData.Append("GEO");
1195                         
1196                 // Check if there is a value for TYPE.
1197                 
1198                 if (DataType.size() > 0){
1199                 
1200                         ProcessData.Append(";TYPE=");
1201                         ProcessData.Append(DataType);
1202                         
1203                 }
1204                 
1205                 // Check if there is a value for ALTID.
1206                 
1207                 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1208                 
1209                         ProcessData.Append(";ALTID=");
1210                         ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1211                         
1212                 }
1213                 
1214                 // Check if there is a value for MEDIATYPE.
1215                 
1216                 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1217                 
1218                         ProcessData.Append(";MEDIATYPE=");
1219                         ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1220                         
1221                 }
1222                 
1223                 // Check if there is a value for PID.
1225                 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1226                 
1227                         ProcessData.Append(";PID=");
1228                         ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1229                         
1230                 }
1232                 // Check if there is a value for PREF.
1234                 if ((*GeographyListPref)[GeographyIter->first] > 0){
1235                 
1236                         ProcessData.Append(";PREF=");
1237                         ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1238                         
1239                 }
1241                 // Check if there is a value for tokens.
1243                 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1244                 
1245                         ProcessData.Append(";");
1246                         ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1247                         
1248                 }
1249                         
1250                 ProcessData.Append(":");
1251                 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1252                 ProcessData.Append(":");
1253                 ProcessData.Append(GeographyIter->second);
1254                 ProcessData.Append("\n");
1256                 ProcessData = OutputText(&ProcessData);
1257                         
1258                 SaveData->Append(ProcessData);
1259                 ProcessData.clear();
1260                         
1261         }
1262                 
1265 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID, 
1266                 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1267                 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref, 
1268                 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1270         wxString ProcessData = "";
1271         
1272         for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1273                 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1275                 ProcessData.Append("URL");
1276                         
1277                 // Check if there is a value for TYPE.
1278                 
1279                 if (DataType.size() > 0){
1280                 
1281                         ProcessData.Append(";TYPE=");
1282                         ProcessData.Append(DataType);
1283                         
1284                 }
1285                 
1286                 // Check if there is a value for ALTID.
1287                 
1288                 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1289                 
1290                         ProcessData.Append(";ALTID=");
1291                         ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1292                         
1293                 }
1294                 
1295                 // Check if there is a value for MEDIATYPE.
1296                 
1297                 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1298                 
1299                         ProcessData.Append(";MEDIATYPE=");
1300                         ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1301                         
1302                 }
1303                 
1304                 // Check if there is a value for PID.
1306                 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1307                 
1308                         ProcessData.Append(";PID=");
1309                         ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1310                         
1311                 }
1313                 // Check if there is a value for PREF.
1315                 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1316                 
1317                         ProcessData.Append(";PREF=");
1318                         ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1319                         
1320                 }
1322                 // Check if there is a value for tokens.
1324                 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1325                 
1326                         ProcessData.Append(";");
1327                         ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1328                         
1329                 }
1330                         
1331                 ProcessData.Append(":");
1332                 ProcessData.Append(WebsiteIter->second);
1333                 ProcessData.Append("\n");
1335                 ProcessData = OutputText(&ProcessData);
1336                         
1337                 SaveData->Append(ProcessData);
1338                 ProcessData.clear();
1339                         
1340         }
1341                         
1344 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1345         map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1346         map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1347         map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1349         wxString ProcessData = "";
1350                 
1351         for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1352                 RoleIter != RoleList->end(); RoleIter++){
1354                 ProcessData.Append("ROLE");
1355                         
1356                 // Check if there is a value for TYPE.
1357                 
1358                 if (DataType.size() > 0){
1359                 
1360                         ProcessData.Append(";TYPE=");
1361                         ProcessData.Append(DataType);
1362                         
1363                 }
1364                 
1365                 // Check if there is a value for ALTID.
1366                 
1367                 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1368                 
1369                         ProcessData.Append(";ALTID=");
1370                         ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1371                         
1372                 }
1374                 // Check if there is a value for LANGUAGE.
1375                 
1376                 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1377                 
1378                         ProcessData.Append(";LANGUAGE=");
1379                         ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1380                         
1381                 }
1382                 
1383                 // Check if there is a value for PID.
1385                 if ((*RoleListPID)[RoleIter->first].size() > 0){
1386                 
1387                         ProcessData.Append(";PID=");
1388                         ProcessData.Append((*RoleListPID)[RoleIter->first]);
1389                         
1390                 }
1392                 // Check if there is a value for PREF.
1394                 if ((*RoleListPref)[RoleIter->first] > 0){
1395                 
1396                         ProcessData.Append(";PREF=");
1397                         ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1398                         
1399                 }
1401                 // Check if there is a value for tokens.
1403                 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1404                 
1405                         ProcessData.Append(";");
1406                         ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1407                         
1408                 }
1409                         
1410                 ProcessData.Append(":");
1411                 ProcessData.Append(RoleIter->second);
1412                 ProcessData.Append("\n");
1414                 ProcessData = OutputText(&ProcessData);
1415                 
1416                 SaveData->Append(ProcessData);
1417                 ProcessData.clear();
1418                         
1419         }
1420                 
1423 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1424         map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage, 
1425         map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType, 
1426         map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens, 
1427         wxString *SaveData, wxString DataType){
1429         wxString ProcessData = "";
1430                 
1431         for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1432                 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1434                 ProcessData.Append("ORG");
1435                         
1436                 // Check if there is a value for TYPE.
1437                 
1438                 if (DataType.size() > 0){
1439                 
1440                         ProcessData.Append(";TYPE=");
1441                         ProcessData.Append(DataType);
1442                         
1443                 }
1444                 
1445                 // Check if there is a value for ALTID.
1446                 
1447                 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1448                 
1449                         ProcessData.Append(";ALTID=");
1450                         ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1451                         
1452                 }
1454                 // Check if there is a value for LANGUAGE.
1455                 
1456                 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1457                 
1458                         ProcessData.Append(";LANGUAGE=");
1459                         ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1460                         
1461                 }
1462                 
1463                 // Check if there is a value for PID.
1465                 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1466                 
1467                         ProcessData.Append(";PID=");
1468                         ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1469                         
1470                 }
1472                 // Check if there is a value for PREF.
1474                 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1475                 
1476                         ProcessData.Append(";PREF=");
1477                         ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1478                         
1479                 }
1480                 
1481                 // Check if there is a value for SORT-AS.
1482                 
1483                 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1484                 
1485                         ProcessData.Append(";SORT-AS=\"");
1486                         ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1487                         ProcessData.Append("\"");
1488                         
1489                 }
1491                 // Check if there is a value for tokens.
1493                 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1494                 
1495                         ProcessData.Append(";");
1496                         ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1497                         
1498                 }
1499                         
1500                 ProcessData.Append(":");
1501                 ProcessData.Append(OrganisationIter->second);
1502                 ProcessData.Append("\n");
1504                 ProcessData = OutputText(&ProcessData);
1505                 
1506                 SaveData->Append(ProcessData);
1507                 ProcessData.clear();
1508                         
1509         }
1510                 
1513 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1514         map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1515         map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1516         map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1518         wxString ProcessData = "";
1519                 
1520         for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1521                 NoteIter != NoteList->end(); NoteIter++){
1523                 ProcessData.Append("NOTE");
1524                         
1525                 // Check if there is a value for TYPE.
1526                 
1527                 if (DataType.size() > 0){
1528                 
1529                         ProcessData.Append(";TYPE=");
1530                         ProcessData.Append(DataType);
1531                         
1532                 }
1533                 
1534                 // Check if there is a value for ALTID.
1535                 
1536                 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1537                 
1538                         ProcessData.Append(";ALTID=");
1539                         ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1540                         
1541                 }
1543                 // Check if there is a value for LANGUAGE.
1544                 
1545                 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1546                 
1547                         ProcessData.Append(";LANGUAGE=");
1548                         ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1549                         
1550                 }
1551                 
1552                 // Check if there is a value for PID.
1554                 if ((*NoteListPID)[NoteIter->first].size() > 0){
1555                 
1556                         ProcessData.Append(";PID=");
1557                         ProcessData.Append((*NoteListPID)[NoteIter->first]);
1558                         
1559                 }
1561                 // Check if there is a value for PREF.
1563                 if ((*NoteListPref)[NoteIter->first] > 0){
1564                 
1565                         ProcessData.Append(";PREF=");
1566                         ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1567                         
1568                 }
1570                 // Check if there is a value for tokens.
1572                 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1573                 
1574                         ProcessData.Append(";");
1575                         ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1576                         
1577                 }
1578                         
1579                 ProcessData.Append(":");
1580                 ProcessData.Append(NoteIter->second);
1581                 ProcessData.Replace("\n", "\\n", true);
1582                 ProcessData.Append("\n");
1584                 ProcessData = OutputText(&ProcessData);
1585                 
1586                 SaveData->Append(ProcessData);
1587                 ProcessData.clear();
1588                         
1589         }
1590                 
1593 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1594         map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1595         map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1596         map<int, wxString> *CategoryListTokens, wxString *SaveData){
1598         wxString ProcessData = "";
1599                 
1600         for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1601                 CategoryIter != CategoryList->end(); CategoryIter++){
1603                 ProcessData.Append("CATEGORIES");
1604                         
1605                 // Check if there is a value for TYPE.
1606                 
1607                 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1608                 
1609                         ProcessData.Append(";TYPE=");
1610                         ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1611                         
1612                 }
1613                 
1614                 // Check if there is a value for ALTID.
1615                 
1616                 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1617                 
1618                         ProcessData.Append(";ALTID=");
1619                         ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1620                         
1621                 }
1623                 // Check if there is a value for LANGUAGE.
1624                 
1625                 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1626                 
1627                         ProcessData.Append(";LANGUAGE=");
1628                         ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1629                         
1630                 }
1631                 
1632                 // Check if there is a value for PID.
1634                 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1635                 
1636                         ProcessData.Append(";PID=");
1637                         ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1638                         
1639                 }
1641                 // Check if there is a value for PREF.
1643                 if ((*CategoryListPref)[CategoryIter->first] > 0){
1644                 
1645                         ProcessData.Append(";PREF=");
1646                         ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1647                         
1648                 }
1650                 // Check if there is a value for tokens.
1652                 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1653                 
1654                         ProcessData.Append(";");
1655                         ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1656                         
1657                 }
1658                         
1659                 ProcessData.Append(":");
1660                 ProcessData.Append(CategoryIter->second);
1661                 ProcessData.Append("\n");
1663                 ProcessData = OutputText(&ProcessData);
1664                 
1665                 SaveData->Append(ProcessData);
1666                 ProcessData.clear();
1667                         
1668         }
1669                 
1672 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID, 
1673                 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1674                 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1675                 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1676                 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1678         wxString ProcessData = "";
1679                 
1680         for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1681                 PicturesIter != PicturesList->end(); PicturesIter++){
1683                 ProcessData.Append("PHOTO");
1684                         
1685                 // Check if there is a value for TYPE.
1686                 
1687                 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1688                 
1689                         ProcessData.Append(";TYPE=");
1690                         ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1691                         
1692                 }
1693                 
1694                 // Check if there is a value for ALTID.
1695                 
1696                 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1697                 
1698                         ProcessData.Append(";ALTID=");
1699                         ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1700                         
1701                 }
1703                 // Check if there is a value for MEDIATYPE..
1704                 
1705                 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1706                 
1707                         ProcessData.Append(";MEDIATYPE=");
1708                         ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1709                         
1710                 }
1711                 
1712                 // Check if there is a value for PID.
1714                 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1715                 
1716                         ProcessData.Append(";PID=");
1717                         ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1718                         
1719                 }
1721                 // Check if there is a value for PREF.
1723                 if ((*PicturesListPref)[PicturesIter->first] > 0){
1724                 
1725                         ProcessData.Append(";PREF=");
1726                         ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1727                         
1728                 }
1730                 // Check if there is a value for tokens.
1732                 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1733                 
1734                         ProcessData.Append(";");
1735                         ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1736                         
1737                 }
1738                 
1739                 ProcessData.Append(":data:");
1740                 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1741                 ProcessData.Append(";");
1742                 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1743                 ProcessData.Append(",");
1744                 ProcessData.Append(PicturesIter->second);
1745                 ProcessData.Append("\n");
1747                 ProcessData = OutputText(&ProcessData);
1748                 
1749                 SaveData->Append(ProcessData);
1750                 ProcessData.clear();
1751                         
1752         }
1753                         
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