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