Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added NOTE 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         // Write the end part of the vCard data file.
564         
565         SaveData->Append("END:VCARD");
566         
567         SaveDataStatus = CONTACTSAVE_OK;
568         
569         return SaveDataStatus;
570         
573 void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
574         map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
575         map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
576         map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
578         wxString ProcessData = "";
579                 
580         for (std::map<int, wxString>::iterator TitleIter = TitleList->begin();
581                 TitleIter != TitleList->end(); TitleIter++){
583                 ProcessData.Append("TITLE");
584                         
585                 // Check if there is a value for TYPE.
586                 
587                 if (DataType.size() > 0){
588                 
589                         ProcessData.Append(";TYPE=");
590                         ProcessData.Append(DataType);
591                         
592                 }
593                 
594                 // Check if there is a value for ALTID.
595                 
596                 if ((*TitleListAltID)[TitleIter->first].size() > 0){
597                 
598                         ProcessData.Append(";ALTID=");
599                         ProcessData.Append((*TitleListAltID)[TitleIter->first]);
600                         
601                 }
603                 // Check if there is a value for LANGUAGE.
604                 
605                 if ((*TitleListLanguage)[TitleIter->first].size() > 0){
606                 
607                         ProcessData.Append(";LANGUAGE=");
608                         ProcessData.Append((*TitleListLanguage)[TitleIter->first]);
609                         
610                 }
611                 
612                 // Check if there is a value for PID.
614                 if ((*TitleListPID)[TitleIter->first].size() > 0){
615                 
616                         ProcessData.Append(";PID=");
617                         ProcessData.Append((*TitleListPID)[TitleIter->first]);
618                         
619                 }
621                 // Check if there is a value for PREF.
623                 if ((*TitleListPref)[TitleIter->first] > 0){
624                 
625                         ProcessData.Append(";PREF=");
626                         ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first]));
627                         
628                 }
630                 // Check if there is a value for tokens.
632                 if ((*TitleListTokens)[TitleIter->first].size() > 0){
633                 
634                         ProcessData.Append(";");
635                         ProcessData.Append((*TitleListTokens)[TitleIter->first]);
636                         
637                 }
638                         
639                 ProcessData.Append(":");
640                 ProcessData.Append(TitleIter->second);
641                 ProcessData.Append("\n");
643                 ProcessData = OutputText(&ProcessData);
644                         
645                 SaveData->Append(ProcessData);
646                 ProcessData.clear();
647                         
648         }
649                 
652 void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID, 
653         map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
654         map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref, 
655         map<int, wxString> *SourceListTokens, wxString *SaveData){
657         wxString ProcessData = "";
658         
659         for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
660                 SourceIter != SourceList->end(); SourceIter++){
662                 ProcessData.Append("SOURCE");
663                         
664                 // Check if there is a value for TYPE.
665                 
666                 if ((*SourceListType)[SourceIter->first].size() > 0){
667                 
668                         ProcessData.Append(";TYPE=");
669                         ProcessData.Append((*SourceListType)[SourceIter->first]);
670                         
671                 }
672                 
673                 // Check if there is a value for ALTID.
674                 
675                 if ((*SourceListAltID)[SourceIter->first].size() > 0){
676                 
677                         ProcessData.Append(";ALTID=");
678                         ProcessData.Append((*SourceListAltID)[SourceIter->first]);
679                         
680                 }
682                 // Check if there is a value for MEDIATYPE.
683                 
684                 if ((*SourceListMediatype)[SourceIter->first].size() > 0){
685                 
686                         ProcessData.Append(";MEDIATYPE=");
687                         ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
688                         
689                 }
690                 
691                 // Check if there is a value for PID.
693                 if ((*SourceListPID)[SourceIter->first].size() > 0){
694                 
695                         ProcessData.Append(";PID=");
696                         ProcessData.Append((*SourceListPID)[SourceIter->first]);
697                         
698                 }
700                 // Check if there is a value for PREF.
702                 if ((*SourceListPref)[SourceIter->first] > 0){
703                 
704                         ProcessData.Append(";PREF=");
705                         ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
706                         
707                 }
709                 // Check if there is a value for tokens.
711                 if ((*SourceListTokens)[SourceIter->first].size() > 0){
712                 
713                         ProcessData.Append(";");
714                         ProcessData.Append((*SourceListTokens)[SourceIter->first]);
715                         
716                 }
717                         
718                 ProcessData.Append(":");
719                 ProcessData.Append(SourceIter->second);
720                 ProcessData.Append("\n");
722                 ProcessData = OutputText(&ProcessData);
723                         
724                 SaveData->Append(ProcessData);
725                 ProcessData.clear();
726                         
727         }
728                 
731 void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID, 
732         map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
733         map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref, 
734         map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
736         wxString ProcessData = "";
737         
738         for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
739                 NicknameIter != NicknameList->end(); NicknameIter++){
741                 ProcessData.Append("NICKNAME");
742                         
743                 // Check if there is a value for TYPE.
744                 
745                 if (DataType.size() > 0){
746                 
747                         ProcessData.Append(";TYPE=");
748                         ProcessData.Append(DataType);
749                         
750                 }
751                 
752                 // Check if there is a value for ALTID.
753                 
754                 if ((*NicknameListAltID)[NicknameIter->first].size() > 0){
755                 
756                         ProcessData.Append(";ALTID=");
757                         ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
758                         
759                 }
761                 // Check if there is a value for MEDIATYPE.
762                 
763                 if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
764                 
765                         ProcessData.Append(";LANGUAGE=");
766                         ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
767                         
768                 }
769                 
770                 // Check if there is a value for PID.
772                 if ((*NicknameListPID)[NicknameIter->first].size() > 0){
773                 
774                         ProcessData.Append(";PID=");
775                         ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
776                         
777                 }
779                 // Check if there is a value for PREF.
781                 if ((*NicknameListPref)[NicknameIter->first] > 0){
782                 
783                         ProcessData.Append(";PREF=");
784                         ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
785                         
786                 }
788                 // Check if there is a value for tokens.
790                 if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
791                 
792                         ProcessData.Append(";");
793                         ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
794                         
795                 }
796                         
797                 ProcessData.Append(":");
798                 ProcessData.Append(NicknameIter->second);
799                 ProcessData.Append("\n");
801                 ProcessData = OutputText(&ProcessData);
802                         
803                 SaveData->Append(ProcessData);
804                 ProcessData.clear();
805                         
806         }
807                 
810 void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID, 
811         map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
812         map<int, wxString> *TZListMediatype, map<int, int> *TZListPref, 
813         map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
815         wxString ProcessData = "";
816         
817         for (std::map<int, wxString>::iterator TZIter = TZList->begin();
818                 TZIter != TZList->end(); TZIter++){
820                 ProcessData.Append("TZ");
821                         
822                 // Check if there is a value for TYPE.
823                 
824                 if (DataType.size() > 0){
825                 
826                         ProcessData.Append(";TYPE=");
827                         ProcessData.Append(DataType);
828                         
829                 }
830                 
831                 // Check if there is a value for ALTID.
832                 
833                 if ((*TZListAltID)[TZIter->first].size() > 0){
834                 
835                         ProcessData.Append(";ALTID=");
836                         ProcessData.Append((*TZListAltID)[TZIter->first]);
837                         
838                 }
840                 // Check if there is a value for MEDIATYPE.
841                 
842                 if ((*TZListMediatype)[TZIter->first].size() > 0){
843                 
844                         ProcessData.Append(";MEDIATYPE=");
845                         ProcessData.Append((*TZListMediatype)[TZIter->first]);
846                         
847                 }
848                 
849                 // Check if there is a value for PID.
851                 if ((*TZListPID)[TZIter->first].size() > 0){
852                 
853                         ProcessData.Append(";PID=");
854                         ProcessData.Append((*TZListPID)[TZIter->first]);
855                         
856                 }
858                 // Check if there is a value for PREF.
860                 if ((*TZListPref)[TZIter->first] > 0){
861                 
862                         ProcessData.Append(";PREF=");
863                         ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
864                         
865                 }
867                 // Check if there is a value for tokens.
869                 if ((*TZListTokens)[TZIter->first].size() > 0){
870                 
871                         ProcessData.Append(";");
872                         ProcessData.Append((*TZListTokens)[TZIter->first]);
873                         
874                 }
875                         
876                 ProcessData.Append(":");
877                 ProcessData.Append(TZIter->second);
878                 ProcessData.Append("\n");
880                 ProcessData = OutputText(&ProcessData);
881                         
882                 SaveData->Append(ProcessData);
883                 ProcessData.clear();
884                         
885         }
886                 
889 void ContactDataObject::SaveAddress(map<int, wxString> *AddressList, map<int, wxString> *AddressListTown,
890                 map<int, wxString> *AddressListCounty, map<int, wxString> *AddressListPostCode,
891                 map<int, wxString> *AddressListCountry, map<int, wxString> *AddressListLabel,
892                 map<int, wxString> *AddressListLang, map<int, wxString> *AddressListAltID,
893                 map<int, wxString> *AddressListPID, map<int, wxString> *AddressListGeo, 
894                 map<int, wxString> *AddressListTimezone, map<int, wxString> *AddressListType, 
895                 map<int, wxString> *AddressListMediatype, map<int, int> *AddressListPref, 
896                 map<int, wxString> *AddressListTokens, wxString *SaveData, wxString DataType){
898         wxString ProcessData = "";
899                         
900         for (std::map<int, wxString>::iterator AddressIter = AddressList->begin();
901                 AddressIter != AddressList->end(); AddressIter++){
902                         
903                 ProcessData.Append("ADR");
904                         
905                 // Check if there is a value for TYPE.
906                 
907                 if (DataType.size() > 0){
908                 
909                         ProcessData.Append(";TYPE=");
910                         ProcessData.Append(DataType);
911                         
912                 }
913                 
914                 // Check if there is a value for ALTID.
915                 
916                 if ((*AddressListAltID)[AddressIter->first].size() > 0){
917                 
918                         ProcessData.Append(";ALTID=");
919                         ProcessData.Append((*AddressListAltID)[AddressIter->first]);
920                         
921                 }
923                 // Check if there is a value for GEO.
924                 
925                 if ((*AddressListGeo)[AddressIter->first].size() > 0){
926                 
927                         ProcessData.Append(";GEO=\"");
928                         ProcessData.Append((*AddressListGeo)[AddressIter->first]);
929                         ProcessData.Append("\"");
930                         
931                 }
933                 // Check if there is a value for LABEL.
935                 if ((*AddressListLabel)[AddressIter->first].size() > 0){
936                 
937                         wxString AddressProcessed = "";
938                         AddressProcessed = (*AddressListLabel)[AddressIter->first];
939                         
940                         AddressProcessed.Replace("\n", "\\n", true);
941                         
942                         ProcessData.Append(";LABEL=");
943                         ProcessData.Append(AddressProcessed);
944                         
945                 }
946                 
947                 // Check if there is a value for LANGUAGE.
948                 
949                 if ((*AddressListLang)[AddressIter->first].size() > 0){
950                 
951                         ProcessData.Append(";LANGUAGE=");
952                         ProcessData.Append((*AddressListLang)[AddressIter->first]);
953                         
954                 }
955                 
956                 // Check if there is a value for MEDIATYPE.
957                 
958                 if ((*AddressListMediatype)[AddressIter->first].size() > 0){
959                 
960                         ProcessData.Append(";MEDIATYPE=");
961                         ProcessData.Append((*AddressListMediatype)[AddressIter->first]);
962                         
963                 }
964                 
965                 // Check if there is a value for PID.
967                 if ((*AddressListPID)[AddressIter->first].size() > 0){
968                 
969                         ProcessData.Append(";PID=");
970                         ProcessData.Append((*AddressListPID)[AddressIter->first]);
971                         
972                 }
974                 // Check if there is a value for PREF.
976                 if ((*AddressListPref)[AddressIter->first] > 0){
977                 
978                         ProcessData.Append(";PREF=");
979                         ProcessData.Append(wxString::Format("%i", (*AddressListPref)[AddressIter->first]));
980                         
981                 }
983                 // Check if there is a value for TZ.
985                 if ((*AddressListTimezone)[AddressIter->first].size() > 0){
986                 
987                         ProcessData.Append(";TZ=");
988                         ProcessData.Append((*AddressListTimezone)[AddressIter->first]);
989                         
990                 }
991                 
992                 // Check if there is a value for tokens.
994                 if ((*AddressListTokens)[AddressIter->first].size() > 0){
995                 
996                         ProcessData.Append(";");
997                         ProcessData.Append((*AddressListTokens)[AddressIter->first]);
998                         
999                 }
1000                 
1001                 // Build the address.
1002                 
1003                 ProcessData.Append(":;;");
1004                 ProcessData.Append((*AddressList)[AddressIter->first]);
1005                 ProcessData.Append(";");
1006                 ProcessData.Append((*AddressListTown)[AddressIter->first]);
1007                 ProcessData.Append(";");
1008                 ProcessData.Append((*AddressListCounty)[AddressIter->first]);
1009                 ProcessData.Append(";");
1010                 ProcessData.Append((*AddressListPostCode)[AddressIter->first]);
1011                 ProcessData.Append(";");
1012                 ProcessData.Append((*AddressListCountry)[AddressIter->first]);
1013                 ProcessData.Append("\n");
1014                 
1015                 ProcessData = OutputText(&ProcessData);
1016                         
1017                 SaveData->Append(ProcessData);
1018                 ProcessData.clear();
1019                         
1020         }
1021                         
1024 void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxString> *EmailListAltID, 
1025         map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
1026         map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens, 
1027         wxString *SaveData, wxString DataType){
1029         wxString ProcessData = "";
1030         
1031         for (std::map<int, wxString>::iterator EmailIter = EmailList->begin();
1032                 EmailIter != EmailList->end(); EmailIter++){
1034                 ProcessData.Append("EMAIL");
1035                         
1036                 // Check if there is a value for TYPE.
1037                 
1038                 if (DataType.size() > 0){
1039                 
1040                         ProcessData.Append(";TYPE=");
1041                         ProcessData.Append(DataType);
1042                         
1043                 }
1044                 
1045                 // Check if there is a value for ALTID.
1046                 
1047                 if ((*EmailListAltID)[EmailIter->first].size() > 0){
1048                 
1049                         ProcessData.Append(";ALTID=");
1050                         ProcessData.Append((*EmailListAltID)[EmailIter->first]);
1051                         
1052                 }
1053                 
1054                 // Check if there is a value for PID.
1056                 if ((*EmailListPID)[EmailIter->first].size() > 0){
1057                 
1058                         ProcessData.Append(";PID=");
1059                         ProcessData.Append((*EmailListPID)[EmailIter->first]);
1060                         
1061                 }
1063                 // Check if there is a value for PREF.
1065                 if ((*EmailListPref)[EmailIter->first] > 0){
1066                 
1067                         ProcessData.Append(";PREF=");
1068                         ProcessData.Append(wxString::Format("%i", (*EmailListPref)[EmailIter->first]));
1069                         
1070                 }
1072                 // Check if there is a value for tokens.
1074                 if ((*EmailListTokens)[EmailIter->first].size() > 0){
1075                 
1076                         ProcessData.Append(";");
1077                         ProcessData.Append((*EmailListTokens)[EmailIter->first]);
1078                         
1079                 }
1080                         
1081                 ProcessData.Append(":");
1082                 ProcessData.Append(EmailIter->second);
1083                 ProcessData.Append("\n");
1085                 ProcessData = OutputText(&ProcessData);
1086                         
1087                 SaveData->Append(ProcessData);
1088                 ProcessData.clear();
1089                         
1090         }
1091                 
1094 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID, 
1095         map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
1096         map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens, 
1097         wxString *SaveData, wxString DataType){
1099         wxString ProcessData = "";
1100         
1101         for (std::map<int, wxString>::iterator LanguageIter = LanguageList->begin();
1102                 LanguageIter != LanguageList->end(); LanguageIter++){
1104                 ProcessData.Append("LANG");
1105                         
1106                 // Check if there is a value for TYPE.
1107                 
1108                 if (DataType.size() > 0){
1109                 
1110                         ProcessData.Append(";TYPE=");
1111                         ProcessData.Append(DataType);
1112                         
1113                 }
1114                 
1115                 // Check if there is a value for ALTID.
1116                 
1117                 if ((*LanguageListAltID)[LanguageIter->first].size() > 0){
1118                 
1119                         ProcessData.Append(";ALTID=");
1120                         ProcessData.Append((*LanguageListAltID)[LanguageIter->first]);
1121                         
1122                 }
1123                 
1124                 // Check if there is a value for PID.
1126                 if ((*LanguageListPID)[LanguageIter->first].size() > 0){
1127                 
1128                         ProcessData.Append(";PID=");
1129                         ProcessData.Append((*LanguageListPID)[LanguageIter->first]);
1130                         
1131                 }
1133                 // Check if there is a value for PREF.
1135                 if ((*LangaugeListPref)[LanguageIter->first] > 0){
1136                 
1137                         ProcessData.Append(";PREF=");
1138                         ProcessData.Append(wxString::Format("%i", (*LangaugeListPref)[LanguageIter->first]));
1139                         
1140                 }
1142                 // Check if there is a value for tokens.
1144                 if ((*LanguageListTokens)[LanguageIter->first].size() > 0){
1145                 
1146                         ProcessData.Append(";");
1147                         ProcessData.Append((*LanguageListTokens)[LanguageIter->first]);
1148                         
1149                 }
1150                         
1151                 ProcessData.Append(":");
1152                 ProcessData.Append(LanguageIter->second);
1153                 ProcessData.Append("\n");
1155                 ProcessData = OutputText(&ProcessData);
1156                         
1157                 SaveData->Append(ProcessData);
1158                 ProcessData.clear();
1159                         
1160         }
1161                 
1164 void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<int, wxString> *GeographyListAltID, 
1165         map<int, wxString> *GeographyListPID, map<int, wxString> *GeographyListType,
1166         map<int, wxString> *GeographyListMediatype, map<int, wxString> *GeographyListDataType,
1167         map<int, int> *GeographyListPref, map<int, wxString> *GeographyListTokens, 
1168         wxString *SaveData, wxString DataType){
1170         wxString ProcessData = "";
1171         
1172         for (std::map<int, wxString>::iterator GeographyIter = GeographyList->begin();
1173                 GeographyIter != GeographyList->end(); GeographyIter++){
1175                 ProcessData.Append("GEO");
1176                         
1177                 // Check if there is a value for TYPE.
1178                 
1179                 if (DataType.size() > 0){
1180                 
1181                         ProcessData.Append(";TYPE=");
1182                         ProcessData.Append(DataType);
1183                         
1184                 }
1185                 
1186                 // Check if there is a value for ALTID.
1187                 
1188                 if ((*GeographyListAltID)[GeographyIter->first].size() > 0){
1189                 
1190                         ProcessData.Append(";ALTID=");
1191                         ProcessData.Append((*GeographyListAltID)[GeographyIter->first]);
1192                         
1193                 }
1194                 
1195                 // Check if there is a value for MEDIATYPE.
1196                 
1197                 if ((*GeographyListMediatype)[GeographyIter->first].size() > 0){
1198                 
1199                         ProcessData.Append(";MEDIATYPE=");
1200                         ProcessData.Append((*GeographyListMediatype)[GeographyIter->first]);
1201                         
1202                 }
1203                 
1204                 // Check if there is a value for PID.
1206                 if ((*GeographyListPID)[GeographyIter->first].size() > 0){
1207                 
1208                         ProcessData.Append(";PID=");
1209                         ProcessData.Append((*GeographyListPID)[GeographyIter->first]);
1210                         
1211                 }
1213                 // Check if there is a value for PREF.
1215                 if ((*GeographyListPref)[GeographyIter->first] > 0){
1216                 
1217                         ProcessData.Append(";PREF=");
1218                         ProcessData.Append(wxString::Format("%i", (*GeographyListPref)[GeographyIter->first]));
1219                         
1220                 }
1222                 // Check if there is a value for tokens.
1224                 if ((*GeographyListTokens)[GeographyIter->first].size() > 0){
1225                 
1226                         ProcessData.Append(";");
1227                         ProcessData.Append((*GeographyListTokens)[GeographyIter->first]);
1228                         
1229                 }
1230                         
1231                 ProcessData.Append(":");
1232                 ProcessData.Append((*GeographyListDataType)[GeographyIter->first]);
1233                 ProcessData.Append(":");
1234                 ProcessData.Append(GeographyIter->second);
1235                 ProcessData.Append("\n");
1237                 ProcessData = OutputText(&ProcessData);
1238                         
1239                 SaveData->Append(ProcessData);
1240                 ProcessData.clear();
1241                         
1242         }
1243                 
1246 void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID, 
1247                 map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
1248                 map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref, 
1249                 map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
1251         wxString ProcessData = "";
1252         
1253         for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
1254                 WebsiteIter != WebsiteList->end(); WebsiteIter++){
1256                 ProcessData.Append("URL");
1257                         
1258                 // Check if there is a value for TYPE.
1259                 
1260                 if (DataType.size() > 0){
1261                 
1262                         ProcessData.Append(";TYPE=");
1263                         ProcessData.Append(DataType);
1264                         
1265                 }
1266                 
1267                 // Check if there is a value for ALTID.
1268                 
1269                 if ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
1270                 
1271                         ProcessData.Append(";ALTID=");
1272                         ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
1273                         
1274                 }
1275                 
1276                 // Check if there is a value for MEDIATYPE.
1277                 
1278                 if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
1279                 
1280                         ProcessData.Append(";MEDIATYPE=");
1281                         ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
1282                         
1283                 }
1284                 
1285                 // Check if there is a value for PID.
1287                 if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
1288                 
1289                         ProcessData.Append(";PID=");
1290                         ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
1291                         
1292                 }
1294                 // Check if there is a value for PREF.
1296                 if ((*WebsiteListPref)[WebsiteIter->first] > 0){
1297                 
1298                         ProcessData.Append(";PREF=");
1299                         ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
1300                         
1301                 }
1303                 // Check if there is a value for tokens.
1305                 if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
1306                 
1307                         ProcessData.Append(";");
1308                         ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
1309                         
1310                 }
1311                         
1312                 ProcessData.Append(":");
1313                 ProcessData.Append(WebsiteIter->second);
1314                 ProcessData.Append("\n");
1316                 ProcessData = OutputText(&ProcessData);
1317                         
1318                 SaveData->Append(ProcessData);
1319                 ProcessData.clear();
1320                         
1321         }
1322                         
1325 void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
1326         map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
1327         map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
1328         map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
1330         wxString ProcessData = "";
1331                 
1332         for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
1333                 RoleIter != RoleList->end(); RoleIter++){
1335                 ProcessData.Append("ROLE");
1336                         
1337                 // Check if there is a value for TYPE.
1338                 
1339                 if (DataType.size() > 0){
1340                 
1341                         ProcessData.Append(";TYPE=");
1342                         ProcessData.Append(DataType);
1343                         
1344                 }
1345                 
1346                 // Check if there is a value for ALTID.
1347                 
1348                 if ((*RoleListAltID)[RoleIter->first].size() > 0){
1349                 
1350                         ProcessData.Append(";ALTID=");
1351                         ProcessData.Append((*RoleListAltID)[RoleIter->first]);
1352                         
1353                 }
1355                 // Check if there is a value for LANGUAGE.
1356                 
1357                 if ((*RoleListLanguage)[RoleIter->first].size() > 0){
1358                 
1359                         ProcessData.Append(";LANGUAGE=");
1360                         ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
1361                         
1362                 }
1363                 
1364                 // Check if there is a value for PID.
1366                 if ((*RoleListPID)[RoleIter->first].size() > 0){
1367                 
1368                         ProcessData.Append(";PID=");
1369                         ProcessData.Append((*RoleListPID)[RoleIter->first]);
1370                         
1371                 }
1373                 // Check if there is a value for PREF.
1375                 if ((*RoleListPref)[RoleIter->first] > 0){
1376                 
1377                         ProcessData.Append(";PREF=");
1378                         ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
1379                         
1380                 }
1382                 // Check if there is a value for tokens.
1384                 if ((*RoleListTokens)[RoleIter->first].size() > 0){
1385                 
1386                         ProcessData.Append(";");
1387                         ProcessData.Append((*RoleListTokens)[RoleIter->first]);
1388                         
1389                 }
1390                         
1391                 ProcessData.Append(":");
1392                 ProcessData.Append(RoleIter->second);
1393                 ProcessData.Append("\n");
1395                 ProcessData = OutputText(&ProcessData);
1396                 
1397                 SaveData->Append(ProcessData);
1398                 ProcessData.clear();
1399                         
1400         }
1401                 
1404 void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, map<int, wxString> *OrganisationListAltID,
1405         map<int, wxString> *OrganisationListPID, map<int, wxString> *OrganisationListLanguage, 
1406         map<int, wxString> *OrganisationListSortAs, map<int, wxString> *OrganisationListType, 
1407         map<int, int> *OrganisationListPref, map<int, wxString> *OrganisationListTokens, 
1408         wxString *SaveData, wxString DataType){
1410         wxString ProcessData = "";
1411                 
1412         for (std::map<int, wxString>::iterator OrganisationIter = OrganisationList->begin();
1413                 OrganisationIter != OrganisationList->end(); OrganisationIter++){
1415                 ProcessData.Append("ORG");
1416                         
1417                 // Check if there is a value for TYPE.
1418                 
1419                 if (DataType.size() > 0){
1420                 
1421                         ProcessData.Append(";TYPE=");
1422                         ProcessData.Append(DataType);
1423                         
1424                 }
1425                 
1426                 // Check if there is a value for ALTID.
1427                 
1428                 if ((*OrganisationListAltID)[OrganisationIter->first].size() > 0){
1429                 
1430                         ProcessData.Append(";ALTID=");
1431                         ProcessData.Append((*OrganisationListAltID)[OrganisationIter->first]);
1432                         
1433                 }
1435                 // Check if there is a value for LANGUAGE.
1436                 
1437                 if ((*OrganisationListLanguage)[OrganisationIter->first].size() > 0){
1438                 
1439                         ProcessData.Append(";LANGUAGE=");
1440                         ProcessData.Append((*OrganisationListLanguage)[OrganisationIter->first]);
1441                         
1442                 }
1443                 
1444                 // Check if there is a value for PID.
1446                 if ((*OrganisationListPID)[OrganisationIter->first].size() > 0){
1447                 
1448                         ProcessData.Append(";PID=");
1449                         ProcessData.Append((*OrganisationListPID)[OrganisationIter->first]);
1450                         
1451                 }
1453                 // Check if there is a value for PREF.
1455                 if ((*OrganisationListPref)[OrganisationIter->first] > 0){
1456                 
1457                         ProcessData.Append(";PREF=");
1458                         ProcessData.Append(wxString::Format("%i", (*OrganisationListPref)[OrganisationIter->first]));
1459                         
1460                 }
1461                 
1462                 // Check if there is a value for SORT-AS.
1463                 
1464                 if ((*OrganisationListSortAs)[OrganisationIter->first].size() > 0){
1465                 
1466                         ProcessData.Append(";SORT-AS=\"");
1467                         ProcessData.Append((*OrganisationListSortAs)[OrganisationIter->first]);
1468                         ProcessData.Append("\"");
1469                         
1470                 }
1472                 // Check if there is a value for tokens.
1474                 if ((*OrganisationListTokens)[OrganisationIter->first].size() > 0){
1475                 
1476                         ProcessData.Append(";");
1477                         ProcessData.Append((*OrganisationListTokens)[OrganisationIter->first]);
1478                         
1479                 }
1480                         
1481                 ProcessData.Append(":");
1482                 ProcessData.Append(OrganisationIter->second);
1483                 ProcessData.Append("\n");
1485                 ProcessData = OutputText(&ProcessData);
1486                 
1487                 SaveData->Append(ProcessData);
1488                 ProcessData.clear();
1489                         
1490         }
1491                 
1494 void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
1495         map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
1496         map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
1497         map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
1499         wxString ProcessData = "";
1500                 
1501         for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
1502                 NoteIter != NoteList->end(); NoteIter++){
1504                 ProcessData.Append("NOTE");
1505                         
1506                 // Check if there is a value for TYPE.
1507                 
1508                 if (DataType.size() > 0){
1509                 
1510                         ProcessData.Append(";TYPE=");
1511                         ProcessData.Append(DataType);
1512                         
1513                 }
1514                 
1515                 // Check if there is a value for ALTID.
1516                 
1517                 if ((*NoteListAltID)[NoteIter->first].size() > 0){
1518                 
1519                         ProcessData.Append(";ALTID=");
1520                         ProcessData.Append((*NoteListAltID)[NoteIter->first]);
1521                         
1522                 }
1524                 // Check if there is a value for LANGUAGE.
1525                 
1526                 if ((*NoteListLanguage)[NoteIter->first].size() > 0){
1527                 
1528                         ProcessData.Append(";LANGUAGE=");
1529                         ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
1530                         
1531                 }
1532                 
1533                 // Check if there is a value for PID.
1535                 if ((*NoteListPID)[NoteIter->first].size() > 0){
1536                 
1537                         ProcessData.Append(";PID=");
1538                         ProcessData.Append((*NoteListPID)[NoteIter->first]);
1539                         
1540                 }
1542                 // Check if there is a value for PREF.
1544                 if ((*NoteListPref)[NoteIter->first] > 0){
1545                 
1546                         ProcessData.Append(";PREF=");
1547                         ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
1548                         
1549                 }
1551                 // Check if there is a value for tokens.
1553                 if ((*NoteListTokens)[NoteIter->first].size() > 0){
1554                 
1555                         ProcessData.Append(";");
1556                         ProcessData.Append((*NoteListTokens)[NoteIter->first]);
1557                         
1558                 }
1559                         
1560                 ProcessData.Append(":");
1561                 ProcessData.Append(NoteIter->second);
1562                 ProcessData.Replace("\n", "\\n", true);
1563                 ProcessData.Append("\n");
1565                 ProcessData = OutputText(&ProcessData);
1566                 
1567                 SaveData->Append(ProcessData);
1568                 ProcessData.clear();
1569                         
1570         }
1571                 
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