Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
boolValue and boolValue2 accidentially declared in SaveContact scope
[xestiaab/.git] / source / contacteditor / frmContactEditor-Save.cpp
1 // frmContactEditor-Save.cpp - frmContactEditor save contact subroutines.
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 "frmContactEditor.h"
20 #include "../enums.h"
21 #include "../version.h"
22 #include "../vcard/vcard.h"
23 #include "../vcard/vcard34conv.h"
24 #include "../common/textprocessing.h"
25 #include "../common/preferences.h"
26 #include "../common/uuid.h"
27 #include "../common/dirs.h"
29 void frmContactEditor::SaveContact( wxCommandEvent& event )
30 {
31     
32     // Check if Display As combo box has a value in it.
33     // Do not go any further if there is no value.
34     
35     wxString cmbDisplayAsValue = cmbDisplayAs->GetValue();
36     
37     if (cmbDisplayAsValue.IsEmpty()){
38         
39         wxMessageBox(_("Display As value cannot be left blank."), _("Display As value empty"), wxICON_ERROR);
40         return;
41         
42     }
43     
44     // Save the updated contact data.
45     
46     vCard ContactData;
47     wxString FilenameFinal;
48     bool ReplaceContact = FALSE;
49     
50     if (StartupEditMode == TRUE){
51     
52         if (cmbType->GetCurrentSelection() == 1 ||
53             cmbType->GetCurrentSelection() == 3 ||
54             cmbType->GetCurrentSelection() == 4){
55         
56             if (IsGroup == TRUE){
57             
58                 // Mark contact for replacing.
59             
60                 ReplaceContact = TRUE;
61                 IsGroup = FALSE;
62             
63             }
64         
65         } else if (cmbType->GetCurrentSelection() == 2){
66         
67                 if (IsGroup == FALSE){
68             
69                 // Mark contact for replacing.
70             
71                 ReplaceContact = TRUE;
72                 IsGroup = TRUE;
73             
74             }
75         
76         }
77     
78         if (ReplaceContact == TRUE){
79         
80             wxString wxDelSplitFilename;
81             wxString wxDelFinalFilename;
82             wxString wxSDelDataURL;
83             wxStringTokenizer wSTDelFilename(wxSContactFilename, wxT("/"));
84             while(wSTDelFilename.HasMoreTokens()){
85             
86                 wxDelSplitFilename = wSTDelFilename.GetNextToken();
87             
88             }
89         
90             wxSDelDataURL = wxDelSplitFilename;
91         
92             // Delete the contact from the server as it will be useless in certain
93             // address book clients.
94         
95             ActMgrPtr->AddTask(2, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDelDataURL, wxDelSplitFilename, wxSContactFilename, wxT(""));
96         
97             // Clear the filename so the trigger to recreate the UID is done.
98         
99             wxSContactFilename.Clear();
100             EditMode = FALSE;
101         
102         }
103     
104     }
105     
106     if (wxSContactFilename.IsEmpty()){
107         
108         // Generate a random UUID.
109         
110         ContactEditorData.UIDToken = GenerateUUID();
111         ContactEditorData.UIDToken = ContactEditorData.UIDToken.MakeUpper();
112         
113         // Setup the filename.
114         
115         FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
116         
117 #if defined(__HAIKU__)
118         
119         //preffilename = wxT("noo");
120         
121 #elif defined(__WIN32__)
122         
123         FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
124         FilenameFinal.Append(ContactEditorData.UIDToken);
125         FilenameFinal.Append(wxT(".vcf"));
126         wxSContactFilename = FilenameFinal;
127         
128 #else
129         
130         FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
131         FilenameFinal.Append(ContactEditorData.UIDToken);
132         FilenameFinal.Append(wxT(".vcf"));
133         wxSContactFilename = FilenameFinal;
134         
135 #endif
136         
137     } else {
138         
139         if (ContactEditorData.UIDToken.IsEmpty()){
140             
141             // UID Token is empty. (Shouldn't be).
142             // Generate a new UID Token.
143             
144             ContactEditorData.UIDToken = GenerateUUID();
145             ContactEditorData.UIDToken = ContactEditorData.UIDToken.MakeUpper();
146             
147         }
148         
149         FilenameFinal = wxSContactFilename;
150         
151     }
152     
153     // Setup the data and write it into the account folder.
154     
155     // Begin preperations to write the contact to a file.
156     
157     bool FNFirst = TRUE;
158     bool NNGeneralFirst = TRUE;
159     bool NNHomeFirst = TRUE;
160     bool NNWorkFirst = TRUE;
161     int intFNCount = 0;
162     std::map<int,int>::iterator intiter;
163     std::map<int,wxString>::iterator striter;
164     
165     ContactData.Add(wxT("BEGIN"), wxT("VCARD"), FALSE);
166     ContactData.Add(wxT("VERSION"), wxT("4.0"), FALSE);
167     
168     // Setup the version string.
169     
170     strValue.Append(wxT("-//Xestia//Address Book Version "));
171     strValue.Append(wxT(XSDAB_VERSION));
172     strValue.Append(wxT("//KW"));
173     
174     ContactData.Add(wxT("PRODID"), strValue, FALSE);
175     
176     // Setup the name.
177     
178     strValue.Clear();
179     
180     // Setup the name field.
181     
182     strValue = txtSurname->GetValue() + wxT(";") +
183     txtForename->GetValue() + wxT(";") +
184     txtOtherNames->GetValue() + wxT(";") +
185     txtTitle->GetValue() + wxT(";") +
186     txtSuffix->GetValue();
187     
188     strValue2 = ContactData.Convert(cmbDisplayAs->GetValue(), FALSE);
189     strValue2.Trim();
190     
191     if (ContactEditorData.NameTokens.IsEmpty()){
192         ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\""), strValue, FALSE);
193     } else {
194         ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\";") + ContactEditorData.NameTokens, strValue, FALSE);
195     }
196     
197     if (cmbType->GetCurrentSelection() == 1){
198         
199         ContactData.AddRaw(wxT("KIND"), wxT("individual"));
200         
201     } else if (cmbType->GetCurrentSelection() == 2){
202         
203         ContactData.AddRaw(wxT("KIND"), wxT("group"));
204         
205         // Go through each of the members and write them out.
206         
207         for (std::map<int, wxString>::iterator itemiter = ContactEditorData.GroupsList.begin();
208              itemiter != ContactEditorData.GroupsList.end(); ++itemiter){
209             
210             ContactData.Add(wxT("MEMBER:urn:uuid"), itemiter->second, FALSE);
211             
212         }
213         
214     } else if (cmbType->GetCurrentSelection() == 3){
215         
216         ContactData.AddRaw(wxT("KIND"), wxT("org"));
217         
218     } else if (cmbType->GetCurrentSelection() == 4){
219         
220         ContactData.AddRaw(wxT("KIND"), wxT("location"));
221         
222     }
223     
224     
225     // Setup the nicknames (General, Home & Business).
226     
227     strValue.Clear();
228     strValue2.Clear();
229     strValue3.Clear();
230     
231     boolValue = FALSE;
232     boolValue2 = FALSE;
233     intValue2 = 0;
234     intValue  = 0;
235     
236     // Setup the gender.
237     
238     if (cmbGender->GetCurrentSelection() != 0){
239         
240         switch(cmbGender->GetCurrentSelection()){
241                 
242             case 1:
243                 
244                 strValue = wxT("M");
245                 break;
246                 
247             case 2:
248                 
249                 strValue = wxT("F");
250                 break;
251                 
252             case 3:
253                 
254                 strValue = wxT("O");
255                 break;
256                 
257             case 4:
258                 
259                 strValue = wxT("N");
260                 break;
261                 
262             case 5:
263                 
264                 strValue = wxT("U");
265                 break;
266                 
267         }
268         
269     }
270     
271     if (!txtGenderDescription->IsEmpty()){
272         
273         strValue2 = txtGenderDescription->GetValue();
274         
275     }
276     
277     if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
278         
279         EscapeString(&strValue2, FALSE);
280         
281         if (!ContactEditorData.GenderTokens.IsEmpty()){
282             
283             if (!strValue2.IsEmpty()){
284                 
285                 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue + wxT(";") + strValue2);
286                 
287             } else {
288                 
289                 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue);
290                 
291             }
292             
293         } else {
294             
295             if (!strValue2.IsEmpty()){
296                 
297                 ContactData.AddRaw(wxT("GENDER"), strValue + wxT(";") + strValue2);
298                 
299             } else {
300                 
301                 ContactData.AddRaw(wxT("GENDER"), strValue);
302                 
303             }
304             
305         }
306         
307     }
308     
309     strValue.Clear();
310     strValue2.Clear();
311     strValue3.Clear();
312     
313     boolValue = FALSE;
314     boolValue2 = FALSE;
315     intValue2 = 0;
316     intValue  = 0;
317     
318     // Process Label.
319     
320     strValue3 = ContactEditorData.BirthdayAltID;
321     
322     if (!strValue3.IsEmpty()){
323         
324         strValue3.Trim();
325         strValue3.Trim();
326         boolValue2 = TRUE;
327         strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
328         
329         boolValue = TRUE;
330         
331     }
332     
333     //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
334     //strValue2 =
335     
336     // Process Language.
337     
338     strValue3 = ContactEditorData.BirthdayCalScale;
339     
340     if (!strValue3.IsEmpty()){
341         
342         strValue3.Trim();
343         strValue3.Trim();
344         
345         if (boolValue2 == TRUE){
346             
347             strValue2.Append(wxT(";"));
348             
349         } else {
350             
351             boolValue2 = TRUE;
352             
353         }
354         
355         strValue2.Append(wxT("CALSCALE=") + strValue3);
356         
357         boolValue = TRUE;
358         
359     }
360     
361     // Process Tokens.
362     
363     strValue2 = ContactEditorData.BirthdayTokens;
364     
365     // Get the birthday and write it.
366     
367     ResetSaveProcessData();
368     
369     if (!txtBirthday->IsEmpty()){
370         
371         strValue = txtBirthday->GetValue();
372         
373         if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
374             
375             if (!strValue2.IsEmpty()){
376                 
377                 EscapeString(&strValue2, FALSE);
378                 EscapeString(&strValue, FALSE);
379                 
380                 ContactData.AddRaw(wxT("BDAY;VALUE=text;") + strValue2 + wxT(";"), strValue);
381                 
382             } else {
383                 
384                 EscapeString(&strValue, FALSE);
385                 
386                 ContactData.AddRaw(wxT("BDAY;VALUE=text"), strValue);
387                 
388             }
389             
390         }
391         
392     } else {
393         
394         // Deal with date.
395         
396         // Get Day, Month & Year.
397         
398         wxDateTime BirthdayDate;
399         wxDateTime::Month BirthdayMonth;
400         int BirthdayDay;
401         int BirthdayYear;
402         wxString DataBeforeT;
403         wxString DataAfterT;
404         wxString FinalBirthdayString;
405         bool ProcessDataAfterT = FALSE;
406         
407         BirthdayDate = dapBirthday->GetValue();
408         
409         if (BirthdayDate.IsValid()){
410             
411             BirthdayDay = BirthdayDate.GetDay();
412             BirthdayMonth = BirthdayDate.GetMonth();
413             BirthdayYear = BirthdayDate.GetYear();
414             
415             // Look for T and replace data before this.
416             
417             wxStringTokenizer wSTDate(ContactEditorData.Birthday, wxT("T"));
418             
419             while (wSTDate.HasMoreTokens()){
420                 
421                 if (ProcessDataAfterT == FALSE){
422                     
423                     DataBeforeT = wSTDate.GetNextToken();
424                     ProcessDataAfterT = TRUE;
425                     
426                 } else {
427                     
428                     DataAfterT = wSTDate.GetNextToken();
429                     break;
430                     
431                 }
432                 
433             }
434             
435             // If there is not T then replace altogether.
436             
437             wxString FinalBirthdayDay;
438             wxString FinalBirthdayMonth;
439             wxString FinalBirthdayYear;
440             
441             if (BirthdayDay < 10){
442                 
443                 FinalBirthdayDay = wxT("0") + wxString::Format(wxT("%i"), BirthdayDay);
444                 
445             } else {
446                 
447                 FinalBirthdayDay = wxString::Format(wxT("%i"), BirthdayDay);
448                 
449             }
450             
451             if (((int)BirthdayMonth + 1) < 10){
452                 
453                 FinalBirthdayMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
454                 
455             } else {
456                 
457                 FinalBirthdayMonth = wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
458                 
459             }
460             
461             if (BirthdayYear == 0){
462                 
463                 FinalBirthdayYear = wxT("--");
464                 
465             } else {
466                 
467                 FinalBirthdayYear = wxString::Format(wxT("%i"), BirthdayYear);
468                 
469             }
470             
471             if (!DataAfterT.IsEmpty()){
472                 
473                 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay + wxT("T") + DataAfterT;
474                 
475             } else {
476                 
477                 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay;
478                 
479             }
480             
481             if (!FinalBirthdayString.IsEmpty() || !strValue2.IsEmpty()){
482                 
483                 if (!strValue2.IsEmpty()){
484                     
485                     EscapeString(&strValue2, FALSE);
486                     EscapeString(&strValue, FALSE);
487                     
488                     ContactData.AddRaw(wxT("BDAY") + strValue2 + wxT(";"), FinalBirthdayString);
489                     
490                 } else {
491                     
492                     EscapeString(&strValue, FALSE);
493                     
494                     ContactData.AddRaw(wxT("BDAY"), FinalBirthdayString);
495                     
496                 }
497                 
498             }
499             
500         }
501         
502     }
503     
504     ResetSaveProcessData();
505     
506     // Process Label.
507     
508     strValue3 = ContactEditorData.AnniversaryAltID;
509     
510     if (!strValue3.IsEmpty()){
511         
512         strValue3.Trim();
513         strValue3.Trim();
514         boolValue2 = TRUE;
515         strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
516         
517         boolValue = TRUE;
518         
519     }
520     
521     //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
522     //strValue2 =
523     
524     // Process Language.
525     
526     strValue3 = ContactEditorData.AnniversaryCalScale;
527     
528     if (!strValue3.IsEmpty()){
529         
530         strValue3.Trim();
531         strValue3.Trim();
532         
533         if (boolValue2 == TRUE){
534             
535             strValue2.Append(wxT(";"));
536             
537         } else {
538             
539             boolValue2 = TRUE;
540             
541         }
542         
543         strValue2.Append(wxT("CALSCALE=") + strValue3);
544         
545         boolValue = TRUE;
546         
547     }
548     
549     // Process Tokens.
550     
551     strValue2 = ContactEditorData.AnniversaryTokens;
552     
553     // Deal with ANNIVERSARY.
554     
555     if (!txtAnniversary->IsEmpty()){
556         
557         strValue = txtAnniversary->GetValue();
558         
559         if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
560             
561             if (!strValue2.IsEmpty()){
562                 
563                 EscapeString(&strValue2, FALSE);
564                 EscapeString(&strValue, FALSE);
565                 
566                 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text;") + strValue2 + wxT(";"), strValue);
567                 
568             } else {
569                 
570                 EscapeString(&strValue, FALSE);
571                 
572                 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text"), strValue);
573                 
574             }
575             
576         }
577         
578     } else {
579         
580         // Look for T and replace data before this.
581         
582         // Get Day, Month & Year.
583         
584         wxDateTime AnniversaryDate;
585         wxDateTime::Month AnniversaryMonth;
586         int AnniversaryDay;
587         int AnniversaryYear;
588         wxString DataBeforeT;
589         wxString DataAfterT;
590         wxString FinalAnniversaryString;
591         bool ProcessDataAfterT = FALSE;
592         
593         AnniversaryDate = dapAnniversary->GetValue();
594         
595         if (AnniversaryDate.IsValid()){
596             
597             AnniversaryDay = AnniversaryDate.GetDay();
598             AnniversaryMonth = AnniversaryDate.GetMonth();
599             AnniversaryYear = AnniversaryDate.GetYear();
600             
601             // Look for T and replace data before this.
602             
603             wxStringTokenizer wSTDate(ContactEditorData.Anniversary, wxT("T"));
604             
605             while (wSTDate.HasMoreTokens()){
606                 
607                 if (ProcessDataAfterT == FALSE){
608                     
609                     DataBeforeT = wSTDate.GetNextToken();
610                     ProcessDataAfterT = TRUE;
611                     
612                 } else {
613                     
614                     DataAfterT = wSTDate.GetNextToken();
615                     break;
616                     
617                 }
618                 
619             }
620             
621             // If there is not T then replace altogether.
622             
623             wxString FinalAnniversaryDay;
624             wxString FinalAnniversaryMonth;
625             wxString FinalAnniversaryYear;
626             
627             if (AnniversaryDay < 10){
628                 
629                 FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
630                 
631             } else {
632                 
633                 FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
634                 
635             }
636             
637             if (((int)AnniversaryMonth + 1) < 10){
638                 
639                 FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
640                 
641             } else {
642                 
643                 FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
644                 
645             }
646             
647             if (AnniversaryYear == 0){
648                 
649                 FinalAnniversaryYear = wxT("--");
650                 
651             } else {
652                 
653                 FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
654                 
655             }
656             
657             if (!DataAfterT.IsEmpty()){
658                 
659                 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
660                 
661             } else {
662                 
663                 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
664                 
665             }
666             
667             if (!FinalAnniversaryString.IsEmpty() || !strValue2.IsEmpty()){
668                 
669                 if (!strValue2.IsEmpty()){
670                     
671                     EscapeString(&strValue2, FALSE);
672                     EscapeString(&strValue, FALSE);
673                     
674                     ContactData.AddRaw(wxT("ANNIVERSARY") + strValue2 + wxT(";"), FinalAnniversaryString);
675                     
676                 } else {
677                     
678                     EscapeString(&strValue, FALSE);
679                     
680                     ContactData.AddRaw(wxT("ANNIVERSARY"), FinalAnniversaryString);
681                     
682                 }
683                 
684             }
685             
686         }
687         
688     }
689     
690     // Setup the addresses (General, Home, Business).
691     
692     //intValue = GeneralAddressList.size();
693     ResetSaveProcessData();
694     
695     for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralAddressList.begin();
696          iter != ContactEditorData.GeneralAddressList.end(); ++iter){
697         
698         int intSeekValue = iter->first;
699         
700         wxString strAddressString;
701         wxString strAddressFinalValue;
702         std::map<int, wxString>::iterator iterValue;
703         
704         strAddressString.Append(wxT(";;"));
705         
706         // Get Address
707         
708         iterValue = ContactEditorData.GeneralAddressList.find(intSeekValue);
709         strAddressFinalValue = iterValue->second;
710         ProcessCaptureStrings(&strAddressFinalValue);
711         strAddressString.Append(strAddressFinalValue + wxT(";"));
712         strAddressFinalValue.Clear();
713         
714         // Get Town
715         
716         iterValue = ContactEditorData.GeneralAddressListTown.find(intSeekValue);
717         strAddressFinalValue = iterValue->second;
718         ProcessCaptureStrings(&strAddressFinalValue);
719         strAddressString.Append(strAddressFinalValue + wxT(";"));
720         strAddressFinalValue.Clear();
721         
722         // Get County
723         
724         iterValue = ContactEditorData.GeneralAddressListCounty.find(intSeekValue);
725         strAddressFinalValue = iterValue->second;
726         ProcessCaptureStrings(&strAddressFinalValue);
727         strAddressString.Append(strAddressFinalValue + wxT(";"));
728         strAddressFinalValue.Clear();
729         
730         // Get Post Code
731         
732         iterValue = ContactEditorData.GeneralAddressListPostCode.find(intSeekValue);
733         strAddressFinalValue = iterValue->second;
734         ProcessCaptureStrings(&strAddressFinalValue);
735         strAddressString.Append(strAddressFinalValue + wxT(";"));
736         strAddressFinalValue.Clear();
737         
738         // Get Country
739         
740         iterValue = ContactEditorData.GeneralAddressListCountry.find(intSeekValue);
741         strAddressFinalValue = iterValue->second;
742         ProcessCaptureStrings(&strAddressFinalValue);
743         strAddressString.Append(strAddressFinalValue);
744         strAddressFinalValue.Clear();
745         
746         ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
747                         &iter, &strAddressString, &ContactData,
748                         wxT("LABEL"), &ContactEditorData.GeneralAddressListLabel,
749                         wxT("LANGUAGE"), &ContactEditorData.GeneralAddressListLang,
750                         wxT("ALTID"), &ContactEditorData.GeneralAddressListAltID,
751                         wxT("PID"), &ContactEditorData.GeneralAddressListPID,
752                         wxT("GEO"), &ContactEditorData.GeneralAddressListGeo,
753                         wxT("TZ"), &ContactEditorData.GeneralAddressListTimezone,
754                         wxT("MEDIATYPE"), &ContactEditorData.GeneralAddressListMediatype,
755                         wxT("PREF"), &ContactEditorData.GeneralAddressListPref,
756                         wxT(""), &ContactEditorData.GeneralAddressListTokens );
757         
758         ResetSaveProcessData();
759         
760     }
761     
762     ResetSaveProcessData();
763     
764     for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeAddressList.begin();
765          iter != ContactEditorData.HomeAddressList.end(); ++iter){
766         
767         int intSeekValue = iter->first;
768         
769         wxString strAddressString;
770         wxString strAddressFinalValue;
771         std::map<int, wxString>::iterator iterValue;
772         
773         strAddressString.Append(wxT(";;"));
774         
775         // Get Address
776         
777         iterValue = ContactEditorData.HomeAddressList.find(intSeekValue);
778         strAddressFinalValue = iterValue->second;
779         ProcessCaptureStrings(&strAddressFinalValue);
780         strAddressString.Append(strAddressFinalValue + wxT(";"));
781         
782         // Get Town
783         
784         iterValue = ContactEditorData.HomeAddressListTown.find(intSeekValue);
785         strAddressFinalValue = iterValue->second;
786         ProcessCaptureStrings(&strAddressFinalValue);
787         strAddressString.Append(strAddressFinalValue + wxT(";"));
788         
789         // Get County
790         
791         iterValue = ContactEditorData.HomeAddressListCounty.find(intSeekValue);
792         strAddressFinalValue = iterValue->second;
793         ProcessCaptureStrings(&strAddressFinalValue);
794         strAddressString.Append(strAddressFinalValue + wxT(";"));
795         
796         // Get Post Code
797         
798         iterValue = ContactEditorData.HomeAddressListPostCode.find(intSeekValue);
799         strAddressFinalValue = iterValue->second;
800         ProcessCaptureStrings(&strAddressFinalValue);
801         strAddressString.Append(strAddressFinalValue + wxT(";"));
802         
803         // Get Country
804         
805         iterValue = ContactEditorData.HomeAddressListCountry.find(intSeekValue);
806         strAddressFinalValue = iterValue->second;
807         ProcessCaptureStrings(&strAddressFinalValue);
808         strAddressString.Append(strAddressFinalValue);
809         
810         ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
811                         &iter, &strAddressString, &ContactData,
812                         wxT("LABEL"), &ContactEditorData.HomeAddressListLabel,
813                         wxT("LANGUAGE"), &ContactEditorData.HomeAddressListLang,
814                         wxT("ALTID"), &ContactEditorData.HomeAddressListAltID,
815                         wxT("PID"), &ContactEditorData.HomeAddressListPID,
816                         wxT("GEO"), &ContactEditorData.HomeAddressListGeo,
817                         wxT("TZ"), &ContactEditorData.HomeAddressListTimezone,
818                         wxT("MEDIATYPE"), &ContactEditorData.HomeAddressListMediatype,
819                         wxT("PREF"), &ContactEditorData.HomeAddressListPref,
820                         wxT(""), &ContactEditorData.HomeAddressListTokens );
821         
822         ResetSaveProcessData();
823         
824     }
825     
826     ResetSaveProcessData();
827     
828     for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessAddressList.begin();
829          iter != ContactEditorData.BusinessAddressList.end(); ++iter){
830         
831         int intSeekValue = iter->first;
832         
833         wxString strAddressString;
834         wxString strAddressFinalValue;
835         std::map<int, wxString>::iterator iterValue;
836         
837         strAddressString.Append(wxT(";;"));
838         
839         // Get Address
840         
841         iterValue = ContactEditorData.BusinessAddressList.find(intSeekValue);
842         strAddressFinalValue = iterValue->second;
843         ProcessCaptureStrings(&strAddressFinalValue);
844         
845         strAddressString.Append(strAddressFinalValue + wxT(";"));
846         
847         // Get Town
848         
849         iterValue = ContactEditorData.BusinessAddressListTown.find(intSeekValue);
850         strAddressFinalValue = iterValue->second;
851         ProcessCaptureStrings(&strAddressFinalValue);
852         
853         strAddressString.Append(strAddressFinalValue + wxT(";"));
854         
855         // Get County
856         
857         iterValue = ContactEditorData.BusinessAddressListCounty.find(intSeekValue);
858         strAddressFinalValue = iterValue->second;
859         ProcessCaptureStrings(&strAddressFinalValue);
860         
861         strAddressString.Append(strAddressFinalValue + wxT(";"));
862         
863         // Get Post Code
864         
865         iterValue = ContactEditorData.BusinessAddressListPostCode.find(intSeekValue);
866         strAddressFinalValue = iterValue->second;
867         ProcessCaptureStrings(&strAddressFinalValue);
868         
869         strAddressString.Append(strAddressFinalValue + wxT(";"));
870         
871         // Get Country
872         
873         iterValue = ContactEditorData.BusinessAddressListCountry.find(intSeekValue);
874         strAddressFinalValue = iterValue->second;
875         ProcessCaptureStrings(&strAddressFinalValue);
876         
877         strAddressString.Append(strAddressFinalValue);
878         
879         ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
880                         &iter, &strAddressString, &ContactData,
881                         wxT("LABEL"), &ContactEditorData.BusinessAddressListLabel,
882                         wxT("LANGUAGE"), &ContactEditorData.BusinessAddressListLang,
883                         wxT("ALTID"), &ContactEditorData.BusinessAddressListAltID,
884                         wxT("PID"), &ContactEditorData.BusinessAddressListPID,
885                         wxT("GEO"), &ContactEditorData.BusinessAddressListGeo,
886                         wxT("TZ"), &ContactEditorData.BusinessAddressListTimezone,
887                         wxT("MEDIATYPE"), &ContactEditorData.BusinessAddressListMediatype,
888                         wxT("PREF"), &ContactEditorData.BusinessAddressListPref,
889                         wxT(""), &ContactEditorData.BusinessAddressListTokens );
890         
891         ResetSaveProcessData();
892         
893     }
894     
895     // Sort out nicknames (if any).
896     
897     for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNicknamesList.begin();
898          iter != ContactEditorData.GeneralNicknamesList.end(); ++iter){
899         
900         intValue2 = iter->first;
901         
902         // Process Alternative ID.
903         
904         ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
905                         &iter, &ContactEditorData.GeneralNicknamesList, &ContactData,
906                         wxT("LANGUAGE"), &ContactEditorData.GeneralNicknamesListLanguage,
907                         wxT("ALTID"), &ContactEditorData.GeneralNicknamesListAltID,
908                         wxT("PID"), &ContactEditorData.GeneralNicknamesListPID,
909                         wxT("PREF"), &ContactEditorData.GeneralNicknamesListPref,
910                         wxT(""), &ContactEditorData.GeneralNicknamesListTokens );
911         
912         ResetSaveProcessData();
913         
914     }
915     
916     ResetSaveProcessData();
917     
918     for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNicknamesList.begin();
919          iter != ContactEditorData.HomeNicknamesList.end(); ++iter){
920         
921         ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
922                         &iter, &ContactEditorData.HomeNicknamesList, &ContactData,
923                         wxT("LANGUAGE"), &ContactEditorData.HomeNicknamesListLanguage,
924                         wxT("ALTID"), &ContactEditorData.HomeNicknamesListAltID,
925                         wxT("PID"), &ContactEditorData.HomeNicknamesListPID,
926                         wxT("PREF"), &ContactEditorData.HomeNicknamesListPref,
927                         wxT(""), &ContactEditorData.HomeNicknamesListTokens );
928         
929         ResetSaveProcessData();
930         
931     }
932     
933     ResetSaveProcessData();
934     
935     for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNicknamesList.begin();
936          iter != ContactEditorData.BusinessNicknamesList.end(); ++iter){
937         
938         ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
939                         &iter, &ContactEditorData.BusinessNicknamesList, &ContactData,
940                         wxT("LANGUAGE"), &ContactEditorData.BusinessNicknamesListLanguage,
941                         wxT("ALTID"), &ContactEditorData.BusinessNicknamesListAltID,
942                         wxT("PID"), &ContactEditorData.BusinessNicknamesListPID,
943                         wxT("PREF"), &ContactEditorData.BusinessNicknamesListPref,
944                         wxT(""), &ContactEditorData.BusinessNicknamesListTokens );
945         
946         ResetSaveProcessData();
947         
948     }
949     
950     ResetSaveProcessData();
951     
952     // Sort out email (general, home and business).
953     
954     for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralEmailList.begin();
955          iter != ContactEditorData.GeneralEmailList.end(); ++iter){
956         
957         //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
958         //strValue2 =
959         
960         wxString strAddressFinalValue;
961         std::map<int, wxString>::iterator iterValue;
962         
963         ProcessSaveData(wxT("EMAIL"), &strValue2, &boolValue2, &boolValue,
964                         &iter, &ContactEditorData.GeneralEmailList, &ContactData,
965                         wxT("ALTID"), &ContactEditorData.GeneralEmailListAltID,
966                         wxT("PID"), &ContactEditorData.GeneralEmailListPID,
967                         wxT("PREF"), &ContactEditorData.GeneralEmailListPref,
968                         wxT(""), &ContactEditorData.GeneralEmailListTokens );
969         
970         ResetSaveProcessData();
971         
972     }
973     
974     ResetSaveProcessData();
975     
976     for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeEmailList.begin();
977          iter != ContactEditorData.HomeEmailList.end(); ++iter){
978         
979         //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
980         //strValue2 =
981         
982         ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
983                         &iter, &ContactEditorData.HomeEmailList, &ContactData,
984                         wxT("ALTID"), &ContactEditorData.HomeEmailListAltID,
985                         wxT("PID"), &ContactEditorData.HomeEmailListPID,
986                         wxT("PREF"), &ContactEditorData.HomeEmailListPref,
987                         wxT(""), &ContactEditorData.HomeEmailListTokens );
988         
989         ResetSaveProcessData();
990         
991     }
992     
993     ResetSaveProcessData();
994     
995     for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessEmailList.begin();
996          iter != ContactEditorData.BusinessEmailList.end(); ++iter){
997         
998         //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
999         //strValue2 =
1000         
1001         ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1002                         &iter, &ContactEditorData.BusinessEmailList, &ContactData,
1003                         wxT("ALTID"), &ContactEditorData.BusinessEmailListAltID,
1004                         wxT("PID"), &ContactEditorData.BusinessEmailListPID,
1005                         wxT("PREF"), &ContactEditorData.BusinessEmailListPref,
1006                         wxT(""), &ContactEditorData.BusinessEmailListTokens );
1007         
1008         ResetSaveProcessData();
1009         
1010     }
1011     
1012     ResetSaveProcessData();
1013     
1014     for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralIMList.begin();
1015          iter != ContactEditorData.GeneralIMList.end(); ++iter){
1016         
1017         intValue2 = iter->first;
1018         
1019         // Process Alternative ID.
1020         
1021         ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
1022                         &iter, &ContactEditorData.GeneralIMList, &ContactData,
1023                         wxT("ALTID"), &ContactEditorData.GeneralIMListAltID,
1024                         wxT("PID"), &ContactEditorData.GeneralIMListPID,
1025                         wxT("MEDIATYPE"), &ContactEditorData.GeneralIMListMediatype,
1026                         wxT("PREF"), &ContactEditorData.GeneralIMListPref,
1027                         wxT(""), &ContactEditorData.GeneralIMListTokens );
1028         
1029         ResetSaveProcessData();
1030         
1031     }
1032     
1033     ResetSaveProcessData();
1034     
1035     for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeIMList.begin();
1036          iter != ContactEditorData.HomeIMList.end(); ++iter){
1037         
1038         ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1039                         &iter, &ContactEditorData.HomeIMList, &ContactData,
1040                         wxT("ALTID"), &ContactEditorData.HomeIMListAltID,
1041                         wxT("PID"), &ContactEditorData.HomeIMListPID,
1042                         wxT("MEDIATYPE"), &ContactEditorData.HomeIMListMediatype,
1043                         wxT("PREF"), &ContactEditorData.HomeIMListPref,
1044                         wxT(""), &ContactEditorData.HomeIMListTokens );
1045         
1046         ResetSaveProcessData();
1047         
1048     }
1049     
1050     ResetSaveProcessData();
1051     
1052     for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessIMList.begin();
1053          iter != ContactEditorData.BusinessIMList.end(); ++iter){
1054         
1055         ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1056                         &iter, &ContactEditorData.BusinessIMList, &ContactData,
1057                         wxT("ALTID"), &ContactEditorData.BusinessIMListAltID,
1058                         wxT("PID"), &ContactEditorData.BusinessIMListPID,
1059                         wxT("MEDIATYPE"), &ContactEditorData.BusinessIMListMediatype,
1060                         wxT("PREF"), &ContactEditorData.BusinessIMListPref,
1061                         wxT(""), &ContactEditorData.BusinessIMListTokens );
1062         
1063         ResetSaveProcessData();
1064         
1065     }
1066     
1067     ResetSaveProcessData();
1068     
1069     for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTelephoneList.begin();
1070          iter != ContactEditorData.GeneralTelephoneList.end(); ++iter){
1071         
1072         wxString strAddressFinalValue = iter->second;
1073         
1074         ProcessCaptureStrings(&strAddressFinalValue);
1075         
1076         if (ContactEditorData.GeneralTelephoneListDataType.find(iter->first) != 
1077                 ContactEditorData.GeneralTelephoneListDataType.end()){
1078         
1079                 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralTelephoneListDataType.find(iter->first);
1081                 strAddressFinalValue.insert(0, ":");    
1082                 strAddressFinalValue.insert(0, DataTypeIter->second);
1083         
1084         } else {
1086                 strAddressFinalValue.insert(0, "tel:");
1087         
1088         }
1089                 
1090         ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1091                         &iter, &strAddressFinalValue, &ContactData,
1092                         wxT("ALTID"), &ContactEditorData.GeneralTelephoneListAltID,
1093                         wxT("PID"), &ContactEditorData.GeneralTelephoneListPID,
1094                         wxT("TYPE"), &ContactEditorData.GeneralTelephoneListType,
1095                         wxT("PREF"), &ContactEditorData.GeneralTelephoneListPref,
1096                         wxT(""), &ContactEditorData.GeneralTelephoneListTokens );
1097         
1098         ResetSaveProcessData();
1099         
1100     }
1101     
1102     ResetSaveProcessData();
1103     
1104     for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTelephoneList.begin();
1105          iter != ContactEditorData.HomeTelephoneList.end(); ++iter){
1106         
1107         wxString strAddressFinalValue = iter->second;
1108         
1109         ProcessCaptureStrings(&strAddressFinalValue);
1110         
1111         if (ContactEditorData.HomeTelephoneListDataType.find(iter->first) != 
1112                 ContactEditorData.HomeTelephoneListDataType.end()){
1113         
1114                 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeTelephoneListDataType.find(iter->first);
1116                 strAddressFinalValue.insert(0, ":");    
1117                 strAddressFinalValue.insert(0, DataTypeIter->second);
1118         
1119         } else {
1121                 strAddressFinalValue.insert(0, "tel:");
1122         
1123         }
1124         
1125         ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1126                         &iter, &strAddressFinalValue, &ContactData,
1127                         wxT("ALTID"), &ContactEditorData.HomeTelephoneListAltID,
1128                         wxT("PID"), &ContactEditorData.HomeTelephoneListPID,
1129                         wxT("TYPE"), &ContactEditorData.HomeTelephoneListType,
1130                         wxT("PREF"), &ContactEditorData.HomeTelephoneListPref,
1131                         wxT(""), &ContactEditorData.HomeTelephoneListTokens );
1132         
1133         ResetSaveProcessData();
1134         
1135     }
1136     
1137     ResetSaveProcessData();
1138     
1139     for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTelephoneList.begin();
1140          iter != ContactEditorData.BusinessTelephoneList.end(); ++iter){
1141         
1142         wxString strAddressFinalValue = iter->second;
1143         
1144         ProcessCaptureStrings(&strAddressFinalValue);
1145         
1146         if (ContactEditorData.BusinessTelephoneListDataType.find(iter->first) != 
1147                 ContactEditorData.BusinessTelephoneListDataType.end()){
1148         
1149                 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessTelephoneListDataType.find(iter->first);
1151                 strAddressFinalValue.insert(0, ":");    
1152                 strAddressFinalValue.insert(0, DataTypeIter->second);
1153         
1154         } else {
1156                 strAddressFinalValue.insert(0, "tel:");
1157         
1158         }
1159         
1160         ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1161                         &iter, &strAddressFinalValue, &ContactData,
1162                         wxT("ALTID"), &ContactEditorData.BusinessTelephoneListAltID,
1163                         wxT("PID"), &ContactEditorData.BusinessTelephoneListPID,
1164                         wxT("TYPE"), &ContactEditorData.BusinessTelephoneListType,
1165                         wxT("PREF"), &ContactEditorData.BusinessTelephoneListPref,
1166                         wxT(""), &ContactEditorData.BusinessTelephoneListTokens );
1167         
1168         ResetSaveProcessData();
1169         
1170     }
1171     
1172     ResetSaveProcessData();
1173     
1174     for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralLanguageList.begin();
1175          iter != ContactEditorData.GeneralLanguageList.end(); ++iter){
1176         
1177         intValue2 = iter->first;
1178         
1179         ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
1180                         &iter, &ContactEditorData.GeneralLanguageList, &ContactData,
1181                         wxT("ALTID"), &ContactEditorData.GeneralLanguageListAltID,
1182                         wxT("PID"), &ContactEditorData.GeneralLanguageListPID,
1183                         wxT("PREF"), &ContactEditorData.GeneralLanguageListPref,
1184                         wxT(""), &ContactEditorData.GeneralLanguageListTokens );
1185         
1186         ResetSaveProcessData();
1187         
1188     }
1189     
1190     ResetSaveProcessData();
1191     
1192     for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeLanguageList.begin();
1193          iter != ContactEditorData.HomeLanguageList.end(); ++iter){
1194         
1195         ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1196                         &iter, &ContactEditorData.HomeLanguageList, &ContactData,
1197                         wxT("ALTID"), &ContactEditorData.HomeLanguageListAltID,
1198                         wxT("PID"), &ContactEditorData.HomeLanguageListPID,
1199                         wxT("PREF"), &ContactEditorData.HomeLanguageListPref,
1200                         wxT(""), &ContactEditorData.HomeLanguageListTokens );
1201         
1202         ResetSaveProcessData();
1203         
1204     }
1205     
1206     ResetSaveProcessData();
1207     
1208     for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessLanguageList.begin();
1209          iter != ContactEditorData.BusinessLanguageList.end(); ++iter){
1210         
1211         ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1212                         &iter, &ContactEditorData.BusinessLanguageList, &ContactData,
1213                         wxT("ALTID"), &ContactEditorData.BusinessLanguageListAltID,
1214                         wxT("PID"), &ContactEditorData.BusinessLanguageListPID,
1215                         wxT("PREF"), &ContactEditorData.BusinessLanguageListPref,
1216                         wxT(""), &ContactEditorData.BusinessLanguageListTokens );
1217         
1218         ResetSaveProcessData();
1219         
1220     }
1221     
1222     ResetSaveProcessData();
1223     
1224     for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTZList.begin();
1225          iter != ContactEditorData.GeneralTZList.end(); ++iter){
1226         
1227         ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
1228                         &iter, &ContactEditorData.GeneralTZList, &ContactData,
1229                         wxT("ALTID"), &ContactEditorData.GeneralTZListAltID,
1230                         wxT("PID"), &ContactEditorData.GeneralTZListPID,
1231                         wxT("MEDIATYPE"), &ContactEditorData.GeneralTZListMediatype,
1232                         wxT("PREF"), &ContactEditorData.GeneralTZListPref,
1233                         wxT(""), &ContactEditorData.GeneralTZListTokens );
1234         
1235         ResetSaveProcessData();
1236         
1237     }
1238     
1239     ResetSaveProcessData();
1240     
1241     for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTZList.begin();
1242          iter != ContactEditorData.HomeTZList.end(); ++iter){
1243         
1244         ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1245                         &iter, &ContactEditorData.HomeTZList, &ContactData,
1246                         wxT("ALTID"), &ContactEditorData.HomeTZListAltID,
1247                         wxT("PID"), &ContactEditorData.HomeTZListPID,
1248                         wxT("MEDIATYPE"), &ContactEditorData.HomeTZListMediatype,
1249                         wxT("PREF"), &ContactEditorData.HomeTZListPref,
1250                         wxT(""), &ContactEditorData.HomeTZListTokens );
1251         
1252         ResetSaveProcessData();
1253         
1254     }
1255     
1256     ResetSaveProcessData();
1257     
1258     for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTZList.begin();
1259          iter != ContactEditorData.BusinessTZList.end(); ++iter){
1260         
1261         ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1262                         &iter, &ContactEditorData.BusinessTZList, &ContactData,
1263                         wxT("ALTID"), &ContactEditorData.BusinessTZListAltID,
1264                         wxT("PID"), &ContactEditorData.BusinessTZListPID,
1265                         wxT("MEDIATYPE"), &ContactEditorData.BusinessTZListMediatype,
1266                         wxT("PREF"), &ContactEditorData.BusinessTZListPref,
1267                         wxT(""), &ContactEditorData.BusinessTZListTokens );
1268         
1269         ResetSaveProcessData();
1270         
1271     }
1272     
1273     ResetSaveProcessData();
1274     
1275     for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralGeographyList.begin();
1276          iter != ContactEditorData.GeneralGeographyList.end(); ++iter){
1277         
1278         wxString strAddressFinalValue = iter->second;
1279         
1280         ProcessCaptureStrings(&strAddressFinalValue);
1281         
1282         strAddressFinalValue.insert(0, wxT("geo:"));
1283         
1284         ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
1285                         &iter, &strAddressFinalValue, &ContactData,
1286                         wxT("ALTID"), &ContactEditorData.GeneralGeographyListAltID,
1287                         wxT("PID"), &ContactEditorData.GeneralGeographyListPID,
1288                         wxT("MEDIATYPE"), &ContactEditorData.GeneralGeographyListMediatype,
1289                         wxT("PREF"), &ContactEditorData.GeneralGeographyListPref,
1290                         wxT(""), &ContactEditorData.GeneralGeographyListTokens );
1291         
1292         ResetSaveProcessData();
1293         
1294     }
1295     
1296     ResetSaveProcessData();
1297     
1298     for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeGeographyList.begin();
1299          iter != ContactEditorData.HomeGeographyList.end(); ++iter){
1300         
1301         wxString strAddressFinalValue = iter->second;
1302         
1303         ProcessCaptureStrings(&strAddressFinalValue);
1304         
1305         strAddressFinalValue.insert(0, wxT("geo:"));
1306         
1307         ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1308                         &iter, &ContactEditorData.HomeGeographyList, &ContactData,
1309                         wxT("ALTID"), &ContactEditorData.HomeGeographyListAltID,
1310                         wxT("PID"), &ContactEditorData.HomeGeographyListPID,
1311                         wxT("MEDIATYPE"), &ContactEditorData.HomeGeographyListMediatype,
1312                         wxT("PREF"), &ContactEditorData.HomeGeographyListPref,
1313                         wxT(""), &ContactEditorData.HomeGeographyListTokens );
1314         
1315         ResetSaveProcessData();
1316         
1317     }
1318     
1319     ResetSaveProcessData();
1320     
1321     for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessGeographyList.begin();
1322          iter != ContactEditorData.BusinessGeographyList.end(); ++iter){
1323         
1324         wxString strAddressFinalValue = iter->second;
1325         
1326         ProcessCaptureStrings(&strAddressFinalValue);
1327         
1328         strAddressFinalValue.insert(0, wxT("geo:"));
1329         
1330         ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1331                         &iter, &ContactEditorData.BusinessGeographyList, &ContactData,
1332                         wxT("ALTID"), &ContactEditorData.BusinessGeographyListAltID,
1333                         wxT("PID"), &ContactEditorData.BusinessGeographyListPID,
1334                         wxT("MEDIATYPE"), &ContactEditorData.BusinessGeographyListMediatype,
1335                         wxT("PREF"), &ContactEditorData.BusinessGeographyListPref,
1336                         wxT(""), &ContactEditorData.BusinessGeographyListTokens );
1337         
1338         ResetSaveProcessData();
1339         
1340     }
1341     
1342     ResetSaveProcessData();
1343     
1344     for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRelatedList.begin();
1345          iter != ContactEditorData.GeneralRelatedList.end(); ++iter){
1346         
1347         ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
1348                         &iter, &ContactEditorData.GeneralRelatedList, &ContactData,
1349                         wxT("ALTID"), &ContactEditorData.GeneralRelatedListAltID,
1350                         wxT("PID"), &ContactEditorData.GeneralRelatedListPID,
1351                         wxT("LANGUAGE"), &ContactEditorData.GeneralRelatedListLanguage,
1352                         wxT("TYPE"), &ContactEditorData.GeneralRelatedListRelType,
1353                         wxT("PREF"), &ContactEditorData.GeneralRelatedListPref,
1354                         wxT(""), &ContactEditorData.GeneralRelatedListTokens );
1355         
1356         ResetSaveProcessData();
1357         
1358     }
1359     
1360     ResetSaveProcessData();
1361     
1362     for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralWebsiteList.begin();
1363          iter != ContactEditorData.GeneralWebsiteList.end(); ++iter){
1364         
1365         ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
1366                         &iter, &ContactEditorData.GeneralWebsiteList, &ContactData,
1367                         wxT("ALTID"), &ContactEditorData.GeneralWebsiteListAltID,
1368                         wxT("PID"), &ContactEditorData.GeneralWebsiteListPID,
1369                         wxT("MEDIATYPE"), &ContactEditorData.GeneralWebsiteListMediatype,
1370                         wxT("PREF"), &ContactEditorData.GeneralWebsiteListPref,
1371                         wxT(""), &ContactEditorData.GeneralWebsiteListTokens );
1372         
1373         ResetSaveProcessData();
1374         
1375     }
1376     
1377     ResetSaveProcessData();
1378     
1379     for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeWebsiteList.begin();
1380          iter != ContactEditorData.HomeWebsiteList.end(); ++iter){
1381         
1382         ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1383                         &iter, &ContactEditorData.HomeWebsiteList, &ContactData,
1384                         wxT("ALTID"), &ContactEditorData.HomeWebsiteListAltID,
1385                         wxT("PID"), &ContactEditorData.HomeWebsiteListPID,
1386                         wxT("MEDIATYPE"), &ContactEditorData.HomeWebsiteListMediatype,
1387                         wxT("PREF"), &ContactEditorData.HomeWebsiteListPref,
1388                         wxT(""), &ContactEditorData.HomeWebsiteListTokens );
1389         
1390         ResetSaveProcessData();
1391         
1392     }
1393     
1394     ResetSaveProcessData();
1395     
1396     for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessWebsiteList.begin();
1397          iter != ContactEditorData.BusinessWebsiteList.end(); ++iter){
1398         
1399         ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1400                         &iter, &ContactEditorData.BusinessWebsiteList, &ContactData,
1401                         wxT("ALTID"), &ContactEditorData.BusinessWebsiteListAltID,
1402                         wxT("PID"), &ContactEditorData.BusinessWebsiteListPID,
1403                         wxT("MEDIATYPE"), &ContactEditorData.BusinessWebsiteListMediatype,
1404                         wxT("PREF"), &ContactEditorData.BusinessWebsiteListPref,
1405                         wxT(""), &ContactEditorData.BusinessWebsiteListTokens );
1406         
1407         ResetSaveProcessData();
1408         
1409     }
1410     
1411     ResetSaveProcessData();
1412     
1413     for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTitleList.begin();
1414          iter != ContactEditorData.GeneralTitleList.end(); ++iter){
1415         
1416         ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
1417                         &iter, &ContactEditorData.GeneralTitleList, &ContactData,
1418                         wxT("ALTID"), &ContactEditorData.GeneralTitleListAltID,
1419                         wxT("PID"), &ContactEditorData.GeneralTitleListPID,
1420                         wxT("LANGUAGE"), &ContactEditorData.GeneralTitleListLanguage,
1421                         wxT("PREF"), &ContactEditorData.GeneralTitleListPref,
1422                         wxT(""), &ContactEditorData.GeneralTitleListTokens );
1423         
1424         ResetSaveProcessData();
1425         
1426     }
1427     
1428     ResetSaveProcessData();
1429     
1430     for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTitleList.begin();
1431          iter != ContactEditorData.HomeTitleList.end(); ++iter){
1432         
1433         ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1434                         &iter, &ContactEditorData.HomeTitleList, &ContactData,
1435                         wxT("ALTID"), &ContactEditorData.HomeTitleListAltID,
1436                         wxT("PID"), &ContactEditorData.HomeTitleListPID,
1437                         wxT("LANGUAGE"), &ContactEditorData.HomeTitleListLanguage,
1438                         wxT("PREF"), &ContactEditorData.HomeTitleListPref,
1439                         wxT(""), &ContactEditorData.HomeTitleListTokens );
1440         
1441         ResetSaveProcessData();
1442         
1443     }
1444     
1445     ResetSaveProcessData();
1446     
1447     for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTitleList.begin();
1448          iter != ContactEditorData.BusinessTitleList.end(); ++iter){
1449         
1450         ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1451                         &iter, &ContactEditorData.BusinessTitleList, &ContactData,
1452                         wxT("ALTID"), &ContactEditorData.BusinessTitleListAltID,
1453                         wxT("PID"), &ContactEditorData.BusinessTitleListPID,
1454                         wxT("LANGUAGE"), &ContactEditorData.BusinessTitleListLanguage,
1455                         wxT("PREF"), &ContactEditorData.BusinessTitleListPref,
1456                         wxT(""), &ContactEditorData.BusinessTitleListTokens );
1457         
1458         ResetSaveProcessData();
1459         
1460     }
1461     
1462     ResetSaveProcessData();
1463     
1464     for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRoleList.begin();
1465          iter != ContactEditorData.GeneralRoleList.end(); ++iter){
1466         
1467         ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
1468                         &iter, &ContactEditorData.GeneralRoleList, &ContactData,
1469                         wxT("ALTID"), &ContactEditorData.GeneralRoleListAltID,
1470                         wxT("PID"), &ContactEditorData.GeneralRoleListPID,
1471                         wxT("LANGUAGE"), &ContactEditorData.GeneralRoleListLanguage,
1472                         wxT("PREF"), &ContactEditorData.GeneralRoleListPref,
1473                         wxT(""), &ContactEditorData.GeneralRoleListTokens );
1474         
1475         ResetSaveProcessData();
1476         
1477     }
1478     
1479     ResetSaveProcessData();
1480     
1481     for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeRoleList.begin();
1482          iter != ContactEditorData.HomeRoleList.end(); ++iter){
1483         
1484         ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1485                         &iter, &ContactEditorData.HomeRoleList, &ContactData,
1486                         wxT("ALTID"), &ContactEditorData.HomeRoleListAltID,
1487                         wxT("PID"), &ContactEditorData.HomeRoleListPID,
1488                         wxT("LANGUAGE"), &ContactEditorData.HomeRoleListLanguage,
1489                         wxT("PREF"), &ContactEditorData.HomeRoleListPref,
1490                         wxT(""), &ContactEditorData.HomeRoleListTokens );
1491         
1492         ResetSaveProcessData();
1493         
1494     }
1495     
1496     ResetSaveProcessData();
1497     
1498     for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessRoleList.begin();
1499          iter != ContactEditorData.BusinessRoleList.end(); ++iter){
1500         
1501         ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1502                         &iter, &ContactEditorData.BusinessRoleList, &ContactData,
1503                         wxT("ALTID"), &ContactEditorData.BusinessRoleListAltID,
1504                         wxT("PID"), &ContactEditorData.BusinessRoleListPID,
1505                         wxT("LANGUAGE"), &ContactEditorData.BusinessRoleListLanguage,
1506                         wxT("PREF"), &ContactEditorData.BusinessRoleListPref,
1507                         wxT(""), &ContactEditorData.BusinessRoleListTokens );
1508         
1509         ResetSaveProcessData();
1510         
1511     }
1512     
1513     ResetSaveProcessData();
1514     
1515     for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralOrganisationsList.begin();
1516          iter != ContactEditorData.GeneralOrganisationsList.end(); ++iter){
1517         
1518         ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
1519                         &iter, &ContactEditorData.GeneralOrganisationsList, &ContactData,
1520                         wxT("ALTID"), &ContactEditorData.GeneralOrganisationsListAltID,
1521                         wxT("PID"), &ContactEditorData.GeneralOrganisationsListPID,
1522                         wxT("LANGUAGE"), &ContactEditorData.GeneralOrganisationsListLanguage,
1523                         wxT("SORT-AS"), &ContactEditorData.GeneralOrganisationsListSortAs,
1524                         wxT("PREF"), &ContactEditorData.GeneralOrganisationsListPref,
1525                         wxT(""), &ContactEditorData.GeneralOrganisationsListTokens );
1526         
1527         ResetSaveProcessData();
1528         
1529     }
1530     
1531     ResetSaveProcessData();
1532     
1533     for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeOrganisationsList.begin();
1534          iter != ContactEditorData.HomeOrganisationsList.end(); ++iter){
1535         
1536         ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1537                         &iter, &ContactEditorData.HomeOrganisationsList, &ContactData,
1538                         wxT("ALTID"), &ContactEditorData.HomeOrganisationsListAltID,
1539                         wxT("PID"), &ContactEditorData.HomeOrganisationsListPID,
1540                         wxT("LANGUAGE"), &ContactEditorData.HomeOrganisationsListLanguage,
1541                         wxT("SORT-AS"), &ContactEditorData.HomeOrganisationsListSortAs,
1542                         wxT("PREF"), &ContactEditorData.HomeOrganisationsListPref,
1543                         wxT(""), &ContactEditorData.HomeOrganisationsListTokens );
1544         
1545         ResetSaveProcessData();
1546         
1547     }
1548     
1549     ResetSaveProcessData();
1550     
1551     for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessOrganisationsList.begin();
1552          iter != ContactEditorData.BusinessOrganisationsList.end(); ++iter){
1553         
1554         ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1555                         &iter, &ContactEditorData.BusinessOrganisationsList, &ContactData,
1556                         wxT("ALTID"), &ContactEditorData.BusinessOrganisationsListAltID,
1557                         wxT("PID"), &ContactEditorData.BusinessOrganisationsListPID,
1558                         wxT("LANGUAGE"), &ContactEditorData.BusinessOrganisationsListLanguage,
1559                         wxT("SORT-AS"), &ContactEditorData.BusinessOrganisationsListSortAs,
1560                         wxT("PREF"), &ContactEditorData.BusinessOrganisationsListPref,
1561                         wxT(""), &ContactEditorData.BusinessOrganisationsListTokens );
1562         
1563         ResetSaveProcessData();
1564         
1565     }
1566     
1567     ResetSaveProcessData();
1568     
1569     for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNoteList.begin();
1570          iter != ContactEditorData.GeneralNoteList.end(); ++iter){
1571         
1572         ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
1573                         &iter, &ContactEditorData.GeneralNoteList, &ContactData,
1574                         wxT("ALTID"), &ContactEditorData.GeneralNoteListAltID,
1575                         wxT("PID"), &ContactEditorData.GeneralNoteListPID,
1576                         wxT("LANGUAGE"), &ContactEditorData.GeneralNoteListLanguage,
1577                         wxT("PREF"), &ContactEditorData.GeneralNoteListPref,
1578                         wxT(""), &ContactEditorData.GeneralNoteListTokens );
1579         
1580         ResetSaveProcessData();
1581         
1582     }
1583     
1584     ResetSaveProcessData();
1585     
1586     for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNoteList.begin();
1587          iter != ContactEditorData.HomeNoteList.end(); ++iter){
1588         
1589         ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1590                         &iter, &ContactEditorData.HomeNoteList, &ContactData,
1591                         wxT("ALTID"), &ContactEditorData.HomeNoteListAltID,
1592                         wxT("PID"), &ContactEditorData.HomeNoteListPID,
1593                         wxT("LANGUAGE"), &ContactEditorData.HomeNoteListLanguage,
1594                         wxT("PREF"), &ContactEditorData.HomeNoteListPref,
1595                         wxT(""), &ContactEditorData.HomeNoteListTokens );
1596         
1597         ResetSaveProcessData();
1598         
1599     }
1600     
1601     ResetSaveProcessData();
1602     
1603     for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNoteList.begin();
1604          iter != ContactEditorData.BusinessNoteList.end(); ++iter){
1605         
1606         ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1607                         &iter, &ContactEditorData.BusinessNoteList, &ContactData,
1608                         wxT("ALTID"), &ContactEditorData.BusinessNoteListAltID,
1609                         wxT("PID"), &ContactEditorData.BusinessNoteListPID,
1610                         wxT("LANGUAGE"), &ContactEditorData.BusinessNoteListLanguage,
1611                         wxT("PREF"), &ContactEditorData.BusinessNoteListPref,
1612                         wxT(""), &ContactEditorData.BusinessNoteListTokens );
1613         
1614         ResetSaveProcessData();
1615         
1616     }
1617     
1618     ResetSaveProcessData();
1619     
1620     for (std::map<int,wxString>::iterator iter = ContactEditorData.CategoriesList.begin();
1621          iter != ContactEditorData.CategoriesList.end(); ++iter){
1622         
1623         ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
1624                         &iter, &ContactEditorData.CategoriesList, &ContactData,
1625                         wxT("ALTID"), &ContactEditorData.CategoriesListAltID,
1626                         wxT("PID"), &ContactEditorData.CategoriesListPID,
1627                         wxT("TYPE"), &ContactEditorData.CategoriesListType,
1628                         wxT("PREF"), &ContactEditorData.CategoriesListPref,
1629                         wxT(""), &ContactEditorData.CategoriesListTokens );
1630         
1631         ResetSaveProcessData();
1632         
1633     }
1634     
1635     // Pictures.
1636     
1637     for (std::map<int, std::string>::iterator iter = ContactEditorData.PicturesList.begin();
1638          iter != ContactEditorData.PicturesList.end(); ++iter){
1639         
1640         int intValueIndex = iter->first;
1641         
1642         std::map<int, std::string>::iterator stdstriter;
1643         std::map<int, wxString>::iterator enciter;
1644         
1645         striter = ContactEditorData.PicturesListPictureType.find(intValueIndex);
1646         enciter = ContactEditorData.PicturesListPicEncType.find(intValueIndex);
1647         
1648         ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
1649                         &iter, &ContactEditorData.PicturesList, &striter,
1650                         &enciter, &ContactData,
1651                         wxT("ALTID"), &ContactEditorData.PicturesListAltID,
1652                         wxT("PID"), &ContactEditorData.PicturesListPID,
1653                         wxT("TYPE"), &ContactEditorData.PicturesListType,
1654                         wxT("PREF"), &ContactEditorData.PicturesListPref,
1655                         wxT(""), &ContactEditorData.PicturesListTokens);
1656         
1657         ResetSaveProcessData();
1658         
1659     }
1660     
1661     ResetSaveProcessData();
1662     
1663     // Logos.
1664     
1665     for (std::map<int, std::string>::iterator iter = ContactEditorData.LogosList.begin();
1666          iter != ContactEditorData.LogosList.end(); ++iter){
1667         
1668         int intValueIndex = iter->first;
1669         
1670         std::map<int, std::string>::iterator stdstriter;
1671         std::map<int, wxString>::iterator enciter;
1672         
1673         striter = ContactEditorData.LogosListPictureType.find(intValueIndex);
1674         enciter = ContactEditorData.LogosListPicEncType.find(intValueIndex);
1675         
1676         ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
1677                         &iter, &ContactEditorData.LogosList, &striter,
1678                         &enciter, &ContactData,
1679                         wxT("ALTID"), &ContactEditorData.LogosListAltID,
1680                         wxT("PID"), &ContactEditorData.LogosListPID,
1681                         wxT("TYPE"), &ContactEditorData.LogosListType,
1682                         wxT("PREF"), &ContactEditorData.LogosListPref,
1683                         wxT(""), &ContactEditorData.LogosListTokens );
1684         
1685         ResetSaveProcessData();
1686         
1687     }
1688     
1689     ResetSaveProcessData();
1690     
1691     // Sounds.
1692     
1693     for (std::map<int, std::string>::iterator iter = ContactEditorData.SoundsList.begin();
1694          iter != ContactEditorData.SoundsList.end(); ++iter){
1695         
1696         int intValueIndex = iter->first;
1697         
1698         std::map<int, std::string>::iterator stdstriter;
1699         std::map<int, wxString>::iterator enciter;
1700         
1701         striter = ContactEditorData.SoundsListAudioType.find(intValueIndex);
1702         enciter = ContactEditorData.SoundsListAudioEncType.find(intValueIndex);
1703         
1704         ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
1705                         &iter, &ContactEditorData.SoundsList, &striter,
1706                         &enciter, &ContactData,
1707                         wxT("ALTID"), &ContactEditorData.SoundsListAltID,
1708                         wxT("PID"), &ContactEditorData.SoundsListPID,
1709                         wxT("TYPE"), &ContactEditorData.SoundsListType,
1710                         wxT("PREF"), &ContactEditorData.SoundsListPref,
1711                         wxT(""), &ContactEditorData.SoundsListTokens );
1712         
1713         ResetSaveProcessData();
1714         
1715     }
1716     
1717     ResetSaveProcessData();
1718     
1719     for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarList.begin();
1720          iter != ContactEditorData.CalendarList.end(); ++iter){
1721         
1722         ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
1723                         &iter, &ContactEditorData.CalendarList, &ContactData,
1724                         wxT("ALTID"), &ContactEditorData.CalendarListAltID,
1725                         wxT("PID"), &ContactEditorData.CalendarListPID,
1726                         wxT("MEDIATYPE"), &ContactEditorData.CalendarListMediatype,
1727                         wxT("TYPE"), &ContactEditorData.CalendarListType,
1728                         wxT("PREF"), &ContactEditorData.CalendarListPref,
1729                         wxT(""), &ContactEditorData.CalendarListTokens );
1730         
1731         ResetSaveProcessData();
1732         
1733     }
1734     
1735     ResetSaveProcessData();
1736     
1737     for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarRequestList.begin();
1738          iter != ContactEditorData.CalendarRequestList.end(); ++iter){
1739         
1740         ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
1741                         &iter, &ContactEditorData.CalendarRequestList, &ContactData,
1742                         wxT("ALTID"), &ContactEditorData.CalendarRequestListAltID,
1743                         wxT("PID"), &ContactEditorData.CalendarRequestListPID,
1744                         wxT("MEDIATYPE"), &ContactEditorData.CalendarRequestListMediatype,
1745                         wxT("TYPE"), &ContactEditorData.CalendarRequestListType,
1746                         wxT("PREF"), &ContactEditorData.CalendarRequestListPref,
1747                         wxT(""), &ContactEditorData.CalendarRequestListTokens );
1748         
1749         ResetSaveProcessData();
1750         
1751     }
1752     
1753     ResetSaveProcessData();
1754     
1755     for (std::map<int,wxString>::iterator iter = ContactEditorData.FreeBusyList.begin();
1756          iter != ContactEditorData.FreeBusyList.end(); ++iter){
1757         
1758         ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
1759                         &iter, &ContactEditorData.FreeBusyList, &ContactData,
1760                         wxT("ALTID"), &ContactEditorData.FreeBusyListAltID,
1761                         wxT("PID"), &ContactEditorData.FreeBusyListPID,
1762                         wxT("MEDIATYPE"), &ContactEditorData.FreeBusyListMediatype,
1763                         wxT("TYPE"), &ContactEditorData.FreeBusyListType,
1764                         wxT("PREF"), &ContactEditorData.FreeBusyListPref,
1765                         wxT(""), &ContactEditorData.FreeBusyListTokens );
1766         
1767         ResetSaveProcessData();
1768         
1769     }
1770     
1771     for (std::map<int, wxString>::iterator iter = ContactEditorData.KeyList.begin();
1772          iter != ContactEditorData.KeyList.end(); ++iter){
1773         
1774         intValue2 = iter->first;
1775         
1776         // Process Alternative ID.
1777         
1778         striter = ContactEditorData.KeyListAltID.find(intValue2);
1779         
1780         if (striter->first == intValue2){
1781             
1782             strValue3 = striter->second;
1783             
1784             if (!strValue3.IsEmpty()){
1785                 
1786                 strValue3.Trim();
1787                 strValue3.Trim();
1788                 
1789                 if (boolValue2 == TRUE){
1790                     
1791                     strValue2.Append(wxT(";"));
1792                     
1793                 } else {
1794                     
1795                     boolValue2 = TRUE;
1796                     
1797                 }
1798                 
1799                 strValue2.Append(wxT("ALTID=") + strValue3);
1800                 
1801                 boolValue = TRUE;
1802                 
1803             }
1804             
1805         }
1806         
1807         // Process PID.
1808         
1809         striter = ContactEditorData.KeyListPID.find(intValue2);
1810         
1811         if (striter->first == intValue2){
1812             
1813             strValue3 = striter->second;
1814             
1815             if (!strValue3.IsEmpty()){
1816                 
1817                 strValue3.Trim();
1818                 strValue3.Trim();
1819                 
1820                 if (boolValue2 == TRUE){
1821                     
1822                     strValue2.Append(wxT(";"));
1823                     
1824                 } else {
1825                     
1826                     boolValue2 = TRUE;
1827                     
1828                 }
1829                 
1830                 strValue2.Append(wxT("PID=") + strValue3);
1831                 
1832                 boolValue = TRUE;
1833                 
1834             }
1835             
1836         }
1837         
1838         // Process Type.
1839         
1840         striter = ContactEditorData.KeyListType.find(intValue2);
1841         
1842         if (striter->first == intValue2){
1843             
1844             strValue3 = striter->second;
1845             
1846             if (!strValue3.IsEmpty()){
1847                 
1848                 strValue3.Trim();
1849                 strValue3.Trim();
1850                 
1851                 if (boolValue2 == TRUE){
1852                     
1853                     strValue2.Append(wxT(";"));
1854                     
1855                 } else {
1856                     
1857                     boolValue2 = TRUE;
1858                     
1859                 }
1860                 
1861                 strValue2.Append(wxT("TYPE=") + strValue3);
1862                 
1863                 boolValue = TRUE;
1864                 
1865             }
1866             
1867         }
1868         
1869         intiter = ContactEditorData.KeyListPref.find(intValue2);
1870         
1871         if (intiter->first == intValue2){
1872             
1873             intValue3 = intiter->second;
1874             
1875             if (intValue3){
1876                 
1877                 if (boolValue2 == TRUE){
1878                     
1879                     strValue2.Append(wxT(";"));
1880                     
1881                 } else {
1882                     
1883                     boolValue2 = TRUE;
1884                     
1885                 }
1886                 
1887                 strValue2.Append(wxT("PREF=") + wxString::Format(wxT("%i"), intValue3));
1888                 
1889                 boolValue = TRUE;
1890                 
1891             }
1892             
1893         }       
1894         
1895         // Process Tokens.
1896         
1897         striter = ContactEditorData.KeyListTokens.find(intValue2);
1898         
1899         if (striter->first == intValue2){
1900             
1901             strValue3 = striter->second;
1902             
1903             if (!strValue3.IsEmpty()){
1904                 
1905                 strValue3.Trim();
1906                 strValue3.Trim();
1907                 
1908                 if (boolValue2 == TRUE){
1909                     
1910                     strValue2.Append(wxT(";"));
1911                     
1912                 } else {
1913                     
1914                     boolValue2 = TRUE;
1915                     
1916                 }
1917                 
1918                 strValue2.Append(strValue3);
1919                 
1920                 boolValue = TRUE;
1921                 
1922             }
1923             
1924         }       
1925         
1926         // Get the key information.
1927         
1928         std::map<int, wxString>::iterator enciter;
1929         
1930         striter = ContactEditorData.KeyListDataType.find(intValue2);    
1931         //enciter = KeyListAudioEncType.find(intValue2);
1932         
1933         wxString strValueData;
1934         
1935         strValueData = iter->second;    
1936         //strValueData.insert(0, wxT("data:") + striter->second + wxT(";") + enciter->second + wxT(","));
1937         strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));       
1938         
1939         
1940         // Add to the vCard.
1941         
1942         if (boolValue == TRUE){
1943             
1944             ContactData.AddRaw(wxT("KEY;") + strValue2, strValueData);
1945             
1946         } else {
1947             
1948             ContactData.Add(wxT("KEY"), strValueData, TRUE);
1949             
1950         }
1951         
1952         ResetSaveProcessData();   
1953         
1954     }
1955     
1956     // Vendor specific items.
1957     
1958     ResetSaveProcessData();   
1959     
1960     for (std::map<int,wxString>::iterator iter = ContactEditorData.VendorList.begin();
1961          iter != ContactEditorData.VendorList.end(); ++iter){
1962         
1963         intValue2 = iter->first;        
1964         
1965         // Get the IANA PEN number.
1966         
1967         striter = ContactEditorData.VendorListPEN.find(intValue2);
1968         
1969         if (striter->first == intValue2){
1970             
1971             strValue2 = striter->second;
1972             
1973         }
1974         
1975         // Get the element name.
1976         
1977         striter = ContactEditorData.VendorListElement.find(intValue2);
1978         
1979         if (striter->first == intValue2){
1980             
1981             strValue3 = striter->second;
1982             
1983         }
1984         
1985         // Get the address.
1986         
1987         striter = ContactEditorData.VendorList.find(intValue2);
1988         
1989         if (striter->first == intValue2){
1990             
1991             strValue = striter->second;
1992             
1993         }
1994         
1995         // Add to the vCard.
1996         
1997         if (boolValue == TRUE){
1998             
1999             ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
2000             
2001         } else {
2002             
2003             ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
2004             
2005         }
2006         
2007         ResetSaveProcessData();
2008         
2009     }              
2010     
2011     ResetSaveProcessData();  
2012     
2013     // X-Tokens.
2014     
2015     for (std::map<int,wxString>::iterator iter = ContactEditorData.XTokenList.begin();
2016          iter != ContactEditorData.XTokenList.end(); ++iter){
2017         
2018         intValue2 = iter->first;        
2019         
2020         // Get the element name.
2021         
2022         striter = ContactEditorData.XTokenListTokens.find(intValue2);
2023         
2024         if (striter->first == intValue2){
2025             
2026             strValue2 = striter->second;
2027             
2028         }       
2029         
2030         // Get the address.
2031         
2032         striter = ContactEditorData.XTokenList.find(intValue2);
2033         
2034         if (striter->first == intValue2){
2035             
2036             strValue = striter->second;
2037             
2038         }
2039         
2040         // Add to the vCard.
2041         
2042         if (boolValue == TRUE){
2043             
2044             ContactData.AddRaw(wxT("X-") + strValue2, strValue);
2045             
2046         } else {
2047             
2048             ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
2049             
2050         }
2051         
2052         ResetSaveProcessData();
2053         
2054     }
2055     
2056     ResetSaveProcessData();
2057     
2058     if (ContactEditorData.FullNamesList.size() == 0){
2059         
2060         wxString FullName = cmbDisplayAs->GetValue();
2061         ContactEditorData.FullNamesList.insert(std::make_pair(0, FullName));
2062         ContactEditorData.FullNamesListAltID.insert(std::make_pair(0, wxT("")));
2063         ContactEditorData.FullNamesListPID.insert(std::make_pair(0, wxT("")));
2064         ContactEditorData.FullNamesListType.insert(std::make_pair(0, wxT("")));
2065         ContactEditorData.FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
2066         ContactEditorData.FullNamesListPref.insert(std::make_pair(0, 0));
2067         ContactEditorData.FullNamesListTokens.insert(std::make_pair(0, wxT("")));
2068         FNFirst = FALSE;
2069         
2070     }
2071     
2072     for (std::map<int, wxString>::iterator iter = ContactEditorData.FullNamesList.begin();
2073          iter != ContactEditorData.FullNamesList.end(); ++iter){
2074         
2075         if (FNFirst == TRUE){
2076             
2077             iter->second = cmbDisplayAs->GetValue();
2078             FNFirst = FALSE;
2079             
2080         }
2081         
2082         std::map<int,wxString>::iterator mapS;
2083         
2084         mapS = ContactEditorData.FullNamesListTokens.find(iter->first);
2085         
2086         ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue, 
2087                         &iter, &ContactEditorData.FullNamesList, &ContactData,
2088                         wxT("ALTID"), &ContactEditorData.FullNamesListAltID,
2089                         wxT("PID"), &ContactEditorData.FullNamesListPID,
2090                         wxT("TYPE"), &ContactEditorData.FullNamesListType,
2091                         wxT("LANGUAGE"), &ContactEditorData.FullNamesListLanguage,
2092                         wxT("PREF"), &ContactEditorData.FullNamesListPref,
2093                         wxT(""), &ContactEditorData.FullNamesListTokens );
2094         
2095         // Get the address.
2096         
2097         ResetSaveProcessData();    
2098         
2099     }
2100     
2101     //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
2102     
2103     // Insert revision (REV) date.
2104     
2105     // Get today's date and time.
2106     
2107     wxDateTime DateTimeNow = wxDateTime::Now();
2108     
2109     wxString DateRev;
2110     
2111     // Set year, month and date.
2112     
2113     int intYear = DateTimeNow.GetYear();
2114     int intMonth = DateTimeNow.GetMonth();
2115     int intDay = DateTimeNow.GetDay();
2116     
2117     DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
2118     
2119     if (intMonth < 10){
2120         
2121         DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
2122         
2123     } else {
2124         
2125         DateRev.Append(wxString::Format(wxT("%i"), intMonth));
2126         
2127     }
2128     
2129     if (intDay < 10){
2130         
2131         DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
2132         
2133     } else {
2134         
2135         DateRev.Append(wxString::Format(wxT("%i"), intDay));
2136         
2137     }
2138     
2139     //DateRev.Append(wx);
2140     //DateRev.Append(wx);
2141     //DateRev.Append(wx);
2142     DateRev.Append(wxT("T"));
2143     
2144     // Set hour, minute and second.
2145     
2146     int intHour = DateTimeNow.GetHour();
2147     int intMinute = DateTimeNow.GetMinute();
2148     int intSecond = DateTimeNow.GetSecond();
2149     
2150     if (intHour < 10){
2151         
2152         DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
2153         
2154     } else {
2155         
2156         DateRev.Append(wxString::Format(wxT("%i"), intHour));    
2157         
2158     }
2159     
2160     if (intMinute < 10){
2161         
2162         DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
2163         
2164     } else {
2165         
2166         DateRev.Append(wxString::Format(wxT("%i"), intMinute));
2167         
2168     }
2169     
2170     if (intSecond < 10){
2171         
2172         DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
2173         
2174     } else {
2175         
2176         DateRev.Append(wxString::Format(wxT("%i"), intSecond));
2177         
2178     }
2179     
2180     //   DateRev.Append(wx);
2181     //   DateRev.Append(wx);
2182     //   DateRev.Append(wxString DateTimeNow->);
2183     DateRev.Append(wxT("Z"));    
2184     
2185     ContactData.Add(wxT("UID"), ContactEditorData.UIDToken, FALSE);
2186     
2187     // End the vCard File.
2188     
2189     ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
2190     
2191     FMTimer.Stop();
2192     ContactData.WriteFile(FilenameFinal);
2193     
2194     vCard34Conv ConvFileFun;
2195     
2196     wxString wxSData;
2197     
2198     ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
2199     
2200     wxString AccountDirPrefix;
2201     wxString AccountDir;
2202     wxString PrefDir;
2203     
2204 #if defined(__HAIKU__)
2205     
2206     //preffilename = wxT("noo");
2208 #elif defined(__APPLE__)
2209     
2210     PrefDir = GetUserPrefDir();
2211     
2212     wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2213     
2214 #elif defined(__WIN32__)
2215     
2216     PrefDir = GetUserPrefDir();
2217     
2218     wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
2219     
2220 #else
2221     
2222     PrefDir = GetUserPrefDir();
2223     
2224     wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2225     
2226 #endif
2227     
2228     XABPreferences PrefData(PrefDir);
2229     
2230     wxString AccountType;
2231     
2232     for (int i = 0; i < PrefData.accounts.GetCount(); i++){
2233         
2234         AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
2235         
2236         if (AccountDir == wxSContactAccount){
2237             
2238             AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
2239             AccountDirPrefix.Trim();
2240             AccountType = PrefData.accounts.GetAccountType(i);
2241             break;
2242             
2243         }
2244         
2245     }
2246     
2247     wxString wxSplitFilename;
2248     wxString wxSDataURL;
2249     
2250     while(wSTFilename.HasMoreTokens()){
2251         
2252         wxSplitFilename = wSTFilename.GetNextToken();
2253         
2254     }
2255     
2256     wxSDataURL = wxSplitFilename;
2257     //wxSDataURL.Append(wxSplitFilename);
2258     
2259     // Find out if the filename exists in the table.
2260     
2261     if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
2262         
2263         wxString ETagResult;
2264         wxString ETagOriginal;
2265         
2266         ETagDB *ETagDBPtr = NULL;
2267         
2268         ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
2269         
2270         wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
2271         wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
2272         
2273         if (wxSETagOrig.IsEmpty()){
2274             
2275             // Generate the ETag.
2276             
2277             wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2278             
2279         }
2280         
2281         if (wxSETag.IsEmpty()){
2282             
2283             // Update empty ETag.
2284             
2285             wxSETag = wxSETagOrig;
2286             ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
2287             
2288         }
2289         else {
2290             
2291             // Don't change original ETag.
2292             
2293             wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2294             ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
2295             
2296         }
2297         
2298         if (EditMode == FALSE){
2299             
2300             ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2301             EditMode = TRUE;
2302             FMTimer.SetFilename(FilenameFinal);
2303             FMTimer.UpdateTimestamp();
2304             FMTimer.Start(10000, FALSE);
2305             
2306             wxCommandEvent reloadevent(RELOADCONTACTLIST);
2307             reloadevent.SetString(wxSContactAccount);
2308             wxPostEvent(this->GetParent(), reloadevent);
2309             
2310         }
2311         else {
2312             
2313             ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2314             FMTimer.UpdateTimestamp();
2315             FMTimer.Start(10000, FALSE);
2316             
2317         }
2318         
2319     }
2320     
2321     // Send a notification to update the main window
2322     // with the new details.
2323     
2324     UCNotif *ucd;
2325     ucd = new UCNotif;
2326     
2327     // TODO: Workout nickname settings by priority and
2328     // type.
2329     
2330     ucd->ContactAccount = wxSContactAccount;
2331     ucd->ContactFilename = FilenameFinal;
2332     ucd->ContactName = cmbDisplayAs->GetValue();
2333     ucd->ContactNameArray = ContactData.GetName();
2334     
2335     for (std::map<int,wxString>::iterator gniter = ContactEditorData.GeneralNicknamesList.begin();
2336          gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){
2337         
2338         ucd->ContactNickname = gniter->second;
2339         break;
2340         
2341     }
2342     
2343     wxCommandEvent event2(CE_UPDATECONTACTLIST);
2344     event2.SetClientData(ucd);
2345     wxPostEvent(MainPtr, event2);
2346     
2349 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
2351     
2352     // Save the updated contact data and close the form.
2353     
2354     wxCommandEvent NullEvent;
2355     this->SaveContact(NullEvent);
2356     this->Close();
2357     
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