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();
585 // Build the values for the ANNIVERSARY property.
589 if (!ContactEditorData.AnniversaryAltID.IsEmpty()){
592 DataValue = ContactEditorData.AnniversaryAltID;
594 EscapeString(&DataValue, FALSE);
596 strValue3.Append("ALTID=");
597 strValue3.Append(DataValue);
605 if (!ContactEditorData.AnniversaryCalScale.IsEmpty()){
608 DataValue = ContactEditorData.AnniversaryCalScale;
610 EscapeString(&DataValue, FALSE);
612 if (boolValue2 == TRUE){
614 strValue3.Append(";");
618 strValue3.Append("CALSCALE=");
619 strValue3.Append(DataValue);
627 if (!ContactEditorData.AnniversaryTokens.IsEmpty()){
630 DataValue = ContactEditorData.AnniversaryTokens;
632 EscapeString(&DataValue, FALSE);
634 if (boolValue2 == TRUE){
636 strValue3.Append(";");
640 strValue3.Append(DataValue);
644 // Write the ANNIVERSARY property.
646 if (!txtAnniversary->IsEmpty()){
648 if (!txtAnniversary->GetValue().IsEmpty()){
650 strValue = txtAnniversary->GetValue();
652 if (!strValue3.IsEmpty()){
654 ContactData.AddRaw("ANNIVERSARY;VALUE=text;" + strValue3, strValue);
658 ContactData.AddRaw("ANNIVERSARY;VALUE=text", strValue);
666 // Look for T and replace data before this.
668 // Get Day, Month & Year.
670 wxDateTime AnniversaryDate;
671 wxDateTime::Month AnniversaryMonth;
674 wxString DataBeforeT;
676 wxString FinalAnniversaryString;
677 bool ProcessDataAfterT = FALSE;
679 AnniversaryDate = dapAnniversary->GetValue();
681 if (AnniversaryDate.IsValid()){
683 AnniversaryDay = AnniversaryDate.GetDay();
684 AnniversaryMonth = AnniversaryDate.GetMonth();
685 AnniversaryYear = AnniversaryDate.GetYear();
687 // Look for T and replace data before this.
689 wxStringTokenizer wSTDate(ContactEditorData.Anniversary, wxT("T"));
691 while (wSTDate.HasMoreTokens()){
693 if (ProcessDataAfterT == FALSE){
695 DataBeforeT = wSTDate.GetNextToken();
696 ProcessDataAfterT = TRUE;
700 DataAfterT = wSTDate.GetNextToken();
707 // If there is not T then replace altogether.
709 wxString FinalAnniversaryDay;
710 wxString FinalAnniversaryMonth;
711 wxString FinalAnniversaryYear;
713 if (AnniversaryDay < 10){
715 FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
719 FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
723 if (((int)AnniversaryMonth + 1) < 10){
725 FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
729 FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
733 if (AnniversaryYear == 0){
735 FinalAnniversaryYear = wxT("--");
739 FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
743 if (!DataAfterT.IsEmpty()){
745 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
749 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
753 if (!FinalAnniversaryString.IsEmpty() || !strValue3.IsEmpty()){
755 if (!strValue3.IsEmpty()){
757 EscapeString(&strValue2, FALSE);
758 EscapeString(&strValue, FALSE);
760 ContactData.AddRaw(wxT("ANNIVERSARY;") + strValue3, FinalAnniversaryString);
764 EscapeString(&strValue, FALSE);
766 ContactData.AddRaw(wxT("ANNIVERSARY"), FinalAnniversaryString);
776 // Setup the addresses (General, Home, Business).
778 //intValue = GeneralAddressList.size();
779 ResetSaveProcessData();
781 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralAddressList.begin();
782 iter != ContactEditorData.GeneralAddressList.end(); ++iter){
784 int intSeekValue = iter->first;
786 wxString strAddressString;
787 wxString strAddressFinalValue;
788 std::map<int, wxString>::iterator iterValue;
790 strAddressString.Append(wxT(";;"));
794 iterValue = ContactEditorData.GeneralAddressList.find(intSeekValue);
795 strAddressFinalValue = iterValue->second;
796 ProcessCaptureStrings(&strAddressFinalValue);
797 strAddressString.Append(strAddressFinalValue + wxT(";"));
798 strAddressFinalValue.Clear();
802 iterValue = ContactEditorData.GeneralAddressListTown.find(intSeekValue);
803 strAddressFinalValue = iterValue->second;
804 ProcessCaptureStrings(&strAddressFinalValue);
805 strAddressString.Append(strAddressFinalValue + wxT(";"));
806 strAddressFinalValue.Clear();
810 iterValue = ContactEditorData.GeneralAddressListCounty.find(intSeekValue);
811 strAddressFinalValue = iterValue->second;
812 ProcessCaptureStrings(&strAddressFinalValue);
813 strAddressString.Append(strAddressFinalValue + wxT(";"));
814 strAddressFinalValue.Clear();
818 iterValue = ContactEditorData.GeneralAddressListPostCode.find(intSeekValue);
819 strAddressFinalValue = iterValue->second;
820 ProcessCaptureStrings(&strAddressFinalValue);
821 strAddressString.Append(strAddressFinalValue + wxT(";"));
822 strAddressFinalValue.Clear();
826 iterValue = ContactEditorData.GeneralAddressListCountry.find(intSeekValue);
827 strAddressFinalValue = iterValue->second;
828 ProcessCaptureStrings(&strAddressFinalValue);
829 strAddressString.Append(strAddressFinalValue);
830 strAddressFinalValue.Clear();
832 ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
833 &iter, &strAddressString, &ContactData,
834 wxT("LABEL"), &ContactEditorData.GeneralAddressListLabel,
835 wxT("LANGUAGE"), &ContactEditorData.GeneralAddressListLang,
836 wxT("ALTID"), &ContactEditorData.GeneralAddressListAltID,
837 wxT("PID"), &ContactEditorData.GeneralAddressListPID,
838 wxT("GEO"), &ContactEditorData.GeneralAddressListGeo,
839 wxT("TZ"), &ContactEditorData.GeneralAddressListTimezone,
840 wxT("MEDIATYPE"), &ContactEditorData.GeneralAddressListMediatype,
841 wxT("PREF"), &ContactEditorData.GeneralAddressListPref,
842 wxT(""), &ContactEditorData.GeneralAddressListTokens );
844 ResetSaveProcessData();
848 ResetSaveProcessData();
850 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeAddressList.begin();
851 iter != ContactEditorData.HomeAddressList.end(); ++iter){
853 int intSeekValue = iter->first;
855 wxString strAddressString;
856 wxString strAddressFinalValue;
857 std::map<int, wxString>::iterator iterValue;
859 strAddressString.Append(wxT(";;"));
863 iterValue = ContactEditorData.HomeAddressList.find(intSeekValue);
864 strAddressFinalValue = iterValue->second;
865 ProcessCaptureStrings(&strAddressFinalValue);
866 strAddressString.Append(strAddressFinalValue + wxT(";"));
870 iterValue = ContactEditorData.HomeAddressListTown.find(intSeekValue);
871 strAddressFinalValue = iterValue->second;
872 ProcessCaptureStrings(&strAddressFinalValue);
873 strAddressString.Append(strAddressFinalValue + wxT(";"));
877 iterValue = ContactEditorData.HomeAddressListCounty.find(intSeekValue);
878 strAddressFinalValue = iterValue->second;
879 ProcessCaptureStrings(&strAddressFinalValue);
880 strAddressString.Append(strAddressFinalValue + wxT(";"));
884 iterValue = ContactEditorData.HomeAddressListPostCode.find(intSeekValue);
885 strAddressFinalValue = iterValue->second;
886 ProcessCaptureStrings(&strAddressFinalValue);
887 strAddressString.Append(strAddressFinalValue + wxT(";"));
891 iterValue = ContactEditorData.HomeAddressListCountry.find(intSeekValue);
892 strAddressFinalValue = iterValue->second;
893 ProcessCaptureStrings(&strAddressFinalValue);
894 strAddressString.Append(strAddressFinalValue);
896 ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
897 &iter, &strAddressString, &ContactData,
898 wxT("LABEL"), &ContactEditorData.HomeAddressListLabel,
899 wxT("LANGUAGE"), &ContactEditorData.HomeAddressListLang,
900 wxT("ALTID"), &ContactEditorData.HomeAddressListAltID,
901 wxT("PID"), &ContactEditorData.HomeAddressListPID,
902 wxT("GEO"), &ContactEditorData.HomeAddressListGeo,
903 wxT("TZ"), &ContactEditorData.HomeAddressListTimezone,
904 wxT("MEDIATYPE"), &ContactEditorData.HomeAddressListMediatype,
905 wxT("PREF"), &ContactEditorData.HomeAddressListPref,
906 wxT(""), &ContactEditorData.HomeAddressListTokens );
908 ResetSaveProcessData();
912 ResetSaveProcessData();
914 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessAddressList.begin();
915 iter != ContactEditorData.BusinessAddressList.end(); ++iter){
917 int intSeekValue = iter->first;
919 wxString strAddressString;
920 wxString strAddressFinalValue;
921 std::map<int, wxString>::iterator iterValue;
923 strAddressString.Append(wxT(";;"));
927 iterValue = ContactEditorData.BusinessAddressList.find(intSeekValue);
928 strAddressFinalValue = iterValue->second;
929 ProcessCaptureStrings(&strAddressFinalValue);
931 strAddressString.Append(strAddressFinalValue + wxT(";"));
935 iterValue = ContactEditorData.BusinessAddressListTown.find(intSeekValue);
936 strAddressFinalValue = iterValue->second;
937 ProcessCaptureStrings(&strAddressFinalValue);
939 strAddressString.Append(strAddressFinalValue + wxT(";"));
943 iterValue = ContactEditorData.BusinessAddressListCounty.find(intSeekValue);
944 strAddressFinalValue = iterValue->second;
945 ProcessCaptureStrings(&strAddressFinalValue);
947 strAddressString.Append(strAddressFinalValue + wxT(";"));
951 iterValue = ContactEditorData.BusinessAddressListPostCode.find(intSeekValue);
952 strAddressFinalValue = iterValue->second;
953 ProcessCaptureStrings(&strAddressFinalValue);
955 strAddressString.Append(strAddressFinalValue + wxT(";"));
959 iterValue = ContactEditorData.BusinessAddressListCountry.find(intSeekValue);
960 strAddressFinalValue = iterValue->second;
961 ProcessCaptureStrings(&strAddressFinalValue);
963 strAddressString.Append(strAddressFinalValue);
965 ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
966 &iter, &strAddressString, &ContactData,
967 wxT("LABEL"), &ContactEditorData.BusinessAddressListLabel,
968 wxT("LANGUAGE"), &ContactEditorData.BusinessAddressListLang,
969 wxT("ALTID"), &ContactEditorData.BusinessAddressListAltID,
970 wxT("PID"), &ContactEditorData.BusinessAddressListPID,
971 wxT("GEO"), &ContactEditorData.BusinessAddressListGeo,
972 wxT("TZ"), &ContactEditorData.BusinessAddressListTimezone,
973 wxT("MEDIATYPE"), &ContactEditorData.BusinessAddressListMediatype,
974 wxT("PREF"), &ContactEditorData.BusinessAddressListPref,
975 wxT(""), &ContactEditorData.BusinessAddressListTokens );
977 ResetSaveProcessData();
981 // Sort out nicknames (if any).
983 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNicknamesList.begin();
984 iter != ContactEditorData.GeneralNicknamesList.end(); ++iter){
986 intValue2 = iter->first;
988 // Process Alternative ID.
990 ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
991 &iter, &ContactEditorData.GeneralNicknamesList, &ContactData,
992 wxT("LANGUAGE"), &ContactEditorData.GeneralNicknamesListLanguage,
993 wxT("ALTID"), &ContactEditorData.GeneralNicknamesListAltID,
994 wxT("PID"), &ContactEditorData.GeneralNicknamesListPID,
995 wxT("PREF"), &ContactEditorData.GeneralNicknamesListPref,
996 wxT(""), &ContactEditorData.GeneralNicknamesListTokens );
998 ResetSaveProcessData();
1002 ResetSaveProcessData();
1004 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNicknamesList.begin();
1005 iter != ContactEditorData.HomeNicknamesList.end(); ++iter){
1007 ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1008 &iter, &ContactEditorData.HomeNicknamesList, &ContactData,
1009 wxT("LANGUAGE"), &ContactEditorData.HomeNicknamesListLanguage,
1010 wxT("ALTID"), &ContactEditorData.HomeNicknamesListAltID,
1011 wxT("PID"), &ContactEditorData.HomeNicknamesListPID,
1012 wxT("PREF"), &ContactEditorData.HomeNicknamesListPref,
1013 wxT(""), &ContactEditorData.HomeNicknamesListTokens );
1015 ResetSaveProcessData();
1019 ResetSaveProcessData();
1021 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNicknamesList.begin();
1022 iter != ContactEditorData.BusinessNicknamesList.end(); ++iter){
1024 ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1025 &iter, &ContactEditorData.BusinessNicknamesList, &ContactData,
1026 wxT("LANGUAGE"), &ContactEditorData.BusinessNicknamesListLanguage,
1027 wxT("ALTID"), &ContactEditorData.BusinessNicknamesListAltID,
1028 wxT("PID"), &ContactEditorData.BusinessNicknamesListPID,
1029 wxT("PREF"), &ContactEditorData.BusinessNicknamesListPref,
1030 wxT(""), &ContactEditorData.BusinessNicknamesListTokens );
1032 ResetSaveProcessData();
1036 ResetSaveProcessData();
1038 // Sort out email (general, home and business).
1040 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralEmailList.begin();
1041 iter != ContactEditorData.GeneralEmailList.end(); ++iter){
1043 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1046 wxString strAddressFinalValue;
1047 std::map<int, wxString>::iterator iterValue;
1049 ProcessSaveData(wxT("EMAIL"), &strValue2, &boolValue2, &boolValue,
1050 &iter, &ContactEditorData.GeneralEmailList, &ContactData,
1051 wxT("ALTID"), &ContactEditorData.GeneralEmailListAltID,
1052 wxT("PID"), &ContactEditorData.GeneralEmailListPID,
1053 wxT("PREF"), &ContactEditorData.GeneralEmailListPref,
1054 wxT(""), &ContactEditorData.GeneralEmailListTokens );
1056 ResetSaveProcessData();
1060 ResetSaveProcessData();
1062 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeEmailList.begin();
1063 iter != ContactEditorData.HomeEmailList.end(); ++iter){
1065 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1068 ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1069 &iter, &ContactEditorData.HomeEmailList, &ContactData,
1070 wxT("ALTID"), &ContactEditorData.HomeEmailListAltID,
1071 wxT("PID"), &ContactEditorData.HomeEmailListPID,
1072 wxT("PREF"), &ContactEditorData.HomeEmailListPref,
1073 wxT(""), &ContactEditorData.HomeEmailListTokens );
1075 ResetSaveProcessData();
1079 ResetSaveProcessData();
1081 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessEmailList.begin();
1082 iter != ContactEditorData.BusinessEmailList.end(); ++iter){
1084 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1087 ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1088 &iter, &ContactEditorData.BusinessEmailList, &ContactData,
1089 wxT("ALTID"), &ContactEditorData.BusinessEmailListAltID,
1090 wxT("PID"), &ContactEditorData.BusinessEmailListPID,
1091 wxT("PREF"), &ContactEditorData.BusinessEmailListPref,
1092 wxT(""), &ContactEditorData.BusinessEmailListTokens );
1094 ResetSaveProcessData();
1098 ResetSaveProcessData();
1100 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralIMList.begin();
1101 iter != ContactEditorData.GeneralIMList.end(); ++iter){
1103 intValue2 = iter->first;
1105 // Process Alternative ID.
1107 ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
1108 &iter, &ContactEditorData.GeneralIMList, &ContactData,
1109 wxT("ALTID"), &ContactEditorData.GeneralIMListAltID,
1110 wxT("PID"), &ContactEditorData.GeneralIMListPID,
1111 wxT("MEDIATYPE"), &ContactEditorData.GeneralIMListMediatype,
1112 wxT("PREF"), &ContactEditorData.GeneralIMListPref,
1113 wxT(""), &ContactEditorData.GeneralIMListTokens );
1115 ResetSaveProcessData();
1119 ResetSaveProcessData();
1121 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeIMList.begin();
1122 iter != ContactEditorData.HomeIMList.end(); ++iter){
1124 ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1125 &iter, &ContactEditorData.HomeIMList, &ContactData,
1126 wxT("ALTID"), &ContactEditorData.HomeIMListAltID,
1127 wxT("PID"), &ContactEditorData.HomeIMListPID,
1128 wxT("MEDIATYPE"), &ContactEditorData.HomeIMListMediatype,
1129 wxT("PREF"), &ContactEditorData.HomeIMListPref,
1130 wxT(""), &ContactEditorData.HomeIMListTokens );
1132 ResetSaveProcessData();
1136 ResetSaveProcessData();
1138 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessIMList.begin();
1139 iter != ContactEditorData.BusinessIMList.end(); ++iter){
1141 ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1142 &iter, &ContactEditorData.BusinessIMList, &ContactData,
1143 wxT("ALTID"), &ContactEditorData.BusinessIMListAltID,
1144 wxT("PID"), &ContactEditorData.BusinessIMListPID,
1145 wxT("MEDIATYPE"), &ContactEditorData.BusinessIMListMediatype,
1146 wxT("PREF"), &ContactEditorData.BusinessIMListPref,
1147 wxT(""), &ContactEditorData.BusinessIMListTokens );
1149 ResetSaveProcessData();
1153 ResetSaveProcessData();
1155 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTelephoneList.begin();
1156 iter != ContactEditorData.GeneralTelephoneList.end(); ++iter){
1158 wxString strAddressFinalValue = iter->second;
1160 ProcessCaptureStrings(&strAddressFinalValue);
1162 if (ContactEditorData.GeneralTelephoneListDataType.find(iter->first) !=
1163 ContactEditorData.GeneralTelephoneListDataType.end()){
1165 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralTelephoneListDataType.find(iter->first);
1167 strAddressFinalValue.insert(0, ":");
1168 strAddressFinalValue.insert(0, DataTypeIter->second);
1172 strAddressFinalValue.insert(0, "tel:");
1176 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1177 &iter, &strAddressFinalValue, &ContactData,
1178 wxT("ALTID"), &ContactEditorData.GeneralTelephoneListAltID,
1179 wxT("PID"), &ContactEditorData.GeneralTelephoneListPID,
1180 wxT("TYPE"), &ContactEditorData.GeneralTelephoneListType,
1181 wxT("PREF"), &ContactEditorData.GeneralTelephoneListPref,
1182 wxT(""), &ContactEditorData.GeneralTelephoneListTokens );
1184 ResetSaveProcessData();
1188 ResetSaveProcessData();
1190 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTelephoneList.begin();
1191 iter != ContactEditorData.HomeTelephoneList.end(); ++iter){
1193 wxString strAddressFinalValue = iter->second;
1195 ProcessCaptureStrings(&strAddressFinalValue);
1197 if (ContactEditorData.HomeTelephoneListDataType.find(iter->first) !=
1198 ContactEditorData.HomeTelephoneListDataType.end()){
1200 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeTelephoneListDataType.find(iter->first);
1202 strAddressFinalValue.insert(0, ":");
1203 strAddressFinalValue.insert(0, DataTypeIter->second);
1207 strAddressFinalValue.insert(0, "tel:");
1211 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1212 &iter, &strAddressFinalValue, &ContactData,
1213 wxT("ALTID"), &ContactEditorData.HomeTelephoneListAltID,
1214 wxT("PID"), &ContactEditorData.HomeTelephoneListPID,
1215 wxT("TYPE"), &ContactEditorData.HomeTelephoneListType,
1216 wxT("PREF"), &ContactEditorData.HomeTelephoneListPref,
1217 wxT(""), &ContactEditorData.HomeTelephoneListTokens );
1219 ResetSaveProcessData();
1223 ResetSaveProcessData();
1225 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTelephoneList.begin();
1226 iter != ContactEditorData.BusinessTelephoneList.end(); ++iter){
1228 wxString strAddressFinalValue = iter->second;
1230 ProcessCaptureStrings(&strAddressFinalValue);
1232 if (ContactEditorData.BusinessTelephoneListDataType.find(iter->first) !=
1233 ContactEditorData.BusinessTelephoneListDataType.end()){
1235 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessTelephoneListDataType.find(iter->first);
1237 strAddressFinalValue.insert(0, ":");
1238 strAddressFinalValue.insert(0, DataTypeIter->second);
1242 strAddressFinalValue.insert(0, "tel:");
1246 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1247 &iter, &strAddressFinalValue, &ContactData,
1248 wxT("ALTID"), &ContactEditorData.BusinessTelephoneListAltID,
1249 wxT("PID"), &ContactEditorData.BusinessTelephoneListPID,
1250 wxT("TYPE"), &ContactEditorData.BusinessTelephoneListType,
1251 wxT("PREF"), &ContactEditorData.BusinessTelephoneListPref,
1252 wxT(""), &ContactEditorData.BusinessTelephoneListTokens );
1254 ResetSaveProcessData();
1258 ResetSaveProcessData();
1260 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralLanguageList.begin();
1261 iter != ContactEditorData.GeneralLanguageList.end(); ++iter){
1263 intValue2 = iter->first;
1265 ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
1266 &iter, &ContactEditorData.GeneralLanguageList, &ContactData,
1267 wxT("ALTID"), &ContactEditorData.GeneralLanguageListAltID,
1268 wxT("PID"), &ContactEditorData.GeneralLanguageListPID,
1269 wxT("PREF"), &ContactEditorData.GeneralLanguageListPref,
1270 wxT(""), &ContactEditorData.GeneralLanguageListTokens );
1272 ResetSaveProcessData();
1276 ResetSaveProcessData();
1278 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeLanguageList.begin();
1279 iter != ContactEditorData.HomeLanguageList.end(); ++iter){
1281 ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1282 &iter, &ContactEditorData.HomeLanguageList, &ContactData,
1283 wxT("ALTID"), &ContactEditorData.HomeLanguageListAltID,
1284 wxT("PID"), &ContactEditorData.HomeLanguageListPID,
1285 wxT("PREF"), &ContactEditorData.HomeLanguageListPref,
1286 wxT(""), &ContactEditorData.HomeLanguageListTokens );
1288 ResetSaveProcessData();
1292 ResetSaveProcessData();
1294 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessLanguageList.begin();
1295 iter != ContactEditorData.BusinessLanguageList.end(); ++iter){
1297 ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1298 &iter, &ContactEditorData.BusinessLanguageList, &ContactData,
1299 wxT("ALTID"), &ContactEditorData.BusinessLanguageListAltID,
1300 wxT("PID"), &ContactEditorData.BusinessLanguageListPID,
1301 wxT("PREF"), &ContactEditorData.BusinessLanguageListPref,
1302 wxT(""), &ContactEditorData.BusinessLanguageListTokens );
1304 ResetSaveProcessData();
1308 ResetSaveProcessData();
1310 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTZList.begin();
1311 iter != ContactEditorData.GeneralTZList.end(); ++iter){
1313 ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
1314 &iter, &ContactEditorData.GeneralTZList, &ContactData,
1315 wxT("ALTID"), &ContactEditorData.GeneralTZListAltID,
1316 wxT("PID"), &ContactEditorData.GeneralTZListPID,
1317 wxT("MEDIATYPE"), &ContactEditorData.GeneralTZListMediatype,
1318 wxT("PREF"), &ContactEditorData.GeneralTZListPref,
1319 wxT(""), &ContactEditorData.GeneralTZListTokens );
1321 ResetSaveProcessData();
1325 ResetSaveProcessData();
1327 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTZList.begin();
1328 iter != ContactEditorData.HomeTZList.end(); ++iter){
1330 ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1331 &iter, &ContactEditorData.HomeTZList, &ContactData,
1332 wxT("ALTID"), &ContactEditorData.HomeTZListAltID,
1333 wxT("PID"), &ContactEditorData.HomeTZListPID,
1334 wxT("MEDIATYPE"), &ContactEditorData.HomeTZListMediatype,
1335 wxT("PREF"), &ContactEditorData.HomeTZListPref,
1336 wxT(""), &ContactEditorData.HomeTZListTokens );
1338 ResetSaveProcessData();
1342 ResetSaveProcessData();
1344 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTZList.begin();
1345 iter != ContactEditorData.BusinessTZList.end(); ++iter){
1347 ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1348 &iter, &ContactEditorData.BusinessTZList, &ContactData,
1349 wxT("ALTID"), &ContactEditorData.BusinessTZListAltID,
1350 wxT("PID"), &ContactEditorData.BusinessTZListPID,
1351 wxT("MEDIATYPE"), &ContactEditorData.BusinessTZListMediatype,
1352 wxT("PREF"), &ContactEditorData.BusinessTZListPref,
1353 wxT(""), &ContactEditorData.BusinessTZListTokens );
1355 ResetSaveProcessData();
1359 ResetSaveProcessData();
1361 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralGeographyList.begin();
1362 iter != ContactEditorData.GeneralGeographyList.end(); ++iter){
1364 wxString strGeoFinalValue = iter->second;
1366 ProcessCaptureStrings(&strGeoFinalValue);
1368 if (ContactEditorData.GeneralGeographyListDataType.find(iter->first) !=
1369 ContactEditorData.GeneralGeographyListDataType.end()){
1371 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralGeographyListDataType.find(iter->first);
1373 strGeoFinalValue.insert(0, ":");
1374 strGeoFinalValue.insert(0, DataTypeIter->second);
1378 strGeoFinalValue.insert(0, "geo:");
1382 ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
1383 &iter, &strGeoFinalValue, &ContactData,
1384 wxT("ALTID"), &ContactEditorData.GeneralGeographyListAltID,
1385 wxT("PID"), &ContactEditorData.GeneralGeographyListPID,
1386 wxT("MEDIATYPE"), &ContactEditorData.GeneralGeographyListMediatype,
1387 wxT("PREF"), &ContactEditorData.GeneralGeographyListPref,
1388 wxT(""), &ContactEditorData.GeneralGeographyListTokens );
1390 ResetSaveProcessData();
1394 ResetSaveProcessData();
1396 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeGeographyList.begin();
1397 iter != ContactEditorData.HomeGeographyList.end(); ++iter){
1399 wxString strGeoFinalValue = iter->second;
1401 ProcessCaptureStrings(&strGeoFinalValue);
1403 if (ContactEditorData.HomeGeographyListDataType.find(iter->first) !=
1404 ContactEditorData.HomeGeographyListDataType.end()){
1406 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeGeographyListDataType.find(iter->first);
1408 strGeoFinalValue.insert(0, ":");
1409 strGeoFinalValue.insert(0, DataTypeIter->second);
1413 strGeoFinalValue.insert(0, "geo:");
1417 ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1418 &iter, &strGeoFinalValue, &ContactData,
1419 wxT("ALTID"), &ContactEditorData.HomeGeographyListAltID,
1420 wxT("PID"), &ContactEditorData.HomeGeographyListPID,
1421 wxT("MEDIATYPE"), &ContactEditorData.HomeGeographyListMediatype,
1422 wxT("PREF"), &ContactEditorData.HomeGeographyListPref,
1423 wxT(""), &ContactEditorData.HomeGeographyListTokens );
1425 ResetSaveProcessData();
1429 ResetSaveProcessData();
1431 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessGeographyList.begin();
1432 iter != ContactEditorData.BusinessGeographyList.end(); ++iter){
1434 wxString strGeoFinalValue = iter->second;
1436 ProcessCaptureStrings(&strGeoFinalValue);
1438 if (ContactEditorData.BusinessGeographyListDataType.find(iter->first) !=
1439 ContactEditorData.BusinessGeographyListDataType.end()){
1441 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessGeographyListDataType.find(iter->first);
1443 strGeoFinalValue.insert(0, ":");
1444 strGeoFinalValue.insert(0, DataTypeIter->second);
1448 strGeoFinalValue.insert(0, "geo:");
1452 ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1453 &iter, &strGeoFinalValue, &ContactData,
1454 wxT("ALTID"), &ContactEditorData.BusinessGeographyListAltID,
1455 wxT("PID"), &ContactEditorData.BusinessGeographyListPID,
1456 wxT("MEDIATYPE"), &ContactEditorData.BusinessGeographyListMediatype,
1457 wxT("PREF"), &ContactEditorData.BusinessGeographyListPref,
1458 wxT(""), &ContactEditorData.BusinessGeographyListTokens );
1460 ResetSaveProcessData();
1464 ResetSaveProcessData();
1466 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRelatedList.begin();
1467 iter != ContactEditorData.GeneralRelatedList.end(); ++iter){
1469 ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
1470 &iter, &ContactEditorData.GeneralRelatedList, &ContactData,
1471 wxT("ALTID"), &ContactEditorData.GeneralRelatedListAltID,
1472 wxT("PID"), &ContactEditorData.GeneralRelatedListPID,
1473 wxT("LANGUAGE"), &ContactEditorData.GeneralRelatedListLanguage,
1474 wxT("TYPE"), &ContactEditorData.GeneralRelatedListRelType,
1475 wxT("PREF"), &ContactEditorData.GeneralRelatedListPref,
1476 wxT(""), &ContactEditorData.GeneralRelatedListTokens );
1478 ResetSaveProcessData();
1482 ResetSaveProcessData();
1484 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralWebsiteList.begin();
1485 iter != ContactEditorData.GeneralWebsiteList.end(); ++iter){
1487 ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
1488 &iter, &ContactEditorData.GeneralWebsiteList, &ContactData,
1489 wxT("ALTID"), &ContactEditorData.GeneralWebsiteListAltID,
1490 wxT("PID"), &ContactEditorData.GeneralWebsiteListPID,
1491 wxT("MEDIATYPE"), &ContactEditorData.GeneralWebsiteListMediatype,
1492 wxT("PREF"), &ContactEditorData.GeneralWebsiteListPref,
1493 wxT(""), &ContactEditorData.GeneralWebsiteListTokens );
1495 ResetSaveProcessData();
1499 ResetSaveProcessData();
1501 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeWebsiteList.begin();
1502 iter != ContactEditorData.HomeWebsiteList.end(); ++iter){
1504 ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1505 &iter, &ContactEditorData.HomeWebsiteList, &ContactData,
1506 wxT("ALTID"), &ContactEditorData.HomeWebsiteListAltID,
1507 wxT("PID"), &ContactEditorData.HomeWebsiteListPID,
1508 wxT("MEDIATYPE"), &ContactEditorData.HomeWebsiteListMediatype,
1509 wxT("PREF"), &ContactEditorData.HomeWebsiteListPref,
1510 wxT(""), &ContactEditorData.HomeWebsiteListTokens );
1512 ResetSaveProcessData();
1516 ResetSaveProcessData();
1518 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessWebsiteList.begin();
1519 iter != ContactEditorData.BusinessWebsiteList.end(); ++iter){
1521 ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1522 &iter, &ContactEditorData.BusinessWebsiteList, &ContactData,
1523 wxT("ALTID"), &ContactEditorData.BusinessWebsiteListAltID,
1524 wxT("PID"), &ContactEditorData.BusinessWebsiteListPID,
1525 wxT("MEDIATYPE"), &ContactEditorData.BusinessWebsiteListMediatype,
1526 wxT("PREF"), &ContactEditorData.BusinessWebsiteListPref,
1527 wxT(""), &ContactEditorData.BusinessWebsiteListTokens );
1529 ResetSaveProcessData();
1533 ResetSaveProcessData();
1535 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTitleList.begin();
1536 iter != ContactEditorData.GeneralTitleList.end(); ++iter){
1538 ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
1539 &iter, &ContactEditorData.GeneralTitleList, &ContactData,
1540 wxT("ALTID"), &ContactEditorData.GeneralTitleListAltID,
1541 wxT("PID"), &ContactEditorData.GeneralTitleListPID,
1542 wxT("LANGUAGE"), &ContactEditorData.GeneralTitleListLanguage,
1543 wxT("PREF"), &ContactEditorData.GeneralTitleListPref,
1544 wxT(""), &ContactEditorData.GeneralTitleListTokens );
1546 ResetSaveProcessData();
1550 ResetSaveProcessData();
1552 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTitleList.begin();
1553 iter != ContactEditorData.HomeTitleList.end(); ++iter){
1555 ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1556 &iter, &ContactEditorData.HomeTitleList, &ContactData,
1557 wxT("ALTID"), &ContactEditorData.HomeTitleListAltID,
1558 wxT("PID"), &ContactEditorData.HomeTitleListPID,
1559 wxT("LANGUAGE"), &ContactEditorData.HomeTitleListLanguage,
1560 wxT("PREF"), &ContactEditorData.HomeTitleListPref,
1561 wxT(""), &ContactEditorData.HomeTitleListTokens );
1563 ResetSaveProcessData();
1567 ResetSaveProcessData();
1569 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTitleList.begin();
1570 iter != ContactEditorData.BusinessTitleList.end(); ++iter){
1572 ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1573 &iter, &ContactEditorData.BusinessTitleList, &ContactData,
1574 wxT("ALTID"), &ContactEditorData.BusinessTitleListAltID,
1575 wxT("PID"), &ContactEditorData.BusinessTitleListPID,
1576 wxT("LANGUAGE"), &ContactEditorData.BusinessTitleListLanguage,
1577 wxT("PREF"), &ContactEditorData.BusinessTitleListPref,
1578 wxT(""), &ContactEditorData.BusinessTitleListTokens );
1580 ResetSaveProcessData();
1584 ResetSaveProcessData();
1586 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRoleList.begin();
1587 iter != ContactEditorData.GeneralRoleList.end(); ++iter){
1589 ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
1590 &iter, &ContactEditorData.GeneralRoleList, &ContactData,
1591 wxT("ALTID"), &ContactEditorData.GeneralRoleListAltID,
1592 wxT("PID"), &ContactEditorData.GeneralRoleListPID,
1593 wxT("LANGUAGE"), &ContactEditorData.GeneralRoleListLanguage,
1594 wxT("PREF"), &ContactEditorData.GeneralRoleListPref,
1595 wxT(""), &ContactEditorData.GeneralRoleListTokens );
1597 ResetSaveProcessData();
1601 ResetSaveProcessData();
1603 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeRoleList.begin();
1604 iter != ContactEditorData.HomeRoleList.end(); ++iter){
1606 ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1607 &iter, &ContactEditorData.HomeRoleList, &ContactData,
1608 wxT("ALTID"), &ContactEditorData.HomeRoleListAltID,
1609 wxT("PID"), &ContactEditorData.HomeRoleListPID,
1610 wxT("LANGUAGE"), &ContactEditorData.HomeRoleListLanguage,
1611 wxT("PREF"), &ContactEditorData.HomeRoleListPref,
1612 wxT(""), &ContactEditorData.HomeRoleListTokens );
1614 ResetSaveProcessData();
1618 ResetSaveProcessData();
1620 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessRoleList.begin();
1621 iter != ContactEditorData.BusinessRoleList.end(); ++iter){
1623 ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1624 &iter, &ContactEditorData.BusinessRoleList, &ContactData,
1625 wxT("ALTID"), &ContactEditorData.BusinessRoleListAltID,
1626 wxT("PID"), &ContactEditorData.BusinessRoleListPID,
1627 wxT("LANGUAGE"), &ContactEditorData.BusinessRoleListLanguage,
1628 wxT("PREF"), &ContactEditorData.BusinessRoleListPref,
1629 wxT(""), &ContactEditorData.BusinessRoleListTokens );
1631 ResetSaveProcessData();
1635 ResetSaveProcessData();
1637 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralOrganisationsList.begin();
1638 iter != ContactEditorData.GeneralOrganisationsList.end(); ++iter){
1640 ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
1641 &iter, &ContactEditorData.GeneralOrganisationsList, &ContactData,
1642 wxT("ALTID"), &ContactEditorData.GeneralOrganisationsListAltID,
1643 wxT("PID"), &ContactEditorData.GeneralOrganisationsListPID,
1644 wxT("LANGUAGE"), &ContactEditorData.GeneralOrganisationsListLanguage,
1645 wxT("SORT-AS"), &ContactEditorData.GeneralOrganisationsListSortAs,
1646 wxT("PREF"), &ContactEditorData.GeneralOrganisationsListPref,
1647 wxT(""), &ContactEditorData.GeneralOrganisationsListTokens );
1649 ResetSaveProcessData();
1653 ResetSaveProcessData();
1655 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeOrganisationsList.begin();
1656 iter != ContactEditorData.HomeOrganisationsList.end(); ++iter){
1658 ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1659 &iter, &ContactEditorData.HomeOrganisationsList, &ContactData,
1660 wxT("ALTID"), &ContactEditorData.HomeOrganisationsListAltID,
1661 wxT("PID"), &ContactEditorData.HomeOrganisationsListPID,
1662 wxT("LANGUAGE"), &ContactEditorData.HomeOrganisationsListLanguage,
1663 wxT("SORT-AS"), &ContactEditorData.HomeOrganisationsListSortAs,
1664 wxT("PREF"), &ContactEditorData.HomeOrganisationsListPref,
1665 wxT(""), &ContactEditorData.HomeOrganisationsListTokens );
1667 ResetSaveProcessData();
1671 ResetSaveProcessData();
1673 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessOrganisationsList.begin();
1674 iter != ContactEditorData.BusinessOrganisationsList.end(); ++iter){
1676 ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1677 &iter, &ContactEditorData.BusinessOrganisationsList, &ContactData,
1678 wxT("ALTID"), &ContactEditorData.BusinessOrganisationsListAltID,
1679 wxT("PID"), &ContactEditorData.BusinessOrganisationsListPID,
1680 wxT("LANGUAGE"), &ContactEditorData.BusinessOrganisationsListLanguage,
1681 wxT("SORT-AS"), &ContactEditorData.BusinessOrganisationsListSortAs,
1682 wxT("PREF"), &ContactEditorData.BusinessOrganisationsListPref,
1683 wxT(""), &ContactEditorData.BusinessOrganisationsListTokens );
1685 ResetSaveProcessData();
1689 ResetSaveProcessData();
1691 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNoteList.begin();
1692 iter != ContactEditorData.GeneralNoteList.end(); ++iter){
1694 ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
1695 &iter, &ContactEditorData.GeneralNoteList, &ContactData,
1696 wxT("ALTID"), &ContactEditorData.GeneralNoteListAltID,
1697 wxT("PID"), &ContactEditorData.GeneralNoteListPID,
1698 wxT("LANGUAGE"), &ContactEditorData.GeneralNoteListLanguage,
1699 wxT("PREF"), &ContactEditorData.GeneralNoteListPref,
1700 wxT(""), &ContactEditorData.GeneralNoteListTokens );
1702 ResetSaveProcessData();
1706 ResetSaveProcessData();
1708 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNoteList.begin();
1709 iter != ContactEditorData.HomeNoteList.end(); ++iter){
1711 ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1712 &iter, &ContactEditorData.HomeNoteList, &ContactData,
1713 wxT("ALTID"), &ContactEditorData.HomeNoteListAltID,
1714 wxT("PID"), &ContactEditorData.HomeNoteListPID,
1715 wxT("LANGUAGE"), &ContactEditorData.HomeNoteListLanguage,
1716 wxT("PREF"), &ContactEditorData.HomeNoteListPref,
1717 wxT(""), &ContactEditorData.HomeNoteListTokens );
1719 ResetSaveProcessData();
1723 ResetSaveProcessData();
1725 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNoteList.begin();
1726 iter != ContactEditorData.BusinessNoteList.end(); ++iter){
1728 ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1729 &iter, &ContactEditorData.BusinessNoteList, &ContactData,
1730 wxT("ALTID"), &ContactEditorData.BusinessNoteListAltID,
1731 wxT("PID"), &ContactEditorData.BusinessNoteListPID,
1732 wxT("LANGUAGE"), &ContactEditorData.BusinessNoteListLanguage,
1733 wxT("PREF"), &ContactEditorData.BusinessNoteListPref,
1734 wxT(""), &ContactEditorData.BusinessNoteListTokens );
1736 ResetSaveProcessData();
1740 ResetSaveProcessData();
1742 for (std::map<int,wxString>::iterator iter = ContactEditorData.CategoriesList.begin();
1743 iter != ContactEditorData.CategoriesList.end(); ++iter){
1745 ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
1746 &iter, &ContactEditorData.CategoriesList, &ContactData,
1747 wxT("ALTID"), &ContactEditorData.CategoriesListAltID,
1748 wxT("PID"), &ContactEditorData.CategoriesListPID,
1749 wxT("TYPE"), &ContactEditorData.CategoriesListType,
1750 wxT("PREF"), &ContactEditorData.CategoriesListPref,
1751 wxT(""), &ContactEditorData.CategoriesListTokens );
1753 ResetSaveProcessData();
1759 for (std::map<int, std::string>::iterator iter = ContactEditorData.PicturesList.begin();
1760 iter != ContactEditorData.PicturesList.end(); ++iter){
1762 int intValueIndex = iter->first;
1764 std::map<int, std::string>::iterator stdstriter;
1765 std::map<int, wxString>::iterator enciter;
1767 striter = ContactEditorData.PicturesListPictureType.find(intValueIndex);
1768 enciter = ContactEditorData.PicturesListPicEncType.find(intValueIndex);
1770 ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
1771 &iter, &ContactEditorData.PicturesList, &striter,
1772 &enciter, &ContactData,
1773 wxT("ALTID"), &ContactEditorData.PicturesListAltID,
1774 wxT("PID"), &ContactEditorData.PicturesListPID,
1775 wxT("TYPE"), &ContactEditorData.PicturesListType,
1776 wxT("PREF"), &ContactEditorData.PicturesListPref,
1777 wxT(""), &ContactEditorData.PicturesListTokens);
1779 ResetSaveProcessData();
1783 ResetSaveProcessData();
1787 for (std::map<int, std::string>::iterator iter = ContactEditorData.LogosList.begin();
1788 iter != ContactEditorData.LogosList.end(); ++iter){
1790 int intValueIndex = iter->first;
1792 std::map<int, std::string>::iterator stdstriter;
1793 std::map<int, wxString>::iterator enciter;
1795 striter = ContactEditorData.LogosListPictureType.find(intValueIndex);
1796 enciter = ContactEditorData.LogosListPicEncType.find(intValueIndex);
1798 ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
1799 &iter, &ContactEditorData.LogosList, &striter,
1800 &enciter, &ContactData,
1801 wxT("ALTID"), &ContactEditorData.LogosListAltID,
1802 wxT("PID"), &ContactEditorData.LogosListPID,
1803 wxT("TYPE"), &ContactEditorData.LogosListType,
1804 wxT("PREF"), &ContactEditorData.LogosListPref,
1805 wxT(""), &ContactEditorData.LogosListTokens );
1807 ResetSaveProcessData();
1811 ResetSaveProcessData();
1815 for (std::map<int, std::string>::iterator iter = ContactEditorData.SoundsList.begin();
1816 iter != ContactEditorData.SoundsList.end(); ++iter){
1818 int intValueIndex = iter->first;
1820 std::map<int, std::string>::iterator stdstriter;
1821 std::map<int, wxString>::iterator enciter;
1823 striter = ContactEditorData.SoundsListAudioType.find(intValueIndex);
1824 enciter = ContactEditorData.SoundsListAudioEncType.find(intValueIndex);
1826 ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
1827 &iter, &ContactEditorData.SoundsList, &striter,
1828 &enciter, &ContactData,
1829 wxT("ALTID"), &ContactEditorData.SoundsListAltID,
1830 wxT("PID"), &ContactEditorData.SoundsListPID,
1831 wxT("TYPE"), &ContactEditorData.SoundsListType,
1832 wxT("PREF"), &ContactEditorData.SoundsListPref,
1833 wxT(""), &ContactEditorData.SoundsListTokens );
1835 ResetSaveProcessData();
1839 ResetSaveProcessData();
1841 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarList.begin();
1842 iter != ContactEditorData.CalendarList.end(); ++iter){
1844 ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
1845 &iter, &ContactEditorData.CalendarList, &ContactData,
1846 wxT("ALTID"), &ContactEditorData.CalendarListAltID,
1847 wxT("PID"), &ContactEditorData.CalendarListPID,
1848 wxT("MEDIATYPE"), &ContactEditorData.CalendarListMediatype,
1849 wxT("TYPE"), &ContactEditorData.CalendarListType,
1850 wxT("PREF"), &ContactEditorData.CalendarListPref,
1851 wxT(""), &ContactEditorData.CalendarListTokens );
1853 ResetSaveProcessData();
1857 ResetSaveProcessData();
1859 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarRequestList.begin();
1860 iter != ContactEditorData.CalendarRequestList.end(); ++iter){
1862 ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
1863 &iter, &ContactEditorData.CalendarRequestList, &ContactData,
1864 wxT("ALTID"), &ContactEditorData.CalendarRequestListAltID,
1865 wxT("PID"), &ContactEditorData.CalendarRequestListPID,
1866 wxT("MEDIATYPE"), &ContactEditorData.CalendarRequestListMediatype,
1867 wxT("TYPE"), &ContactEditorData.CalendarRequestListType,
1868 wxT("PREF"), &ContactEditorData.CalendarRequestListPref,
1869 wxT(""), &ContactEditorData.CalendarRequestListTokens );
1871 ResetSaveProcessData();
1875 ResetSaveProcessData();
1877 for (std::map<int,wxString>::iterator iter = ContactEditorData.FreeBusyList.begin();
1878 iter != ContactEditorData.FreeBusyList.end(); ++iter){
1880 ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
1881 &iter, &ContactEditorData.FreeBusyList, &ContactData,
1882 wxT("ALTID"), &ContactEditorData.FreeBusyListAltID,
1883 wxT("PID"), &ContactEditorData.FreeBusyListPID,
1884 wxT("MEDIATYPE"), &ContactEditorData.FreeBusyListMediatype,
1885 wxT("TYPE"), &ContactEditorData.FreeBusyListType,
1886 wxT("PREF"), &ContactEditorData.FreeBusyListPref,
1887 wxT(""), &ContactEditorData.FreeBusyListTokens );
1889 ResetSaveProcessData();
1893 for (std::map<int, wxString>::iterator iter = ContactEditorData.KeyList.begin();
1894 iter != ContactEditorData.KeyList.end(); ++iter){
1896 intValue2 = iter->first;
1898 // Get the key information.
1900 std::map<int, wxString>::iterator enciter;
1902 striter = ContactEditorData.KeyListDataType.find(intValue2);
1903 //enciter = KeyListAudioEncType.find(intValue2);
1905 wxString strValueData;
1907 strValueData = iter->second;
1908 strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));
1910 ProcessSaveData(wxT("KEY"), &strValue2, &boolValue2, &boolValue,
1911 &iter, &strValueData, &ContactData,
1912 wxT("ALTID"), &ContactEditorData.KeyListAltID,
1913 wxT("PID"), &ContactEditorData.KeyListPID,
1914 wxT("TYPE"), &ContactEditorData.KeyListType,
1915 wxT("PREF"), &ContactEditorData.KeyListPref,
1916 wxT(""), &ContactEditorData.KeyListTokens );
1918 ResetSaveProcessData();
1922 // Vendor specific items.
1924 ResetSaveProcessData();
1926 for (std::map<int,wxString>::iterator iter = ContactEditorData.VendorList.begin();
1927 iter != ContactEditorData.VendorList.end(); ++iter){
1929 intValue2 = iter->first;
1931 // Get the IANA PEN number.
1933 striter = ContactEditorData.VendorListPEN.find(intValue2);
1935 if (striter->first == intValue2){
1937 strValue2 = striter->second;
1941 // Get the element name.
1943 striter = ContactEditorData.VendorListElement.find(intValue2);
1945 if (striter->first == intValue2){
1947 strValue3 = striter->second;
1953 striter = ContactEditorData.VendorList.find(intValue2);
1955 if (striter->first == intValue2){
1957 strValue = striter->second;
1961 // Add to the vCard.
1963 if (boolValue == TRUE){
1965 ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
1969 ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
1973 ResetSaveProcessData();
1977 ResetSaveProcessData();
1981 for (std::map<int,wxString>::iterator iter = ContactEditorData.XTokenList.begin();
1982 iter != ContactEditorData.XTokenList.end(); ++iter){
1984 intValue2 = iter->first;
1986 // Get the element name.
1988 striter = ContactEditorData.XTokenListTokens.find(intValue2);
1990 if (striter->first == intValue2){
1992 strValue2 = striter->second;
1998 striter = ContactEditorData.XTokenList.find(intValue2);
2000 if (striter->first == intValue2){
2002 strValue = striter->second;
2006 // Add to the vCard.
2008 if (boolValue == TRUE){
2010 ContactData.AddRaw(wxT("X-") + strValue2, strValue);
2014 ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
2018 ResetSaveProcessData();
2022 ResetSaveProcessData();
2024 if (ContactEditorData.FullNamesList.size() == 0){
2026 wxString FullName = cmbDisplayAs->GetValue();
2027 ContactEditorData.FullNamesList.insert(std::make_pair(0, FullName));
2028 ContactEditorData.FullNamesListAltID.insert(std::make_pair(0, wxT("")));
2029 ContactEditorData.FullNamesListPID.insert(std::make_pair(0, wxT("")));
2030 ContactEditorData.FullNamesListType.insert(std::make_pair(0, wxT("")));
2031 ContactEditorData.FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
2032 ContactEditorData.FullNamesListPref.insert(std::make_pair(0, 0));
2033 ContactEditorData.FullNamesListTokens.insert(std::make_pair(0, wxT("")));
2038 for (std::map<int, wxString>::iterator iter = ContactEditorData.FullNamesList.begin();
2039 iter != ContactEditorData.FullNamesList.end(); ++iter){
2041 if (FNFirst == TRUE){
2043 iter->second = cmbDisplayAs->GetValue();
2048 std::map<int,wxString>::iterator mapS;
2050 mapS = ContactEditorData.FullNamesListTokens.find(iter->first);
2052 ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue,
2053 &iter, &ContactEditorData.FullNamesList, &ContactData,
2054 wxT("ALTID"), &ContactEditorData.FullNamesListAltID,
2055 wxT("PID"), &ContactEditorData.FullNamesListPID,
2056 wxT("TYPE"), &ContactEditorData.FullNamesListType,
2057 wxT("LANGUAGE"), &ContactEditorData.FullNamesListLanguage,
2058 wxT("PREF"), &ContactEditorData.FullNamesListPref,
2059 wxT(""), &ContactEditorData.FullNamesListTokens );
2063 ResetSaveProcessData();
2067 //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
2069 // Insert revision (REV) date.
2071 // Get today's date and time.
2073 wxDateTime DateTimeNow = wxDateTime::Now();
2077 // Set year, month and date.
2079 int intYear = DateTimeNow.GetYear();
2080 int intMonth = DateTimeNow.GetMonth();
2081 int intDay = DateTimeNow.GetDay();
2083 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
2087 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
2091 DateRev.Append(wxString::Format(wxT("%i"), intMonth));
2097 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
2101 DateRev.Append(wxString::Format(wxT("%i"), intDay));
2105 //DateRev.Append(wx);
2106 //DateRev.Append(wx);
2107 //DateRev.Append(wx);
2108 DateRev.Append(wxT("T"));
2110 // Set hour, minute and second.
2112 int intHour = DateTimeNow.GetHour();
2113 int intMinute = DateTimeNow.GetMinute();
2114 int intSecond = DateTimeNow.GetSecond();
2118 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
2122 DateRev.Append(wxString::Format(wxT("%i"), intHour));
2126 if (intMinute < 10){
2128 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
2132 DateRev.Append(wxString::Format(wxT("%i"), intMinute));
2136 if (intSecond < 10){
2138 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
2142 DateRev.Append(wxString::Format(wxT("%i"), intSecond));
2146 // DateRev.Append(wx);
2147 // DateRev.Append(wx);
2148 // DateRev.Append(wxString DateTimeNow->);
2149 DateRev.Append(wxT("Z"));
2151 ContactData.Add(wxT("UID"), ContactEditorData.UIDToken, FALSE);
2153 // End the vCard File.
2155 ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
2158 ContactData.WriteFile(FilenameFinal);
2160 vCard34Conv ConvFileFun;
2164 ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
2166 wxString AccountDirPrefix;
2167 wxString AccountDir;
2170 #if defined(__HAIKU__)
2172 //preffilename = wxT("noo");
2174 #elif defined(__APPLE__)
2176 PrefDir = GetUserPrefDir();
2178 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2180 #elif defined(__WIN32__)
2182 PrefDir = GetUserPrefDir();
2184 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
2188 PrefDir = GetUserPrefDir();
2190 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2194 XABPreferences PrefData(PrefDir);
2196 wxString AccountType;
2198 for (int i = 0; i < PrefData.accounts.GetCount(); i++){
2200 AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
2202 if (AccountDir == wxSContactAccount){
2204 AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
2205 AccountDirPrefix.Trim();
2206 AccountType = PrefData.accounts.GetAccountType(i);
2213 wxString wxSplitFilename;
2214 wxString wxSDataURL;
2216 while(wSTFilename.HasMoreTokens()){
2218 wxSplitFilename = wSTFilename.GetNextToken();
2222 wxSDataURL = wxSplitFilename;
2223 //wxSDataURL.Append(wxSplitFilename);
2225 // Find out if the filename exists in the table.
2227 if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
2229 wxString ETagResult;
2230 wxString ETagOriginal;
2232 ETagDB *ETagDBPtr = NULL;
2234 ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
2236 wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
2237 wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
2239 if (wxSETagOrig.IsEmpty()){
2241 // Generate the ETag.
2243 wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2247 if (wxSETag.IsEmpty()){
2249 // Update empty ETag.
2251 wxSETag = wxSETagOrig;
2252 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
2257 // Don't change original ETag.
2259 wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2260 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
2264 if (EditMode == FALSE){
2266 ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2268 FMTimer.SetFilename(FilenameFinal);
2269 FMTimer.UpdateTimestamp();
2270 FMTimer.Start(10000, FALSE);
2272 wxCommandEvent reloadevent(RELOADCONTACTLIST);
2273 reloadevent.SetString(wxSContactAccount);
2274 wxPostEvent(this->GetParent(), reloadevent);
2279 ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2280 FMTimer.UpdateTimestamp();
2281 FMTimer.Start(10000, FALSE);
2287 // Send a notification to update the main window
2288 // with the new details.
2293 // TODO: Workout nickname settings by priority and
2296 ucd->ContactAccount = wxSContactAccount;
2297 ucd->ContactFilename = FilenameFinal;
2298 ucd->ContactName = cmbDisplayAs->GetValue();
2299 ucd->ContactNameArray = ContactData.GetName();
2301 for (std::map<int,wxString>::iterator gniter = ContactEditorData.GeneralNicknamesList.begin();
2302 gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){
2304 ucd->ContactNickname = gniter->second;
2309 wxCommandEvent event2(CE_UPDATECONTACTLIST);
2310 event2.SetClientData(ucd);
2311 wxPostEvent(MainPtr, event2);
2315 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
2318 // Save the updated contact data and close the form.
2320 wxCommandEvent NullEvent;
2321 this->SaveContact(NullEvent);