Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
7fdb87ce5d20c286b5c100aeee3704bb7e2555ac
[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         // Write the end part of the vCard data file.
589         
590         SaveData->Append("END:VCARD");
591         
592         SaveDataStatus = CONTACTSAVE_OK;
593         
594         return SaveDataStatus;
595         
598 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
599         map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
600         map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
601         map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
603         wxString ProcessData = "";
604                 
605         for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
606                 TitleIter != TitleList->end(); TitleIter++){
608                 ProcessData.Append("TITLE");
609                         
610                 // Check if there is a value for TYPE.
611                 
612                 if (DataType.size() > 0){
613                 
614                         ProcessData.Append(";TYPE=");
615                         ProcessData.Append(DataType);
616                         
617                 }
618                 
619                 // Check if there is a value for ALTID.
620                 
621                 if ((*TitleListAltID)[TitleIter->first].size() > 0){
622                 
623                         ProcessData.Append(";ALTID=");
624                         ProcessData.Append((*TitleListAltID)[TitleIter->first]);
625                         
626                 }
628                 // Check if there is a value for LANGUAGE.
629                 
630                 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
631                 
632                         ProcessData.Append(";LANGUAGE=");
633                         ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
634                         
635                 }
636                 
637                 // Check if there is a value for PID.
639                 if ((*TitleListPID)[TitleIter->first].size() > 0){
640                 
641                         ProcessData.Append(";PID=");
642                         ProcessData.Append((*TitleListPID)[TitleIter->first]);
643                         
644                 }
646                 // Check if there is a value for PREF.
648                 if ((*TitleListPref)[TitleIter->first] > 0){
649                 
650                         ProcessData.Append(";PREF=");
651                         ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
652                         
653                 }
655                 // Check if there is a value for tokens.
657                 if ((*TitleListTokens)[TitleIter->first].size() > 0){
658                 
659                         ProcessData.Append(";");
660                         ProcessData.Append((*TitleListTokens)[TitleIter->first]);
661                         
662                 }
663                         
664                 ProcessData.Append(":");
665                 ProcessData.Append(TitleIter->second);
666                 ProcessData.Append("\n");
668                 ProcessData = OutputText(&ProcessData);
669                         
670                 SaveData->Append(ProcessData);
671                 ProcessData.clear();
672                         
673         }
674                 
677 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID, 
678         map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
679         map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref, 
680         map<int, wxString> *SourceListTokens, wxString *SaveData){
682         wxString ProcessData = "";
683         
684         for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
685                 SourceIter != SourceList->end(); SourceIter++){
687                 ProcessData.Append("SOURCE");
688                         
689                 // Check if there is a value for TYPE.
690                 
691                 if ((*SourceListType)[SourceIter->first].size() > 0){
692                 
693                         ProcessData.Append(";TYPE=");
694                         ProcessData.Append((*SourceListType)[SourceIter->first]);
695                         
696                 }
697                 
698                 // Check if there is a value for ALTID.
699                 
700                 if ((*SourceListAltID)[SourceIter->first].size() > 0){
701                 
702                         ProcessData.Append(";ALTID=");
703                         ProcessData.Append((*SourceListAltID)[SourceIter->first]);
704                         
705                 }
707                 // Check if there is a value for MEDIATYPE.
708                 
709                 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
710                 
711                         ProcessData.Append(";MEDIATYPE=");
712                         ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
713                         
714                 }
715                 
716                 // Check if there is a value for PID.
718                 if ((*SourceListPID)[SourceIter->first].size() > 0){
719                 
720                         ProcessData.Append(";PID=");
721                         ProcessData.Append((*SourceListPID)[SourceIter->first]);
722                         
723                 }
725                 // Check if there is a value for PREF.
727                 if ((*SourceListPref)[SourceIter->first] > 0){
728                 
729                         ProcessData.Append(";PREF=");
730                         ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
731                         
732                 }
734                 // Check if there is a value for tokens.
736                 if ((*SourceListTokens)[SourceIter->first].size() > 0){
737                 
738                         ProcessData.Append(";");
739                         ProcessData.Append((*SourceListTokens)[SourceIter->first]);
740                         
741                 }
742                         
743                 ProcessData.Append(":");
744                 ProcessData.Append(SourceIter->second);
745                 ProcessData.Append("\n");
747                 ProcessData = OutputText(&ProcessData);
748                         
749                 SaveData->Append(ProcessData);
750                 ProcessData.clear();
751                         
752         }
753                 
756 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID, 
757         map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
758         map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref, 
759         map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
761         wxString ProcessData = "";
762         
763         for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
764                 NicknameIter != NicknameList->end(); NicknameIter++){
766                 ProcessData.Append("NICKNAME");
767                         
768                 // Check if there is a value for TYPE.
769                 
770                 if (DataType.size() > 0){
771                 
772                         ProcessData.Append(";TYPE=");
773                         ProcessData.Append(DataType);
774                         
775                 }
776                 
777                 // Check if there is a value for ALTID.
778                 
779                 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
780                 
781                         ProcessData.Append(";ALTID=");
782                         ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
783                         
784                 }
786                 // Check if there is a value for MEDIATYPE.
787                 
788                 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
789                 
790                         ProcessData.Append(";LANGUAGE=");
791                         ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
792                         
793                 }
794                 
795                 // Check if there is a value for PID.
797                 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
798                 
799                         ProcessData.Append(";PID=");
800                         ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
801                         
802                 }
804                 // Check if there is a value for PREF.
806                 if ((*NicknameListPref)[NicknameIter->first] > 0){
807                 
808                         ProcessData.Append(";PREF=");
809                         ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
810                         
811                 }
813                 // Check if there is a value for tokens.
815                 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
816                 
817                         ProcessData.Append(";");
818                         ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
819                         
820                 }
821                         
822                 ProcessData.Append(":");
823                 ProcessData.Append(NicknameIter->second);
824                 ProcessData.Append("\n");
826                 ProcessData = OutputText(&ProcessData);
827                         
828                 SaveData->Append(ProcessData);
829                 ProcessData.clear();
830                         
831         }
832                 
835 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID, 
836         map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
837         map<int, wxString> *TZListMediatype, map<int, int> *TZListPref, 
838         map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
840         wxString ProcessData = "";
841         
842         for (std::map<int, wxString>::iterator TZIter = TZList->begin();
843                 TZIter != TZList->end(); TZIter++){
845                 ProcessData.Append("TZ");
846                         
847                 // Check if there is a value for TYPE.
848                 
849                 if (DataType.size() > 0){
850                 
851                         ProcessData.Append(";TYPE=");
852                         ProcessData.Append(DataType);
853                         
854                 }
855                 
856                 // Check if there is a value for ALTID.
857                 
858                 if ((*TZListAltID)[TZIter->first].size() > 0){
859                 
860                         ProcessData.Append(";ALTID=");
861                         ProcessData.Append((*TZListAltID)[TZIter->first]);
862                         
863                 }
865                 // Check if there is a value for MEDIATYPE.
866                 
867                 if ((*TZListMediatype)[TZIter->first].size() > 0){
868                 
869                         ProcessData.Append(";MEDIATYPE=");
870                         ProcessData.Append((*TZListMediatype)[TZIter->first]);
871                         
872                 }
873                 
874                 // Check if there is a value for PID.
876                 if ((*TZListPID)[TZIter->first].size() > 0){
877                 
878                         ProcessData.Append(";PID=");
879                         ProcessData.Append((*TZListPID)[TZIter->first]);
880                         
881                 }
883                 // Check if there is a value for PREF.
885                 if ((*TZListPref)[TZIter->first] > 0){
886                 
887                         ProcessData.Append(";PREF=");
888                         ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
889                         
890                 }
892                 // Check if there is a value for tokens.
894                 if ((*TZListTokens)[TZIter->first].size() > 0){
895                 
896                         ProcessData.Append(";");
897                         ProcessData.Append((*TZListTokens)[TZIter->first]);
898                         
899                 }
900                         
901                 ProcessData.Append(":");
902                 ProcessData.Append(TZIter->second);
903                 ProcessData.Append("\n");
905                 ProcessData = OutputText(&ProcessData);
906                         
907                 SaveData->Append(ProcessData);
908                 ProcessData.clear();
909                         
910         }
911                 
914 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
915                 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
916                 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
917                 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
918                 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo, 
919                 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType, 
920                 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref, 
921                 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
923         wxString ProcessData = "";
924                         
925         for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
926                 AddressIter != AddressList->end(); AddressIter++){
927                         
928                 ProcessData.Append("ADR");
929                         
930                 // Check if there is a value for TYPE.
931                 
932                 if (DataType.size() > 0){
933                 
934                         ProcessData.Append(";TYPE=");
935                         ProcessData.Append(DataType);
936                         
937                 }
938                 
939                 // Check if there is a value for ALTID.
940                 
941                 if ((*AddressListAltID)[AddressIter->first].size() > 0){
942                 
943                         ProcessData.Append(";ALTID=");
944                         ProcessData.Append((*AddressListAltID)[AddressIter->first]);
945                         
946                 }
948                 // Check if there is a value for GEO.
949                 
950                 if ((*AddressListGeo)[AddressIter->first].size() > 0){
951                 
952                         ProcessData.Append(";GEO=\"");
953                         ProcessData.Append((*AddressListGeo)[AddressIter->first]);
954                         ProcessData.Append("\"");
955                         
956                 }
958                 // Check if there is a value for LABEL.
960                 if ((*AddressListLabel)[AddressIter->first].size() > 0){
961                 
962                         wxString AddressProcessed = "";
963                         AddressProcessed = (*AddressListLabel)[AddressIter->first];
964                         
965                         AddressProcessed.Replace("\n", "\\n", true);
966                         
967                         ProcessData.Append(";LABEL=");
968                         ProcessData.Append(AddressProcessed);
969                         
970                 }
971                 
972                 // Check if there is a value for LANGUAGE.
973                 
974                 if ((*AddressListLang)[AddressIter->first].size() > 0){
975                 
976                         ProcessData.Append(";LANGUAGE=");
977                         ProcessData.Append((*AddressListLang)[AddressIter->first]);
978                         
979                 }
980                 
981                 // Check if there is a value for MEDIATYPE.
982                 
983                 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
984                 
985                         ProcessData.Append(";MEDIATYPE=");
986                         ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
987                         
988                 }
989                 
990                 // Check if there is a value for PID.
992                 if ((*AddressListPID)[AddressIter->first].size() > 0){
993                 
994                         ProcessData.Append(";PID=");
995                         ProcessData.Append((*AddressListPID)[AddressIter->first]);
996                         
997                 }
999                 // Check if there is a value for PREF.
1001                 if ((*AddressListPref)[AddressIter->first] > 0){
1002                 
1003                         ProcessData.Append(";PREF=");
1004                         ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
1005                         
1006                 }
1008                 // Check if there is a value for TZ.
1010                 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
1011                 
1012                         ProcessData.Append(";TZ=");
1013                         ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
1014                         
1015                 }
1016                 
1017                 // Check if there is a value for tokens.
1019                 if ((*AddressListTokens)[AddressIter->first].size() > 0){
1020                 
1021                         ProcessData.Append(";");
1022                         ProcessData.Append((*AddressListTokens)[AddressIter->first]);
1023                         
1024                 }
1025                 
1026                 // Build the address.
1027                 
1028                 ProcessData.Append(":;;");
1029                 ProcessData.Append((*AddressList)[AddressIter->first]);
1030                 ProcessData.Append(";");
1031                 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1032                 ProcessData.Append(";");
1033                 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1034                 ProcessData.Append(";");
1035                 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1036                 ProcessData.Append(";");
1037                 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1038                 ProcessData.Append("\n");
1039                 
1040                 ProcessData = OutputText(&ProcessData);
1041                         
1042                 SaveData->Append(ProcessData);
1043                 ProcessData.clear();
1044                         
1045         }
1046                         
1049 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID, 
1050         map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1051         map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens, 
1052         wxString *SaveData, wxString DataType){
1054         wxString ProcessData = "";
1055         
1056         for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1057                 EmailIter != EmailList->end(); EmailIter++){
1059                 ProcessData.Append("EMAIL");
1060                         
1061                 // Check if there is a value for TYPE.
1062                 
1063                 if (DataType.size() > 0){
1064                 
1065                         ProcessData.Append(";TYPE=");
1066                         ProcessData.Append(DataType);
1067                         
1068                 }
1069                 
1070                 // Check if there is a value for ALTID.
1071                 
1072                 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1073                 
1074                         ProcessData.Append(";ALTID=");
1075                         ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1076                         
1077                 }
1078                 
1079                 // Check if there is a value for PID.
1081                 if ((*EmailListPID)[EmailIter->first].size() > 0){
1082                 
1083                         ProcessData.Append(";PID=");
1084                         ProcessData.Append((*EmailListPID)[EmailIter->first]);
1085                         
1086                 }
1088                 // Check if there is a value for PREF.
1090                 if ((*EmailListPref)[EmailIter->first] > 0){
1091                 
1092                         ProcessData.Append(";PREF=");
1093                         ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1094                         
1095                 }
1097                 // Check if there is a value for tokens.
1099                 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1100                 
1101                         ProcessData.Append(";");
1102                         ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1103                         
1104                 }
1105                         
1106                 ProcessData.Append(":");
1107                 ProcessData.Append(EmailIter->second);
1108                 ProcessData.Append("\n");
1110                 ProcessData = OutputText(&ProcessData);
1111                         
1112                 SaveData->Append(ProcessData);
1113                 ProcessData.clear();
1114                         
1115         }
1116                 
1119 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID, 
1120         map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1121         map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens, 
1122         wxString *SaveData, wxString DataType){
1124         wxString ProcessData = "";
1125         
1126         for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1127                 LanguageIter != LanguageList->end(); LanguageIter++){
1129                 ProcessData.Append("LANG");
1130                         
1131                 // Check if there is a value for TYPE.
1132                 
1133                 if (DataType.size() > 0){
1134                 
1135                         ProcessData.Append(";TYPE=");
1136                         ProcessData.Append(DataType);
1137                         
1138                 }
1139                 
1140                 // Check if there is a value for ALTID.
1141                 
1142                 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1143                 
1144                         ProcessData.Append(";ALTID=");
1145                         ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1146                         
1147                 }
1148                 
1149                 // Check if there is a value for PID.
1151                 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1152                 
1153                         ProcessData.Append(";PID=");
1154                         ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1155                         
1156                 }
1158                 // Check if there is a value for PREF.
1160                 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1161                 
1162                         ProcessData.Append(";PREF=");
1163                         ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1164                         
1165                 }
1167                 // Check if there is a value for tokens.
1169                 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1170                 
1171                         ProcessData.Append(";");
1172                         ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1173                         
1174                 }
1175                         
1176                 ProcessData.Append(":");
1177                 ProcessData.Append(LanguageIter->second);
1178                 ProcessData.Append("\n");
1180                 ProcessData = OutputText(&ProcessData);
1181                         
1182                 SaveData->Append(ProcessData);
1183                 ProcessData.clear();
1184                         
1185         }
1186                 
1189 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID, 
1190         map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1191         map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1192         map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens, 
1193         wxString *SaveData, wxString DataType){
1195         wxString ProcessData = "";
1196         
1197         for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1198                 GeographyIter != GeographyList->end(); GeographyIter++){
1200                 ProcessData.Append("GEO");
1201                         
1202                 // Check if there is a value for TYPE.
1203                 
1204                 if (DataType.size() > 0){
1205                 
1206                         ProcessData.Append(";TYPE=");
1207                         ProcessData.Append(DataType);
1208                         
1209                 }
1210                 
1211                 // Check if there is a value for ALTID.
1212                 
1213                 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1214                 
1215                         ProcessData.Append(";ALTID=");
1216                         ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1217                         
1218                 }
1219                 
1220                 // Check if there is a value for MEDIATYPE.
1221                 
1222                 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1223                 
1224                         ProcessData.Append(";MEDIATYPE=");
1225                         ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1226                         
1227                 }
1228                 
1229                 // Check if there is a value for PID.
1231                 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1232                 
1233                         ProcessData.Append(";PID=");
1234                         ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1235                         
1236                 }
1238                 // Check if there is a value for PREF.
1240                 if ((*GeographyListPref)[GeographyIter->first] > 0){
1241                 
1242                         ProcessData.Append(";PREF=");
1243                         ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1244                         
1245                 }
1247                 // Check if there is a value for tokens.
1249                 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1250                 
1251                         ProcessData.Append(";");
1252                         ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1253                         
1254                 }
1255                         
1256                 ProcessData.Append(":");
1257                 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1258                 ProcessData.Append(":");
1259                 ProcessData.Append(GeographyIter->second);
1260                 ProcessData.Append("\n");
1262                 ProcessData = OutputText(&ProcessData);
1263                         
1264                 SaveData->Append(ProcessData);
1265                 ProcessData.clear();
1266                         
1267         }
1268                 
1271 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID, 
1272                 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1273                 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref, 
1274                 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1276         wxString ProcessData = "";
1277         
1278         for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1279                 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1281                 ProcessData.Append("URL");
1282                         
1283                 // Check if there is a value for TYPE.
1284                 
1285                 if (DataType.size() > 0){
1286                 
1287                         ProcessData.Append(";TYPE=");
1288                         ProcessData.Append(DataType);
1289                         
1290                 }
1291                 
1292                 // Check if there is a value for ALTID.
1293                 
1294                 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1295                 
1296                         ProcessData.Append(";ALTID=");
1297                         ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1298                         
1299                 }
1300                 
1301                 // Check if there is a value for MEDIATYPE.
1302                 
1303                 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1304                 
1305                         ProcessData.Append(";MEDIATYPE=");
1306                         ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1307                         
1308                 }
1309                 
1310                 // Check if there is a value for PID.
1312                 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1313                 
1314                         ProcessData.Append(";PID=");
1315                         ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1316                         
1317                 }
1319                 // Check if there is a value for PREF.
1321                 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1322                 
1323                         ProcessData.Append(";PREF=");
1324                         ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1325                         
1326                 }
1328                 // Check if there is a value for tokens.
1330                 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1331                 
1332                         ProcessData.Append(";");
1333                         ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1334                         
1335                 }
1336                         
1337                 ProcessData.Append(":");
1338                 ProcessData.Append(WebsiteIter->second);
1339                 ProcessData.Append("\n");
1341                 ProcessData = OutputText(&ProcessData);
1342                         
1343                 SaveData->Append(ProcessData);
1344                 ProcessData.clear();
1345                         
1346         }
1347                         
1350 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1351         map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1352         map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1353         map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1355         wxString ProcessData = "";
1356                 
1357         for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1358                 RoleIter != RoleList->end(); RoleIter++){
1360                 ProcessData.Append("ROLE");
1361                         
1362                 // Check if there is a value for TYPE.
1363                 
1364                 if (DataType.size() > 0){
1365                 
1366                         ProcessData.Append(";TYPE=");
1367                         ProcessData.Append(DataType);
1368                         
1369                 }
1370                 
1371                 // Check if there is a value for ALTID.
1372                 
1373                 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1374                 
1375                         ProcessData.Append(";ALTID=");
1376                         ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1377                         
1378                 }
1380                 // Check if there is a value for LANGUAGE.
1381                 
1382                 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1383                 
1384                         ProcessData.Append(";LANGUAGE=");
1385                         ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1386                         
1387                 }
1388                 
1389                 // Check if there is a value for PID.
1391                 if ((*RoleListPID)[RoleIter->first].size() > 0){
1392                 
1393                         ProcessData.Append(";PID=");
1394                         ProcessData.Append((*RoleListPID)[RoleIter->first]);
1395                         
1396                 }
1398                 // Check if there is a value for PREF.
1400                 if ((*RoleListPref)[RoleIter->first] > 0){
1401                 
1402                         ProcessData.Append(";PREF=");
1403                         ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1404                         
1405                 }
1407                 // Check if there is a value for tokens.
1409                 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1410                 
1411                         ProcessData.Append(";");
1412                         ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1413                         
1414                 }
1415                         
1416                 ProcessData.Append(":");
1417                 ProcessData.Append(RoleIter->second);
1418                 ProcessData.Append("\n");
1420                 ProcessData = OutputText(&ProcessData);
1421                 
1422                 SaveData->Append(ProcessData);
1423                 ProcessData.clear();
1424                         
1425         }
1426                 
1429 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1430         map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage, 
1431         map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType, 
1432         map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens, 
1433         wxString *SaveData, wxString DataType){
1435         wxString ProcessData = "";
1436                 
1437         for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1438                 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1440                 ProcessData.Append("ORG");
1441                         
1442                 // Check if there is a value for TYPE.
1443                 
1444                 if (DataType.size() > 0){
1445                 
1446                         ProcessData.Append(";TYPE=");
1447                         ProcessData.Append(DataType);
1448                         
1449                 }
1450                 
1451                 // Check if there is a value for ALTID.
1452                 
1453                 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1454                 
1455                         ProcessData.Append(";ALTID=");
1456                         ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1457                         
1458                 }
1460                 // Check if there is a value for LANGUAGE.
1461                 
1462                 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1463                 
1464                         ProcessData.Append(";LANGUAGE=");
1465                         ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1466                         
1467                 }
1468                 
1469                 // Check if there is a value for PID.
1471                 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1472                 
1473                         ProcessData.Append(";PID=");
1474                         ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1475                         
1476                 }
1478                 // Check if there is a value for PREF.
1480                 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1481                 
1482                         ProcessData.Append(";PREF=");
1483                         ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1484                         
1485                 }
1486                 
1487                 // Check if there is a value for SORT-AS.
1488                 
1489                 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1490                 
1491                         ProcessData.Append(";SORT-AS=\"");
1492                         ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1493                         ProcessData.Append("\"");
1494                         
1495                 }
1497                 // Check if there is a value for tokens.
1499                 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1500                 
1501                         ProcessData.Append(";");
1502                         ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1503                         
1504                 }
1505                         
1506                 ProcessData.Append(":");
1507                 ProcessData.Append(OrganisationIter->second);
1508                 ProcessData.Append("\n");
1510                 ProcessData = OutputText(&ProcessData);
1511                 
1512                 SaveData->Append(ProcessData);
1513                 ProcessData.clear();
1514                         
1515         }
1516                 
1519 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1520         map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1521         map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1522         map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1524         wxString ProcessData = "";
1525                 
1526         for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1527                 NoteIter != NoteList->end(); NoteIter++){
1529                 ProcessData.Append("NOTE");
1530                         
1531                 // Check if there is a value for TYPE.
1532                 
1533                 if (DataType.size() > 0){
1534                 
1535                         ProcessData.Append(";TYPE=");
1536                         ProcessData.Append(DataType);
1537                         
1538                 }
1539                 
1540                 // Check if there is a value for ALTID.
1541                 
1542                 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1543                 
1544                         ProcessData.Append(";ALTID=");
1545                         ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1546                         
1547                 }
1549                 // Check if there is a value for LANGUAGE.
1550                 
1551                 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1552                 
1553                         ProcessData.Append(";LANGUAGE=");
1554                         ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1555                         
1556                 }
1557                 
1558                 // Check if there is a value for PID.
1560                 if ((*NoteListPID)[NoteIter->first].size() > 0){
1561                 
1562                         ProcessData.Append(";PID=");
1563                         ProcessData.Append((*NoteListPID)[NoteIter->first]);
1564                         
1565                 }
1567                 // Check if there is a value for PREF.
1569                 if ((*NoteListPref)[NoteIter->first] > 0){
1570                 
1571                         ProcessData.Append(";PREF=");
1572                         ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1573                         
1574                 }
1576                 // Check if there is a value for tokens.
1578                 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1579                 
1580                         ProcessData.Append(";");
1581                         ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1582                         
1583                 }
1584                         
1585                 ProcessData.Append(":");
1586                 ProcessData.Append(NoteIter->second);
1587                 ProcessData.Replace("\n", "\\n", true);
1588                 ProcessData.Append("\n");
1590                 ProcessData = OutputText(&ProcessData);
1591                 
1592                 SaveData->Append(ProcessData);
1593                 ProcessData.clear();
1594                         
1595         }
1596                 
1599 void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
1600         map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
1601         map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
1602         map<int, wxString> *CategoryListTokens, wxString *SaveData){
1604         wxString ProcessData = "";
1605                 
1606         for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
1607                 CategoryIter != CategoryList->end(); CategoryIter++){
1609                 ProcessData.Append("CATEGORIES");
1610                         
1611                 // Check if there is a value for TYPE.
1612                 
1613                 if ((*CategoryListType)[CategoryIter->first].size() > 0){
1614                 
1615                         ProcessData.Append(";TYPE=");
1616                         ProcessData.Append((*CategoryListType)[CategoryIter->first]);
1617                         
1618                 }
1619                 
1620                 // Check if there is a value for ALTID.
1621                 
1622                 if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
1623                 
1624                         ProcessData.Append(";ALTID=");
1625                         ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
1626                         
1627                 }
1629                 // Check if there is a value for LANGUAGE.
1630                 
1631                 if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
1632                 
1633                         ProcessData.Append(";LANGUAGE=");
1634                         ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
1635                         
1636                 }
1637                 
1638                 // Check if there is a value for PID.
1640                 if ((*CategoryListPID)[CategoryIter->first].size() > 0){
1641                 
1642                         ProcessData.Append(";PID=");
1643                         ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
1644                         
1645                 }
1647                 // Check if there is a value for PREF.
1649                 if ((*CategoryListPref)[CategoryIter->first] > 0){
1650                 
1651                         ProcessData.Append(";PREF=");
1652                         ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
1653                         
1654                 }
1656                 // Check if there is a value for tokens.
1658                 if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
1659                 
1660                         ProcessData.Append(";");
1661                         ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
1662                         
1663                 }
1664                         
1665                 ProcessData.Append(":");
1666                 ProcessData.Append(CategoryIter->second);
1667                 ProcessData.Append("\n");
1669                 ProcessData = OutputText(&ProcessData);
1670                 
1671                 SaveData->Append(ProcessData);
1672                 ProcessData.clear();
1673                         
1674         }
1675                 
1678 void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID, 
1679                 map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
1680                 map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
1681                 map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
1682                 map<int, wxString> *PicturesListTokens, wxString *SaveData){
1684         wxString ProcessData = "";
1685                 
1686         for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
1687                 PicturesIter != PicturesList->end(); PicturesIter++){
1689                 ProcessData.Append("PHOTO");
1690                         
1691                 // Check if there is a value for TYPE.
1692                 
1693                 if ((*PicturesListType)[PicturesIter->first].size() > 0){
1694                 
1695                         ProcessData.Append(";TYPE=");
1696                         ProcessData.Append((*PicturesListType)[PicturesIter->first]);
1697                         
1698                 }
1699                 
1700                 // Check if there is a value for ALTID.
1701                 
1702                 if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
1703                 
1704                         ProcessData.Append(";ALTID=");
1705                         ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
1706                         
1707                 }
1709                 // Check if there is a value for MEDIATYPE..
1710                 
1711                 if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
1712                 
1713                         ProcessData.Append(";MEDIATYPE=");
1714                         ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
1715                         
1716                 }
1717                 
1718                 // Check if there is a value for PID.
1720                 if ((*PicturesListPID)[PicturesIter->first].size() > 0){
1721                 
1722                         ProcessData.Append(";PID=");
1723                         ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
1724                         
1725                 }
1727                 // Check if there is a value for PREF.
1729                 if ((*PicturesListPref)[PicturesIter->first] > 0){
1730                 
1731                         ProcessData.Append(";PREF=");
1732                         ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
1733                         
1734                 }
1736                 // Check if there is a value for tokens.
1738                 if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
1739                 
1740                         ProcessData.Append(";");
1741                         ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
1742                         
1743                 }
1744                 
1745                 ProcessData.Append(":data:");
1746                 ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
1747                 ProcessData.Append(";");
1748                 ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
1749                 ProcessData.Append(",");
1750                 ProcessData.Append(PicturesIter->second);
1751                 ProcessData.Append("\n");
1753                 ProcessData = OutputText(&ProcessData);
1754                 
1755                 SaveData->Append(ProcessData);
1756                 ProcessData.clear();
1757                         
1758         }
1759                         
1762 void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID, 
1763         map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
1764         map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
1765         map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
1766         map<int, wxString> *LogosListTokens, wxString *SaveData){
1768         wxString ProcessData = "";
1769                 
1770         for (std::map<int, string>::iterator LogosIter = LogosList->begin();
1771                 LogosIter != LogosList->end(); LogosIter++){
1773                 ProcessData.Append("LOGO");
1774                         
1775                 // Check if there is a value for TYPE.
1776                 
1777                 if ((*LogosListType)[LogosIter->first].size() > 0){
1778                 
1779                         ProcessData.Append(";TYPE=");
1780                         ProcessData.Append((*LogosListType)[LogosIter->first]);
1781                         
1782                 }
1783                 
1784                 // Check if there is a value for ALTID.
1785                 
1786                 if ((*LogosListAltID)[LogosIter->first].size() > 0){
1787                 
1788                         ProcessData.Append(";ALTID=");
1789                         ProcessData.Append((*LogosListAltID)[LogosIter->first]);
1790                         
1791                 }
1793                 // Check if there is a value for MEDIATYPE..
1794                 
1795                 if ((*LogosListMediatype)[LogosIter->first].size() > 0){
1796                 
1797                         ProcessData.Append(";MEDIATYPE=");
1798                         ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
1799                         
1800                 }
1801                 
1802                 // Check if there is a value for PID.
1804                 if ((*LogosListPID)[LogosIter->first].size() > 0){
1805                 
1806                         ProcessData.Append(";PID=");
1807                         ProcessData.Append((*LogosListPID)[LogosIter->first]);
1808                         
1809                 }
1811                 // Check if there is a value for PREF.
1813                 if ((*LogosListPref)[LogosIter->first] > 0){
1814                 
1815                         ProcessData.Append(";PREF=");
1816                         ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
1817                         
1818                 }
1820                 // Check if there is a value for tokens.
1822                 if ((*LogosListTokens)[LogosIter->first].size() > 0){
1823                 
1824                         ProcessData.Append(";");
1825                         ProcessData.Append((*LogosListTokens)[LogosIter->first]);
1826                         
1827                 }
1828                 
1829                 ProcessData.Append(":data:");
1830                 ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
1831                 ProcessData.Append(";");
1832                 ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
1833                 ProcessData.Append(",");
1834                 ProcessData.Append(LogosIter->second);
1835                 ProcessData.Append("\n");
1837                 ProcessData = OutputText(&ProcessData);
1838                 
1839                 SaveData->Append(ProcessData);
1840                 ProcessData.clear();
1841                         
1842         }
1843                 
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