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