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