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("/"));
84 while(wSTDelFilename.HasMoreTokens()){
86 wxDelSplitFilename = wSTDelFilename.GetNextToken();
90 wxSDelDataURL = wxDelSplitFilename;
92 // Delete the contact from the server as it will be useless in certain
93 // address book clients.
95 ActMgrPtr->AddTask(2, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDelDataURL, wxDelSplitFilename, wxSContactFilename, wxT(""));
97 // Clear the filename so the trigger to recreate the UID is done.
99 wxSContactFilename.Clear();
106 if (wxSContactFilename.IsEmpty()){
108 // Generate a random UUID.
110 ContactEditorData.UIDToken = GenerateUUID();
111 ContactEditorData.UIDToken = ContactEditorData.UIDToken.MakeUpper();
113 // Setup the filename.
115 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
117 #if defined(__HAIKU__)
119 //preffilename = wxT("noo");
121 #elif defined(__WIN32__)
123 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
124 FilenameFinal.Append(ContactEditorData.UIDToken);
125 FilenameFinal.Append(wxT(".vcf"));
126 wxSContactFilename = FilenameFinal;
130 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
131 FilenameFinal.Append(ContactEditorData.UIDToken);
132 FilenameFinal.Append(wxT(".vcf"));
133 wxSContactFilename = FilenameFinal;
139 if (ContactEditorData.UIDToken.IsEmpty()){
141 // UID Token is empty. (Shouldn't be).
142 // Generate a new UID Token.
144 ContactEditorData.UIDToken = GenerateUUID();
145 ContactEditorData.UIDToken = ContactEditorData.UIDToken.MakeUpper();
149 FilenameFinal = wxSContactFilename;
153 // Setup the data and write it into the account folder.
155 // Begin preperations to write the contact to a file.
158 bool NNGeneralFirst = TRUE;
159 bool NNHomeFirst = TRUE;
160 bool NNWorkFirst = TRUE;
162 std::map<int,int>::iterator intiter;
163 std::map<int,wxString>::iterator striter;
165 ContactData.Add(wxT("BEGIN"), wxT("VCARD"), FALSE);
166 ContactData.Add(wxT("VERSION"), wxT("4.0"), FALSE);
168 // Setup the version string.
170 strValue.Append(wxT("-//Xestia//Address Book Version "));
171 strValue.Append(wxT(XSDAB_VERSION));
172 strValue.Append(wxT("//KW"));
174 ContactData.Add(wxT("PRODID"), strValue, FALSE);
176 // Process the REV property.
178 wxDateTime DateTimeSave;
179 DateTimeSave = DateTimeSave.SetToCurrent();
180 wxString DateTimeSaveValue;
182 DateTimeSaveValue += wxString::Format("%04i", DateTimeSave.GetYear());
183 DateTimeSaveValue += wxString::Format("%02i", (DateTimeSave.GetMonth() + 1));
184 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetDay());
185 DateTimeSaveValue += "T";
186 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetHour());
187 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetMinute());
188 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetSecond());
190 if (!ContactEditorData.RevisionTokens.IsEmpty()){
191 ContactData.AddRaw("REV;" + ContactEditorData.RevisionTokens, DateTimeSaveValue);
193 ContactData.AddRaw("REV", DateTimeSaveValue);
195 // Process the XML properties.
197 for (std::map<int,wxString>::iterator iter = ContactEditorData.XMLList.begin();
198 iter != ContactEditorData.XMLList.end(); ++iter){
200 wxString strOrigValue;
202 strOrigValue = ContactEditorData.XMLList.find(iter->first)->second;
204 ResetUnusedString(&strOrigValue);
206 ProcessSaveData(wxT("XML"), &strValue2, &boolValue2, &boolValue,
207 &iter, &strOrigValue, &ContactData,
208 wxT("ALTID"), &ContactEditorData.XMLListAltID );
210 ResetSaveProcessData();
214 // Process the CLIENTPIDMAP properties.
216 for (std::map<int,wxString>::iterator iter = ContactEditorData.ClientPIDList.begin();
217 iter != ContactEditorData.ClientPIDList.end(); ++iter){
219 wxString strOrigValue;
221 strOrigValue = ContactEditorData.ClientPIDList.find(iter->first)->second;
223 ResetUnusedString(&strOrigValue);
225 ProcessSaveData(wxT("CLIENTPIDMAP"), &strValue2, &boolValue2, &boolValue,
226 &iter, &strOrigValue, &ContactData,
227 wxT(""), &ContactEditorData.ClientPIDListTokens );
229 ResetSaveProcessData();
233 // Process the SOURCE properties.
235 for (std::map<int,wxString>::iterator iter = ContactEditorData.SourceList.begin();
236 iter != ContactEditorData.SourceList.end(); ++iter){
238 wxString strOrigValue;
240 strOrigValue = ContactEditorData.SourceList.find(iter->first)->second;
242 ResetUnusedString(&strOrigValue);
244 ProcessSaveData(wxT("SOURCE"), &strValue2, &boolValue2, &boolValue,
245 &iter, &strOrigValue, &ContactData,
246 wxT("ALTID"), &ContactEditorData.SourceListAltID,
247 wxT("PID"), &ContactEditorData.SourceListPID,
248 wxT("TYPE"), &ContactEditorData.SourceListType,
249 wxT("PREF"), &ContactEditorData.SourceListPref,
250 wxT("MEDIATYPE"), &ContactEditorData.SourceListMediatype,
251 wxT(""), &ContactEditorData.SourceListTokens );
253 ResetSaveProcessData();
261 // Setup the name field.
263 strValue = txtSurname->GetValue() + wxT(";") +
264 txtForename->GetValue() + wxT(";") +
265 txtOtherNames->GetValue() + wxT(";") +
266 txtTitle->GetValue() + wxT(";") +
267 txtSuffix->GetValue();
269 strValue2 = ContactData.Convert(cmbDisplayAs->GetValue(), FALSE);
272 if (ContactEditorData.NameTokens.IsEmpty()){
273 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\""), strValue, FALSE);
275 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\";") + ContactEditorData.NameTokens, strValue, FALSE);
278 if (cmbType->GetCurrentSelection() == 1){
280 ContactData.AddRaw(wxT("KIND"), wxT("individual"));
282 } else if (cmbType->GetCurrentSelection() == 2){
284 ContactData.AddRaw(wxT("KIND"), wxT("group"));
286 // Go through each of the members and write them out.
288 for (std::map<int, wxString>::iterator itemiter = ContactEditorData.GroupsList.begin();
289 itemiter != ContactEditorData.GroupsList.end(); ++itemiter){
291 ContactData.Add(wxT("MEMBER:urn:uuid"), itemiter->second, FALSE);
295 } else if (cmbType->GetCurrentSelection() == 3){
297 ContactData.AddRaw(wxT("KIND"), wxT("org"));
299 } else if (cmbType->GetCurrentSelection() == 4){
301 ContactData.AddRaw(wxT("KIND"), wxT("location"));
306 // Setup the nicknames (General, Home & Business).
319 if (cmbGender->GetCurrentSelection() != 0){
321 switch(cmbGender->GetCurrentSelection()){
352 if (!txtGenderDescription->IsEmpty()){
354 strValue2 = txtGenderDescription->GetValue();
358 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
360 EscapeString(&strValue2, FALSE);
362 if (!ContactEditorData.GenderTokens.IsEmpty()){
364 if (!strValue2.IsEmpty()){
366 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue + wxT(";") + strValue2);
370 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue);
376 if (!strValue2.IsEmpty()){
378 ContactData.AddRaw(wxT("GENDER"), strValue + wxT(";") + strValue2);
382 ContactData.AddRaw(wxT("GENDER"), strValue);
390 ResetSaveProcessData();
392 // Build the values for the BDAY property.
396 if (!ContactEditorData.BirthdayAltID.IsEmpty()){
399 DataValue = ContactEditorData.BirthdayAltID;
401 EscapeString(&DataValue, FALSE);
403 strValue3.Append("ALTID=");
404 strValue3.Append(DataValue);
412 if (!ContactEditorData.BirthdayCalScale.IsEmpty()){
415 DataValue = ContactEditorData.BirthdayCalScale;
417 EscapeString(&DataValue, FALSE);
419 if (boolValue2 == TRUE){
421 strValue3.Append(";");
425 strValue3.Append("CALSCALE=");
426 strValue3.Append(DataValue);
434 if (!ContactEditorData.BirthdayTokens.IsEmpty()){
437 DataValue = ContactEditorData.BirthdayTokens;
439 EscapeString(&DataValue, FALSE);
441 if (boolValue2 == TRUE){
443 strValue3.Append(";");
447 strValue3.Append(DataValue);
451 // Write the BDAY property.
453 if (!txtBirthday->IsEmpty()){
455 if (!txtBirthday->GetValue().IsEmpty()){
457 strValue = txtBirthday->GetValue();
459 if (!strValue3.IsEmpty()){
461 ContactData.AddRaw("BDAY;VALUE=text;" + strValue3, strValue);
465 ContactData.AddRaw("BDAY;VALUE=text", strValue);
475 // Get Day, Month & Year.
477 wxDateTime BirthdayDate;
478 wxDateTime::Month BirthdayMonth;
481 wxString DataBeforeT;
483 wxString FinalBirthdayString;
484 bool ProcessDataAfterT = FALSE;
486 BirthdayDate = dapBirthday->GetValue();
488 if (BirthdayDate.IsValid()){
490 BirthdayDay = BirthdayDate.GetDay();
491 BirthdayMonth = BirthdayDate.GetMonth();
492 BirthdayYear = BirthdayDate.GetYear();
494 // Look for T and replace data before this.
496 wxStringTokenizer wSTDate(ContactEditorData.Birthday, wxT("T"));
498 while (wSTDate.HasMoreTokens()){
500 if (ProcessDataAfterT == FALSE){
502 DataBeforeT = wSTDate.GetNextToken();
503 ProcessDataAfterT = TRUE;
507 DataAfterT = wSTDate.GetNextToken();
514 // If there is not T then replace altogether.
516 wxString FinalBirthdayDay;
517 wxString FinalBirthdayMonth;
518 wxString FinalBirthdayYear;
520 if (BirthdayDay < 10){
522 FinalBirthdayDay = wxT("0") + wxString::Format(wxT("%i"), BirthdayDay);
526 FinalBirthdayDay = wxString::Format(wxT("%i"), BirthdayDay);
530 if (((int)BirthdayMonth + 1) < 10){
532 FinalBirthdayMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
536 FinalBirthdayMonth = wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
540 if (BirthdayYear == 0){
542 FinalBirthdayYear = wxT("--");
546 FinalBirthdayYear = wxString::Format(wxT("%i"), BirthdayYear);
550 if (!DataAfterT.IsEmpty()){
552 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay + wxT("T") + DataAfterT;
556 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay;
560 if (!FinalBirthdayString.IsEmpty() || !strValue3.IsEmpty()){
562 if (!strValue3.IsEmpty()){
564 EscapeString(&strValue2, FALSE);
565 EscapeString(&strValue, FALSE);
567 ContactData.AddRaw(wxT("BDAY;") + strValue3, FinalBirthdayString);
571 EscapeString(&strValue, FALSE);
573 ContactData.AddRaw(wxT("BDAY"), FinalBirthdayString);
583 ResetSaveProcessData();
587 strValue3 = ContactEditorData.AnniversaryAltID;
589 if (!strValue3.IsEmpty()){
594 strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
600 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
605 strValue3 = ContactEditorData.AnniversaryCalScale;
607 if (!strValue3.IsEmpty()){
612 if (boolValue2 == TRUE){
614 strValue2.Append(wxT(";"));
622 strValue2.Append(wxT("CALSCALE=") + strValue3);
630 strValue2 = ContactEditorData.AnniversaryTokens;
632 // Deal with ANNIVERSARY.
634 if (!txtAnniversary->IsEmpty()){
636 strValue = txtAnniversary->GetValue();
638 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
640 if (!strValue2.IsEmpty()){
642 EscapeString(&strValue2, FALSE);
643 EscapeString(&strValue, FALSE);
645 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text;") + strValue2 + wxT(";"), strValue);
649 EscapeString(&strValue, FALSE);
651 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text"), strValue);
659 // Look for T and replace data before this.
661 // Get Day, Month & Year.
663 wxDateTime AnniversaryDate;
664 wxDateTime::Month AnniversaryMonth;
667 wxString DataBeforeT;
669 wxString FinalAnniversaryString;
670 bool ProcessDataAfterT = FALSE;
672 AnniversaryDate = dapAnniversary->GetValue();
674 if (AnniversaryDate.IsValid()){
676 AnniversaryDay = AnniversaryDate.GetDay();
677 AnniversaryMonth = AnniversaryDate.GetMonth();
678 AnniversaryYear = AnniversaryDate.GetYear();
680 // Look for T and replace data before this.
682 wxStringTokenizer wSTDate(ContactEditorData.Anniversary, wxT("T"));
684 while (wSTDate.HasMoreTokens()){
686 if (ProcessDataAfterT == FALSE){
688 DataBeforeT = wSTDate.GetNextToken();
689 ProcessDataAfterT = TRUE;
693 DataAfterT = wSTDate.GetNextToken();
700 // If there is not T then replace altogether.
702 wxString FinalAnniversaryDay;
703 wxString FinalAnniversaryMonth;
704 wxString FinalAnniversaryYear;
706 if (AnniversaryDay < 10){
708 FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
712 FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
716 if (((int)AnniversaryMonth + 1) < 10){
718 FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
722 FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
726 if (AnniversaryYear == 0){
728 FinalAnniversaryYear = wxT("--");
732 FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
736 if (!DataAfterT.IsEmpty()){
738 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
742 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
746 if (!FinalAnniversaryString.IsEmpty() || !strValue2.IsEmpty()){
748 if (!strValue2.IsEmpty()){
750 EscapeString(&strValue2, FALSE);
751 EscapeString(&strValue, FALSE);
753 ContactData.AddRaw(wxT("ANNIVERSARY") + strValue2 + wxT(";"), FinalAnniversaryString);
757 EscapeString(&strValue, FALSE);
759 ContactData.AddRaw(wxT("ANNIVERSARY"), FinalAnniversaryString);
769 // Setup the addresses (General, Home, Business).
771 //intValue = GeneralAddressList.size();
772 ResetSaveProcessData();
774 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralAddressList.begin();
775 iter != ContactEditorData.GeneralAddressList.end(); ++iter){
777 int intSeekValue = iter->first;
779 wxString strAddressString;
780 wxString strAddressFinalValue;
781 std::map<int, wxString>::iterator iterValue;
783 strAddressString.Append(wxT(";;"));
787 iterValue = ContactEditorData.GeneralAddressList.find(intSeekValue);
788 strAddressFinalValue = iterValue->second;
789 ProcessCaptureStrings(&strAddressFinalValue);
790 strAddressString.Append(strAddressFinalValue + wxT(";"));
791 strAddressFinalValue.Clear();
795 iterValue = ContactEditorData.GeneralAddressListTown.find(intSeekValue);
796 strAddressFinalValue = iterValue->second;
797 ProcessCaptureStrings(&strAddressFinalValue);
798 strAddressString.Append(strAddressFinalValue + wxT(";"));
799 strAddressFinalValue.Clear();
803 iterValue = ContactEditorData.GeneralAddressListCounty.find(intSeekValue);
804 strAddressFinalValue = iterValue->second;
805 ProcessCaptureStrings(&strAddressFinalValue);
806 strAddressString.Append(strAddressFinalValue + wxT(";"));
807 strAddressFinalValue.Clear();
811 iterValue = ContactEditorData.GeneralAddressListPostCode.find(intSeekValue);
812 strAddressFinalValue = iterValue->second;
813 ProcessCaptureStrings(&strAddressFinalValue);
814 strAddressString.Append(strAddressFinalValue + wxT(";"));
815 strAddressFinalValue.Clear();
819 iterValue = ContactEditorData.GeneralAddressListCountry.find(intSeekValue);
820 strAddressFinalValue = iterValue->second;
821 ProcessCaptureStrings(&strAddressFinalValue);
822 strAddressString.Append(strAddressFinalValue);
823 strAddressFinalValue.Clear();
825 ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
826 &iter, &strAddressString, &ContactData,
827 wxT("LABEL"), &ContactEditorData.GeneralAddressListLabel,
828 wxT("LANGUAGE"), &ContactEditorData.GeneralAddressListLang,
829 wxT("ALTID"), &ContactEditorData.GeneralAddressListAltID,
830 wxT("PID"), &ContactEditorData.GeneralAddressListPID,
831 wxT("GEO"), &ContactEditorData.GeneralAddressListGeo,
832 wxT("TZ"), &ContactEditorData.GeneralAddressListTimezone,
833 wxT("MEDIATYPE"), &ContactEditorData.GeneralAddressListMediatype,
834 wxT("PREF"), &ContactEditorData.GeneralAddressListPref,
835 wxT(""), &ContactEditorData.GeneralAddressListTokens );
837 ResetSaveProcessData();
841 ResetSaveProcessData();
843 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeAddressList.begin();
844 iter != ContactEditorData.HomeAddressList.end(); ++iter){
846 int intSeekValue = iter->first;
848 wxString strAddressString;
849 wxString strAddressFinalValue;
850 std::map<int, wxString>::iterator iterValue;
852 strAddressString.Append(wxT(";;"));
856 iterValue = ContactEditorData.HomeAddressList.find(intSeekValue);
857 strAddressFinalValue = iterValue->second;
858 ProcessCaptureStrings(&strAddressFinalValue);
859 strAddressString.Append(strAddressFinalValue + wxT(";"));
863 iterValue = ContactEditorData.HomeAddressListTown.find(intSeekValue);
864 strAddressFinalValue = iterValue->second;
865 ProcessCaptureStrings(&strAddressFinalValue);
866 strAddressString.Append(strAddressFinalValue + wxT(";"));
870 iterValue = ContactEditorData.HomeAddressListCounty.find(intSeekValue);
871 strAddressFinalValue = iterValue->second;
872 ProcessCaptureStrings(&strAddressFinalValue);
873 strAddressString.Append(strAddressFinalValue + wxT(";"));
877 iterValue = ContactEditorData.HomeAddressListPostCode.find(intSeekValue);
878 strAddressFinalValue = iterValue->second;
879 ProcessCaptureStrings(&strAddressFinalValue);
880 strAddressString.Append(strAddressFinalValue + wxT(";"));
884 iterValue = ContactEditorData.HomeAddressListCountry.find(intSeekValue);
885 strAddressFinalValue = iterValue->second;
886 ProcessCaptureStrings(&strAddressFinalValue);
887 strAddressString.Append(strAddressFinalValue);
889 ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
890 &iter, &strAddressString, &ContactData,
891 wxT("LABEL"), &ContactEditorData.HomeAddressListLabel,
892 wxT("LANGUAGE"), &ContactEditorData.HomeAddressListLang,
893 wxT("ALTID"), &ContactEditorData.HomeAddressListAltID,
894 wxT("PID"), &ContactEditorData.HomeAddressListPID,
895 wxT("GEO"), &ContactEditorData.HomeAddressListGeo,
896 wxT("TZ"), &ContactEditorData.HomeAddressListTimezone,
897 wxT("MEDIATYPE"), &ContactEditorData.HomeAddressListMediatype,
898 wxT("PREF"), &ContactEditorData.HomeAddressListPref,
899 wxT(""), &ContactEditorData.HomeAddressListTokens );
901 ResetSaveProcessData();
905 ResetSaveProcessData();
907 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessAddressList.begin();
908 iter != ContactEditorData.BusinessAddressList.end(); ++iter){
910 int intSeekValue = iter->first;
912 wxString strAddressString;
913 wxString strAddressFinalValue;
914 std::map<int, wxString>::iterator iterValue;
916 strAddressString.Append(wxT(";;"));
920 iterValue = ContactEditorData.BusinessAddressList.find(intSeekValue);
921 strAddressFinalValue = iterValue->second;
922 ProcessCaptureStrings(&strAddressFinalValue);
924 strAddressString.Append(strAddressFinalValue + wxT(";"));
928 iterValue = ContactEditorData.BusinessAddressListTown.find(intSeekValue);
929 strAddressFinalValue = iterValue->second;
930 ProcessCaptureStrings(&strAddressFinalValue);
932 strAddressString.Append(strAddressFinalValue + wxT(";"));
936 iterValue = ContactEditorData.BusinessAddressListCounty.find(intSeekValue);
937 strAddressFinalValue = iterValue->second;
938 ProcessCaptureStrings(&strAddressFinalValue);
940 strAddressString.Append(strAddressFinalValue + wxT(";"));
944 iterValue = ContactEditorData.BusinessAddressListPostCode.find(intSeekValue);
945 strAddressFinalValue = iterValue->second;
946 ProcessCaptureStrings(&strAddressFinalValue);
948 strAddressString.Append(strAddressFinalValue + wxT(";"));
952 iterValue = ContactEditorData.BusinessAddressListCountry.find(intSeekValue);
953 strAddressFinalValue = iterValue->second;
954 ProcessCaptureStrings(&strAddressFinalValue);
956 strAddressString.Append(strAddressFinalValue);
958 ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
959 &iter, &strAddressString, &ContactData,
960 wxT("LABEL"), &ContactEditorData.BusinessAddressListLabel,
961 wxT("LANGUAGE"), &ContactEditorData.BusinessAddressListLang,
962 wxT("ALTID"), &ContactEditorData.BusinessAddressListAltID,
963 wxT("PID"), &ContactEditorData.BusinessAddressListPID,
964 wxT("GEO"), &ContactEditorData.BusinessAddressListGeo,
965 wxT("TZ"), &ContactEditorData.BusinessAddressListTimezone,
966 wxT("MEDIATYPE"), &ContactEditorData.BusinessAddressListMediatype,
967 wxT("PREF"), &ContactEditorData.BusinessAddressListPref,
968 wxT(""), &ContactEditorData.BusinessAddressListTokens );
970 ResetSaveProcessData();
974 // Sort out nicknames (if any).
976 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNicknamesList.begin();
977 iter != ContactEditorData.GeneralNicknamesList.end(); ++iter){
979 intValue2 = iter->first;
981 // Process Alternative ID.
983 ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
984 &iter, &ContactEditorData.GeneralNicknamesList, &ContactData,
985 wxT("LANGUAGE"), &ContactEditorData.GeneralNicknamesListLanguage,
986 wxT("ALTID"), &ContactEditorData.GeneralNicknamesListAltID,
987 wxT("PID"), &ContactEditorData.GeneralNicknamesListPID,
988 wxT("PREF"), &ContactEditorData.GeneralNicknamesListPref,
989 wxT(""), &ContactEditorData.GeneralNicknamesListTokens );
991 ResetSaveProcessData();
995 ResetSaveProcessData();
997 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNicknamesList.begin();
998 iter != ContactEditorData.HomeNicknamesList.end(); ++iter){
1000 ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1001 &iter, &ContactEditorData.HomeNicknamesList, &ContactData,
1002 wxT("LANGUAGE"), &ContactEditorData.HomeNicknamesListLanguage,
1003 wxT("ALTID"), &ContactEditorData.HomeNicknamesListAltID,
1004 wxT("PID"), &ContactEditorData.HomeNicknamesListPID,
1005 wxT("PREF"), &ContactEditorData.HomeNicknamesListPref,
1006 wxT(""), &ContactEditorData.HomeNicknamesListTokens );
1008 ResetSaveProcessData();
1012 ResetSaveProcessData();
1014 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNicknamesList.begin();
1015 iter != ContactEditorData.BusinessNicknamesList.end(); ++iter){
1017 ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1018 &iter, &ContactEditorData.BusinessNicknamesList, &ContactData,
1019 wxT("LANGUAGE"), &ContactEditorData.BusinessNicknamesListLanguage,
1020 wxT("ALTID"), &ContactEditorData.BusinessNicknamesListAltID,
1021 wxT("PID"), &ContactEditorData.BusinessNicknamesListPID,
1022 wxT("PREF"), &ContactEditorData.BusinessNicknamesListPref,
1023 wxT(""), &ContactEditorData.BusinessNicknamesListTokens );
1025 ResetSaveProcessData();
1029 ResetSaveProcessData();
1031 // Sort out email (general, home and business).
1033 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralEmailList.begin();
1034 iter != ContactEditorData.GeneralEmailList.end(); ++iter){
1036 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1039 wxString strAddressFinalValue;
1040 std::map<int, wxString>::iterator iterValue;
1042 ProcessSaveData(wxT("EMAIL"), &strValue2, &boolValue2, &boolValue,
1043 &iter, &ContactEditorData.GeneralEmailList, &ContactData,
1044 wxT("ALTID"), &ContactEditorData.GeneralEmailListAltID,
1045 wxT("PID"), &ContactEditorData.GeneralEmailListPID,
1046 wxT("PREF"), &ContactEditorData.GeneralEmailListPref,
1047 wxT(""), &ContactEditorData.GeneralEmailListTokens );
1049 ResetSaveProcessData();
1053 ResetSaveProcessData();
1055 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeEmailList.begin();
1056 iter != ContactEditorData.HomeEmailList.end(); ++iter){
1058 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1061 ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1062 &iter, &ContactEditorData.HomeEmailList, &ContactData,
1063 wxT("ALTID"), &ContactEditorData.HomeEmailListAltID,
1064 wxT("PID"), &ContactEditorData.HomeEmailListPID,
1065 wxT("PREF"), &ContactEditorData.HomeEmailListPref,
1066 wxT(""), &ContactEditorData.HomeEmailListTokens );
1068 ResetSaveProcessData();
1072 ResetSaveProcessData();
1074 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessEmailList.begin();
1075 iter != ContactEditorData.BusinessEmailList.end(); ++iter){
1077 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1080 ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1081 &iter, &ContactEditorData.BusinessEmailList, &ContactData,
1082 wxT("ALTID"), &ContactEditorData.BusinessEmailListAltID,
1083 wxT("PID"), &ContactEditorData.BusinessEmailListPID,
1084 wxT("PREF"), &ContactEditorData.BusinessEmailListPref,
1085 wxT(""), &ContactEditorData.BusinessEmailListTokens );
1087 ResetSaveProcessData();
1091 ResetSaveProcessData();
1093 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralIMList.begin();
1094 iter != ContactEditorData.GeneralIMList.end(); ++iter){
1096 intValue2 = iter->first;
1098 // Process Alternative ID.
1100 ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
1101 &iter, &ContactEditorData.GeneralIMList, &ContactData,
1102 wxT("ALTID"), &ContactEditorData.GeneralIMListAltID,
1103 wxT("PID"), &ContactEditorData.GeneralIMListPID,
1104 wxT("MEDIATYPE"), &ContactEditorData.GeneralIMListMediatype,
1105 wxT("PREF"), &ContactEditorData.GeneralIMListPref,
1106 wxT(""), &ContactEditorData.GeneralIMListTokens );
1108 ResetSaveProcessData();
1112 ResetSaveProcessData();
1114 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeIMList.begin();
1115 iter != ContactEditorData.HomeIMList.end(); ++iter){
1117 ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1118 &iter, &ContactEditorData.HomeIMList, &ContactData,
1119 wxT("ALTID"), &ContactEditorData.HomeIMListAltID,
1120 wxT("PID"), &ContactEditorData.HomeIMListPID,
1121 wxT("MEDIATYPE"), &ContactEditorData.HomeIMListMediatype,
1122 wxT("PREF"), &ContactEditorData.HomeIMListPref,
1123 wxT(""), &ContactEditorData.HomeIMListTokens );
1125 ResetSaveProcessData();
1129 ResetSaveProcessData();
1131 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessIMList.begin();
1132 iter != ContactEditorData.BusinessIMList.end(); ++iter){
1134 ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1135 &iter, &ContactEditorData.BusinessIMList, &ContactData,
1136 wxT("ALTID"), &ContactEditorData.BusinessIMListAltID,
1137 wxT("PID"), &ContactEditorData.BusinessIMListPID,
1138 wxT("MEDIATYPE"), &ContactEditorData.BusinessIMListMediatype,
1139 wxT("PREF"), &ContactEditorData.BusinessIMListPref,
1140 wxT(""), &ContactEditorData.BusinessIMListTokens );
1142 ResetSaveProcessData();
1146 ResetSaveProcessData();
1148 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTelephoneList.begin();
1149 iter != ContactEditorData.GeneralTelephoneList.end(); ++iter){
1151 wxString strAddressFinalValue = iter->second;
1153 ProcessCaptureStrings(&strAddressFinalValue);
1155 if (ContactEditorData.GeneralTelephoneListDataType.find(iter->first) !=
1156 ContactEditorData.GeneralTelephoneListDataType.end()){
1158 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralTelephoneListDataType.find(iter->first);
1160 strAddressFinalValue.insert(0, ":");
1161 strAddressFinalValue.insert(0, DataTypeIter->second);
1165 strAddressFinalValue.insert(0, "tel:");
1169 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1170 &iter, &strAddressFinalValue, &ContactData,
1171 wxT("ALTID"), &ContactEditorData.GeneralTelephoneListAltID,
1172 wxT("PID"), &ContactEditorData.GeneralTelephoneListPID,
1173 wxT("TYPE"), &ContactEditorData.GeneralTelephoneListType,
1174 wxT("PREF"), &ContactEditorData.GeneralTelephoneListPref,
1175 wxT(""), &ContactEditorData.GeneralTelephoneListTokens );
1177 ResetSaveProcessData();
1181 ResetSaveProcessData();
1183 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTelephoneList.begin();
1184 iter != ContactEditorData.HomeTelephoneList.end(); ++iter){
1186 wxString strAddressFinalValue = iter->second;
1188 ProcessCaptureStrings(&strAddressFinalValue);
1190 if (ContactEditorData.HomeTelephoneListDataType.find(iter->first) !=
1191 ContactEditorData.HomeTelephoneListDataType.end()){
1193 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeTelephoneListDataType.find(iter->first);
1195 strAddressFinalValue.insert(0, ":");
1196 strAddressFinalValue.insert(0, DataTypeIter->second);
1200 strAddressFinalValue.insert(0, "tel:");
1204 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1205 &iter, &strAddressFinalValue, &ContactData,
1206 wxT("ALTID"), &ContactEditorData.HomeTelephoneListAltID,
1207 wxT("PID"), &ContactEditorData.HomeTelephoneListPID,
1208 wxT("TYPE"), &ContactEditorData.HomeTelephoneListType,
1209 wxT("PREF"), &ContactEditorData.HomeTelephoneListPref,
1210 wxT(""), &ContactEditorData.HomeTelephoneListTokens );
1212 ResetSaveProcessData();
1216 ResetSaveProcessData();
1218 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTelephoneList.begin();
1219 iter != ContactEditorData.BusinessTelephoneList.end(); ++iter){
1221 wxString strAddressFinalValue = iter->second;
1223 ProcessCaptureStrings(&strAddressFinalValue);
1225 if (ContactEditorData.BusinessTelephoneListDataType.find(iter->first) !=
1226 ContactEditorData.BusinessTelephoneListDataType.end()){
1228 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessTelephoneListDataType.find(iter->first);
1230 strAddressFinalValue.insert(0, ":");
1231 strAddressFinalValue.insert(0, DataTypeIter->second);
1235 strAddressFinalValue.insert(0, "tel:");
1239 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1240 &iter, &strAddressFinalValue, &ContactData,
1241 wxT("ALTID"), &ContactEditorData.BusinessTelephoneListAltID,
1242 wxT("PID"), &ContactEditorData.BusinessTelephoneListPID,
1243 wxT("TYPE"), &ContactEditorData.BusinessTelephoneListType,
1244 wxT("PREF"), &ContactEditorData.BusinessTelephoneListPref,
1245 wxT(""), &ContactEditorData.BusinessTelephoneListTokens );
1247 ResetSaveProcessData();
1251 ResetSaveProcessData();
1253 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralLanguageList.begin();
1254 iter != ContactEditorData.GeneralLanguageList.end(); ++iter){
1256 intValue2 = iter->first;
1258 ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
1259 &iter, &ContactEditorData.GeneralLanguageList, &ContactData,
1260 wxT("ALTID"), &ContactEditorData.GeneralLanguageListAltID,
1261 wxT("PID"), &ContactEditorData.GeneralLanguageListPID,
1262 wxT("PREF"), &ContactEditorData.GeneralLanguageListPref,
1263 wxT(""), &ContactEditorData.GeneralLanguageListTokens );
1265 ResetSaveProcessData();
1269 ResetSaveProcessData();
1271 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeLanguageList.begin();
1272 iter != ContactEditorData.HomeLanguageList.end(); ++iter){
1274 ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1275 &iter, &ContactEditorData.HomeLanguageList, &ContactData,
1276 wxT("ALTID"), &ContactEditorData.HomeLanguageListAltID,
1277 wxT("PID"), &ContactEditorData.HomeLanguageListPID,
1278 wxT("PREF"), &ContactEditorData.HomeLanguageListPref,
1279 wxT(""), &ContactEditorData.HomeLanguageListTokens );
1281 ResetSaveProcessData();
1285 ResetSaveProcessData();
1287 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessLanguageList.begin();
1288 iter != ContactEditorData.BusinessLanguageList.end(); ++iter){
1290 ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1291 &iter, &ContactEditorData.BusinessLanguageList, &ContactData,
1292 wxT("ALTID"), &ContactEditorData.BusinessLanguageListAltID,
1293 wxT("PID"), &ContactEditorData.BusinessLanguageListPID,
1294 wxT("PREF"), &ContactEditorData.BusinessLanguageListPref,
1295 wxT(""), &ContactEditorData.BusinessLanguageListTokens );
1297 ResetSaveProcessData();
1301 ResetSaveProcessData();
1303 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTZList.begin();
1304 iter != ContactEditorData.GeneralTZList.end(); ++iter){
1306 ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
1307 &iter, &ContactEditorData.GeneralTZList, &ContactData,
1308 wxT("ALTID"), &ContactEditorData.GeneralTZListAltID,
1309 wxT("PID"), &ContactEditorData.GeneralTZListPID,
1310 wxT("MEDIATYPE"), &ContactEditorData.GeneralTZListMediatype,
1311 wxT("PREF"), &ContactEditorData.GeneralTZListPref,
1312 wxT(""), &ContactEditorData.GeneralTZListTokens );
1314 ResetSaveProcessData();
1318 ResetSaveProcessData();
1320 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTZList.begin();
1321 iter != ContactEditorData.HomeTZList.end(); ++iter){
1323 ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1324 &iter, &ContactEditorData.HomeTZList, &ContactData,
1325 wxT("ALTID"), &ContactEditorData.HomeTZListAltID,
1326 wxT("PID"), &ContactEditorData.HomeTZListPID,
1327 wxT("MEDIATYPE"), &ContactEditorData.HomeTZListMediatype,
1328 wxT("PREF"), &ContactEditorData.HomeTZListPref,
1329 wxT(""), &ContactEditorData.HomeTZListTokens );
1331 ResetSaveProcessData();
1335 ResetSaveProcessData();
1337 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTZList.begin();
1338 iter != ContactEditorData.BusinessTZList.end(); ++iter){
1340 ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1341 &iter, &ContactEditorData.BusinessTZList, &ContactData,
1342 wxT("ALTID"), &ContactEditorData.BusinessTZListAltID,
1343 wxT("PID"), &ContactEditorData.BusinessTZListPID,
1344 wxT("MEDIATYPE"), &ContactEditorData.BusinessTZListMediatype,
1345 wxT("PREF"), &ContactEditorData.BusinessTZListPref,
1346 wxT(""), &ContactEditorData.BusinessTZListTokens );
1348 ResetSaveProcessData();
1352 ResetSaveProcessData();
1354 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralGeographyList.begin();
1355 iter != ContactEditorData.GeneralGeographyList.end(); ++iter){
1357 wxString strGeoFinalValue = iter->second;
1359 ProcessCaptureStrings(&strGeoFinalValue);
1361 if (ContactEditorData.GeneralGeographyListDataType.find(iter->first) !=
1362 ContactEditorData.GeneralGeographyListDataType.end()){
1364 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralGeographyListDataType.find(iter->first);
1366 strGeoFinalValue.insert(0, ":");
1367 strGeoFinalValue.insert(0, DataTypeIter->second);
1371 strGeoFinalValue.insert(0, "geo:");
1375 ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
1376 &iter, &strGeoFinalValue, &ContactData,
1377 wxT("ALTID"), &ContactEditorData.GeneralGeographyListAltID,
1378 wxT("PID"), &ContactEditorData.GeneralGeographyListPID,
1379 wxT("MEDIATYPE"), &ContactEditorData.GeneralGeographyListMediatype,
1380 wxT("PREF"), &ContactEditorData.GeneralGeographyListPref,
1381 wxT(""), &ContactEditorData.GeneralGeographyListTokens );
1383 ResetSaveProcessData();
1387 ResetSaveProcessData();
1389 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeGeographyList.begin();
1390 iter != ContactEditorData.HomeGeographyList.end(); ++iter){
1392 wxString strGeoFinalValue = iter->second;
1394 ProcessCaptureStrings(&strGeoFinalValue);
1396 if (ContactEditorData.HomeGeographyListDataType.find(iter->first) !=
1397 ContactEditorData.HomeGeographyListDataType.end()){
1399 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeGeographyListDataType.find(iter->first);
1401 strGeoFinalValue.insert(0, ":");
1402 strGeoFinalValue.insert(0, DataTypeIter->second);
1406 strGeoFinalValue.insert(0, "geo:");
1410 ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1411 &iter, &strGeoFinalValue, &ContactData,
1412 wxT("ALTID"), &ContactEditorData.HomeGeographyListAltID,
1413 wxT("PID"), &ContactEditorData.HomeGeographyListPID,
1414 wxT("MEDIATYPE"), &ContactEditorData.HomeGeographyListMediatype,
1415 wxT("PREF"), &ContactEditorData.HomeGeographyListPref,
1416 wxT(""), &ContactEditorData.HomeGeographyListTokens );
1418 ResetSaveProcessData();
1422 ResetSaveProcessData();
1424 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessGeographyList.begin();
1425 iter != ContactEditorData.BusinessGeographyList.end(); ++iter){
1427 wxString strGeoFinalValue = iter->second;
1429 ProcessCaptureStrings(&strGeoFinalValue);
1431 if (ContactEditorData.BusinessGeographyListDataType.find(iter->first) !=
1432 ContactEditorData.BusinessGeographyListDataType.end()){
1434 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessGeographyListDataType.find(iter->first);
1436 strGeoFinalValue.insert(0, ":");
1437 strGeoFinalValue.insert(0, DataTypeIter->second);
1441 strGeoFinalValue.insert(0, "geo:");
1445 ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1446 &iter, &strGeoFinalValue, &ContactData,
1447 wxT("ALTID"), &ContactEditorData.BusinessGeographyListAltID,
1448 wxT("PID"), &ContactEditorData.BusinessGeographyListPID,
1449 wxT("MEDIATYPE"), &ContactEditorData.BusinessGeographyListMediatype,
1450 wxT("PREF"), &ContactEditorData.BusinessGeographyListPref,
1451 wxT(""), &ContactEditorData.BusinessGeographyListTokens );
1453 ResetSaveProcessData();
1457 ResetSaveProcessData();
1459 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRelatedList.begin();
1460 iter != ContactEditorData.GeneralRelatedList.end(); ++iter){
1462 ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
1463 &iter, &ContactEditorData.GeneralRelatedList, &ContactData,
1464 wxT("ALTID"), &ContactEditorData.GeneralRelatedListAltID,
1465 wxT("PID"), &ContactEditorData.GeneralRelatedListPID,
1466 wxT("LANGUAGE"), &ContactEditorData.GeneralRelatedListLanguage,
1467 wxT("TYPE"), &ContactEditorData.GeneralRelatedListRelType,
1468 wxT("PREF"), &ContactEditorData.GeneralRelatedListPref,
1469 wxT(""), &ContactEditorData.GeneralRelatedListTokens );
1471 ResetSaveProcessData();
1475 ResetSaveProcessData();
1477 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralWebsiteList.begin();
1478 iter != ContactEditorData.GeneralWebsiteList.end(); ++iter){
1480 ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
1481 &iter, &ContactEditorData.GeneralWebsiteList, &ContactData,
1482 wxT("ALTID"), &ContactEditorData.GeneralWebsiteListAltID,
1483 wxT("PID"), &ContactEditorData.GeneralWebsiteListPID,
1484 wxT("MEDIATYPE"), &ContactEditorData.GeneralWebsiteListMediatype,
1485 wxT("PREF"), &ContactEditorData.GeneralWebsiteListPref,
1486 wxT(""), &ContactEditorData.GeneralWebsiteListTokens );
1488 ResetSaveProcessData();
1492 ResetSaveProcessData();
1494 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeWebsiteList.begin();
1495 iter != ContactEditorData.HomeWebsiteList.end(); ++iter){
1497 ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1498 &iter, &ContactEditorData.HomeWebsiteList, &ContactData,
1499 wxT("ALTID"), &ContactEditorData.HomeWebsiteListAltID,
1500 wxT("PID"), &ContactEditorData.HomeWebsiteListPID,
1501 wxT("MEDIATYPE"), &ContactEditorData.HomeWebsiteListMediatype,
1502 wxT("PREF"), &ContactEditorData.HomeWebsiteListPref,
1503 wxT(""), &ContactEditorData.HomeWebsiteListTokens );
1505 ResetSaveProcessData();
1509 ResetSaveProcessData();
1511 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessWebsiteList.begin();
1512 iter != ContactEditorData.BusinessWebsiteList.end(); ++iter){
1514 ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1515 &iter, &ContactEditorData.BusinessWebsiteList, &ContactData,
1516 wxT("ALTID"), &ContactEditorData.BusinessWebsiteListAltID,
1517 wxT("PID"), &ContactEditorData.BusinessWebsiteListPID,
1518 wxT("MEDIATYPE"), &ContactEditorData.BusinessWebsiteListMediatype,
1519 wxT("PREF"), &ContactEditorData.BusinessWebsiteListPref,
1520 wxT(""), &ContactEditorData.BusinessWebsiteListTokens );
1522 ResetSaveProcessData();
1526 ResetSaveProcessData();
1528 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTitleList.begin();
1529 iter != ContactEditorData.GeneralTitleList.end(); ++iter){
1531 ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
1532 &iter, &ContactEditorData.GeneralTitleList, &ContactData,
1533 wxT("ALTID"), &ContactEditorData.GeneralTitleListAltID,
1534 wxT("PID"), &ContactEditorData.GeneralTitleListPID,
1535 wxT("LANGUAGE"), &ContactEditorData.GeneralTitleListLanguage,
1536 wxT("PREF"), &ContactEditorData.GeneralTitleListPref,
1537 wxT(""), &ContactEditorData.GeneralTitleListTokens );
1539 ResetSaveProcessData();
1543 ResetSaveProcessData();
1545 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTitleList.begin();
1546 iter != ContactEditorData.HomeTitleList.end(); ++iter){
1548 ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1549 &iter, &ContactEditorData.HomeTitleList, &ContactData,
1550 wxT("ALTID"), &ContactEditorData.HomeTitleListAltID,
1551 wxT("PID"), &ContactEditorData.HomeTitleListPID,
1552 wxT("LANGUAGE"), &ContactEditorData.HomeTitleListLanguage,
1553 wxT("PREF"), &ContactEditorData.HomeTitleListPref,
1554 wxT(""), &ContactEditorData.HomeTitleListTokens );
1556 ResetSaveProcessData();
1560 ResetSaveProcessData();
1562 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTitleList.begin();
1563 iter != ContactEditorData.BusinessTitleList.end(); ++iter){
1565 ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1566 &iter, &ContactEditorData.BusinessTitleList, &ContactData,
1567 wxT("ALTID"), &ContactEditorData.BusinessTitleListAltID,
1568 wxT("PID"), &ContactEditorData.BusinessTitleListPID,
1569 wxT("LANGUAGE"), &ContactEditorData.BusinessTitleListLanguage,
1570 wxT("PREF"), &ContactEditorData.BusinessTitleListPref,
1571 wxT(""), &ContactEditorData.BusinessTitleListTokens );
1573 ResetSaveProcessData();
1577 ResetSaveProcessData();
1579 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRoleList.begin();
1580 iter != ContactEditorData.GeneralRoleList.end(); ++iter){
1582 ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
1583 &iter, &ContactEditorData.GeneralRoleList, &ContactData,
1584 wxT("ALTID"), &ContactEditorData.GeneralRoleListAltID,
1585 wxT("PID"), &ContactEditorData.GeneralRoleListPID,
1586 wxT("LANGUAGE"), &ContactEditorData.GeneralRoleListLanguage,
1587 wxT("PREF"), &ContactEditorData.GeneralRoleListPref,
1588 wxT(""), &ContactEditorData.GeneralRoleListTokens );
1590 ResetSaveProcessData();
1594 ResetSaveProcessData();
1596 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeRoleList.begin();
1597 iter != ContactEditorData.HomeRoleList.end(); ++iter){
1599 ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1600 &iter, &ContactEditorData.HomeRoleList, &ContactData,
1601 wxT("ALTID"), &ContactEditorData.HomeRoleListAltID,
1602 wxT("PID"), &ContactEditorData.HomeRoleListPID,
1603 wxT("LANGUAGE"), &ContactEditorData.HomeRoleListLanguage,
1604 wxT("PREF"), &ContactEditorData.HomeRoleListPref,
1605 wxT(""), &ContactEditorData.HomeRoleListTokens );
1607 ResetSaveProcessData();
1611 ResetSaveProcessData();
1613 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessRoleList.begin();
1614 iter != ContactEditorData.BusinessRoleList.end(); ++iter){
1616 ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1617 &iter, &ContactEditorData.BusinessRoleList, &ContactData,
1618 wxT("ALTID"), &ContactEditorData.BusinessRoleListAltID,
1619 wxT("PID"), &ContactEditorData.BusinessRoleListPID,
1620 wxT("LANGUAGE"), &ContactEditorData.BusinessRoleListLanguage,
1621 wxT("PREF"), &ContactEditorData.BusinessRoleListPref,
1622 wxT(""), &ContactEditorData.BusinessRoleListTokens );
1624 ResetSaveProcessData();
1628 ResetSaveProcessData();
1630 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralOrganisationsList.begin();
1631 iter != ContactEditorData.GeneralOrganisationsList.end(); ++iter){
1633 ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
1634 &iter, &ContactEditorData.GeneralOrganisationsList, &ContactData,
1635 wxT("ALTID"), &ContactEditorData.GeneralOrganisationsListAltID,
1636 wxT("PID"), &ContactEditorData.GeneralOrganisationsListPID,
1637 wxT("LANGUAGE"), &ContactEditorData.GeneralOrganisationsListLanguage,
1638 wxT("SORT-AS"), &ContactEditorData.GeneralOrganisationsListSortAs,
1639 wxT("PREF"), &ContactEditorData.GeneralOrganisationsListPref,
1640 wxT(""), &ContactEditorData.GeneralOrganisationsListTokens );
1642 ResetSaveProcessData();
1646 ResetSaveProcessData();
1648 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeOrganisationsList.begin();
1649 iter != ContactEditorData.HomeOrganisationsList.end(); ++iter){
1651 ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1652 &iter, &ContactEditorData.HomeOrganisationsList, &ContactData,
1653 wxT("ALTID"), &ContactEditorData.HomeOrganisationsListAltID,
1654 wxT("PID"), &ContactEditorData.HomeOrganisationsListPID,
1655 wxT("LANGUAGE"), &ContactEditorData.HomeOrganisationsListLanguage,
1656 wxT("SORT-AS"), &ContactEditorData.HomeOrganisationsListSortAs,
1657 wxT("PREF"), &ContactEditorData.HomeOrganisationsListPref,
1658 wxT(""), &ContactEditorData.HomeOrganisationsListTokens );
1660 ResetSaveProcessData();
1664 ResetSaveProcessData();
1666 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessOrganisationsList.begin();
1667 iter != ContactEditorData.BusinessOrganisationsList.end(); ++iter){
1669 ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1670 &iter, &ContactEditorData.BusinessOrganisationsList, &ContactData,
1671 wxT("ALTID"), &ContactEditorData.BusinessOrganisationsListAltID,
1672 wxT("PID"), &ContactEditorData.BusinessOrganisationsListPID,
1673 wxT("LANGUAGE"), &ContactEditorData.BusinessOrganisationsListLanguage,
1674 wxT("SORT-AS"), &ContactEditorData.BusinessOrganisationsListSortAs,
1675 wxT("PREF"), &ContactEditorData.BusinessOrganisationsListPref,
1676 wxT(""), &ContactEditorData.BusinessOrganisationsListTokens );
1678 ResetSaveProcessData();
1682 ResetSaveProcessData();
1684 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNoteList.begin();
1685 iter != ContactEditorData.GeneralNoteList.end(); ++iter){
1687 ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
1688 &iter, &ContactEditorData.GeneralNoteList, &ContactData,
1689 wxT("ALTID"), &ContactEditorData.GeneralNoteListAltID,
1690 wxT("PID"), &ContactEditorData.GeneralNoteListPID,
1691 wxT("LANGUAGE"), &ContactEditorData.GeneralNoteListLanguage,
1692 wxT("PREF"), &ContactEditorData.GeneralNoteListPref,
1693 wxT(""), &ContactEditorData.GeneralNoteListTokens );
1695 ResetSaveProcessData();
1699 ResetSaveProcessData();
1701 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNoteList.begin();
1702 iter != ContactEditorData.HomeNoteList.end(); ++iter){
1704 ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1705 &iter, &ContactEditorData.HomeNoteList, &ContactData,
1706 wxT("ALTID"), &ContactEditorData.HomeNoteListAltID,
1707 wxT("PID"), &ContactEditorData.HomeNoteListPID,
1708 wxT("LANGUAGE"), &ContactEditorData.HomeNoteListLanguage,
1709 wxT("PREF"), &ContactEditorData.HomeNoteListPref,
1710 wxT(""), &ContactEditorData.HomeNoteListTokens );
1712 ResetSaveProcessData();
1716 ResetSaveProcessData();
1718 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNoteList.begin();
1719 iter != ContactEditorData.BusinessNoteList.end(); ++iter){
1721 ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1722 &iter, &ContactEditorData.BusinessNoteList, &ContactData,
1723 wxT("ALTID"), &ContactEditorData.BusinessNoteListAltID,
1724 wxT("PID"), &ContactEditorData.BusinessNoteListPID,
1725 wxT("LANGUAGE"), &ContactEditorData.BusinessNoteListLanguage,
1726 wxT("PREF"), &ContactEditorData.BusinessNoteListPref,
1727 wxT(""), &ContactEditorData.BusinessNoteListTokens );
1729 ResetSaveProcessData();
1733 ResetSaveProcessData();
1735 for (std::map<int,wxString>::iterator iter = ContactEditorData.CategoriesList.begin();
1736 iter != ContactEditorData.CategoriesList.end(); ++iter){
1738 ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
1739 &iter, &ContactEditorData.CategoriesList, &ContactData,
1740 wxT("ALTID"), &ContactEditorData.CategoriesListAltID,
1741 wxT("PID"), &ContactEditorData.CategoriesListPID,
1742 wxT("TYPE"), &ContactEditorData.CategoriesListType,
1743 wxT("PREF"), &ContactEditorData.CategoriesListPref,
1744 wxT(""), &ContactEditorData.CategoriesListTokens );
1746 ResetSaveProcessData();
1752 for (std::map<int, std::string>::iterator iter = ContactEditorData.PicturesList.begin();
1753 iter != ContactEditorData.PicturesList.end(); ++iter){
1755 int intValueIndex = iter->first;
1757 std::map<int, std::string>::iterator stdstriter;
1758 std::map<int, wxString>::iterator enciter;
1760 striter = ContactEditorData.PicturesListPictureType.find(intValueIndex);
1761 enciter = ContactEditorData.PicturesListPicEncType.find(intValueIndex);
1763 ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
1764 &iter, &ContactEditorData.PicturesList, &striter,
1765 &enciter, &ContactData,
1766 wxT("ALTID"), &ContactEditorData.PicturesListAltID,
1767 wxT("PID"), &ContactEditorData.PicturesListPID,
1768 wxT("TYPE"), &ContactEditorData.PicturesListType,
1769 wxT("PREF"), &ContactEditorData.PicturesListPref,
1770 wxT(""), &ContactEditorData.PicturesListTokens);
1772 ResetSaveProcessData();
1776 ResetSaveProcessData();
1780 for (std::map<int, std::string>::iterator iter = ContactEditorData.LogosList.begin();
1781 iter != ContactEditorData.LogosList.end(); ++iter){
1783 int intValueIndex = iter->first;
1785 std::map<int, std::string>::iterator stdstriter;
1786 std::map<int, wxString>::iterator enciter;
1788 striter = ContactEditorData.LogosListPictureType.find(intValueIndex);
1789 enciter = ContactEditorData.LogosListPicEncType.find(intValueIndex);
1791 ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
1792 &iter, &ContactEditorData.LogosList, &striter,
1793 &enciter, &ContactData,
1794 wxT("ALTID"), &ContactEditorData.LogosListAltID,
1795 wxT("PID"), &ContactEditorData.LogosListPID,
1796 wxT("TYPE"), &ContactEditorData.LogosListType,
1797 wxT("PREF"), &ContactEditorData.LogosListPref,
1798 wxT(""), &ContactEditorData.LogosListTokens );
1800 ResetSaveProcessData();
1804 ResetSaveProcessData();
1808 for (std::map<int, std::string>::iterator iter = ContactEditorData.SoundsList.begin();
1809 iter != ContactEditorData.SoundsList.end(); ++iter){
1811 int intValueIndex = iter->first;
1813 std::map<int, std::string>::iterator stdstriter;
1814 std::map<int, wxString>::iterator enciter;
1816 striter = ContactEditorData.SoundsListAudioType.find(intValueIndex);
1817 enciter = ContactEditorData.SoundsListAudioEncType.find(intValueIndex);
1819 ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
1820 &iter, &ContactEditorData.SoundsList, &striter,
1821 &enciter, &ContactData,
1822 wxT("ALTID"), &ContactEditorData.SoundsListAltID,
1823 wxT("PID"), &ContactEditorData.SoundsListPID,
1824 wxT("TYPE"), &ContactEditorData.SoundsListType,
1825 wxT("PREF"), &ContactEditorData.SoundsListPref,
1826 wxT(""), &ContactEditorData.SoundsListTokens );
1828 ResetSaveProcessData();
1832 ResetSaveProcessData();
1834 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarList.begin();
1835 iter != ContactEditorData.CalendarList.end(); ++iter){
1837 ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
1838 &iter, &ContactEditorData.CalendarList, &ContactData,
1839 wxT("ALTID"), &ContactEditorData.CalendarListAltID,
1840 wxT("PID"), &ContactEditorData.CalendarListPID,
1841 wxT("MEDIATYPE"), &ContactEditorData.CalendarListMediatype,
1842 wxT("TYPE"), &ContactEditorData.CalendarListType,
1843 wxT("PREF"), &ContactEditorData.CalendarListPref,
1844 wxT(""), &ContactEditorData.CalendarListTokens );
1846 ResetSaveProcessData();
1850 ResetSaveProcessData();
1852 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarRequestList.begin();
1853 iter != ContactEditorData.CalendarRequestList.end(); ++iter){
1855 ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
1856 &iter, &ContactEditorData.CalendarRequestList, &ContactData,
1857 wxT("ALTID"), &ContactEditorData.CalendarRequestListAltID,
1858 wxT("PID"), &ContactEditorData.CalendarRequestListPID,
1859 wxT("MEDIATYPE"), &ContactEditorData.CalendarRequestListMediatype,
1860 wxT("TYPE"), &ContactEditorData.CalendarRequestListType,
1861 wxT("PREF"), &ContactEditorData.CalendarRequestListPref,
1862 wxT(""), &ContactEditorData.CalendarRequestListTokens );
1864 ResetSaveProcessData();
1868 ResetSaveProcessData();
1870 for (std::map<int,wxString>::iterator iter = ContactEditorData.FreeBusyList.begin();
1871 iter != ContactEditorData.FreeBusyList.end(); ++iter){
1873 ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
1874 &iter, &ContactEditorData.FreeBusyList, &ContactData,
1875 wxT("ALTID"), &ContactEditorData.FreeBusyListAltID,
1876 wxT("PID"), &ContactEditorData.FreeBusyListPID,
1877 wxT("MEDIATYPE"), &ContactEditorData.FreeBusyListMediatype,
1878 wxT("TYPE"), &ContactEditorData.FreeBusyListType,
1879 wxT("PREF"), &ContactEditorData.FreeBusyListPref,
1880 wxT(""), &ContactEditorData.FreeBusyListTokens );
1882 ResetSaveProcessData();
1886 for (std::map<int, wxString>::iterator iter = ContactEditorData.KeyList.begin();
1887 iter != ContactEditorData.KeyList.end(); ++iter){
1889 intValue2 = iter->first;
1891 // Get the key information.
1893 std::map<int, wxString>::iterator enciter;
1895 striter = ContactEditorData.KeyListDataType.find(intValue2);
1896 //enciter = KeyListAudioEncType.find(intValue2);
1898 wxString strValueData;
1900 strValueData = iter->second;
1901 strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));
1903 ProcessSaveData(wxT("KEY"), &strValue2, &boolValue2, &boolValue,
1904 &iter, &strValueData, &ContactData,
1905 wxT("ALTID"), &ContactEditorData.KeyListAltID,
1906 wxT("PID"), &ContactEditorData.KeyListPID,
1907 wxT("TYPE"), &ContactEditorData.KeyListType,
1908 wxT("PREF"), &ContactEditorData.KeyListPref,
1909 wxT(""), &ContactEditorData.KeyListTokens );
1911 ResetSaveProcessData();
1915 // Vendor specific items.
1917 ResetSaveProcessData();
1919 for (std::map<int,wxString>::iterator iter = ContactEditorData.VendorList.begin();
1920 iter != ContactEditorData.VendorList.end(); ++iter){
1922 intValue2 = iter->first;
1924 // Get the IANA PEN number.
1926 striter = ContactEditorData.VendorListPEN.find(intValue2);
1928 if (striter->first == intValue2){
1930 strValue2 = striter->second;
1934 // Get the element name.
1936 striter = ContactEditorData.VendorListElement.find(intValue2);
1938 if (striter->first == intValue2){
1940 strValue3 = striter->second;
1946 striter = ContactEditorData.VendorList.find(intValue2);
1948 if (striter->first == intValue2){
1950 strValue = striter->second;
1954 // Add to the vCard.
1956 if (boolValue == TRUE){
1958 ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
1962 ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
1966 ResetSaveProcessData();
1970 ResetSaveProcessData();
1974 for (std::map<int,wxString>::iterator iter = ContactEditorData.XTokenList.begin();
1975 iter != ContactEditorData.XTokenList.end(); ++iter){
1977 intValue2 = iter->first;
1979 // Get the element name.
1981 striter = ContactEditorData.XTokenListTokens.find(intValue2);
1983 if (striter->first == intValue2){
1985 strValue2 = striter->second;
1991 striter = ContactEditorData.XTokenList.find(intValue2);
1993 if (striter->first == intValue2){
1995 strValue = striter->second;
1999 // Add to the vCard.
2001 if (boolValue == TRUE){
2003 ContactData.AddRaw(wxT("X-") + strValue2, strValue);
2007 ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
2011 ResetSaveProcessData();
2015 ResetSaveProcessData();
2017 if (ContactEditorData.FullNamesList.size() == 0){
2019 wxString FullName = cmbDisplayAs->GetValue();
2020 ContactEditorData.FullNamesList.insert(std::make_pair(0, FullName));
2021 ContactEditorData.FullNamesListAltID.insert(std::make_pair(0, wxT("")));
2022 ContactEditorData.FullNamesListPID.insert(std::make_pair(0, wxT("")));
2023 ContactEditorData.FullNamesListType.insert(std::make_pair(0, wxT("")));
2024 ContactEditorData.FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
2025 ContactEditorData.FullNamesListPref.insert(std::make_pair(0, 0));
2026 ContactEditorData.FullNamesListTokens.insert(std::make_pair(0, wxT("")));
2031 for (std::map<int, wxString>::iterator iter = ContactEditorData.FullNamesList.begin();
2032 iter != ContactEditorData.FullNamesList.end(); ++iter){
2034 if (FNFirst == TRUE){
2036 iter->second = cmbDisplayAs->GetValue();
2041 std::map<int,wxString>::iterator mapS;
2043 mapS = ContactEditorData.FullNamesListTokens.find(iter->first);
2045 ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue,
2046 &iter, &ContactEditorData.FullNamesList, &ContactData,
2047 wxT("ALTID"), &ContactEditorData.FullNamesListAltID,
2048 wxT("PID"), &ContactEditorData.FullNamesListPID,
2049 wxT("TYPE"), &ContactEditorData.FullNamesListType,
2050 wxT("LANGUAGE"), &ContactEditorData.FullNamesListLanguage,
2051 wxT("PREF"), &ContactEditorData.FullNamesListPref,
2052 wxT(""), &ContactEditorData.FullNamesListTokens );
2056 ResetSaveProcessData();
2060 //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
2062 // Insert revision (REV) date.
2064 // Get today's date and time.
2066 wxDateTime DateTimeNow = wxDateTime::Now();
2070 // Set year, month and date.
2072 int intYear = DateTimeNow.GetYear();
2073 int intMonth = DateTimeNow.GetMonth();
2074 int intDay = DateTimeNow.GetDay();
2076 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
2080 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
2084 DateRev.Append(wxString::Format(wxT("%i"), intMonth));
2090 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
2094 DateRev.Append(wxString::Format(wxT("%i"), intDay));
2098 //DateRev.Append(wx);
2099 //DateRev.Append(wx);
2100 //DateRev.Append(wx);
2101 DateRev.Append(wxT("T"));
2103 // Set hour, minute and second.
2105 int intHour = DateTimeNow.GetHour();
2106 int intMinute = DateTimeNow.GetMinute();
2107 int intSecond = DateTimeNow.GetSecond();
2111 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
2115 DateRev.Append(wxString::Format(wxT("%i"), intHour));
2119 if (intMinute < 10){
2121 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
2125 DateRev.Append(wxString::Format(wxT("%i"), intMinute));
2129 if (intSecond < 10){
2131 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
2135 DateRev.Append(wxString::Format(wxT("%i"), intSecond));
2139 // DateRev.Append(wx);
2140 // DateRev.Append(wx);
2141 // DateRev.Append(wxString DateTimeNow->);
2142 DateRev.Append(wxT("Z"));
2144 ContactData.Add(wxT("UID"), ContactEditorData.UIDToken, FALSE);
2146 // End the vCard File.
2148 ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
2151 ContactData.WriteFile(FilenameFinal);
2153 vCard34Conv ConvFileFun;
2157 ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
2159 wxString AccountDirPrefix;
2160 wxString AccountDir;
2163 #if defined(__HAIKU__)
2165 //preffilename = wxT("noo");
2167 #elif defined(__APPLE__)
2169 PrefDir = GetUserPrefDir();
2171 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2173 #elif defined(__WIN32__)
2175 PrefDir = GetUserPrefDir();
2177 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
2181 PrefDir = GetUserPrefDir();
2183 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2187 XABPreferences PrefData(PrefDir);
2189 wxString AccountType;
2191 for (int i = 0; i < PrefData.accounts.GetCount(); i++){
2193 AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
2195 if (AccountDir == wxSContactAccount){
2197 AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
2198 AccountDirPrefix.Trim();
2199 AccountType = PrefData.accounts.GetAccountType(i);
2206 wxString wxSplitFilename;
2207 wxString wxSDataURL;
2209 while(wSTFilename.HasMoreTokens()){
2211 wxSplitFilename = wSTFilename.GetNextToken();
2215 wxSDataURL = wxSplitFilename;
2216 //wxSDataURL.Append(wxSplitFilename);
2218 // Find out if the filename exists in the table.
2220 if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
2222 wxString ETagResult;
2223 wxString ETagOriginal;
2225 ETagDB *ETagDBPtr = NULL;
2227 ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
2229 wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
2230 wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
2232 if (wxSETagOrig.IsEmpty()){
2234 // Generate the ETag.
2236 wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2240 if (wxSETag.IsEmpty()){
2242 // Update empty ETag.
2244 wxSETag = wxSETagOrig;
2245 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
2250 // Don't change original ETag.
2252 wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2253 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
2257 if (EditMode == FALSE){
2259 ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2261 FMTimer.SetFilename(FilenameFinal);
2262 FMTimer.UpdateTimestamp();
2263 FMTimer.Start(10000, FALSE);
2265 wxCommandEvent reloadevent(RELOADCONTACTLIST);
2266 reloadevent.SetString(wxSContactAccount);
2267 wxPostEvent(this->GetParent(), reloadevent);
2272 ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2273 FMTimer.UpdateTimestamp();
2274 FMTimer.Start(10000, FALSE);
2280 // Send a notification to update the main window
2281 // with the new details.
2286 // TODO: Workout nickname settings by priority and
2289 ucd->ContactAccount = wxSContactAccount;
2290 ucd->ContactFilename = FilenameFinal;
2291 ucd->ContactName = cmbDisplayAs->GetValue();
2292 ucd->ContactNameArray = ContactData.GetName();
2294 for (std::map<int,wxString>::iterator gniter = ContactEditorData.GeneralNicknamesList.begin();
2295 gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){
2297 ucd->ContactNickname = gniter->second;
2302 wxCommandEvent event2(CE_UPDATECONTACTLIST);
2303 event2.SetClientData(ucd);
2304 wxPostEvent(MainPtr, event2);
2308 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
2311 // Save the updated contact data and close the form.
2313 wxCommandEvent NullEvent;
2314 this->SaveContact(NullEvent);