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