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