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