1 // frmContactEditor-Save.cpp - frmContactEditor save contact subroutines.
3 // (c) 2012-2016 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "frmContactEditor.h"
21 #include "../version.h"
22 #include "../vcard/vcard.h"
23 #include "../vcard/vcard34conv.h"
24 #include "../common/textprocessing.h"
25 #include "../common/preferences.h"
26 #include "../common/uuid.h"
27 #include "../common/dirs.h"
29 void frmContactEditor::SaveContact( wxCommandEvent& event )
32 // Check if Display As combo box has a value in it.
33 // Do not go any further if there is no value.
35 wxString cmbDisplayAsValue = cmbDisplayAs->GetValue();
37 if (cmbDisplayAsValue.IsEmpty()){
39 wxMessageBox(_("Display As value cannot be left blank."), _("Display As value empty"), wxICON_ERROR);
44 // Save the updated contact data.
47 wxString FilenameFinal;
48 bool ReplaceContact = FALSE;
50 if (StartupEditMode == TRUE){
52 if (cmbType->GetCurrentSelection() == 1 ||
53 cmbType->GetCurrentSelection() == 3 ||
54 cmbType->GetCurrentSelection() == 4){
58 // Mark contact for replacing.
60 ReplaceContact = TRUE;
65 } else if (cmbType->GetCurrentSelection() == 2){
67 if (IsGroup == FALSE){
69 // Mark contact for replacing.
71 ReplaceContact = TRUE;
78 if (ReplaceContact == TRUE){
80 wxString wxDelSplitFilename;
81 wxString wxDelFinalFilename;
82 wxString wxSDelDataURL;
83 wxStringTokenizer wSTDelFilename(wxSContactFilename, wxT("/"));
85 while(wSTDelFilename.HasMoreTokens()){
87 wxDelSplitFilename = wSTDelFilename.GetNextToken();
91 wxSDelDataURL = wxDelSplitFilename;
93 // Delete the contact from the server as it will be useless in certain
94 // address book clients.
96 ActMgrPtr->AddTask(2, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDelDataURL, wxDelSplitFilename, wxSContactFilename, wxT(""));
98 // Clear the filename so the trigger to recreate the UID is done.
100 wxSContactFilename.Clear();
107 if (wxSContactFilename.IsEmpty()){
109 // Generate a random UUID.
111 ContactEditorData.UIDToken = GenerateUUID();
112 ContactEditorData.UIDToken = ContactEditorData.UIDToken.MakeUpper();
114 // Setup the filename.
116 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
118 #if defined(__HAIKU__)
120 #elif defined(__WIN32__)
122 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
123 FilenameFinal.Append(ContactEditorData.UIDToken);
124 FilenameFinal.Append(wxT(".vcf"));
125 wxSContactFilename = FilenameFinal;
129 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
130 FilenameFinal.Append(ContactEditorData.UIDToken);
131 FilenameFinal.Append(wxT(".vcf"));
132 wxSContactFilename = FilenameFinal;
138 if (ContactEditorData.UIDToken.IsEmpty()){
140 // UID Token is empty. (Shouldn't be).
141 // Generate a new UID Token.
143 ContactEditorData.UIDToken = GenerateUUID();
144 ContactEditorData.UIDToken = ContactEditorData.UIDToken.MakeUpper();
148 FilenameFinal = wxSContactFilename;
152 // Setup the data and write it into the account folder.
154 // Begin preperations to write the contact to a file.
157 std::map<int,int>::iterator intiter;
158 std::map<int,wxString>::iterator striter;
160 ContactData.Add(wxT("BEGIN"), wxT("VCARD"), FALSE);
161 ContactData.Add(wxT("VERSION"), wxT("4.0"), FALSE);
163 // Setup the version string.
165 strValue.Append(wxT("-//Xestia//Address Book Version "));
166 strValue.Append(wxT(XSDAB_VERSION));
167 strValue.Append(wxT("//KW"));
169 ContactData.Add(wxT("PRODID"), strValue, FALSE);
171 // Process the REV property.
173 wxDateTime DateTimeSave;
174 DateTimeSave = DateTimeSave.SetToCurrent();
175 wxString DateTimeSaveValue;
177 DateTimeSaveValue += wxString::Format("%04i", DateTimeSave.GetYear());
178 DateTimeSaveValue += wxString::Format("%02i", (DateTimeSave.GetMonth() + 1));
179 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetDay());
180 DateTimeSaveValue += "T";
181 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetHour());
182 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetMinute());
183 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetSecond());
185 if (!ContactEditorData.RevisionTokens.IsEmpty()){
187 ContactData.AddRaw("REV;" + ContactEditorData.RevisionTokens, DateTimeSaveValue);
191 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()){
274 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\""), strValue, FALSE);
278 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\";") + ContactEditorData.NameTokens, strValue, FALSE);
282 if (cmbType->GetCurrentSelection() == 1){
284 ContactData.AddRaw(wxT("KIND"), wxT("individual"));
286 } else if (cmbType->GetCurrentSelection() == 2){
288 ContactData.AddRaw(wxT("KIND"), wxT("group"));
290 // Go through each of the members and write them out.
292 for (std::map<int, wxString>::iterator itemiter = ContactEditorData.GroupsList.begin();
293 itemiter != ContactEditorData.GroupsList.end(); ++itemiter){
295 ContactData.Add(wxT("MEMBER:urn:uuid"), itemiter->second, FALSE);
299 } else if (cmbType->GetCurrentSelection() == 3){
301 ContactData.AddRaw(wxT("KIND"), wxT("org"));
303 } else if (cmbType->GetCurrentSelection() == 4){
305 ContactData.AddRaw(wxT("KIND"), wxT("location"));
310 // Setup the nicknames (General, Home & Business).
323 if (cmbGender->GetCurrentSelection() != 0){
325 switch(cmbGender->GetCurrentSelection()){
356 if (!txtGenderDescription->IsEmpty()){
358 strValue2 = txtGenderDescription->GetValue();
362 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
364 EscapeString(&strValue2, FALSE);
366 if (!ContactEditorData.GenderTokens.IsEmpty()){
368 if (!strValue2.IsEmpty()){
370 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue + wxT(";") + strValue2);
374 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue);
380 if (!strValue2.IsEmpty()){
382 ContactData.AddRaw(wxT("GENDER"), strValue + wxT(";") + strValue2);
386 ContactData.AddRaw(wxT("GENDER"), strValue);
394 ResetSaveProcessData();
396 // Build the values for the BDAY property.
400 if (!ContactEditorData.BirthdayAltID.IsEmpty()){
403 DataValue = ContactEditorData.BirthdayAltID;
405 EscapeString(&DataValue, FALSE);
407 strValue3.Append("ALTID=");
408 strValue3.Append(DataValue);
416 if (!ContactEditorData.BirthdayCalScale.IsEmpty()){
419 DataValue = ContactEditorData.BirthdayCalScale;
421 EscapeString(&DataValue, FALSE);
423 if (boolValue2 == TRUE){
425 strValue3.Append(";");
429 strValue3.Append("CALSCALE=");
430 strValue3.Append(DataValue);
438 if (!ContactEditorData.BirthdayTokens.IsEmpty()){
441 DataValue = ContactEditorData.BirthdayTokens;
443 EscapeString(&DataValue, FALSE);
445 if (boolValue2 == TRUE){
447 strValue3.Append(";");
451 strValue3.Append(DataValue);
455 // Write the BDAY property.
457 if (!txtBirthday->IsEmpty()){
459 if (!txtBirthday->GetValue().IsEmpty()){
461 strValue = txtBirthday->GetValue();
463 if (!strValue3.IsEmpty()){
465 ContactData.AddRaw("BDAY;VALUE=text;" + strValue3, strValue);
469 ContactData.AddRaw("BDAY;VALUE=text", strValue);
479 // Get Day, Month & Year.
481 wxDateTime BirthdayDate;
482 wxDateTime::Month BirthdayMonth;
485 wxString DataBeforeT;
487 wxString FinalBirthdayString;
488 bool ProcessDataAfterT = FALSE;
490 BirthdayDate = dapBirthday->GetValue();
492 if (BirthdayDate.IsValid()){
494 BirthdayDay = BirthdayDate.GetDay();
495 BirthdayMonth = BirthdayDate.GetMonth();
496 BirthdayYear = BirthdayDate.GetYear();
498 // Look for T and replace data before this.
500 wxStringTokenizer wSTDate(ContactEditorData.Birthday, wxT("T"));
502 while (wSTDate.HasMoreTokens()){
504 if (ProcessDataAfterT == FALSE){
506 DataBeforeT = wSTDate.GetNextToken();
507 ProcessDataAfterT = TRUE;
511 DataAfterT = wSTDate.GetNextToken();
518 // If there is not T then replace altogether.
520 wxString FinalBirthdayDay;
521 wxString FinalBirthdayMonth;
522 wxString FinalBirthdayYear;
524 if (BirthdayDay < 10){
526 FinalBirthdayDay = wxT("0") + wxString::Format(wxT("%i"), BirthdayDay);
530 FinalBirthdayDay = wxString::Format(wxT("%i"), BirthdayDay);
534 if (((int)BirthdayMonth + 1) < 10){
536 FinalBirthdayMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
540 FinalBirthdayMonth = wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
544 if (BirthdayYear == 0){
546 FinalBirthdayYear = wxT("--");
550 FinalBirthdayYear = wxString::Format(wxT("%i"), BirthdayYear);
554 if (!DataAfterT.IsEmpty()){
556 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay + wxT("T") + DataAfterT;
560 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay;
564 if (!FinalBirthdayString.IsEmpty() || !strValue3.IsEmpty()){
566 if (!strValue3.IsEmpty()){
568 EscapeString(&strValue2, FALSE);
569 EscapeString(&strValue, FALSE);
571 ContactData.AddRaw(wxT("BDAY;") + strValue3, FinalBirthdayString);
575 EscapeString(&strValue, FALSE);
577 ContactData.AddRaw(wxT("BDAY"), FinalBirthdayString);
587 ResetSaveProcessData();
589 // Build the values for the ANNIVERSARY property.
593 if (!ContactEditorData.AnniversaryAltID.IsEmpty()){
596 DataValue = ContactEditorData.AnniversaryAltID;
598 EscapeString(&DataValue, FALSE);
600 strValue3.Append("ALTID=");
601 strValue3.Append(DataValue);
609 if (!ContactEditorData.AnniversaryCalScale.IsEmpty()){
612 DataValue = ContactEditorData.AnniversaryCalScale;
614 EscapeString(&DataValue, FALSE);
616 if (boolValue2 == TRUE){
618 strValue3.Append(";");
622 strValue3.Append("CALSCALE=");
623 strValue3.Append(DataValue);
631 if (!ContactEditorData.AnniversaryTokens.IsEmpty()){
634 DataValue = ContactEditorData.AnniversaryTokens;
636 EscapeString(&DataValue, FALSE);
638 if (boolValue2 == TRUE){
640 strValue3.Append(";");
644 strValue3.Append(DataValue);
648 // Write the ANNIVERSARY property.
650 if (!txtAnniversary->IsEmpty()){
652 if (!txtAnniversary->GetValue().IsEmpty()){
654 strValue = txtAnniversary->GetValue();
656 if (!strValue3.IsEmpty()){
658 ContactData.AddRaw("ANNIVERSARY;VALUE=text;" + strValue3, strValue);
662 ContactData.AddRaw("ANNIVERSARY;VALUE=text", strValue);
670 // Look for T and replace data before this.
672 // Get Day, Month & Year.
674 wxDateTime AnniversaryDate;
675 wxDateTime::Month AnniversaryMonth;
678 wxString DataBeforeT;
680 wxString FinalAnniversaryString;
681 bool ProcessDataAfterT = FALSE;
683 AnniversaryDate = dapAnniversary->GetValue();
685 if (AnniversaryDate.IsValid()){
687 AnniversaryDay = AnniversaryDate.GetDay();
688 AnniversaryMonth = AnniversaryDate.GetMonth();
689 AnniversaryYear = AnniversaryDate.GetYear();
691 // Look for T and replace data before this.
693 wxStringTokenizer wSTDate(ContactEditorData.Anniversary, wxT("T"));
695 while (wSTDate.HasMoreTokens()){
697 if (ProcessDataAfterT == FALSE){
699 DataBeforeT = wSTDate.GetNextToken();
700 ProcessDataAfterT = TRUE;
704 DataAfterT = wSTDate.GetNextToken();
711 // If there is not T then replace altogether.
713 wxString FinalAnniversaryDay;
714 wxString FinalAnniversaryMonth;
715 wxString FinalAnniversaryYear;
717 if (AnniversaryDay < 10){
719 FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
723 FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
727 if (((int)AnniversaryMonth + 1) < 10){
729 FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
733 FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
737 if (AnniversaryYear == 0){
739 FinalAnniversaryYear = wxT("--");
743 FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
747 if (!DataAfterT.IsEmpty()){
749 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
753 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
757 if (!FinalAnniversaryString.IsEmpty() || !strValue3.IsEmpty()){
759 if (!strValue3.IsEmpty()){
761 EscapeString(&strValue2, FALSE);
762 EscapeString(&strValue, FALSE);
764 ContactData.AddRaw(wxT("ANNIVERSARY;") + strValue3, FinalAnniversaryString);
768 EscapeString(&strValue, FALSE);
770 ContactData.AddRaw(wxT("ANNIVERSARY"), FinalAnniversaryString);
780 // Setup the addresses (General, Home, Business).
782 ResetSaveProcessData();
784 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralAddressList.begin();
785 iter != ContactEditorData.GeneralAddressList.end(); ++iter){
787 int intSeekValue = iter->first;
789 wxString strAddressString;
790 wxString strAddressFinalValue;
791 std::map<int, wxString>::iterator iterValue;
793 strAddressString.Append(wxT(";;"));
797 iterValue = ContactEditorData.GeneralAddressList.find(intSeekValue);
798 strAddressFinalValue = iterValue->second;
799 ProcessCaptureStrings(&strAddressFinalValue);
800 strAddressString.Append(strAddressFinalValue + wxT(";"));
801 strAddressFinalValue.Clear();
805 iterValue = ContactEditorData.GeneralAddressListTown.find(intSeekValue);
806 strAddressFinalValue = iterValue->second;
807 ProcessCaptureStrings(&strAddressFinalValue);
808 strAddressString.Append(strAddressFinalValue + wxT(";"));
809 strAddressFinalValue.Clear();
813 iterValue = ContactEditorData.GeneralAddressListCounty.find(intSeekValue);
814 strAddressFinalValue = iterValue->second;
815 ProcessCaptureStrings(&strAddressFinalValue);
816 strAddressString.Append(strAddressFinalValue + wxT(";"));
817 strAddressFinalValue.Clear();
821 iterValue = ContactEditorData.GeneralAddressListPostCode.find(intSeekValue);
822 strAddressFinalValue = iterValue->second;
823 ProcessCaptureStrings(&strAddressFinalValue);
824 strAddressString.Append(strAddressFinalValue + wxT(";"));
825 strAddressFinalValue.Clear();
829 iterValue = ContactEditorData.GeneralAddressListCountry.find(intSeekValue);
830 strAddressFinalValue = iterValue->second;
831 ProcessCaptureStrings(&strAddressFinalValue);
832 strAddressString.Append(strAddressFinalValue);
833 strAddressFinalValue.Clear();
835 ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
836 &iter, &strAddressString, &ContactData,
837 wxT("LABEL"), &ContactEditorData.GeneralAddressListLabel,
838 wxT("LANGUAGE"), &ContactEditorData.GeneralAddressListLang,
839 wxT("ALTID"), &ContactEditorData.GeneralAddressListAltID,
840 wxT("PID"), &ContactEditorData.GeneralAddressListPID,
841 wxT("GEO"), &ContactEditorData.GeneralAddressListGeo,
842 wxT("TZ"), &ContactEditorData.GeneralAddressListTimezone,
843 wxT("MEDIATYPE"), &ContactEditorData.GeneralAddressListMediatype,
844 wxT("PREF"), &ContactEditorData.GeneralAddressListPref,
845 wxT(""), &ContactEditorData.GeneralAddressListTokens );
847 ResetSaveProcessData();
851 ResetSaveProcessData();
853 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeAddressList.begin();
854 iter != ContactEditorData.HomeAddressList.end(); ++iter){
856 int intSeekValue = iter->first;
858 wxString strAddressString;
859 wxString strAddressFinalValue;
860 std::map<int, wxString>::iterator iterValue;
862 strAddressString.Append(wxT(";;"));
866 iterValue = ContactEditorData.HomeAddressList.find(intSeekValue);
867 strAddressFinalValue = iterValue->second;
868 ProcessCaptureStrings(&strAddressFinalValue);
869 strAddressString.Append(strAddressFinalValue + wxT(";"));
873 iterValue = ContactEditorData.HomeAddressListTown.find(intSeekValue);
874 strAddressFinalValue = iterValue->second;
875 ProcessCaptureStrings(&strAddressFinalValue);
876 strAddressString.Append(strAddressFinalValue + wxT(";"));
880 iterValue = ContactEditorData.HomeAddressListCounty.find(intSeekValue);
881 strAddressFinalValue = iterValue->second;
882 ProcessCaptureStrings(&strAddressFinalValue);
883 strAddressString.Append(strAddressFinalValue + wxT(";"));
887 iterValue = ContactEditorData.HomeAddressListPostCode.find(intSeekValue);
888 strAddressFinalValue = iterValue->second;
889 ProcessCaptureStrings(&strAddressFinalValue);
890 strAddressString.Append(strAddressFinalValue + wxT(";"));
894 iterValue = ContactEditorData.HomeAddressListCountry.find(intSeekValue);
895 strAddressFinalValue = iterValue->second;
896 ProcessCaptureStrings(&strAddressFinalValue);
897 strAddressString.Append(strAddressFinalValue);
899 ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
900 &iter, &strAddressString, &ContactData,
901 wxT("LABEL"), &ContactEditorData.HomeAddressListLabel,
902 wxT("LANGUAGE"), &ContactEditorData.HomeAddressListLang,
903 wxT("ALTID"), &ContactEditorData.HomeAddressListAltID,
904 wxT("PID"), &ContactEditorData.HomeAddressListPID,
905 wxT("GEO"), &ContactEditorData.HomeAddressListGeo,
906 wxT("TZ"), &ContactEditorData.HomeAddressListTimezone,
907 wxT("MEDIATYPE"), &ContactEditorData.HomeAddressListMediatype,
908 wxT("PREF"), &ContactEditorData.HomeAddressListPref,
909 wxT(""), &ContactEditorData.HomeAddressListTokens );
911 ResetSaveProcessData();
915 ResetSaveProcessData();
917 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessAddressList.begin();
918 iter != ContactEditorData.BusinessAddressList.end(); ++iter){
920 int intSeekValue = iter->first;
922 wxString strAddressString;
923 wxString strAddressFinalValue;
924 std::map<int, wxString>::iterator iterValue;
926 strAddressString.Append(wxT(";;"));
930 iterValue = ContactEditorData.BusinessAddressList.find(intSeekValue);
931 strAddressFinalValue = iterValue->second;
932 ProcessCaptureStrings(&strAddressFinalValue);
934 strAddressString.Append(strAddressFinalValue + wxT(";"));
938 iterValue = ContactEditorData.BusinessAddressListTown.find(intSeekValue);
939 strAddressFinalValue = iterValue->second;
940 ProcessCaptureStrings(&strAddressFinalValue);
942 strAddressString.Append(strAddressFinalValue + wxT(";"));
946 iterValue = ContactEditorData.BusinessAddressListCounty.find(intSeekValue);
947 strAddressFinalValue = iterValue->second;
948 ProcessCaptureStrings(&strAddressFinalValue);
950 strAddressString.Append(strAddressFinalValue + wxT(";"));
954 iterValue = ContactEditorData.BusinessAddressListPostCode.find(intSeekValue);
955 strAddressFinalValue = iterValue->second;
956 ProcessCaptureStrings(&strAddressFinalValue);
958 strAddressString.Append(strAddressFinalValue + wxT(";"));
962 iterValue = ContactEditorData.BusinessAddressListCountry.find(intSeekValue);
963 strAddressFinalValue = iterValue->second;
964 ProcessCaptureStrings(&strAddressFinalValue);
966 strAddressString.Append(strAddressFinalValue);
968 ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
969 &iter, &strAddressString, &ContactData,
970 wxT("LABEL"), &ContactEditorData.BusinessAddressListLabel,
971 wxT("LANGUAGE"), &ContactEditorData.BusinessAddressListLang,
972 wxT("ALTID"), &ContactEditorData.BusinessAddressListAltID,
973 wxT("PID"), &ContactEditorData.BusinessAddressListPID,
974 wxT("GEO"), &ContactEditorData.BusinessAddressListGeo,
975 wxT("TZ"), &ContactEditorData.BusinessAddressListTimezone,
976 wxT("MEDIATYPE"), &ContactEditorData.BusinessAddressListMediatype,
977 wxT("PREF"), &ContactEditorData.BusinessAddressListPref,
978 wxT(""), &ContactEditorData.BusinessAddressListTokens );
980 ResetSaveProcessData();
984 // Sort out nicknames (if any).
986 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNicknamesList.begin();
987 iter != ContactEditorData.GeneralNicknamesList.end(); ++iter){
989 intValue2 = iter->first;
991 // Process Alternative ID.
993 ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
994 &iter, &ContactEditorData.GeneralNicknamesList, &ContactData,
995 wxT("LANGUAGE"), &ContactEditorData.GeneralNicknamesListLanguage,
996 wxT("ALTID"), &ContactEditorData.GeneralNicknamesListAltID,
997 wxT("PID"), &ContactEditorData.GeneralNicknamesListPID,
998 wxT("PREF"), &ContactEditorData.GeneralNicknamesListPref,
999 wxT(""), &ContactEditorData.GeneralNicknamesListTokens );
1001 ResetSaveProcessData();
1005 ResetSaveProcessData();
1007 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNicknamesList.begin();
1008 iter != ContactEditorData.HomeNicknamesList.end(); ++iter){
1010 ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1011 &iter, &ContactEditorData.HomeNicknamesList, &ContactData,
1012 wxT("LANGUAGE"), &ContactEditorData.HomeNicknamesListLanguage,
1013 wxT("ALTID"), &ContactEditorData.HomeNicknamesListAltID,
1014 wxT("PID"), &ContactEditorData.HomeNicknamesListPID,
1015 wxT("PREF"), &ContactEditorData.HomeNicknamesListPref,
1016 wxT(""), &ContactEditorData.HomeNicknamesListTokens );
1018 ResetSaveProcessData();
1022 ResetSaveProcessData();
1024 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNicknamesList.begin();
1025 iter != ContactEditorData.BusinessNicknamesList.end(); ++iter){
1027 ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1028 &iter, &ContactEditorData.BusinessNicknamesList, &ContactData,
1029 wxT("LANGUAGE"), &ContactEditorData.BusinessNicknamesListLanguage,
1030 wxT("ALTID"), &ContactEditorData.BusinessNicknamesListAltID,
1031 wxT("PID"), &ContactEditorData.BusinessNicknamesListPID,
1032 wxT("PREF"), &ContactEditorData.BusinessNicknamesListPref,
1033 wxT(""), &ContactEditorData.BusinessNicknamesListTokens );
1035 ResetSaveProcessData();
1039 ResetSaveProcessData();
1041 // Sort out email (general, home and business).
1043 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralEmailList.begin();
1044 iter != ContactEditorData.GeneralEmailList.end(); ++iter){
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 ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1066 &iter, &ContactEditorData.HomeEmailList, &ContactData,
1067 wxT("ALTID"), &ContactEditorData.HomeEmailListAltID,
1068 wxT("PID"), &ContactEditorData.HomeEmailListPID,
1069 wxT("PREF"), &ContactEditorData.HomeEmailListPref,
1070 wxT(""), &ContactEditorData.HomeEmailListTokens );
1072 ResetSaveProcessData();
1076 ResetSaveProcessData();
1078 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessEmailList.begin();
1079 iter != ContactEditorData.BusinessEmailList.end(); ++iter){
1081 ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1082 &iter, &ContactEditorData.BusinessEmailList, &ContactData,
1083 wxT("ALTID"), &ContactEditorData.BusinessEmailListAltID,
1084 wxT("PID"), &ContactEditorData.BusinessEmailListPID,
1085 wxT("PREF"), &ContactEditorData.BusinessEmailListPref,
1086 wxT(""), &ContactEditorData.BusinessEmailListTokens );
1088 ResetSaveProcessData();
1092 ResetSaveProcessData();
1094 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralIMList.begin();
1095 iter != ContactEditorData.GeneralIMList.end(); ++iter){
1097 intValue2 = iter->first;
1099 wxString strIMFinalValue = iter->second;
1101 ProcessCaptureStrings(&strIMFinalValue);
1103 if (ContactEditorData.GeneralIMListTypeInfo.find(iter->first) !=
1104 ContactEditorData.GeneralIMListTypeInfo.end()){
1106 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralIMListTypeInfo.find(iter->first);
1108 strIMFinalValue.insert(0, ":");
1109 strIMFinalValue.insert(0, DataTypeIter->second);
1113 strIMFinalValue.insert(0, "none:");
1117 // Process Alternative ID.
1119 ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
1120 &iter, &strIMFinalValue, &ContactData,
1121 wxT("ALTID"), &ContactEditorData.GeneralIMListAltID,
1122 wxT("PID"), &ContactEditorData.GeneralIMListPID,
1123 wxT("MEDIATYPE"), &ContactEditorData.GeneralIMListMediatype,
1124 wxT("PREF"), &ContactEditorData.GeneralIMListPref,
1125 wxT(""), &ContactEditorData.GeneralIMListTokens );
1127 ResetSaveProcessData();
1131 ResetSaveProcessData();
1133 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeIMList.begin();
1134 iter != ContactEditorData.HomeIMList.end(); ++iter){
1136 wxString strIMFinalValue = iter->second;
1138 ProcessCaptureStrings(&strIMFinalValue);
1140 if (ContactEditorData.HomeIMListTypeInfo.find(iter->first) !=
1141 ContactEditorData.HomeIMListTypeInfo.end()){
1143 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeIMListTypeInfo.find(iter->first);
1145 strIMFinalValue.insert(0, ":");
1146 strIMFinalValue.insert(0, DataTypeIter->second);
1150 strIMFinalValue.insert(0, "none:");
1154 ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1155 &iter, &ContactEditorData.HomeIMList, &ContactData,
1156 wxT("ALTID"), &ContactEditorData.HomeIMListAltID,
1157 wxT("PID"), &ContactEditorData.HomeIMListPID,
1158 wxT("MEDIATYPE"), &ContactEditorData.HomeIMListMediatype,
1159 wxT("PREF"), &ContactEditorData.HomeIMListPref,
1160 wxT(""), &ContactEditorData.HomeIMListTokens );
1162 ResetSaveProcessData();
1166 ResetSaveProcessData();
1168 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessIMList.begin();
1169 iter != ContactEditorData.BusinessIMList.end(); ++iter){
1171 wxString strIMFinalValue = iter->second;
1173 ProcessCaptureStrings(&strIMFinalValue);
1175 if (ContactEditorData.BusinessIMListTypeInfo.find(iter->first) !=
1176 ContactEditorData.BusinessIMListTypeInfo.end()){
1178 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessIMListTypeInfo.find(iter->first);
1180 strIMFinalValue.insert(0, ":");
1181 strIMFinalValue.insert(0, DataTypeIter->second);
1185 strIMFinalValue.insert(0, "none:");
1189 ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1190 &iter, &ContactEditorData.BusinessIMList, &ContactData,
1191 wxT("ALTID"), &ContactEditorData.BusinessIMListAltID,
1192 wxT("PID"), &ContactEditorData.BusinessIMListPID,
1193 wxT("MEDIATYPE"), &ContactEditorData.BusinessIMListMediatype,
1194 wxT("PREF"), &ContactEditorData.BusinessIMListPref,
1195 wxT(""), &ContactEditorData.BusinessIMListTokens );
1197 ResetSaveProcessData();
1201 ResetSaveProcessData();
1203 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTelephoneList.begin();
1204 iter != ContactEditorData.GeneralTelephoneList.end(); ++iter){
1206 wxString strAddressFinalValue = iter->second;
1207 int DataID = iter->first;
1209 ProcessCaptureStrings(&strAddressFinalValue);
1211 if (MapDataExists(&DataID, &ContactEditorData.GeneralTelephoneListDataType)){
1213 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralTelephoneListDataType.find(iter->first);
1215 strAddressFinalValue.insert(0, ":");
1216 strAddressFinalValue.insert(0, DataTypeIter->second);
1220 strAddressFinalValue.insert(0, "tel:");
1224 wxString strAddressTypeInfo;
1226 if (MapDataExists(&DataID, &ContactEditorData.GeneralTelephoneListTypeInfo)){
1228 strAddressTypeInfo = ContactEditorData.GeneralTelephoneListTypeInfo.find(iter->first)->second;
1232 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1233 &iter, &strAddressFinalValue, &ContactData,
1234 wxT("ALTID"), &ContactEditorData.GeneralTelephoneListAltID,
1235 wxT("PID"), &ContactEditorData.GeneralTelephoneListPID,
1236 wxT("TYPE"), &ContactEditorData.GeneralTelephoneListTypeInfo,
1237 wxT("PREF"), &ContactEditorData.GeneralTelephoneListPref,
1238 wxT(""), &ContactEditorData.GeneralTelephoneListTokens );
1240 ResetSaveProcessData();
1244 ResetSaveProcessData();
1246 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTelephoneList.begin();
1247 iter != ContactEditorData.HomeTelephoneList.end(); ++iter){
1249 wxString strAddressFinalValue = iter->second;
1251 ProcessCaptureStrings(&strAddressFinalValue);
1253 if (ContactEditorData.HomeTelephoneListDataType.find(iter->first) !=
1254 ContactEditorData.HomeTelephoneListDataType.end()){
1256 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeTelephoneListDataType.find(iter->first);
1258 strAddressFinalValue.insert(0, ":");
1259 strAddressFinalValue.insert(0, DataTypeIter->second);
1263 strAddressFinalValue.insert(0, "tel:");
1267 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1268 &iter, &strAddressFinalValue, &ContactData,
1269 wxT("ALTID"), &ContactEditorData.HomeTelephoneListAltID,
1270 wxT("PID"), &ContactEditorData.HomeTelephoneListPID,
1271 wxT("TYPE"), &ContactEditorData.HomeTelephoneListTypeInfo,
1272 wxT("PREF"), &ContactEditorData.HomeTelephoneListPref,
1273 wxT(""), &ContactEditorData.HomeTelephoneListTokens );
1275 ResetSaveProcessData();
1279 ResetSaveProcessData();
1281 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTelephoneList.begin();
1282 iter != ContactEditorData.BusinessTelephoneList.end(); ++iter){
1284 wxString strAddressFinalValue = iter->second;
1286 ProcessCaptureStrings(&strAddressFinalValue);
1288 if (ContactEditorData.BusinessTelephoneListDataType.find(iter->first) !=
1289 ContactEditorData.BusinessTelephoneListDataType.end()){
1291 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessTelephoneListDataType.find(iter->first);
1293 strAddressFinalValue.insert(0, ":");
1294 strAddressFinalValue.insert(0, DataTypeIter->second);
1298 strAddressFinalValue.insert(0, "tel:");
1302 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1303 &iter, &strAddressFinalValue, &ContactData,
1304 wxT("ALTID"), &ContactEditorData.BusinessTelephoneListAltID,
1305 wxT("PID"), &ContactEditorData.BusinessTelephoneListPID,
1306 wxT("TYPE"), &ContactEditorData.BusinessTelephoneListTypeInfo,
1307 wxT("PREF"), &ContactEditorData.BusinessTelephoneListPref,
1308 wxT(""), &ContactEditorData.BusinessTelephoneListTokens );
1310 ResetSaveProcessData();
1314 ResetSaveProcessData();
1316 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralLanguageList.begin();
1317 iter != ContactEditorData.GeneralLanguageList.end(); ++iter){
1319 intValue2 = iter->first;
1321 ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
1322 &iter, &ContactEditorData.GeneralLanguageList, &ContactData,
1323 wxT("ALTID"), &ContactEditorData.GeneralLanguageListAltID,
1324 wxT("PID"), &ContactEditorData.GeneralLanguageListPID,
1325 wxT("PREF"), &ContactEditorData.GeneralLanguageListPref,
1326 wxT(""), &ContactEditorData.GeneralLanguageListTokens );
1328 ResetSaveProcessData();
1332 ResetSaveProcessData();
1334 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeLanguageList.begin();
1335 iter != ContactEditorData.HomeLanguageList.end(); ++iter){
1337 ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1338 &iter, &ContactEditorData.HomeLanguageList, &ContactData,
1339 wxT("ALTID"), &ContactEditorData.HomeLanguageListAltID,
1340 wxT("PID"), &ContactEditorData.HomeLanguageListPID,
1341 wxT("PREF"), &ContactEditorData.HomeLanguageListPref,
1342 wxT(""), &ContactEditorData.HomeLanguageListTokens );
1344 ResetSaveProcessData();
1348 ResetSaveProcessData();
1350 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessLanguageList.begin();
1351 iter != ContactEditorData.BusinessLanguageList.end(); ++iter){
1353 ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1354 &iter, &ContactEditorData.BusinessLanguageList, &ContactData,
1355 wxT("ALTID"), &ContactEditorData.BusinessLanguageListAltID,
1356 wxT("PID"), &ContactEditorData.BusinessLanguageListPID,
1357 wxT("PREF"), &ContactEditorData.BusinessLanguageListPref,
1358 wxT(""), &ContactEditorData.BusinessLanguageListTokens );
1360 ResetSaveProcessData();
1364 ResetSaveProcessData();
1366 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTZList.begin();
1367 iter != ContactEditorData.GeneralTZList.end(); ++iter){
1369 ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
1370 &iter, &ContactEditorData.GeneralTZList, &ContactData,
1371 wxT("ALTID"), &ContactEditorData.GeneralTZListAltID,
1372 wxT("PID"), &ContactEditorData.GeneralTZListPID,
1373 wxT("MEDIATYPE"), &ContactEditorData.GeneralTZListMediatype,
1374 wxT("PREF"), &ContactEditorData.GeneralTZListPref,
1375 wxT(""), &ContactEditorData.GeneralTZListTokens );
1377 ResetSaveProcessData();
1381 ResetSaveProcessData();
1383 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTZList.begin();
1384 iter != ContactEditorData.HomeTZList.end(); ++iter){
1386 ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1387 &iter, &ContactEditorData.HomeTZList, &ContactData,
1388 wxT("ALTID"), &ContactEditorData.HomeTZListAltID,
1389 wxT("PID"), &ContactEditorData.HomeTZListPID,
1390 wxT("MEDIATYPE"), &ContactEditorData.HomeTZListMediatype,
1391 wxT("PREF"), &ContactEditorData.HomeTZListPref,
1392 wxT(""), &ContactEditorData.HomeTZListTokens );
1394 ResetSaveProcessData();
1398 ResetSaveProcessData();
1400 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTZList.begin();
1401 iter != ContactEditorData.BusinessTZList.end(); ++iter){
1403 ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1404 &iter, &ContactEditorData.BusinessTZList, &ContactData,
1405 wxT("ALTID"), &ContactEditorData.BusinessTZListAltID,
1406 wxT("PID"), &ContactEditorData.BusinessTZListPID,
1407 wxT("MEDIATYPE"), &ContactEditorData.BusinessTZListMediatype,
1408 wxT("PREF"), &ContactEditorData.BusinessTZListPref,
1409 wxT(""), &ContactEditorData.BusinessTZListTokens );
1411 ResetSaveProcessData();
1415 ResetSaveProcessData();
1417 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralGeographyList.begin();
1418 iter != ContactEditorData.GeneralGeographyList.end(); ++iter){
1420 wxString strGeoFinalValue = iter->second;
1422 ProcessCaptureStrings(&strGeoFinalValue);
1424 if (ContactEditorData.GeneralGeographyListDataType.find(iter->first) !=
1425 ContactEditorData.GeneralGeographyListDataType.end()){
1427 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralGeographyListDataType.find(iter->first);
1429 strGeoFinalValue.insert(0, ":");
1430 strGeoFinalValue.insert(0, DataTypeIter->second);
1434 strGeoFinalValue.insert(0, "geo:");
1438 ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
1439 &iter, &strGeoFinalValue, &ContactData,
1440 wxT("ALTID"), &ContactEditorData.GeneralGeographyListAltID,
1441 wxT("PID"), &ContactEditorData.GeneralGeographyListPID,
1442 wxT("MEDIATYPE"), &ContactEditorData.GeneralGeographyListMediatype,
1443 wxT("PREF"), &ContactEditorData.GeneralGeographyListPref,
1444 wxT(""), &ContactEditorData.GeneralGeographyListTokens );
1446 ResetSaveProcessData();
1450 ResetSaveProcessData();
1452 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeGeographyList.begin();
1453 iter != ContactEditorData.HomeGeographyList.end(); ++iter){
1455 wxString strGeoFinalValue = iter->second;
1457 ProcessCaptureStrings(&strGeoFinalValue);
1459 if (ContactEditorData.HomeGeographyListDataType.find(iter->first) !=
1460 ContactEditorData.HomeGeographyListDataType.end()){
1462 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeGeographyListDataType.find(iter->first);
1464 strGeoFinalValue.insert(0, ":");
1465 strGeoFinalValue.insert(0, DataTypeIter->second);
1469 strGeoFinalValue.insert(0, "geo:");
1473 ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1474 &iter, &strGeoFinalValue, &ContactData,
1475 wxT("ALTID"), &ContactEditorData.HomeGeographyListAltID,
1476 wxT("PID"), &ContactEditorData.HomeGeographyListPID,
1477 wxT("MEDIATYPE"), &ContactEditorData.HomeGeographyListMediatype,
1478 wxT("PREF"), &ContactEditorData.HomeGeographyListPref,
1479 wxT(""), &ContactEditorData.HomeGeographyListTokens );
1481 ResetSaveProcessData();
1485 ResetSaveProcessData();
1487 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessGeographyList.begin();
1488 iter != ContactEditorData.BusinessGeographyList.end(); ++iter){
1490 wxString strGeoFinalValue = iter->second;
1492 ProcessCaptureStrings(&strGeoFinalValue);
1494 if (ContactEditorData.BusinessGeographyListDataType.find(iter->first) !=
1495 ContactEditorData.BusinessGeographyListDataType.end()){
1497 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessGeographyListDataType.find(iter->first);
1499 strGeoFinalValue.insert(0, ":");
1500 strGeoFinalValue.insert(0, DataTypeIter->second);
1504 strGeoFinalValue.insert(0, "geo:");
1508 ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1509 &iter, &strGeoFinalValue, &ContactData,
1510 wxT("ALTID"), &ContactEditorData.BusinessGeographyListAltID,
1511 wxT("PID"), &ContactEditorData.BusinessGeographyListPID,
1512 wxT("MEDIATYPE"), &ContactEditorData.BusinessGeographyListMediatype,
1513 wxT("PREF"), &ContactEditorData.BusinessGeographyListPref,
1514 wxT(""), &ContactEditorData.BusinessGeographyListTokens );
1516 ResetSaveProcessData();
1520 ResetSaveProcessData();
1522 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRelatedList.begin();
1523 iter != ContactEditorData.GeneralRelatedList.end(); ++iter){
1525 ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
1526 &iter, &ContactEditorData.GeneralRelatedList, &ContactData,
1527 wxT("ALTID"), &ContactEditorData.GeneralRelatedListAltID,
1528 wxT("PID"), &ContactEditorData.GeneralRelatedListPID,
1529 wxT("LANGUAGE"), &ContactEditorData.GeneralRelatedListLanguage,
1530 wxT("TYPE"), &ContactEditorData.GeneralRelatedListRelType,
1531 wxT("PREF"), &ContactEditorData.GeneralRelatedListPref,
1532 wxT(""), &ContactEditorData.GeneralRelatedListTokens );
1534 ResetSaveProcessData();
1538 ResetSaveProcessData();
1540 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralWebsiteList.begin();
1541 iter != ContactEditorData.GeneralWebsiteList.end(); ++iter){
1543 ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
1544 &iter, &ContactEditorData.GeneralWebsiteList, &ContactData,
1545 wxT("ALTID"), &ContactEditorData.GeneralWebsiteListAltID,
1546 wxT("PID"), &ContactEditorData.GeneralWebsiteListPID,
1547 wxT("MEDIATYPE"), &ContactEditorData.GeneralWebsiteListMediatype,
1548 wxT("PREF"), &ContactEditorData.GeneralWebsiteListPref,
1549 wxT(""), &ContactEditorData.GeneralWebsiteListTokens );
1551 ResetSaveProcessData();
1555 ResetSaveProcessData();
1557 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeWebsiteList.begin();
1558 iter != ContactEditorData.HomeWebsiteList.end(); ++iter){
1560 ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1561 &iter, &ContactEditorData.HomeWebsiteList, &ContactData,
1562 wxT("ALTID"), &ContactEditorData.HomeWebsiteListAltID,
1563 wxT("PID"), &ContactEditorData.HomeWebsiteListPID,
1564 wxT("MEDIATYPE"), &ContactEditorData.HomeWebsiteListMediatype,
1565 wxT("PREF"), &ContactEditorData.HomeWebsiteListPref,
1566 wxT(""), &ContactEditorData.HomeWebsiteListTokens );
1568 ResetSaveProcessData();
1572 ResetSaveProcessData();
1574 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessWebsiteList.begin();
1575 iter != ContactEditorData.BusinessWebsiteList.end(); ++iter){
1577 ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1578 &iter, &ContactEditorData.BusinessWebsiteList, &ContactData,
1579 wxT("ALTID"), &ContactEditorData.BusinessWebsiteListAltID,
1580 wxT("PID"), &ContactEditorData.BusinessWebsiteListPID,
1581 wxT("MEDIATYPE"), &ContactEditorData.BusinessWebsiteListMediatype,
1582 wxT("PREF"), &ContactEditorData.BusinessWebsiteListPref,
1583 wxT(""), &ContactEditorData.BusinessWebsiteListTokens );
1585 ResetSaveProcessData();
1589 ResetSaveProcessData();
1591 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTitleList.begin();
1592 iter != ContactEditorData.GeneralTitleList.end(); ++iter){
1594 ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
1595 &iter, &ContactEditorData.GeneralTitleList, &ContactData,
1596 wxT("ALTID"), &ContactEditorData.GeneralTitleListAltID,
1597 wxT("PID"), &ContactEditorData.GeneralTitleListPID,
1598 wxT("LANGUAGE"), &ContactEditorData.GeneralTitleListLanguage,
1599 wxT("PREF"), &ContactEditorData.GeneralTitleListPref,
1600 wxT(""), &ContactEditorData.GeneralTitleListTokens );
1602 ResetSaveProcessData();
1606 ResetSaveProcessData();
1608 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTitleList.begin();
1609 iter != ContactEditorData.HomeTitleList.end(); ++iter){
1611 ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1612 &iter, &ContactEditorData.HomeTitleList, &ContactData,
1613 wxT("ALTID"), &ContactEditorData.HomeTitleListAltID,
1614 wxT("PID"), &ContactEditorData.HomeTitleListPID,
1615 wxT("LANGUAGE"), &ContactEditorData.HomeTitleListLanguage,
1616 wxT("PREF"), &ContactEditorData.HomeTitleListPref,
1617 wxT(""), &ContactEditorData.HomeTitleListTokens );
1619 ResetSaveProcessData();
1623 ResetSaveProcessData();
1625 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTitleList.begin();
1626 iter != ContactEditorData.BusinessTitleList.end(); ++iter){
1628 ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1629 &iter, &ContactEditorData.BusinessTitleList, &ContactData,
1630 wxT("ALTID"), &ContactEditorData.BusinessTitleListAltID,
1631 wxT("PID"), &ContactEditorData.BusinessTitleListPID,
1632 wxT("LANGUAGE"), &ContactEditorData.BusinessTitleListLanguage,
1633 wxT("PREF"), &ContactEditorData.BusinessTitleListPref,
1634 wxT(""), &ContactEditorData.BusinessTitleListTokens );
1636 ResetSaveProcessData();
1640 ResetSaveProcessData();
1642 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRoleList.begin();
1643 iter != ContactEditorData.GeneralRoleList.end(); ++iter){
1645 ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
1646 &iter, &ContactEditorData.GeneralRoleList, &ContactData,
1647 wxT("ALTID"), &ContactEditorData.GeneralRoleListAltID,
1648 wxT("PID"), &ContactEditorData.GeneralRoleListPID,
1649 wxT("LANGUAGE"), &ContactEditorData.GeneralRoleListLanguage,
1650 wxT("PREF"), &ContactEditorData.GeneralRoleListPref,
1651 wxT(""), &ContactEditorData.GeneralRoleListTokens );
1653 ResetSaveProcessData();
1657 ResetSaveProcessData();
1659 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeRoleList.begin();
1660 iter != ContactEditorData.HomeRoleList.end(); ++iter){
1662 ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1663 &iter, &ContactEditorData.HomeRoleList, &ContactData,
1664 wxT("ALTID"), &ContactEditorData.HomeRoleListAltID,
1665 wxT("PID"), &ContactEditorData.HomeRoleListPID,
1666 wxT("LANGUAGE"), &ContactEditorData.HomeRoleListLanguage,
1667 wxT("PREF"), &ContactEditorData.HomeRoleListPref,
1668 wxT(""), &ContactEditorData.HomeRoleListTokens );
1670 ResetSaveProcessData();
1674 ResetSaveProcessData();
1676 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessRoleList.begin();
1677 iter != ContactEditorData.BusinessRoleList.end(); ++iter){
1679 ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1680 &iter, &ContactEditorData.BusinessRoleList, &ContactData,
1681 wxT("ALTID"), &ContactEditorData.BusinessRoleListAltID,
1682 wxT("PID"), &ContactEditorData.BusinessRoleListPID,
1683 wxT("LANGUAGE"), &ContactEditorData.BusinessRoleListLanguage,
1684 wxT("PREF"), &ContactEditorData.BusinessRoleListPref,
1685 wxT(""), &ContactEditorData.BusinessRoleListTokens );
1687 ResetSaveProcessData();
1691 ResetSaveProcessData();
1693 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralOrganisationsList.begin();
1694 iter != ContactEditorData.GeneralOrganisationsList.end(); ++iter){
1696 ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
1697 &iter, &ContactEditorData.GeneralOrganisationsList, &ContactData,
1698 wxT("ALTID"), &ContactEditorData.GeneralOrganisationsListAltID,
1699 wxT("PID"), &ContactEditorData.GeneralOrganisationsListPID,
1700 wxT("LANGUAGE"), &ContactEditorData.GeneralOrganisationsListLanguage,
1701 wxT("SORT-AS"), &ContactEditorData.GeneralOrganisationsListSortAs,
1702 wxT("PREF"), &ContactEditorData.GeneralOrganisationsListPref,
1703 wxT(""), &ContactEditorData.GeneralOrganisationsListTokens );
1705 ResetSaveProcessData();
1709 ResetSaveProcessData();
1711 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeOrganisationsList.begin();
1712 iter != ContactEditorData.HomeOrganisationsList.end(); ++iter){
1714 ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1715 &iter, &ContactEditorData.HomeOrganisationsList, &ContactData,
1716 wxT("ALTID"), &ContactEditorData.HomeOrganisationsListAltID,
1717 wxT("PID"), &ContactEditorData.HomeOrganisationsListPID,
1718 wxT("LANGUAGE"), &ContactEditorData.HomeOrganisationsListLanguage,
1719 wxT("SORT-AS"), &ContactEditorData.HomeOrganisationsListSortAs,
1720 wxT("PREF"), &ContactEditorData.HomeOrganisationsListPref,
1721 wxT(""), &ContactEditorData.HomeOrganisationsListTokens );
1723 ResetSaveProcessData();
1727 ResetSaveProcessData();
1729 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessOrganisationsList.begin();
1730 iter != ContactEditorData.BusinessOrganisationsList.end(); ++iter){
1732 ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1733 &iter, &ContactEditorData.BusinessOrganisationsList, &ContactData,
1734 wxT("ALTID"), &ContactEditorData.BusinessOrganisationsListAltID,
1735 wxT("PID"), &ContactEditorData.BusinessOrganisationsListPID,
1736 wxT("LANGUAGE"), &ContactEditorData.BusinessOrganisationsListLanguage,
1737 wxT("SORT-AS"), &ContactEditorData.BusinessOrganisationsListSortAs,
1738 wxT("PREF"), &ContactEditorData.BusinessOrganisationsListPref,
1739 wxT(""), &ContactEditorData.BusinessOrganisationsListTokens );
1741 ResetSaveProcessData();
1745 ResetSaveProcessData();
1747 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNoteList.begin();
1748 iter != ContactEditorData.GeneralNoteList.end(); ++iter){
1750 ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
1751 &iter, &ContactEditorData.GeneralNoteList, &ContactData,
1752 wxT("ALTID"), &ContactEditorData.GeneralNoteListAltID,
1753 wxT("PID"), &ContactEditorData.GeneralNoteListPID,
1754 wxT("LANGUAGE"), &ContactEditorData.GeneralNoteListLanguage,
1755 wxT("PREF"), &ContactEditorData.GeneralNoteListPref,
1756 wxT(""), &ContactEditorData.GeneralNoteListTokens );
1758 ResetSaveProcessData();
1762 ResetSaveProcessData();
1764 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNoteList.begin();
1765 iter != ContactEditorData.HomeNoteList.end(); ++iter){
1767 ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1768 &iter, &ContactEditorData.HomeNoteList, &ContactData,
1769 wxT("ALTID"), &ContactEditorData.HomeNoteListAltID,
1770 wxT("PID"), &ContactEditorData.HomeNoteListPID,
1771 wxT("LANGUAGE"), &ContactEditorData.HomeNoteListLanguage,
1772 wxT("PREF"), &ContactEditorData.HomeNoteListPref,
1773 wxT(""), &ContactEditorData.HomeNoteListTokens );
1775 ResetSaveProcessData();
1779 ResetSaveProcessData();
1781 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNoteList.begin();
1782 iter != ContactEditorData.BusinessNoteList.end(); ++iter){
1784 ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1785 &iter, &ContactEditorData.BusinessNoteList, &ContactData,
1786 wxT("ALTID"), &ContactEditorData.BusinessNoteListAltID,
1787 wxT("PID"), &ContactEditorData.BusinessNoteListPID,
1788 wxT("LANGUAGE"), &ContactEditorData.BusinessNoteListLanguage,
1789 wxT("PREF"), &ContactEditorData.BusinessNoteListPref,
1790 wxT(""), &ContactEditorData.BusinessNoteListTokens );
1792 ResetSaveProcessData();
1796 ResetSaveProcessData();
1798 for (std::map<int,wxString>::iterator iter = ContactEditorData.CategoriesList.begin();
1799 iter != ContactEditorData.CategoriesList.end(); ++iter){
1801 ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
1802 &iter, &ContactEditorData.CategoriesList, &ContactData,
1803 wxT("ALTID"), &ContactEditorData.CategoriesListAltID,
1804 wxT("PID"), &ContactEditorData.CategoriesListPID,
1805 wxT("TYPE"), &ContactEditorData.CategoriesListType,
1806 wxT("PREF"), &ContactEditorData.CategoriesListPref,
1807 wxT(""), &ContactEditorData.CategoriesListTokens );
1809 ResetSaveProcessData();
1815 for (std::map<int, std::string>::iterator iter = ContactEditorData.PicturesList.begin();
1816 iter != ContactEditorData.PicturesList.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.PicturesListPictureType.find(intValueIndex);
1824 enciter = ContactEditorData.PicturesListPicEncType.find(intValueIndex);
1826 ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
1827 &iter, &ContactEditorData.PicturesList, &striter,
1828 &enciter, &ContactData,
1829 wxT("ALTID"), &ContactEditorData.PicturesListAltID,
1830 wxT("PID"), &ContactEditorData.PicturesListPID,
1831 wxT("TYPE"), &ContactEditorData.PicturesListType,
1832 wxT("PREF"), &ContactEditorData.PicturesListPref,
1833 wxT(""), &ContactEditorData.PicturesListTokens);
1835 ResetSaveProcessData();
1839 ResetSaveProcessData();
1843 for (std::map<int, std::string>::iterator iter = ContactEditorData.LogosList.begin();
1844 iter != ContactEditorData.LogosList.end(); ++iter){
1846 int intValueIndex = iter->first;
1848 std::map<int, std::string>::iterator stdstriter;
1849 std::map<int, wxString>::iterator enciter;
1851 striter = ContactEditorData.LogosListPictureType.find(intValueIndex);
1852 enciter = ContactEditorData.LogosListPicEncType.find(intValueIndex);
1854 ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
1855 &iter, &ContactEditorData.LogosList, &striter,
1856 &enciter, &ContactData,
1857 wxT("ALTID"), &ContactEditorData.LogosListAltID,
1858 wxT("PID"), &ContactEditorData.LogosListPID,
1859 wxT("TYPE"), &ContactEditorData.LogosListType,
1860 wxT("PREF"), &ContactEditorData.LogosListPref,
1861 wxT(""), &ContactEditorData.LogosListTokens );
1863 ResetSaveProcessData();
1867 ResetSaveProcessData();
1871 for (std::map<int, std::string>::iterator iter = ContactEditorData.SoundsList.begin();
1872 iter != ContactEditorData.SoundsList.end(); ++iter){
1874 int intValueIndex = iter->first;
1876 std::map<int, std::string>::iterator stdstriter;
1877 std::map<int, wxString>::iterator enciter;
1879 striter = ContactEditorData.SoundsListAudioType.find(intValueIndex);
1880 enciter = ContactEditorData.SoundsListAudioEncType.find(intValueIndex);
1882 ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
1883 &iter, &ContactEditorData.SoundsList, &striter,
1884 &enciter, &ContactData,
1885 wxT("ALTID"), &ContactEditorData.SoundsListAltID,
1886 wxT("PID"), &ContactEditorData.SoundsListPID,
1887 wxT("TYPE"), &ContactEditorData.SoundsListType,
1888 wxT("PREF"), &ContactEditorData.SoundsListPref,
1889 wxT(""), &ContactEditorData.SoundsListTokens );
1891 ResetSaveProcessData();
1895 ResetSaveProcessData();
1897 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarList.begin();
1898 iter != ContactEditorData.CalendarList.end(); ++iter){
1900 ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
1901 &iter, &ContactEditorData.CalendarList, &ContactData,
1902 wxT("ALTID"), &ContactEditorData.CalendarListAltID,
1903 wxT("PID"), &ContactEditorData.CalendarListPID,
1904 wxT("MEDIATYPE"), &ContactEditorData.CalendarListMediatype,
1905 wxT("TYPE"), &ContactEditorData.CalendarListType,
1906 wxT("PREF"), &ContactEditorData.CalendarListPref,
1907 wxT(""), &ContactEditorData.CalendarListTokens );
1909 ResetSaveProcessData();
1913 ResetSaveProcessData();
1915 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarRequestList.begin();
1916 iter != ContactEditorData.CalendarRequestList.end(); ++iter){
1918 ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
1919 &iter, &ContactEditorData.CalendarRequestList, &ContactData,
1920 wxT("ALTID"), &ContactEditorData.CalendarRequestListAltID,
1921 wxT("PID"), &ContactEditorData.CalendarRequestListPID,
1922 wxT("MEDIATYPE"), &ContactEditorData.CalendarRequestListMediatype,
1923 wxT("TYPE"), &ContactEditorData.CalendarRequestListType,
1924 wxT("PREF"), &ContactEditorData.CalendarRequestListPref,
1925 wxT(""), &ContactEditorData.CalendarRequestListTokens );
1927 ResetSaveProcessData();
1931 ResetSaveProcessData();
1933 for (std::map<int,wxString>::iterator iter = ContactEditorData.FreeBusyList.begin();
1934 iter != ContactEditorData.FreeBusyList.end(); ++iter){
1936 ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
1937 &iter, &ContactEditorData.FreeBusyList, &ContactData,
1938 wxT("ALTID"), &ContactEditorData.FreeBusyListAltID,
1939 wxT("PID"), &ContactEditorData.FreeBusyListPID,
1940 wxT("MEDIATYPE"), &ContactEditorData.FreeBusyListMediatype,
1941 wxT("TYPE"), &ContactEditorData.FreeBusyListType,
1942 wxT("PREF"), &ContactEditorData.FreeBusyListPref,
1943 wxT(""), &ContactEditorData.FreeBusyListTokens );
1945 ResetSaveProcessData();
1949 for (std::map<int, wxString>::iterator iter = ContactEditorData.KeyList.begin();
1950 iter != ContactEditorData.KeyList.end(); ++iter){
1952 intValue2 = iter->first;
1954 // Get the key information.
1956 std::map<int, wxString>::iterator enciter;
1958 striter = ContactEditorData.KeyListDataType.find(intValue2);
1960 wxString strValueData;
1962 strValueData = iter->second;
1963 strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));
1965 ProcessSaveData(wxT("KEY"), &strValue2, &boolValue2, &boolValue,
1966 &iter, &strValueData, &ContactData,
1967 wxT("ALTID"), &ContactEditorData.KeyListAltID,
1968 wxT("PID"), &ContactEditorData.KeyListPID,
1969 wxT("TYPE"), &ContactEditorData.KeyListType,
1970 wxT("PREF"), &ContactEditorData.KeyListPref,
1971 wxT(""), &ContactEditorData.KeyListTokens );
1973 ResetSaveProcessData();
1977 // Vendor specific items.
1979 ResetSaveProcessData();
1981 for (std::map<int,wxString>::iterator iter = ContactEditorData.VendorList.begin();
1982 iter != ContactEditorData.VendorList.end(); ++iter){
1984 intValue2 = iter->first;
1986 // Get the IANA PEN number.
1988 striter = ContactEditorData.VendorListPEN.find(intValue2);
1990 if (striter->first == intValue2){
1992 strValue2 = striter->second;
1996 // Get the element name.
1998 striter = ContactEditorData.VendorListElement.find(intValue2);
2000 if (striter->first == intValue2){
2002 strValue3 = striter->second;
2008 striter = ContactEditorData.VendorList.find(intValue2);
2010 if (striter->first == intValue2){
2012 strValue = striter->second;
2016 // Add to the vCard.
2018 if (boolValue == TRUE){
2020 ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
2024 ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
2028 ResetSaveProcessData();
2032 ResetSaveProcessData();
2036 for (std::map<int,wxString>::iterator iter = ContactEditorData.XTokenList.begin();
2037 iter != ContactEditorData.XTokenList.end(); ++iter){
2039 intValue2 = iter->first;
2041 // Get the element name.
2043 striter = ContactEditorData.XTokenListTokens.find(intValue2);
2045 if (striter->first == intValue2){
2047 strValue2 = striter->second;
2053 striter = ContactEditorData.XTokenList.find(intValue2);
2055 if (striter->first == intValue2){
2057 strValue = striter->second;
2061 // Add to the vCard.
2063 if (boolValue == TRUE){
2065 ContactData.AddRaw(wxT("X-") + strValue2, strValue);
2069 ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
2073 ResetSaveProcessData();
2077 ResetSaveProcessData();
2079 if (ContactEditorData.FullNamesList.size() == 0){
2081 wxString FullName = cmbDisplayAs->GetValue();
2082 ContactEditorData.FullNamesList.insert(std::make_pair(0, FullName));
2083 ContactEditorData.FullNamesListAltID.insert(std::make_pair(0, wxT("")));
2084 ContactEditorData.FullNamesListPID.insert(std::make_pair(0, wxT("")));
2085 ContactEditorData.FullNamesListType.insert(std::make_pair(0, wxT("")));
2086 ContactEditorData.FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
2087 ContactEditorData.FullNamesListPref.insert(std::make_pair(0, 0));
2088 ContactEditorData.FullNamesListTokens.insert(std::make_pair(0, wxT("")));
2093 for (std::map<int, wxString>::iterator iter = ContactEditorData.FullNamesList.begin();
2094 iter != ContactEditorData.FullNamesList.end(); ++iter){
2096 if (FNFirst == TRUE){
2098 iter->second = cmbDisplayAs->GetValue();
2103 std::map<int,wxString>::iterator mapS;
2105 mapS = ContactEditorData.FullNamesListTokens.find(iter->first);
2107 ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue,
2108 &iter, &ContactEditorData.FullNamesList, &ContactData,
2109 wxT("ALTID"), &ContactEditorData.FullNamesListAltID,
2110 wxT("PID"), &ContactEditorData.FullNamesListPID,
2111 wxT("TYPE"), &ContactEditorData.FullNamesListType,
2112 wxT("LANGUAGE"), &ContactEditorData.FullNamesListLanguage,
2113 wxT("PREF"), &ContactEditorData.FullNamesListPref,
2114 wxT(""), &ContactEditorData.FullNamesListTokens );
2118 ResetSaveProcessData();
2122 // Insert revision (REV) date.
2124 // Get today's date and time.
2126 wxDateTime DateTimeNow = wxDateTime::Now();
2130 // Set year, month and date.
2132 int intYear = DateTimeNow.GetYear();
2133 int intMonth = DateTimeNow.GetMonth();
2134 int intDay = DateTimeNow.GetDay();
2136 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
2140 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
2144 DateRev.Append(wxString::Format(wxT("%i"), intMonth));
2150 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
2154 DateRev.Append(wxString::Format(wxT("%i"), intDay));
2158 DateRev.Append(wxT("T"));
2160 // Set hour, minute and second.
2162 int intHour = DateTimeNow.GetHour();
2163 int intMinute = DateTimeNow.GetMinute();
2164 int intSecond = DateTimeNow.GetSecond();
2168 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
2172 DateRev.Append(wxString::Format(wxT("%i"), intHour));
2176 if (intMinute < 10){
2178 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
2182 DateRev.Append(wxString::Format(wxT("%i"), intMinute));
2186 if (intSecond < 10){
2188 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
2192 DateRev.Append(wxString::Format(wxT("%i"), intSecond));
2196 DateRev.Append(wxT("Z"));
2198 ContactData.Add(wxT("UID"), ContactEditorData.UIDToken, FALSE);
2200 // End the vCard File.
2202 ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
2205 ContactData.WriteFile(FilenameFinal);
2207 vCard34Conv ConvFileFun;
2211 ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
2213 wxString AccountDirPrefix;
2214 wxString AccountDir;
2217 #if defined(__HAIKU__)
2219 #elif defined(__APPLE__)
2221 PrefDir = GetUserPrefDir();
2223 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2225 #elif defined(__WIN32__)
2227 PrefDir = GetUserPrefDir();
2229 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
2233 PrefDir = GetUserPrefDir();
2235 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2239 XABPreferences PrefData(PrefDir);
2241 wxString AccountType;
2243 for (int i = 0; i < PrefData.accounts.GetCount(); i++){
2245 AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
2247 if (AccountDir == wxSContactAccount){
2249 AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
2250 AccountDirPrefix.Trim();
2251 AccountType = PrefData.accounts.GetAccountType(i);
2258 wxString wxSplitFilename;
2259 wxString wxSDataURL;
2261 while(wSTFilename.HasMoreTokens()){
2263 wxSplitFilename = wSTFilename.GetNextToken();
2267 wxSDataURL = wxSplitFilename;
2269 // Find out if the filename exists in the table.
2271 if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
2273 wxString ETagResult;
2274 wxString ETagOriginal;
2276 ETagDB *ETagDBPtr = NULL;
2278 ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
2280 wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
2281 wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
2283 if (wxSETagOrig.IsEmpty()){
2285 // Generate the ETag.
2287 wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2291 if (wxSETag.IsEmpty()){
2293 // Update empty ETag.
2295 wxSETag = wxSETagOrig;
2296 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
2300 // Don't change original ETag.
2302 wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2303 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
2307 if (EditMode == FALSE){
2309 ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2311 FMTimer.SetFilename(FilenameFinal);
2312 FMTimer.UpdateTimestamp();
2313 FMTimer.Start(10000, FALSE);
2315 wxCommandEvent reloadevent(RELOADCONTACTLIST);
2316 reloadevent.SetString(wxSContactAccount);
2317 wxPostEvent(this->GetParent(), reloadevent);
2321 ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2322 FMTimer.UpdateTimestamp();
2323 FMTimer.Start(10000, FALSE);
2329 // Send a notification to update the main window
2330 // with the new details.
2335 // TODO: Workout nickname settings by priority and
2338 ucd->ContactAccount = wxSContactAccount;
2339 ucd->ContactFilename = FilenameFinal;
2340 ucd->ContactName = cmbDisplayAs->GetValue();
2341 ucd->ContactNameArray = ContactData.GetName();
2343 for (std::map<int,wxString>::iterator gniter = ContactEditorData.GeneralNicknamesList.begin();
2344 gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){
2346 ucd->ContactNickname = gniter->second;
2351 wxCommandEvent event2(CE_UPDATECONTACTLIST);
2352 event2.SetClientData(ucd);
2353 wxPostEvent(MainPtr, event2);
2357 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
2360 // Save the updated contact data and close the form.
2362 wxCommandEvent NullEvent;
2363 this->SaveContact(NullEvent);