1 // frmContactEditor-Save.cpp - frmContactEditor save contact subroutines.
3 // (c) 2012-2016 Xestia Software Development.
5 // This file is part of Xestia Address Book.
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.
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.
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"
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 )
32 // Check if Display As combo box has a value in it.
33 // Do not go any further if there is no value.
35 wxString cmbDisplayAsValue = cmbDisplayAs->GetValue();
37 if (cmbDisplayAsValue.IsEmpty()){
39 wxMessageBox(_("Display As value cannot be left blank."), _("Display As value empty"), wxICON_ERROR);
44 // Save the updated contact data.
47 wxString FilenameFinal;
48 bool ReplaceContact = FALSE;
50 if (StartupEditMode == TRUE){
52 if (cmbType->GetCurrentSelection() == 1 ||
53 cmbType->GetCurrentSelection() == 3 ||
54 cmbType->GetCurrentSelection() == 4){
58 // Mark contact for replacing.
60 ReplaceContact = TRUE;
65 } else if (cmbType->GetCurrentSelection() == 2){
67 if (IsGroup == FALSE){
69 // Mark contact for replacing.
71 ReplaceContact = TRUE;
78 if (ReplaceContact == TRUE){
80 wxString wxDelSplitFilename;
81 wxString wxDelFinalFilename;
82 wxString wxSDelDataURL;
83 wxStringTokenizer wSTDelFilename(wxSContactFilename, wxT("/"));
85 while(wSTDelFilename.HasMoreTokens()){
87 wxDelSplitFilename = wSTDelFilename.GetNextToken();
91 wxSDelDataURL = wxDelSplitFilename;
93 // Delete the contact from the server as it will be useless in certain
94 // address book clients.
96 ActMgrPtr->AddTask(2, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDelDataURL, wxDelSplitFilename, wxSContactFilename, wxT(""));
98 // Clear the filename so the trigger to recreate the UID is done.
100 wxSContactFilename.Clear();
107 if (wxSContactFilename.IsEmpty()){
109 // Generate a random UUID.
111 ContactEditorData.UIDToken = GenerateUUID();
112 ContactEditorData.UIDToken = ContactEditorData.UIDToken.MakeUpper();
114 // Setup the filename.
116 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
118 #if defined(__HAIKU__)
120 //preffilename = wxT("noo");
122 #elif defined(__WIN32__)
124 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
125 FilenameFinal.Append(ContactEditorData.UIDToken);
126 FilenameFinal.Append(wxT(".vcf"));
127 wxSContactFilename = FilenameFinal;
131 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
132 FilenameFinal.Append(ContactEditorData.UIDToken);
133 FilenameFinal.Append(wxT(".vcf"));
134 wxSContactFilename = FilenameFinal;
140 if (ContactEditorData.UIDToken.IsEmpty()){
142 // UID Token is empty. (Shouldn't be).
143 // Generate a new UID Token.
145 ContactEditorData.UIDToken = GenerateUUID();
146 ContactEditorData.UIDToken = ContactEditorData.UIDToken.MakeUpper();
150 FilenameFinal = wxSContactFilename;
154 // Setup the data and write it into the account folder.
156 // Begin preperations to write the contact to a file.
159 std::map<int,int>::iterator intiter;
160 std::map<int,wxString>::iterator striter;
162 ContactData.Add(wxT("BEGIN"), wxT("VCARD"), FALSE);
163 ContactData.Add(wxT("VERSION"), wxT("4.0"), FALSE);
165 // Setup the version string.
167 strValue.Append(wxT("-//Xestia//Address Book Version "));
168 strValue.Append(wxT(XSDAB_VERSION));
169 strValue.Append(wxT("//KW"));
171 ContactData.Add(wxT("PRODID"), strValue, FALSE);
173 // Process the REV property.
175 wxDateTime DateTimeSave;
176 DateTimeSave = DateTimeSave.SetToCurrent();
177 wxString DateTimeSaveValue;
179 DateTimeSaveValue += wxString::Format("%04i", DateTimeSave.GetYear());
180 DateTimeSaveValue += wxString::Format("%02i", (DateTimeSave.GetMonth() + 1));
181 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetDay());
182 DateTimeSaveValue += "T";
183 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetHour());
184 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetMinute());
185 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetSecond());
187 if (!ContactEditorData.RevisionTokens.IsEmpty()){
189 ContactData.AddRaw("REV;" + ContactEditorData.RevisionTokens, DateTimeSaveValue);
193 ContactData.AddRaw("REV", DateTimeSaveValue);
197 // Process the XML properties.
199 for (std::map<int,wxString>::iterator iter = ContactEditorData.XMLList.begin();
200 iter != ContactEditorData.XMLList.end(); ++iter){
202 wxString strOrigValue;
204 strOrigValue = ContactEditorData.XMLList.find(iter->first)->second;
206 ResetUnusedString(&strOrigValue);
208 ProcessSaveData(wxT("XML"), &strValue2, &boolValue2, &boolValue,
209 &iter, &strOrigValue, &ContactData,
210 wxT("ALTID"), &ContactEditorData.XMLListAltID );
212 ResetSaveProcessData();
216 // Process the CLIENTPIDMAP properties.
218 for (std::map<int,wxString>::iterator iter = ContactEditorData.ClientPIDList.begin();
219 iter != ContactEditorData.ClientPIDList.end(); ++iter){
221 wxString strOrigValue;
223 strOrigValue = ContactEditorData.ClientPIDList.find(iter->first)->second;
225 ResetUnusedString(&strOrigValue);
227 ProcessSaveData(wxT("CLIENTPIDMAP"), &strValue2, &boolValue2, &boolValue,
228 &iter, &strOrigValue, &ContactData,
229 wxT(""), &ContactEditorData.ClientPIDListTokens );
231 ResetSaveProcessData();
235 // Process the SOURCE properties.
237 for (std::map<int,wxString>::iterator iter = ContactEditorData.SourceList.begin();
238 iter != ContactEditorData.SourceList.end(); ++iter){
240 wxString strOrigValue;
242 strOrigValue = ContactEditorData.SourceList.find(iter->first)->second;
244 ResetUnusedString(&strOrigValue);
246 ProcessSaveData(wxT("SOURCE"), &strValue2, &boolValue2, &boolValue,
247 &iter, &strOrigValue, &ContactData,
248 wxT("ALTID"), &ContactEditorData.SourceListAltID,
249 wxT("PID"), &ContactEditorData.SourceListPID,
250 wxT("TYPE"), &ContactEditorData.SourceListType,
251 wxT("PREF"), &ContactEditorData.SourceListPref,
252 wxT("MEDIATYPE"), &ContactEditorData.SourceListMediatype,
253 wxT(""), &ContactEditorData.SourceListTokens );
255 ResetSaveProcessData();
263 // Setup the name field.
265 strValue = txtSurname->GetValue() + wxT(";") +
266 txtForename->GetValue() + wxT(";") +
267 txtOtherNames->GetValue() + wxT(";") +
268 txtTitle->GetValue() + wxT(";") +
269 txtSuffix->GetValue();
271 strValue2 = ContactData.Convert(cmbDisplayAs->GetValue(), FALSE);
274 if (ContactEditorData.NameTokens.IsEmpty()){
276 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\""), strValue, FALSE);
280 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\";") + ContactEditorData.NameTokens, strValue, FALSE);
284 if (cmbType->GetCurrentSelection() == 1){
286 ContactData.AddRaw(wxT("KIND"), wxT("individual"));
288 } else if (cmbType->GetCurrentSelection() == 2){
290 ContactData.AddRaw(wxT("KIND"), wxT("group"));
292 // Go through each of the members and write them out.
294 for (std::map<int, wxString>::iterator itemiter = ContactEditorData.GroupsList.begin();
295 itemiter != ContactEditorData.GroupsList.end(); ++itemiter){
297 ContactData.Add(wxT("MEMBER:urn:uuid"), itemiter->second, FALSE);
301 } else if (cmbType->GetCurrentSelection() == 3){
303 ContactData.AddRaw(wxT("KIND"), wxT("org"));
305 } else if (cmbType->GetCurrentSelection() == 4){
307 ContactData.AddRaw(wxT("KIND"), wxT("location"));
312 // Setup the nicknames (General, Home & Business).
325 if (cmbGender->GetCurrentSelection() != 0){
327 switch(cmbGender->GetCurrentSelection()){
358 if (!txtGenderDescription->IsEmpty()){
360 strValue2 = txtGenderDescription->GetValue();
364 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
366 EscapeString(&strValue2, FALSE);
368 if (!ContactEditorData.GenderTokens.IsEmpty()){
370 if (!strValue2.IsEmpty()){
372 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue + wxT(";") + strValue2);
376 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue);
382 if (!strValue2.IsEmpty()){
384 ContactData.AddRaw(wxT("GENDER"), strValue + wxT(";") + strValue2);
388 ContactData.AddRaw(wxT("GENDER"), strValue);
396 ResetSaveProcessData();
398 // Build the values for the BDAY property.
402 if (!ContactEditorData.BirthdayAltID.IsEmpty()){
405 DataValue = ContactEditorData.BirthdayAltID;
407 EscapeString(&DataValue, FALSE);
409 strValue3.Append("ALTID=");
410 strValue3.Append(DataValue);
418 if (!ContactEditorData.BirthdayCalScale.IsEmpty()){
421 DataValue = ContactEditorData.BirthdayCalScale;
423 EscapeString(&DataValue, FALSE);
425 if (boolValue2 == TRUE){
427 strValue3.Append(";");
431 strValue3.Append("CALSCALE=");
432 strValue3.Append(DataValue);
440 if (!ContactEditorData.BirthdayTokens.IsEmpty()){
443 DataValue = ContactEditorData.BirthdayTokens;
445 EscapeString(&DataValue, FALSE);
447 if (boolValue2 == TRUE){
449 strValue3.Append(";");
453 strValue3.Append(DataValue);
457 // Write the BDAY property.
459 if (!txtBirthday->IsEmpty()){
461 if (!txtBirthday->GetValue().IsEmpty()){
463 strValue = txtBirthday->GetValue();
465 if (!strValue3.IsEmpty()){
467 ContactData.AddRaw("BDAY;VALUE=text;" + strValue3, strValue);
471 ContactData.AddRaw("BDAY;VALUE=text", strValue);
481 // Get Day, Month & Year.
483 wxDateTime BirthdayDate;
484 wxDateTime::Month BirthdayMonth;
487 wxString DataBeforeT;
489 wxString FinalBirthdayString;
490 bool ProcessDataAfterT = FALSE;
492 BirthdayDate = dapBirthday->GetValue();
494 if (BirthdayDate.IsValid()){
496 BirthdayDay = BirthdayDate.GetDay();
497 BirthdayMonth = BirthdayDate.GetMonth();
498 BirthdayYear = BirthdayDate.GetYear();
500 // Look for T and replace data before this.
502 wxStringTokenizer wSTDate(ContactEditorData.Birthday, wxT("T"));
504 while (wSTDate.HasMoreTokens()){
506 if (ProcessDataAfterT == FALSE){
508 DataBeforeT = wSTDate.GetNextToken();
509 ProcessDataAfterT = TRUE;
513 DataAfterT = wSTDate.GetNextToken();
520 // If there is not T then replace altogether.
522 wxString FinalBirthdayDay;
523 wxString FinalBirthdayMonth;
524 wxString FinalBirthdayYear;
526 if (BirthdayDay < 10){
528 FinalBirthdayDay = wxT("0") + wxString::Format(wxT("%i"), BirthdayDay);
532 FinalBirthdayDay = wxString::Format(wxT("%i"), BirthdayDay);
536 if (((int)BirthdayMonth + 1) < 10){
538 FinalBirthdayMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
542 FinalBirthdayMonth = wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
546 if (BirthdayYear == 0){
548 FinalBirthdayYear = wxT("--");
552 FinalBirthdayYear = wxString::Format(wxT("%i"), BirthdayYear);
556 if (!DataAfterT.IsEmpty()){
558 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay + wxT("T") + DataAfterT;
562 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay;
566 if (!FinalBirthdayString.IsEmpty() || !strValue3.IsEmpty()){
568 if (!strValue3.IsEmpty()){
570 EscapeString(&strValue2, FALSE);
571 EscapeString(&strValue, FALSE);
573 ContactData.AddRaw(wxT("BDAY;") + strValue3, FinalBirthdayString);
577 EscapeString(&strValue, FALSE);
579 ContactData.AddRaw(wxT("BDAY"), FinalBirthdayString);
589 ResetSaveProcessData();
591 // Build the values for the ANNIVERSARY property.
595 if (!ContactEditorData.AnniversaryAltID.IsEmpty()){
598 DataValue = ContactEditorData.AnniversaryAltID;
600 EscapeString(&DataValue, FALSE);
602 strValue3.Append("ALTID=");
603 strValue3.Append(DataValue);
611 if (!ContactEditorData.AnniversaryCalScale.IsEmpty()){
614 DataValue = ContactEditorData.AnniversaryCalScale;
616 EscapeString(&DataValue, FALSE);
618 if (boolValue2 == TRUE){
620 strValue3.Append(";");
624 strValue3.Append("CALSCALE=");
625 strValue3.Append(DataValue);
633 if (!ContactEditorData.AnniversaryTokens.IsEmpty()){
636 DataValue = ContactEditorData.AnniversaryTokens;
638 EscapeString(&DataValue, FALSE);
640 if (boolValue2 == TRUE){
642 strValue3.Append(";");
646 strValue3.Append(DataValue);
650 // Write the ANNIVERSARY property.
652 if (!txtAnniversary->IsEmpty()){
654 if (!txtAnniversary->GetValue().IsEmpty()){
656 strValue = txtAnniversary->GetValue();
658 if (!strValue3.IsEmpty()){
660 ContactData.AddRaw("ANNIVERSARY;VALUE=text;" + strValue3, strValue);
664 ContactData.AddRaw("ANNIVERSARY;VALUE=text", strValue);
672 // Look for T and replace data before this.
674 // Get Day, Month & Year.
676 wxDateTime AnniversaryDate;
677 wxDateTime::Month AnniversaryMonth;
680 wxString DataBeforeT;
682 wxString FinalAnniversaryString;
683 bool ProcessDataAfterT = FALSE;
685 AnniversaryDate = dapAnniversary->GetValue();
687 if (AnniversaryDate.IsValid()){
689 AnniversaryDay = AnniversaryDate.GetDay();
690 AnniversaryMonth = AnniversaryDate.GetMonth();
691 AnniversaryYear = AnniversaryDate.GetYear();
693 // Look for T and replace data before this.
695 wxStringTokenizer wSTDate(ContactEditorData.Anniversary, wxT("T"));
697 while (wSTDate.HasMoreTokens()){
699 if (ProcessDataAfterT == FALSE){
701 DataBeforeT = wSTDate.GetNextToken();
702 ProcessDataAfterT = TRUE;
706 DataAfterT = wSTDate.GetNextToken();
713 // If there is not T then replace altogether.
715 wxString FinalAnniversaryDay;
716 wxString FinalAnniversaryMonth;
717 wxString FinalAnniversaryYear;
719 if (AnniversaryDay < 10){
721 FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
725 FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
729 if (((int)AnniversaryMonth + 1) < 10){
731 FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
735 FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
739 if (AnniversaryYear == 0){
741 FinalAnniversaryYear = wxT("--");
745 FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
749 if (!DataAfterT.IsEmpty()){
751 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
755 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
759 if (!FinalAnniversaryString.IsEmpty() || !strValue3.IsEmpty()){
761 if (!strValue3.IsEmpty()){
763 EscapeString(&strValue2, FALSE);
764 EscapeString(&strValue, FALSE);
766 ContactData.AddRaw(wxT("ANNIVERSARY;") + strValue3, FinalAnniversaryString);
770 EscapeString(&strValue, FALSE);
772 ContactData.AddRaw(wxT("ANNIVERSARY"), FinalAnniversaryString);
782 // Setup the addresses (General, Home, Business).
784 ResetSaveProcessData();
786 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralAddressList.begin();
787 iter != ContactEditorData.GeneralAddressList.end(); ++iter){
789 int intSeekValue = iter->first;
791 wxString strAddressString;
792 wxString strAddressFinalValue;
793 std::map<int, wxString>::iterator iterValue;
795 strAddressString.Append(wxT(";;"));
799 iterValue = ContactEditorData.GeneralAddressList.find(intSeekValue);
800 strAddressFinalValue = iterValue->second;
801 ProcessCaptureStrings(&strAddressFinalValue);
802 strAddressString.Append(strAddressFinalValue + wxT(";"));
803 strAddressFinalValue.Clear();
807 iterValue = ContactEditorData.GeneralAddressListTown.find(intSeekValue);
808 strAddressFinalValue = iterValue->second;
809 ProcessCaptureStrings(&strAddressFinalValue);
810 strAddressString.Append(strAddressFinalValue + wxT(";"));
811 strAddressFinalValue.Clear();
815 iterValue = ContactEditorData.GeneralAddressListCounty.find(intSeekValue);
816 strAddressFinalValue = iterValue->second;
817 ProcessCaptureStrings(&strAddressFinalValue);
818 strAddressString.Append(strAddressFinalValue + wxT(";"));
819 strAddressFinalValue.Clear();
823 iterValue = ContactEditorData.GeneralAddressListPostCode.find(intSeekValue);
824 strAddressFinalValue = iterValue->second;
825 ProcessCaptureStrings(&strAddressFinalValue);
826 strAddressString.Append(strAddressFinalValue + wxT(";"));
827 strAddressFinalValue.Clear();
831 iterValue = ContactEditorData.GeneralAddressListCountry.find(intSeekValue);
832 strAddressFinalValue = iterValue->second;
833 ProcessCaptureStrings(&strAddressFinalValue);
834 strAddressString.Append(strAddressFinalValue);
835 strAddressFinalValue.Clear();
837 ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
838 &iter, &strAddressString, &ContactData,
839 wxT("LABEL"), &ContactEditorData.GeneralAddressListLabel,
840 wxT("LANGUAGE"), &ContactEditorData.GeneralAddressListLang,
841 wxT("ALTID"), &ContactEditorData.GeneralAddressListAltID,
842 wxT("PID"), &ContactEditorData.GeneralAddressListPID,
843 wxT("GEO"), &ContactEditorData.GeneralAddressListGeo,
844 wxT("TZ"), &ContactEditorData.GeneralAddressListTimezone,
845 wxT("MEDIATYPE"), &ContactEditorData.GeneralAddressListMediatype,
846 wxT("PREF"), &ContactEditorData.GeneralAddressListPref,
847 wxT(""), &ContactEditorData.GeneralAddressListTokens );
849 ResetSaveProcessData();
853 ResetSaveProcessData();
855 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeAddressList.begin();
856 iter != ContactEditorData.HomeAddressList.end(); ++iter){
858 int intSeekValue = iter->first;
860 wxString strAddressString;
861 wxString strAddressFinalValue;
862 std::map<int, wxString>::iterator iterValue;
864 strAddressString.Append(wxT(";;"));
868 iterValue = ContactEditorData.HomeAddressList.find(intSeekValue);
869 strAddressFinalValue = iterValue->second;
870 ProcessCaptureStrings(&strAddressFinalValue);
871 strAddressString.Append(strAddressFinalValue + wxT(";"));
875 iterValue = ContactEditorData.HomeAddressListTown.find(intSeekValue);
876 strAddressFinalValue = iterValue->second;
877 ProcessCaptureStrings(&strAddressFinalValue);
878 strAddressString.Append(strAddressFinalValue + wxT(";"));
882 iterValue = ContactEditorData.HomeAddressListCounty.find(intSeekValue);
883 strAddressFinalValue = iterValue->second;
884 ProcessCaptureStrings(&strAddressFinalValue);
885 strAddressString.Append(strAddressFinalValue + wxT(";"));
889 iterValue = ContactEditorData.HomeAddressListPostCode.find(intSeekValue);
890 strAddressFinalValue = iterValue->second;
891 ProcessCaptureStrings(&strAddressFinalValue);
892 strAddressString.Append(strAddressFinalValue + wxT(";"));
896 iterValue = ContactEditorData.HomeAddressListCountry.find(intSeekValue);
897 strAddressFinalValue = iterValue->second;
898 ProcessCaptureStrings(&strAddressFinalValue);
899 strAddressString.Append(strAddressFinalValue);
901 ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
902 &iter, &strAddressString, &ContactData,
903 wxT("LABEL"), &ContactEditorData.HomeAddressListLabel,
904 wxT("LANGUAGE"), &ContactEditorData.HomeAddressListLang,
905 wxT("ALTID"), &ContactEditorData.HomeAddressListAltID,
906 wxT("PID"), &ContactEditorData.HomeAddressListPID,
907 wxT("GEO"), &ContactEditorData.HomeAddressListGeo,
908 wxT("TZ"), &ContactEditorData.HomeAddressListTimezone,
909 wxT("MEDIATYPE"), &ContactEditorData.HomeAddressListMediatype,
910 wxT("PREF"), &ContactEditorData.HomeAddressListPref,
911 wxT(""), &ContactEditorData.HomeAddressListTokens );
913 ResetSaveProcessData();
917 ResetSaveProcessData();
919 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessAddressList.begin();
920 iter != ContactEditorData.BusinessAddressList.end(); ++iter){
922 int intSeekValue = iter->first;
924 wxString strAddressString;
925 wxString strAddressFinalValue;
926 std::map<int, wxString>::iterator iterValue;
928 strAddressString.Append(wxT(";;"));
932 iterValue = ContactEditorData.BusinessAddressList.find(intSeekValue);
933 strAddressFinalValue = iterValue->second;
934 ProcessCaptureStrings(&strAddressFinalValue);
936 strAddressString.Append(strAddressFinalValue + wxT(";"));
940 iterValue = ContactEditorData.BusinessAddressListTown.find(intSeekValue);
941 strAddressFinalValue = iterValue->second;
942 ProcessCaptureStrings(&strAddressFinalValue);
944 strAddressString.Append(strAddressFinalValue + wxT(";"));
948 iterValue = ContactEditorData.BusinessAddressListCounty.find(intSeekValue);
949 strAddressFinalValue = iterValue->second;
950 ProcessCaptureStrings(&strAddressFinalValue);
952 strAddressString.Append(strAddressFinalValue + wxT(";"));
956 iterValue = ContactEditorData.BusinessAddressListPostCode.find(intSeekValue);
957 strAddressFinalValue = iterValue->second;
958 ProcessCaptureStrings(&strAddressFinalValue);
960 strAddressString.Append(strAddressFinalValue + wxT(";"));
964 iterValue = ContactEditorData.BusinessAddressListCountry.find(intSeekValue);
965 strAddressFinalValue = iterValue->second;
966 ProcessCaptureStrings(&strAddressFinalValue);
968 strAddressString.Append(strAddressFinalValue);
970 ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
971 &iter, &strAddressString, &ContactData,
972 wxT("LABEL"), &ContactEditorData.BusinessAddressListLabel,
973 wxT("LANGUAGE"), &ContactEditorData.BusinessAddressListLang,
974 wxT("ALTID"), &ContactEditorData.BusinessAddressListAltID,
975 wxT("PID"), &ContactEditorData.BusinessAddressListPID,
976 wxT("GEO"), &ContactEditorData.BusinessAddressListGeo,
977 wxT("TZ"), &ContactEditorData.BusinessAddressListTimezone,
978 wxT("MEDIATYPE"), &ContactEditorData.BusinessAddressListMediatype,
979 wxT("PREF"), &ContactEditorData.BusinessAddressListPref,
980 wxT(""), &ContactEditorData.BusinessAddressListTokens );
982 ResetSaveProcessData();
986 // Sort out nicknames (if any).
988 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNicknamesList.begin();
989 iter != ContactEditorData.GeneralNicknamesList.end(); ++iter){
991 intValue2 = iter->first;
993 // Process Alternative ID.
995 ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
996 &iter, &ContactEditorData.GeneralNicknamesList, &ContactData,
997 wxT("LANGUAGE"), &ContactEditorData.GeneralNicknamesListLanguage,
998 wxT("ALTID"), &ContactEditorData.GeneralNicknamesListAltID,
999 wxT("PID"), &ContactEditorData.GeneralNicknamesListPID,
1000 wxT("PREF"), &ContactEditorData.GeneralNicknamesListPref,
1001 wxT(""), &ContactEditorData.GeneralNicknamesListTokens );
1003 ResetSaveProcessData();
1007 ResetSaveProcessData();
1009 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNicknamesList.begin();
1010 iter != ContactEditorData.HomeNicknamesList.end(); ++iter){
1012 ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1013 &iter, &ContactEditorData.HomeNicknamesList, &ContactData,
1014 wxT("LANGUAGE"), &ContactEditorData.HomeNicknamesListLanguage,
1015 wxT("ALTID"), &ContactEditorData.HomeNicknamesListAltID,
1016 wxT("PID"), &ContactEditorData.HomeNicknamesListPID,
1017 wxT("PREF"), &ContactEditorData.HomeNicknamesListPref,
1018 wxT(""), &ContactEditorData.HomeNicknamesListTokens );
1020 ResetSaveProcessData();
1024 ResetSaveProcessData();
1026 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNicknamesList.begin();
1027 iter != ContactEditorData.BusinessNicknamesList.end(); ++iter){
1029 ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1030 &iter, &ContactEditorData.BusinessNicknamesList, &ContactData,
1031 wxT("LANGUAGE"), &ContactEditorData.BusinessNicknamesListLanguage,
1032 wxT("ALTID"), &ContactEditorData.BusinessNicknamesListAltID,
1033 wxT("PID"), &ContactEditorData.BusinessNicknamesListPID,
1034 wxT("PREF"), &ContactEditorData.BusinessNicknamesListPref,
1035 wxT(""), &ContactEditorData.BusinessNicknamesListTokens );
1037 ResetSaveProcessData();
1041 ResetSaveProcessData();
1043 // Sort out email (general, home and business).
1045 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralEmailList.begin();
1046 iter != ContactEditorData.GeneralEmailList.end(); ++iter){
1048 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1051 wxString strAddressFinalValue;
1052 std::map<int, wxString>::iterator iterValue;
1054 ProcessSaveData(wxT("EMAIL"), &strValue2, &boolValue2, &boolValue,
1055 &iter, &ContactEditorData.GeneralEmailList, &ContactData,
1056 wxT("ALTID"), &ContactEditorData.GeneralEmailListAltID,
1057 wxT("PID"), &ContactEditorData.GeneralEmailListPID,
1058 wxT("PREF"), &ContactEditorData.GeneralEmailListPref,
1059 wxT(""), &ContactEditorData.GeneralEmailListTokens );
1061 ResetSaveProcessData();
1065 ResetSaveProcessData();
1067 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeEmailList.begin();
1068 iter != ContactEditorData.HomeEmailList.end(); ++iter){
1070 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1073 ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1074 &iter, &ContactEditorData.HomeEmailList, &ContactData,
1075 wxT("ALTID"), &ContactEditorData.HomeEmailListAltID,
1076 wxT("PID"), &ContactEditorData.HomeEmailListPID,
1077 wxT("PREF"), &ContactEditorData.HomeEmailListPref,
1078 wxT(""), &ContactEditorData.HomeEmailListTokens );
1080 ResetSaveProcessData();
1084 ResetSaveProcessData();
1086 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessEmailList.begin();
1087 iter != ContactEditorData.BusinessEmailList.end(); ++iter){
1089 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1092 ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1093 &iter, &ContactEditorData.BusinessEmailList, &ContactData,
1094 wxT("ALTID"), &ContactEditorData.BusinessEmailListAltID,
1095 wxT("PID"), &ContactEditorData.BusinessEmailListPID,
1096 wxT("PREF"), &ContactEditorData.BusinessEmailListPref,
1097 wxT(""), &ContactEditorData.BusinessEmailListTokens );
1099 ResetSaveProcessData();
1103 ResetSaveProcessData();
1105 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralIMList.begin();
1106 iter != ContactEditorData.GeneralIMList.end(); ++iter){
1108 intValue2 = iter->first;
1110 wxString strIMFinalValue = iter->second;
1112 ProcessCaptureStrings(&strIMFinalValue);
1114 if (ContactEditorData.GeneralIMListTypeInfo.find(iter->first) !=
1115 ContactEditorData.GeneralIMListTypeInfo.end()){
1117 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralIMListTypeInfo.find(iter->first);
1119 strIMFinalValue.insert(0, ":");
1120 strIMFinalValue.insert(0, DataTypeIter->second);
1124 strIMFinalValue.insert(0, "none:");
1128 // Process Alternative ID.
1130 ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
1131 &iter, &strIMFinalValue, &ContactData,
1132 wxT("ALTID"), &ContactEditorData.GeneralIMListAltID,
1133 wxT("PID"), &ContactEditorData.GeneralIMListPID,
1134 wxT("MEDIATYPE"), &ContactEditorData.GeneralIMListMediatype,
1135 wxT("PREF"), &ContactEditorData.GeneralIMListPref,
1136 wxT(""), &ContactEditorData.GeneralIMListTokens );
1138 ResetSaveProcessData();
1142 ResetSaveProcessData();
1144 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeIMList.begin();
1145 iter != ContactEditorData.HomeIMList.end(); ++iter){
1147 wxString strIMFinalValue = iter->second;
1149 ProcessCaptureStrings(&strIMFinalValue);
1151 if (ContactEditorData.HomeIMListTypeInfo.find(iter->first) !=
1152 ContactEditorData.HomeIMListTypeInfo.end()){
1154 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeIMListTypeInfo.find(iter->first);
1156 strIMFinalValue.insert(0, ":");
1157 strIMFinalValue.insert(0, DataTypeIter->second);
1161 strIMFinalValue.insert(0, "none:");
1165 ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1166 &iter, &ContactEditorData.HomeIMList, &ContactData,
1167 wxT("ALTID"), &ContactEditorData.HomeIMListAltID,
1168 wxT("PID"), &ContactEditorData.HomeIMListPID,
1169 wxT("MEDIATYPE"), &ContactEditorData.HomeIMListMediatype,
1170 wxT("PREF"), &ContactEditorData.HomeIMListPref,
1171 wxT(""), &ContactEditorData.HomeIMListTokens );
1173 ResetSaveProcessData();
1177 ResetSaveProcessData();
1179 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessIMList.begin();
1180 iter != ContactEditorData.BusinessIMList.end(); ++iter){
1182 wxString strIMFinalValue = iter->second;
1184 ProcessCaptureStrings(&strIMFinalValue);
1186 if (ContactEditorData.BusinessIMListTypeInfo.find(iter->first) !=
1187 ContactEditorData.BusinessIMListTypeInfo.end()){
1189 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessIMListTypeInfo.find(iter->first);
1191 strIMFinalValue.insert(0, ":");
1192 strIMFinalValue.insert(0, DataTypeIter->second);
1196 strIMFinalValue.insert(0, "none:");
1200 ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1201 &iter, &ContactEditorData.BusinessIMList, &ContactData,
1202 wxT("ALTID"), &ContactEditorData.BusinessIMListAltID,
1203 wxT("PID"), &ContactEditorData.BusinessIMListPID,
1204 wxT("MEDIATYPE"), &ContactEditorData.BusinessIMListMediatype,
1205 wxT("PREF"), &ContactEditorData.BusinessIMListPref,
1206 wxT(""), &ContactEditorData.BusinessIMListTokens );
1208 ResetSaveProcessData();
1212 ResetSaveProcessData();
1214 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTelephoneList.begin();
1215 iter != ContactEditorData.GeneralTelephoneList.end(); ++iter){
1217 wxString strAddressFinalValue = iter->second;
1218 int DataID = iter->first;
1220 ProcessCaptureStrings(&strAddressFinalValue);
1222 if (MapDataExists(&DataID, &ContactEditorData.GeneralTelephoneListDataType)){
1224 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralTelephoneListDataType.find(iter->first);
1226 strAddressFinalValue.insert(0, ":");
1227 strAddressFinalValue.insert(0, DataTypeIter->second);
1231 strAddressFinalValue.insert(0, "tel:");
1235 wxString strAddressTypeInfo;
1237 if (MapDataExists(&DataID, &ContactEditorData.GeneralTelephoneListTypeInfo)){
1239 strAddressTypeInfo = ContactEditorData.GeneralTelephoneListTypeInfo.find(iter->first)->second;
1243 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1244 &iter, &strAddressFinalValue, &ContactData,
1245 wxT("ALTID"), &ContactEditorData.GeneralTelephoneListAltID,
1246 wxT("PID"), &ContactEditorData.GeneralTelephoneListPID,
1247 wxT("TYPE"), &ContactEditorData.GeneralTelephoneListTypeInfo,
1248 wxT("PREF"), &ContactEditorData.GeneralTelephoneListPref,
1249 wxT(""), &ContactEditorData.GeneralTelephoneListTokens );
1251 ResetSaveProcessData();
1255 ResetSaveProcessData();
1257 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTelephoneList.begin();
1258 iter != ContactEditorData.HomeTelephoneList.end(); ++iter){
1260 wxString strAddressFinalValue = iter->second;
1262 ProcessCaptureStrings(&strAddressFinalValue);
1264 if (ContactEditorData.HomeTelephoneListDataType.find(iter->first) !=
1265 ContactEditorData.HomeTelephoneListDataType.end()){
1267 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeTelephoneListDataType.find(iter->first);
1269 strAddressFinalValue.insert(0, ":");
1270 strAddressFinalValue.insert(0, DataTypeIter->second);
1274 strAddressFinalValue.insert(0, "tel:");
1278 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1279 &iter, &strAddressFinalValue, &ContactData,
1280 wxT("ALTID"), &ContactEditorData.HomeTelephoneListAltID,
1281 wxT("PID"), &ContactEditorData.HomeTelephoneListPID,
1282 wxT("TYPE"), &ContactEditorData.HomeTelephoneListTypeInfo,
1283 wxT("PREF"), &ContactEditorData.HomeTelephoneListPref,
1284 wxT(""), &ContactEditorData.HomeTelephoneListTokens );
1286 ResetSaveProcessData();
1290 ResetSaveProcessData();
1292 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTelephoneList.begin();
1293 iter != ContactEditorData.BusinessTelephoneList.end(); ++iter){
1295 wxString strAddressFinalValue = iter->second;
1297 ProcessCaptureStrings(&strAddressFinalValue);
1299 if (ContactEditorData.BusinessTelephoneListDataType.find(iter->first) !=
1300 ContactEditorData.BusinessTelephoneListDataType.end()){
1302 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessTelephoneListDataType.find(iter->first);
1304 strAddressFinalValue.insert(0, ":");
1305 strAddressFinalValue.insert(0, DataTypeIter->second);
1309 strAddressFinalValue.insert(0, "tel:");
1313 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1314 &iter, &strAddressFinalValue, &ContactData,
1315 wxT("ALTID"), &ContactEditorData.BusinessTelephoneListAltID,
1316 wxT("PID"), &ContactEditorData.BusinessTelephoneListPID,
1317 wxT("TYPE"), &ContactEditorData.BusinessTelephoneListTypeInfo,
1318 wxT("PREF"), &ContactEditorData.BusinessTelephoneListPref,
1319 wxT(""), &ContactEditorData.BusinessTelephoneListTokens );
1321 ResetSaveProcessData();
1325 ResetSaveProcessData();
1327 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralLanguageList.begin();
1328 iter != ContactEditorData.GeneralLanguageList.end(); ++iter){
1330 intValue2 = iter->first;
1332 ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
1333 &iter, &ContactEditorData.GeneralLanguageList, &ContactData,
1334 wxT("ALTID"), &ContactEditorData.GeneralLanguageListAltID,
1335 wxT("PID"), &ContactEditorData.GeneralLanguageListPID,
1336 wxT("PREF"), &ContactEditorData.GeneralLanguageListPref,
1337 wxT(""), &ContactEditorData.GeneralLanguageListTokens );
1339 ResetSaveProcessData();
1343 ResetSaveProcessData();
1345 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeLanguageList.begin();
1346 iter != ContactEditorData.HomeLanguageList.end(); ++iter){
1348 ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1349 &iter, &ContactEditorData.HomeLanguageList, &ContactData,
1350 wxT("ALTID"), &ContactEditorData.HomeLanguageListAltID,
1351 wxT("PID"), &ContactEditorData.HomeLanguageListPID,
1352 wxT("PREF"), &ContactEditorData.HomeLanguageListPref,
1353 wxT(""), &ContactEditorData.HomeLanguageListTokens );
1355 ResetSaveProcessData();
1359 ResetSaveProcessData();
1361 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessLanguageList.begin();
1362 iter != ContactEditorData.BusinessLanguageList.end(); ++iter){
1364 ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1365 &iter, &ContactEditorData.BusinessLanguageList, &ContactData,
1366 wxT("ALTID"), &ContactEditorData.BusinessLanguageListAltID,
1367 wxT("PID"), &ContactEditorData.BusinessLanguageListPID,
1368 wxT("PREF"), &ContactEditorData.BusinessLanguageListPref,
1369 wxT(""), &ContactEditorData.BusinessLanguageListTokens );
1371 ResetSaveProcessData();
1375 ResetSaveProcessData();
1377 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTZList.begin();
1378 iter != ContactEditorData.GeneralTZList.end(); ++iter){
1380 ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
1381 &iter, &ContactEditorData.GeneralTZList, &ContactData,
1382 wxT("ALTID"), &ContactEditorData.GeneralTZListAltID,
1383 wxT("PID"), &ContactEditorData.GeneralTZListPID,
1384 wxT("MEDIATYPE"), &ContactEditorData.GeneralTZListMediatype,
1385 wxT("PREF"), &ContactEditorData.GeneralTZListPref,
1386 wxT(""), &ContactEditorData.GeneralTZListTokens );
1388 ResetSaveProcessData();
1392 ResetSaveProcessData();
1394 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTZList.begin();
1395 iter != ContactEditorData.HomeTZList.end(); ++iter){
1397 ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1398 &iter, &ContactEditorData.HomeTZList, &ContactData,
1399 wxT("ALTID"), &ContactEditorData.HomeTZListAltID,
1400 wxT("PID"), &ContactEditorData.HomeTZListPID,
1401 wxT("MEDIATYPE"), &ContactEditorData.HomeTZListMediatype,
1402 wxT("PREF"), &ContactEditorData.HomeTZListPref,
1403 wxT(""), &ContactEditorData.HomeTZListTokens );
1405 ResetSaveProcessData();
1409 ResetSaveProcessData();
1411 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTZList.begin();
1412 iter != ContactEditorData.BusinessTZList.end(); ++iter){
1414 ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1415 &iter, &ContactEditorData.BusinessTZList, &ContactData,
1416 wxT("ALTID"), &ContactEditorData.BusinessTZListAltID,
1417 wxT("PID"), &ContactEditorData.BusinessTZListPID,
1418 wxT("MEDIATYPE"), &ContactEditorData.BusinessTZListMediatype,
1419 wxT("PREF"), &ContactEditorData.BusinessTZListPref,
1420 wxT(""), &ContactEditorData.BusinessTZListTokens );
1422 ResetSaveProcessData();
1426 ResetSaveProcessData();
1428 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralGeographyList.begin();
1429 iter != ContactEditorData.GeneralGeographyList.end(); ++iter){
1431 wxString strGeoFinalValue = iter->second;
1433 ProcessCaptureStrings(&strGeoFinalValue);
1435 if (ContactEditorData.GeneralGeographyListDataType.find(iter->first) !=
1436 ContactEditorData.GeneralGeographyListDataType.end()){
1438 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralGeographyListDataType.find(iter->first);
1440 strGeoFinalValue.insert(0, ":");
1441 strGeoFinalValue.insert(0, DataTypeIter->second);
1445 strGeoFinalValue.insert(0, "geo:");
1449 ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
1450 &iter, &strGeoFinalValue, &ContactData,
1451 wxT("ALTID"), &ContactEditorData.GeneralGeographyListAltID,
1452 wxT("PID"), &ContactEditorData.GeneralGeographyListPID,
1453 wxT("MEDIATYPE"), &ContactEditorData.GeneralGeographyListMediatype,
1454 wxT("PREF"), &ContactEditorData.GeneralGeographyListPref,
1455 wxT(""), &ContactEditorData.GeneralGeographyListTokens );
1457 ResetSaveProcessData();
1461 ResetSaveProcessData();
1463 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeGeographyList.begin();
1464 iter != ContactEditorData.HomeGeographyList.end(); ++iter){
1466 wxString strGeoFinalValue = iter->second;
1468 ProcessCaptureStrings(&strGeoFinalValue);
1470 if (ContactEditorData.HomeGeographyListDataType.find(iter->first) !=
1471 ContactEditorData.HomeGeographyListDataType.end()){
1473 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeGeographyListDataType.find(iter->first);
1475 strGeoFinalValue.insert(0, ":");
1476 strGeoFinalValue.insert(0, DataTypeIter->second);
1480 strGeoFinalValue.insert(0, "geo:");
1484 ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1485 &iter, &strGeoFinalValue, &ContactData,
1486 wxT("ALTID"), &ContactEditorData.HomeGeographyListAltID,
1487 wxT("PID"), &ContactEditorData.HomeGeographyListPID,
1488 wxT("MEDIATYPE"), &ContactEditorData.HomeGeographyListMediatype,
1489 wxT("PREF"), &ContactEditorData.HomeGeographyListPref,
1490 wxT(""), &ContactEditorData.HomeGeographyListTokens );
1492 ResetSaveProcessData();
1496 ResetSaveProcessData();
1498 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessGeographyList.begin();
1499 iter != ContactEditorData.BusinessGeographyList.end(); ++iter){
1501 wxString strGeoFinalValue = iter->second;
1503 ProcessCaptureStrings(&strGeoFinalValue);
1505 if (ContactEditorData.BusinessGeographyListDataType.find(iter->first) !=
1506 ContactEditorData.BusinessGeographyListDataType.end()){
1508 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessGeographyListDataType.find(iter->first);
1510 strGeoFinalValue.insert(0, ":");
1511 strGeoFinalValue.insert(0, DataTypeIter->second);
1515 strGeoFinalValue.insert(0, "geo:");
1519 ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1520 &iter, &strGeoFinalValue, &ContactData,
1521 wxT("ALTID"), &ContactEditorData.BusinessGeographyListAltID,
1522 wxT("PID"), &ContactEditorData.BusinessGeographyListPID,
1523 wxT("MEDIATYPE"), &ContactEditorData.BusinessGeographyListMediatype,
1524 wxT("PREF"), &ContactEditorData.BusinessGeographyListPref,
1525 wxT(""), &ContactEditorData.BusinessGeographyListTokens );
1527 ResetSaveProcessData();
1531 ResetSaveProcessData();
1533 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRelatedList.begin();
1534 iter != ContactEditorData.GeneralRelatedList.end(); ++iter){
1536 ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
1537 &iter, &ContactEditorData.GeneralRelatedList, &ContactData,
1538 wxT("ALTID"), &ContactEditorData.GeneralRelatedListAltID,
1539 wxT("PID"), &ContactEditorData.GeneralRelatedListPID,
1540 wxT("LANGUAGE"), &ContactEditorData.GeneralRelatedListLanguage,
1541 wxT("TYPE"), &ContactEditorData.GeneralRelatedListRelType,
1542 wxT("PREF"), &ContactEditorData.GeneralRelatedListPref,
1543 wxT(""), &ContactEditorData.GeneralRelatedListTokens );
1545 ResetSaveProcessData();
1549 ResetSaveProcessData();
1551 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralWebsiteList.begin();
1552 iter != ContactEditorData.GeneralWebsiteList.end(); ++iter){
1554 ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
1555 &iter, &ContactEditorData.GeneralWebsiteList, &ContactData,
1556 wxT("ALTID"), &ContactEditorData.GeneralWebsiteListAltID,
1557 wxT("PID"), &ContactEditorData.GeneralWebsiteListPID,
1558 wxT("MEDIATYPE"), &ContactEditorData.GeneralWebsiteListMediatype,
1559 wxT("PREF"), &ContactEditorData.GeneralWebsiteListPref,
1560 wxT(""), &ContactEditorData.GeneralWebsiteListTokens );
1562 ResetSaveProcessData();
1566 ResetSaveProcessData();
1568 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeWebsiteList.begin();
1569 iter != ContactEditorData.HomeWebsiteList.end(); ++iter){
1571 ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1572 &iter, &ContactEditorData.HomeWebsiteList, &ContactData,
1573 wxT("ALTID"), &ContactEditorData.HomeWebsiteListAltID,
1574 wxT("PID"), &ContactEditorData.HomeWebsiteListPID,
1575 wxT("MEDIATYPE"), &ContactEditorData.HomeWebsiteListMediatype,
1576 wxT("PREF"), &ContactEditorData.HomeWebsiteListPref,
1577 wxT(""), &ContactEditorData.HomeWebsiteListTokens );
1579 ResetSaveProcessData();
1583 ResetSaveProcessData();
1585 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessWebsiteList.begin();
1586 iter != ContactEditorData.BusinessWebsiteList.end(); ++iter){
1588 ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1589 &iter, &ContactEditorData.BusinessWebsiteList, &ContactData,
1590 wxT("ALTID"), &ContactEditorData.BusinessWebsiteListAltID,
1591 wxT("PID"), &ContactEditorData.BusinessWebsiteListPID,
1592 wxT("MEDIATYPE"), &ContactEditorData.BusinessWebsiteListMediatype,
1593 wxT("PREF"), &ContactEditorData.BusinessWebsiteListPref,
1594 wxT(""), &ContactEditorData.BusinessWebsiteListTokens );
1596 ResetSaveProcessData();
1600 ResetSaveProcessData();
1602 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTitleList.begin();
1603 iter != ContactEditorData.GeneralTitleList.end(); ++iter){
1605 ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
1606 &iter, &ContactEditorData.GeneralTitleList, &ContactData,
1607 wxT("ALTID"), &ContactEditorData.GeneralTitleListAltID,
1608 wxT("PID"), &ContactEditorData.GeneralTitleListPID,
1609 wxT("LANGUAGE"), &ContactEditorData.GeneralTitleListLanguage,
1610 wxT("PREF"), &ContactEditorData.GeneralTitleListPref,
1611 wxT(""), &ContactEditorData.GeneralTitleListTokens );
1613 ResetSaveProcessData();
1617 ResetSaveProcessData();
1619 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTitleList.begin();
1620 iter != ContactEditorData.HomeTitleList.end(); ++iter){
1622 ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1623 &iter, &ContactEditorData.HomeTitleList, &ContactData,
1624 wxT("ALTID"), &ContactEditorData.HomeTitleListAltID,
1625 wxT("PID"), &ContactEditorData.HomeTitleListPID,
1626 wxT("LANGUAGE"), &ContactEditorData.HomeTitleListLanguage,
1627 wxT("PREF"), &ContactEditorData.HomeTitleListPref,
1628 wxT(""), &ContactEditorData.HomeTitleListTokens );
1630 ResetSaveProcessData();
1634 ResetSaveProcessData();
1636 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTitleList.begin();
1637 iter != ContactEditorData.BusinessTitleList.end(); ++iter){
1639 ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1640 &iter, &ContactEditorData.BusinessTitleList, &ContactData,
1641 wxT("ALTID"), &ContactEditorData.BusinessTitleListAltID,
1642 wxT("PID"), &ContactEditorData.BusinessTitleListPID,
1643 wxT("LANGUAGE"), &ContactEditorData.BusinessTitleListLanguage,
1644 wxT("PREF"), &ContactEditorData.BusinessTitleListPref,
1645 wxT(""), &ContactEditorData.BusinessTitleListTokens );
1647 ResetSaveProcessData();
1651 ResetSaveProcessData();
1653 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRoleList.begin();
1654 iter != ContactEditorData.GeneralRoleList.end(); ++iter){
1656 ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
1657 &iter, &ContactEditorData.GeneralRoleList, &ContactData,
1658 wxT("ALTID"), &ContactEditorData.GeneralRoleListAltID,
1659 wxT("PID"), &ContactEditorData.GeneralRoleListPID,
1660 wxT("LANGUAGE"), &ContactEditorData.GeneralRoleListLanguage,
1661 wxT("PREF"), &ContactEditorData.GeneralRoleListPref,
1662 wxT(""), &ContactEditorData.GeneralRoleListTokens );
1664 ResetSaveProcessData();
1668 ResetSaveProcessData();
1670 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeRoleList.begin();
1671 iter != ContactEditorData.HomeRoleList.end(); ++iter){
1673 ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1674 &iter, &ContactEditorData.HomeRoleList, &ContactData,
1675 wxT("ALTID"), &ContactEditorData.HomeRoleListAltID,
1676 wxT("PID"), &ContactEditorData.HomeRoleListPID,
1677 wxT("LANGUAGE"), &ContactEditorData.HomeRoleListLanguage,
1678 wxT("PREF"), &ContactEditorData.HomeRoleListPref,
1679 wxT(""), &ContactEditorData.HomeRoleListTokens );
1681 ResetSaveProcessData();
1685 ResetSaveProcessData();
1687 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessRoleList.begin();
1688 iter != ContactEditorData.BusinessRoleList.end(); ++iter){
1690 ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1691 &iter, &ContactEditorData.BusinessRoleList, &ContactData,
1692 wxT("ALTID"), &ContactEditorData.BusinessRoleListAltID,
1693 wxT("PID"), &ContactEditorData.BusinessRoleListPID,
1694 wxT("LANGUAGE"), &ContactEditorData.BusinessRoleListLanguage,
1695 wxT("PREF"), &ContactEditorData.BusinessRoleListPref,
1696 wxT(""), &ContactEditorData.BusinessRoleListTokens );
1698 ResetSaveProcessData();
1702 ResetSaveProcessData();
1704 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralOrganisationsList.begin();
1705 iter != ContactEditorData.GeneralOrganisationsList.end(); ++iter){
1707 ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
1708 &iter, &ContactEditorData.GeneralOrganisationsList, &ContactData,
1709 wxT("ALTID"), &ContactEditorData.GeneralOrganisationsListAltID,
1710 wxT("PID"), &ContactEditorData.GeneralOrganisationsListPID,
1711 wxT("LANGUAGE"), &ContactEditorData.GeneralOrganisationsListLanguage,
1712 wxT("SORT-AS"), &ContactEditorData.GeneralOrganisationsListSortAs,
1713 wxT("PREF"), &ContactEditorData.GeneralOrganisationsListPref,
1714 wxT(""), &ContactEditorData.GeneralOrganisationsListTokens );
1716 ResetSaveProcessData();
1720 ResetSaveProcessData();
1722 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeOrganisationsList.begin();
1723 iter != ContactEditorData.HomeOrganisationsList.end(); ++iter){
1725 ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1726 &iter, &ContactEditorData.HomeOrganisationsList, &ContactData,
1727 wxT("ALTID"), &ContactEditorData.HomeOrganisationsListAltID,
1728 wxT("PID"), &ContactEditorData.HomeOrganisationsListPID,
1729 wxT("LANGUAGE"), &ContactEditorData.HomeOrganisationsListLanguage,
1730 wxT("SORT-AS"), &ContactEditorData.HomeOrganisationsListSortAs,
1731 wxT("PREF"), &ContactEditorData.HomeOrganisationsListPref,
1732 wxT(""), &ContactEditorData.HomeOrganisationsListTokens );
1734 ResetSaveProcessData();
1738 ResetSaveProcessData();
1740 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessOrganisationsList.begin();
1741 iter != ContactEditorData.BusinessOrganisationsList.end(); ++iter){
1743 ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1744 &iter, &ContactEditorData.BusinessOrganisationsList, &ContactData,
1745 wxT("ALTID"), &ContactEditorData.BusinessOrganisationsListAltID,
1746 wxT("PID"), &ContactEditorData.BusinessOrganisationsListPID,
1747 wxT("LANGUAGE"), &ContactEditorData.BusinessOrganisationsListLanguage,
1748 wxT("SORT-AS"), &ContactEditorData.BusinessOrganisationsListSortAs,
1749 wxT("PREF"), &ContactEditorData.BusinessOrganisationsListPref,
1750 wxT(""), &ContactEditorData.BusinessOrganisationsListTokens );
1752 ResetSaveProcessData();
1756 ResetSaveProcessData();
1758 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNoteList.begin();
1759 iter != ContactEditorData.GeneralNoteList.end(); ++iter){
1761 ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
1762 &iter, &ContactEditorData.GeneralNoteList, &ContactData,
1763 wxT("ALTID"), &ContactEditorData.GeneralNoteListAltID,
1764 wxT("PID"), &ContactEditorData.GeneralNoteListPID,
1765 wxT("LANGUAGE"), &ContactEditorData.GeneralNoteListLanguage,
1766 wxT("PREF"), &ContactEditorData.GeneralNoteListPref,
1767 wxT(""), &ContactEditorData.GeneralNoteListTokens );
1769 ResetSaveProcessData();
1773 ResetSaveProcessData();
1775 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNoteList.begin();
1776 iter != ContactEditorData.HomeNoteList.end(); ++iter){
1778 ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1779 &iter, &ContactEditorData.HomeNoteList, &ContactData,
1780 wxT("ALTID"), &ContactEditorData.HomeNoteListAltID,
1781 wxT("PID"), &ContactEditorData.HomeNoteListPID,
1782 wxT("LANGUAGE"), &ContactEditorData.HomeNoteListLanguage,
1783 wxT("PREF"), &ContactEditorData.HomeNoteListPref,
1784 wxT(""), &ContactEditorData.HomeNoteListTokens );
1786 ResetSaveProcessData();
1790 ResetSaveProcessData();
1792 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNoteList.begin();
1793 iter != ContactEditorData.BusinessNoteList.end(); ++iter){
1795 ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1796 &iter, &ContactEditorData.BusinessNoteList, &ContactData,
1797 wxT("ALTID"), &ContactEditorData.BusinessNoteListAltID,
1798 wxT("PID"), &ContactEditorData.BusinessNoteListPID,
1799 wxT("LANGUAGE"), &ContactEditorData.BusinessNoteListLanguage,
1800 wxT("PREF"), &ContactEditorData.BusinessNoteListPref,
1801 wxT(""), &ContactEditorData.BusinessNoteListTokens );
1803 ResetSaveProcessData();
1807 ResetSaveProcessData();
1809 for (std::map<int,wxString>::iterator iter = ContactEditorData.CategoriesList.begin();
1810 iter != ContactEditorData.CategoriesList.end(); ++iter){
1812 ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
1813 &iter, &ContactEditorData.CategoriesList, &ContactData,
1814 wxT("ALTID"), &ContactEditorData.CategoriesListAltID,
1815 wxT("PID"), &ContactEditorData.CategoriesListPID,
1816 wxT("TYPE"), &ContactEditorData.CategoriesListType,
1817 wxT("PREF"), &ContactEditorData.CategoriesListPref,
1818 wxT(""), &ContactEditorData.CategoriesListTokens );
1820 ResetSaveProcessData();
1826 for (std::map<int, std::string>::iterator iter = ContactEditorData.PicturesList.begin();
1827 iter != ContactEditorData.PicturesList.end(); ++iter){
1829 int intValueIndex = iter->first;
1831 std::map<int, std::string>::iterator stdstriter;
1832 std::map<int, wxString>::iterator enciter;
1834 striter = ContactEditorData.PicturesListPictureType.find(intValueIndex);
1835 enciter = ContactEditorData.PicturesListPicEncType.find(intValueIndex);
1837 ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
1838 &iter, &ContactEditorData.PicturesList, &striter,
1839 &enciter, &ContactData,
1840 wxT("ALTID"), &ContactEditorData.PicturesListAltID,
1841 wxT("PID"), &ContactEditorData.PicturesListPID,
1842 wxT("TYPE"), &ContactEditorData.PicturesListType,
1843 wxT("PREF"), &ContactEditorData.PicturesListPref,
1844 wxT(""), &ContactEditorData.PicturesListTokens);
1846 ResetSaveProcessData();
1850 ResetSaveProcessData();
1854 for (std::map<int, std::string>::iterator iter = ContactEditorData.LogosList.begin();
1855 iter != ContactEditorData.LogosList.end(); ++iter){
1857 int intValueIndex = iter->first;
1859 std::map<int, std::string>::iterator stdstriter;
1860 std::map<int, wxString>::iterator enciter;
1862 striter = ContactEditorData.LogosListPictureType.find(intValueIndex);
1863 enciter = ContactEditorData.LogosListPicEncType.find(intValueIndex);
1865 ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
1866 &iter, &ContactEditorData.LogosList, &striter,
1867 &enciter, &ContactData,
1868 wxT("ALTID"), &ContactEditorData.LogosListAltID,
1869 wxT("PID"), &ContactEditorData.LogosListPID,
1870 wxT("TYPE"), &ContactEditorData.LogosListType,
1871 wxT("PREF"), &ContactEditorData.LogosListPref,
1872 wxT(""), &ContactEditorData.LogosListTokens );
1874 ResetSaveProcessData();
1878 ResetSaveProcessData();
1882 for (std::map<int, std::string>::iterator iter = ContactEditorData.SoundsList.begin();
1883 iter != ContactEditorData.SoundsList.end(); ++iter){
1885 int intValueIndex = iter->first;
1887 std::map<int, std::string>::iterator stdstriter;
1888 std::map<int, wxString>::iterator enciter;
1890 striter = ContactEditorData.SoundsListAudioType.find(intValueIndex);
1891 enciter = ContactEditorData.SoundsListAudioEncType.find(intValueIndex);
1893 ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
1894 &iter, &ContactEditorData.SoundsList, &striter,
1895 &enciter, &ContactData,
1896 wxT("ALTID"), &ContactEditorData.SoundsListAltID,
1897 wxT("PID"), &ContactEditorData.SoundsListPID,
1898 wxT("TYPE"), &ContactEditorData.SoundsListType,
1899 wxT("PREF"), &ContactEditorData.SoundsListPref,
1900 wxT(""), &ContactEditorData.SoundsListTokens );
1902 ResetSaveProcessData();
1906 ResetSaveProcessData();
1908 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarList.begin();
1909 iter != ContactEditorData.CalendarList.end(); ++iter){
1911 ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
1912 &iter, &ContactEditorData.CalendarList, &ContactData,
1913 wxT("ALTID"), &ContactEditorData.CalendarListAltID,
1914 wxT("PID"), &ContactEditorData.CalendarListPID,
1915 wxT("MEDIATYPE"), &ContactEditorData.CalendarListMediatype,
1916 wxT("TYPE"), &ContactEditorData.CalendarListType,
1917 wxT("PREF"), &ContactEditorData.CalendarListPref,
1918 wxT(""), &ContactEditorData.CalendarListTokens );
1920 ResetSaveProcessData();
1924 ResetSaveProcessData();
1926 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarRequestList.begin();
1927 iter != ContactEditorData.CalendarRequestList.end(); ++iter){
1929 ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
1930 &iter, &ContactEditorData.CalendarRequestList, &ContactData,
1931 wxT("ALTID"), &ContactEditorData.CalendarRequestListAltID,
1932 wxT("PID"), &ContactEditorData.CalendarRequestListPID,
1933 wxT("MEDIATYPE"), &ContactEditorData.CalendarRequestListMediatype,
1934 wxT("TYPE"), &ContactEditorData.CalendarRequestListType,
1935 wxT("PREF"), &ContactEditorData.CalendarRequestListPref,
1936 wxT(""), &ContactEditorData.CalendarRequestListTokens );
1938 ResetSaveProcessData();
1942 ResetSaveProcessData();
1944 for (std::map<int,wxString>::iterator iter = ContactEditorData.FreeBusyList.begin();
1945 iter != ContactEditorData.FreeBusyList.end(); ++iter){
1947 ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
1948 &iter, &ContactEditorData.FreeBusyList, &ContactData,
1949 wxT("ALTID"), &ContactEditorData.FreeBusyListAltID,
1950 wxT("PID"), &ContactEditorData.FreeBusyListPID,
1951 wxT("MEDIATYPE"), &ContactEditorData.FreeBusyListMediatype,
1952 wxT("TYPE"), &ContactEditorData.FreeBusyListType,
1953 wxT("PREF"), &ContactEditorData.FreeBusyListPref,
1954 wxT(""), &ContactEditorData.FreeBusyListTokens );
1956 ResetSaveProcessData();
1960 for (std::map<int, wxString>::iterator iter = ContactEditorData.KeyList.begin();
1961 iter != ContactEditorData.KeyList.end(); ++iter){
1963 intValue2 = iter->first;
1965 // Get the key information.
1967 std::map<int, wxString>::iterator enciter;
1969 striter = ContactEditorData.KeyListDataType.find(intValue2);
1970 //enciter = KeyListAudioEncType.find(intValue2);
1972 wxString strValueData;
1974 strValueData = iter->second;
1975 strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));
1977 ProcessSaveData(wxT("KEY"), &strValue2, &boolValue2, &boolValue,
1978 &iter, &strValueData, &ContactData,
1979 wxT("ALTID"), &ContactEditorData.KeyListAltID,
1980 wxT("PID"), &ContactEditorData.KeyListPID,
1981 wxT("TYPE"), &ContactEditorData.KeyListType,
1982 wxT("PREF"), &ContactEditorData.KeyListPref,
1983 wxT(""), &ContactEditorData.KeyListTokens );
1985 ResetSaveProcessData();
1989 // Vendor specific items.
1991 ResetSaveProcessData();
1993 for (std::map<int,wxString>::iterator iter = ContactEditorData.VendorList.begin();
1994 iter != ContactEditorData.VendorList.end(); ++iter){
1996 intValue2 = iter->first;
1998 // Get the IANA PEN number.
2000 striter = ContactEditorData.VendorListPEN.find(intValue2);
2002 if (striter->first == intValue2){
2004 strValue2 = striter->second;
2008 // Get the element name.
2010 striter = ContactEditorData.VendorListElement.find(intValue2);
2012 if (striter->first == intValue2){
2014 strValue3 = striter->second;
2020 striter = ContactEditorData.VendorList.find(intValue2);
2022 if (striter->first == intValue2){
2024 strValue = striter->second;
2028 // Add to the vCard.
2030 if (boolValue == TRUE){
2032 ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
2036 ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
2040 ResetSaveProcessData();
2044 ResetSaveProcessData();
2048 for (std::map<int,wxString>::iterator iter = ContactEditorData.XTokenList.begin();
2049 iter != ContactEditorData.XTokenList.end(); ++iter){
2051 intValue2 = iter->first;
2053 // Get the element name.
2055 striter = ContactEditorData.XTokenListTokens.find(intValue2);
2057 if (striter->first == intValue2){
2059 strValue2 = striter->second;
2065 striter = ContactEditorData.XTokenList.find(intValue2);
2067 if (striter->first == intValue2){
2069 strValue = striter->second;
2073 // Add to the vCard.
2075 if (boolValue == TRUE){
2077 ContactData.AddRaw(wxT("X-") + strValue2, strValue);
2081 ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
2085 ResetSaveProcessData();
2089 ResetSaveProcessData();
2091 if (ContactEditorData.FullNamesList.size() == 0){
2093 wxString FullName = cmbDisplayAs->GetValue();
2094 ContactEditorData.FullNamesList.insert(std::make_pair(0, FullName));
2095 ContactEditorData.FullNamesListAltID.insert(std::make_pair(0, wxT("")));
2096 ContactEditorData.FullNamesListPID.insert(std::make_pair(0, wxT("")));
2097 ContactEditorData.FullNamesListType.insert(std::make_pair(0, wxT("")));
2098 ContactEditorData.FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
2099 ContactEditorData.FullNamesListPref.insert(std::make_pair(0, 0));
2100 ContactEditorData.FullNamesListTokens.insert(std::make_pair(0, wxT("")));
2105 for (std::map<int, wxString>::iterator iter = ContactEditorData.FullNamesList.begin();
2106 iter != ContactEditorData.FullNamesList.end(); ++iter){
2108 if (FNFirst == TRUE){
2110 iter->second = cmbDisplayAs->GetValue();
2115 std::map<int,wxString>::iterator mapS;
2117 mapS = ContactEditorData.FullNamesListTokens.find(iter->first);
2119 ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue,
2120 &iter, &ContactEditorData.FullNamesList, &ContactData,
2121 wxT("ALTID"), &ContactEditorData.FullNamesListAltID,
2122 wxT("PID"), &ContactEditorData.FullNamesListPID,
2123 wxT("TYPE"), &ContactEditorData.FullNamesListType,
2124 wxT("LANGUAGE"), &ContactEditorData.FullNamesListLanguage,
2125 wxT("PREF"), &ContactEditorData.FullNamesListPref,
2126 wxT(""), &ContactEditorData.FullNamesListTokens );
2130 ResetSaveProcessData();
2134 //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
2136 // Insert revision (REV) date.
2138 // Get today's date and time.
2140 wxDateTime DateTimeNow = wxDateTime::Now();
2144 // Set year, month and date.
2146 int intYear = DateTimeNow.GetYear();
2147 int intMonth = DateTimeNow.GetMonth();
2148 int intDay = DateTimeNow.GetDay();
2150 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
2154 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
2158 DateRev.Append(wxString::Format(wxT("%i"), intMonth));
2164 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
2168 DateRev.Append(wxString::Format(wxT("%i"), intDay));
2172 //DateRev.Append(wx);
2173 //DateRev.Append(wx);
2174 //DateRev.Append(wx);
2175 DateRev.Append(wxT("T"));
2177 // Set hour, minute and second.
2179 int intHour = DateTimeNow.GetHour();
2180 int intMinute = DateTimeNow.GetMinute();
2181 int intSecond = DateTimeNow.GetSecond();
2185 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
2189 DateRev.Append(wxString::Format(wxT("%i"), intHour));
2193 if (intMinute < 10){
2195 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
2199 DateRev.Append(wxString::Format(wxT("%i"), intMinute));
2203 if (intSecond < 10){
2205 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
2209 DateRev.Append(wxString::Format(wxT("%i"), intSecond));
2213 // DateRev.Append(wx);
2214 // DateRev.Append(wx);
2215 // DateRev.Append(wxString DateTimeNow->);
2216 DateRev.Append(wxT("Z"));
2218 ContactData.Add(wxT("UID"), ContactEditorData.UIDToken, FALSE);
2220 // End the vCard File.
2222 ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
2225 ContactData.WriteFile(FilenameFinal);
2227 vCard34Conv ConvFileFun;
2231 ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
2233 wxString AccountDirPrefix;
2234 wxString AccountDir;
2237 #if defined(__HAIKU__)
2239 //preffilename = wxT("noo");
2241 #elif defined(__APPLE__)
2243 PrefDir = GetUserPrefDir();
2245 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2247 #elif defined(__WIN32__)
2249 PrefDir = GetUserPrefDir();
2251 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
2255 PrefDir = GetUserPrefDir();
2257 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2261 XABPreferences PrefData(PrefDir);
2263 wxString AccountType;
2265 for (int i = 0; i < PrefData.accounts.GetCount(); i++){
2267 AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
2269 if (AccountDir == wxSContactAccount){
2271 AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
2272 AccountDirPrefix.Trim();
2273 AccountType = PrefData.accounts.GetAccountType(i);
2280 wxString wxSplitFilename;
2281 wxString wxSDataURL;
2283 while(wSTFilename.HasMoreTokens()){
2285 wxSplitFilename = wSTFilename.GetNextToken();
2289 wxSDataURL = wxSplitFilename;
2290 //wxSDataURL.Append(wxSplitFilename);
2292 // Find out if the filename exists in the table.
2294 if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
2296 wxString ETagResult;
2297 wxString ETagOriginal;
2299 ETagDB *ETagDBPtr = NULL;
2301 ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
2303 wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
2304 wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
2306 if (wxSETagOrig.IsEmpty()){
2308 // Generate the ETag.
2310 wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2314 if (wxSETag.IsEmpty()){
2316 // Update empty ETag.
2318 wxSETag = wxSETagOrig;
2319 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
2323 // Don't change original ETag.
2325 wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2326 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
2330 if (EditMode == FALSE){
2332 ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2334 FMTimer.SetFilename(FilenameFinal);
2335 FMTimer.UpdateTimestamp();
2336 FMTimer.Start(10000, FALSE);
2338 wxCommandEvent reloadevent(RELOADCONTACTLIST);
2339 reloadevent.SetString(wxSContactAccount);
2340 wxPostEvent(this->GetParent(), reloadevent);
2344 ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2345 FMTimer.UpdateTimestamp();
2346 FMTimer.Start(10000, FALSE);
2352 // Send a notification to update the main window
2353 // with the new details.
2358 // TODO: Workout nickname settings by priority and
2361 ucd->ContactAccount = wxSContactAccount;
2362 ucd->ContactFilename = FilenameFinal;
2363 ucd->ContactName = cmbDisplayAs->GetValue();
2364 ucd->ContactNameArray = ContactData.GetName();
2366 for (std::map<int,wxString>::iterator gniter = ContactEditorData.GeneralNicknamesList.begin();
2367 gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){
2369 ucd->ContactNickname = gniter->second;
2374 wxCommandEvent event2(CE_UPDATECONTACTLIST);
2375 event2.SetClientData(ucd);
2376 wxPostEvent(MainPtr, event2);
2380 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
2383 // Save the updated contact data and close the form.
2385 wxCommandEvent NullEvent;
2386 this->SaveContact(NullEvent);