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