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