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