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 ResetSaveProcessData();
780 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralAddressList.begin();
781 iter != ContactEditorData.GeneralAddressList.end(); ++iter){
783 int intSeekValue = iter->first;
785 wxString strAddressString;
786 wxString strAddressFinalValue;
787 std::map<int, wxString>::iterator iterValue;
789 strAddressString.Append(wxT(";;"));
793 iterValue = ContactEditorData.GeneralAddressList.find(intSeekValue);
794 strAddressFinalValue = iterValue->second;
795 ProcessCaptureStrings(&strAddressFinalValue);
796 strAddressString.Append(strAddressFinalValue + wxT(";"));
797 strAddressFinalValue.Clear();
801 iterValue = ContactEditorData.GeneralAddressListTown.find(intSeekValue);
802 strAddressFinalValue = iterValue->second;
803 ProcessCaptureStrings(&strAddressFinalValue);
804 strAddressString.Append(strAddressFinalValue + wxT(";"));
805 strAddressFinalValue.Clear();
809 iterValue = ContactEditorData.GeneralAddressListCounty.find(intSeekValue);
810 strAddressFinalValue = iterValue->second;
811 ProcessCaptureStrings(&strAddressFinalValue);
812 strAddressString.Append(strAddressFinalValue + wxT(";"));
813 strAddressFinalValue.Clear();
817 iterValue = ContactEditorData.GeneralAddressListPostCode.find(intSeekValue);
818 strAddressFinalValue = iterValue->second;
819 ProcessCaptureStrings(&strAddressFinalValue);
820 strAddressString.Append(strAddressFinalValue + wxT(";"));
821 strAddressFinalValue.Clear();
825 iterValue = ContactEditorData.GeneralAddressListCountry.find(intSeekValue);
826 strAddressFinalValue = iterValue->second;
827 ProcessCaptureStrings(&strAddressFinalValue);
828 strAddressString.Append(strAddressFinalValue);
829 strAddressFinalValue.Clear();
831 ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
832 &iter, &strAddressString, &ContactData,
833 wxT("LABEL"), &ContactEditorData.GeneralAddressListLabel,
834 wxT("LANGUAGE"), &ContactEditorData.GeneralAddressListLang,
835 wxT("ALTID"), &ContactEditorData.GeneralAddressListAltID,
836 wxT("PID"), &ContactEditorData.GeneralAddressListPID,
837 wxT("GEO"), &ContactEditorData.GeneralAddressListGeo,
838 wxT("TZ"), &ContactEditorData.GeneralAddressListTimezone,
839 wxT("MEDIATYPE"), &ContactEditorData.GeneralAddressListMediatype,
840 wxT("PREF"), &ContactEditorData.GeneralAddressListPref,
841 wxT(""), &ContactEditorData.GeneralAddressListTokens );
843 ResetSaveProcessData();
847 ResetSaveProcessData();
849 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeAddressList.begin();
850 iter != ContactEditorData.HomeAddressList.end(); ++iter){
852 int intSeekValue = iter->first;
854 wxString strAddressString;
855 wxString strAddressFinalValue;
856 std::map<int, wxString>::iterator iterValue;
858 strAddressString.Append(wxT(";;"));
862 iterValue = ContactEditorData.HomeAddressList.find(intSeekValue);
863 strAddressFinalValue = iterValue->second;
864 ProcessCaptureStrings(&strAddressFinalValue);
865 strAddressString.Append(strAddressFinalValue + wxT(";"));
869 iterValue = ContactEditorData.HomeAddressListTown.find(intSeekValue);
870 strAddressFinalValue = iterValue->second;
871 ProcessCaptureStrings(&strAddressFinalValue);
872 strAddressString.Append(strAddressFinalValue + wxT(";"));
876 iterValue = ContactEditorData.HomeAddressListCounty.find(intSeekValue);
877 strAddressFinalValue = iterValue->second;
878 ProcessCaptureStrings(&strAddressFinalValue);
879 strAddressString.Append(strAddressFinalValue + wxT(";"));
883 iterValue = ContactEditorData.HomeAddressListPostCode.find(intSeekValue);
884 strAddressFinalValue = iterValue->second;
885 ProcessCaptureStrings(&strAddressFinalValue);
886 strAddressString.Append(strAddressFinalValue + wxT(";"));
890 iterValue = ContactEditorData.HomeAddressListCountry.find(intSeekValue);
891 strAddressFinalValue = iterValue->second;
892 ProcessCaptureStrings(&strAddressFinalValue);
893 strAddressString.Append(strAddressFinalValue);
895 ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
896 &iter, &strAddressString, &ContactData,
897 wxT("LABEL"), &ContactEditorData.HomeAddressListLabel,
898 wxT("LANGUAGE"), &ContactEditorData.HomeAddressListLang,
899 wxT("ALTID"), &ContactEditorData.HomeAddressListAltID,
900 wxT("PID"), &ContactEditorData.HomeAddressListPID,
901 wxT("GEO"), &ContactEditorData.HomeAddressListGeo,
902 wxT("TZ"), &ContactEditorData.HomeAddressListTimezone,
903 wxT("MEDIATYPE"), &ContactEditorData.HomeAddressListMediatype,
904 wxT("PREF"), &ContactEditorData.HomeAddressListPref,
905 wxT(""), &ContactEditorData.HomeAddressListTokens );
907 ResetSaveProcessData();
911 ResetSaveProcessData();
913 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessAddressList.begin();
914 iter != ContactEditorData.BusinessAddressList.end(); ++iter){
916 int intSeekValue = iter->first;
918 wxString strAddressString;
919 wxString strAddressFinalValue;
920 std::map<int, wxString>::iterator iterValue;
922 strAddressString.Append(wxT(";;"));
926 iterValue = ContactEditorData.BusinessAddressList.find(intSeekValue);
927 strAddressFinalValue = iterValue->second;
928 ProcessCaptureStrings(&strAddressFinalValue);
930 strAddressString.Append(strAddressFinalValue + wxT(";"));
934 iterValue = ContactEditorData.BusinessAddressListTown.find(intSeekValue);
935 strAddressFinalValue = iterValue->second;
936 ProcessCaptureStrings(&strAddressFinalValue);
938 strAddressString.Append(strAddressFinalValue + wxT(";"));
942 iterValue = ContactEditorData.BusinessAddressListCounty.find(intSeekValue);
943 strAddressFinalValue = iterValue->second;
944 ProcessCaptureStrings(&strAddressFinalValue);
946 strAddressString.Append(strAddressFinalValue + wxT(";"));
950 iterValue = ContactEditorData.BusinessAddressListPostCode.find(intSeekValue);
951 strAddressFinalValue = iterValue->second;
952 ProcessCaptureStrings(&strAddressFinalValue);
954 strAddressString.Append(strAddressFinalValue + wxT(";"));
958 iterValue = ContactEditorData.BusinessAddressListCountry.find(intSeekValue);
959 strAddressFinalValue = iterValue->second;
960 ProcessCaptureStrings(&strAddressFinalValue);
962 strAddressString.Append(strAddressFinalValue);
964 ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
965 &iter, &strAddressString, &ContactData,
966 wxT("LABEL"), &ContactEditorData.BusinessAddressListLabel,
967 wxT("LANGUAGE"), &ContactEditorData.BusinessAddressListLang,
968 wxT("ALTID"), &ContactEditorData.BusinessAddressListAltID,
969 wxT("PID"), &ContactEditorData.BusinessAddressListPID,
970 wxT("GEO"), &ContactEditorData.BusinessAddressListGeo,
971 wxT("TZ"), &ContactEditorData.BusinessAddressListTimezone,
972 wxT("MEDIATYPE"), &ContactEditorData.BusinessAddressListMediatype,
973 wxT("PREF"), &ContactEditorData.BusinessAddressListPref,
974 wxT(""), &ContactEditorData.BusinessAddressListTokens );
976 ResetSaveProcessData();
980 // Sort out nicknames (if any).
982 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNicknamesList.begin();
983 iter != ContactEditorData.GeneralNicknamesList.end(); ++iter){
985 intValue2 = iter->first;
987 // Process Alternative ID.
989 ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
990 &iter, &ContactEditorData.GeneralNicknamesList, &ContactData,
991 wxT("LANGUAGE"), &ContactEditorData.GeneralNicknamesListLanguage,
992 wxT("ALTID"), &ContactEditorData.GeneralNicknamesListAltID,
993 wxT("PID"), &ContactEditorData.GeneralNicknamesListPID,
994 wxT("PREF"), &ContactEditorData.GeneralNicknamesListPref,
995 wxT(""), &ContactEditorData.GeneralNicknamesListTokens );
997 ResetSaveProcessData();
1001 ResetSaveProcessData();
1003 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNicknamesList.begin();
1004 iter != ContactEditorData.HomeNicknamesList.end(); ++iter){
1006 ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1007 &iter, &ContactEditorData.HomeNicknamesList, &ContactData,
1008 wxT("LANGUAGE"), &ContactEditorData.HomeNicknamesListLanguage,
1009 wxT("ALTID"), &ContactEditorData.HomeNicknamesListAltID,
1010 wxT("PID"), &ContactEditorData.HomeNicknamesListPID,
1011 wxT("PREF"), &ContactEditorData.HomeNicknamesListPref,
1012 wxT(""), &ContactEditorData.HomeNicknamesListTokens );
1014 ResetSaveProcessData();
1018 ResetSaveProcessData();
1020 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNicknamesList.begin();
1021 iter != ContactEditorData.BusinessNicknamesList.end(); ++iter){
1023 ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1024 &iter, &ContactEditorData.BusinessNicknamesList, &ContactData,
1025 wxT("LANGUAGE"), &ContactEditorData.BusinessNicknamesListLanguage,
1026 wxT("ALTID"), &ContactEditorData.BusinessNicknamesListAltID,
1027 wxT("PID"), &ContactEditorData.BusinessNicknamesListPID,
1028 wxT("PREF"), &ContactEditorData.BusinessNicknamesListPref,
1029 wxT(""), &ContactEditorData.BusinessNicknamesListTokens );
1031 ResetSaveProcessData();
1035 ResetSaveProcessData();
1037 // Sort out email (general, home and business).
1039 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralEmailList.begin();
1040 iter != ContactEditorData.GeneralEmailList.end(); ++iter){
1042 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1045 wxString strAddressFinalValue;
1046 std::map<int, wxString>::iterator iterValue;
1048 ProcessSaveData(wxT("EMAIL"), &strValue2, &boolValue2, &boolValue,
1049 &iter, &ContactEditorData.GeneralEmailList, &ContactData,
1050 wxT("ALTID"), &ContactEditorData.GeneralEmailListAltID,
1051 wxT("PID"), &ContactEditorData.GeneralEmailListPID,
1052 wxT("PREF"), &ContactEditorData.GeneralEmailListPref,
1053 wxT(""), &ContactEditorData.GeneralEmailListTokens );
1055 ResetSaveProcessData();
1059 ResetSaveProcessData();
1061 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeEmailList.begin();
1062 iter != ContactEditorData.HomeEmailList.end(); ++iter){
1064 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1067 ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1068 &iter, &ContactEditorData.HomeEmailList, &ContactData,
1069 wxT("ALTID"), &ContactEditorData.HomeEmailListAltID,
1070 wxT("PID"), &ContactEditorData.HomeEmailListPID,
1071 wxT("PREF"), &ContactEditorData.HomeEmailListPref,
1072 wxT(""), &ContactEditorData.HomeEmailListTokens );
1074 ResetSaveProcessData();
1078 ResetSaveProcessData();
1080 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessEmailList.begin();
1081 iter != ContactEditorData.BusinessEmailList.end(); ++iter){
1083 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1086 ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1087 &iter, &ContactEditorData.BusinessEmailList, &ContactData,
1088 wxT("ALTID"), &ContactEditorData.BusinessEmailListAltID,
1089 wxT("PID"), &ContactEditorData.BusinessEmailListPID,
1090 wxT("PREF"), &ContactEditorData.BusinessEmailListPref,
1091 wxT(""), &ContactEditorData.BusinessEmailListTokens );
1093 ResetSaveProcessData();
1097 ResetSaveProcessData();
1099 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralIMList.begin();
1100 iter != ContactEditorData.GeneralIMList.end(); ++iter){
1102 intValue2 = iter->first;
1104 // Process Alternative ID.
1106 ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
1107 &iter, &ContactEditorData.GeneralIMList, &ContactData,
1108 wxT("ALTID"), &ContactEditorData.GeneralIMListAltID,
1109 wxT("PID"), &ContactEditorData.GeneralIMListPID,
1110 wxT("MEDIATYPE"), &ContactEditorData.GeneralIMListMediatype,
1111 wxT("PREF"), &ContactEditorData.GeneralIMListPref,
1112 wxT(""), &ContactEditorData.GeneralIMListTokens );
1114 ResetSaveProcessData();
1118 ResetSaveProcessData();
1120 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeIMList.begin();
1121 iter != ContactEditorData.HomeIMList.end(); ++iter){
1123 ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1124 &iter, &ContactEditorData.HomeIMList, &ContactData,
1125 wxT("ALTID"), &ContactEditorData.HomeIMListAltID,
1126 wxT("PID"), &ContactEditorData.HomeIMListPID,
1127 wxT("MEDIATYPE"), &ContactEditorData.HomeIMListMediatype,
1128 wxT("PREF"), &ContactEditorData.HomeIMListPref,
1129 wxT(""), &ContactEditorData.HomeIMListTokens );
1131 ResetSaveProcessData();
1135 ResetSaveProcessData();
1137 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessIMList.begin();
1138 iter != ContactEditorData.BusinessIMList.end(); ++iter){
1140 ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1141 &iter, &ContactEditorData.BusinessIMList, &ContactData,
1142 wxT("ALTID"), &ContactEditorData.BusinessIMListAltID,
1143 wxT("PID"), &ContactEditorData.BusinessIMListPID,
1144 wxT("MEDIATYPE"), &ContactEditorData.BusinessIMListMediatype,
1145 wxT("PREF"), &ContactEditorData.BusinessIMListPref,
1146 wxT(""), &ContactEditorData.BusinessIMListTokens );
1148 ResetSaveProcessData();
1152 ResetSaveProcessData();
1154 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTelephoneList.begin();
1155 iter != ContactEditorData.GeneralTelephoneList.end(); ++iter){
1157 wxString strAddressFinalValue = iter->second;
1158 int DataID = iter->first;
1160 ProcessCaptureStrings(&strAddressFinalValue);
1162 if (MapDataExists(&DataID, &ContactEditorData.GeneralTelephoneListDataType)){
1164 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralTelephoneListDataType.find(iter->first);
1166 strAddressFinalValue.insert(0, ":");
1167 strAddressFinalValue.insert(0, DataTypeIter->second);
1171 strAddressFinalValue.insert(0, "tel:");
1175 wxString strAddressTypeInfo;
1177 if (MapDataExists(&DataID, &ContactEditorData.GeneralTelephoneListTypeInfo)){
1179 strAddressTypeInfo = ContactEditorData.GeneralTelephoneListTypeInfo.find(iter->first)->second;
1183 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1184 &iter, &strAddressFinalValue, &ContactData,
1185 wxT("ALTID"), &ContactEditorData.GeneralTelephoneListAltID,
1186 wxT("PID"), &ContactEditorData.GeneralTelephoneListPID,
1187 wxT("TYPE"), &ContactEditorData.GeneralTelephoneListTypeInfo,
1188 wxT("PREF"), &ContactEditorData.GeneralTelephoneListPref,
1189 wxT(""), &ContactEditorData.GeneralTelephoneListTokens );
1191 ResetSaveProcessData();
1195 ResetSaveProcessData();
1197 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTelephoneList.begin();
1198 iter != ContactEditorData.HomeTelephoneList.end(); ++iter){
1200 wxString strAddressFinalValue = iter->second;
1202 ProcessCaptureStrings(&strAddressFinalValue);
1204 if (ContactEditorData.HomeTelephoneListDataType.find(iter->first) !=
1205 ContactEditorData.HomeTelephoneListDataType.end()){
1207 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeTelephoneListDataType.find(iter->first);
1209 strAddressFinalValue.insert(0, ":");
1210 strAddressFinalValue.insert(0, DataTypeIter->second);
1214 strAddressFinalValue.insert(0, "tel:");
1218 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1219 &iter, &strAddressFinalValue, &ContactData,
1220 wxT("ALTID"), &ContactEditorData.HomeTelephoneListAltID,
1221 wxT("PID"), &ContactEditorData.HomeTelephoneListPID,
1222 wxT("TYPE"), &ContactEditorData.HomeTelephoneListTypeInfo,
1223 wxT("PREF"), &ContactEditorData.HomeTelephoneListPref,
1224 wxT(""), &ContactEditorData.HomeTelephoneListTokens );
1226 ResetSaveProcessData();
1230 ResetSaveProcessData();
1232 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTelephoneList.begin();
1233 iter != ContactEditorData.BusinessTelephoneList.end(); ++iter){
1235 wxString strAddressFinalValue = iter->second;
1237 ProcessCaptureStrings(&strAddressFinalValue);
1239 if (ContactEditorData.BusinessTelephoneListDataType.find(iter->first) !=
1240 ContactEditorData.BusinessTelephoneListDataType.end()){
1242 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessTelephoneListDataType.find(iter->first);
1244 strAddressFinalValue.insert(0, ":");
1245 strAddressFinalValue.insert(0, DataTypeIter->second);
1249 strAddressFinalValue.insert(0, "tel:");
1253 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1254 &iter, &strAddressFinalValue, &ContactData,
1255 wxT("ALTID"), &ContactEditorData.BusinessTelephoneListAltID,
1256 wxT("PID"), &ContactEditorData.BusinessTelephoneListPID,
1257 wxT("TYPE"), &ContactEditorData.BusinessTelephoneListTypeInfo,
1258 wxT("PREF"), &ContactEditorData.BusinessTelephoneListPref,
1259 wxT(""), &ContactEditorData.BusinessTelephoneListTokens );
1261 ResetSaveProcessData();
1265 ResetSaveProcessData();
1267 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralLanguageList.begin();
1268 iter != ContactEditorData.GeneralLanguageList.end(); ++iter){
1270 intValue2 = iter->first;
1272 ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
1273 &iter, &ContactEditorData.GeneralLanguageList, &ContactData,
1274 wxT("ALTID"), &ContactEditorData.GeneralLanguageListAltID,
1275 wxT("PID"), &ContactEditorData.GeneralLanguageListPID,
1276 wxT("PREF"), &ContactEditorData.GeneralLanguageListPref,
1277 wxT(""), &ContactEditorData.GeneralLanguageListTokens );
1279 ResetSaveProcessData();
1283 ResetSaveProcessData();
1285 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeLanguageList.begin();
1286 iter != ContactEditorData.HomeLanguageList.end(); ++iter){
1288 ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1289 &iter, &ContactEditorData.HomeLanguageList, &ContactData,
1290 wxT("ALTID"), &ContactEditorData.HomeLanguageListAltID,
1291 wxT("PID"), &ContactEditorData.HomeLanguageListPID,
1292 wxT("PREF"), &ContactEditorData.HomeLanguageListPref,
1293 wxT(""), &ContactEditorData.HomeLanguageListTokens );
1295 ResetSaveProcessData();
1299 ResetSaveProcessData();
1301 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessLanguageList.begin();
1302 iter != ContactEditorData.BusinessLanguageList.end(); ++iter){
1304 ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1305 &iter, &ContactEditorData.BusinessLanguageList, &ContactData,
1306 wxT("ALTID"), &ContactEditorData.BusinessLanguageListAltID,
1307 wxT("PID"), &ContactEditorData.BusinessLanguageListPID,
1308 wxT("PREF"), &ContactEditorData.BusinessLanguageListPref,
1309 wxT(""), &ContactEditorData.BusinessLanguageListTokens );
1311 ResetSaveProcessData();
1315 ResetSaveProcessData();
1317 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTZList.begin();
1318 iter != ContactEditorData.GeneralTZList.end(); ++iter){
1320 ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
1321 &iter, &ContactEditorData.GeneralTZList, &ContactData,
1322 wxT("ALTID"), &ContactEditorData.GeneralTZListAltID,
1323 wxT("PID"), &ContactEditorData.GeneralTZListPID,
1324 wxT("MEDIATYPE"), &ContactEditorData.GeneralTZListMediatype,
1325 wxT("PREF"), &ContactEditorData.GeneralTZListPref,
1326 wxT(""), &ContactEditorData.GeneralTZListTokens );
1328 ResetSaveProcessData();
1332 ResetSaveProcessData();
1334 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTZList.begin();
1335 iter != ContactEditorData.HomeTZList.end(); ++iter){
1337 ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1338 &iter, &ContactEditorData.HomeTZList, &ContactData,
1339 wxT("ALTID"), &ContactEditorData.HomeTZListAltID,
1340 wxT("PID"), &ContactEditorData.HomeTZListPID,
1341 wxT("MEDIATYPE"), &ContactEditorData.HomeTZListMediatype,
1342 wxT("PREF"), &ContactEditorData.HomeTZListPref,
1343 wxT(""), &ContactEditorData.HomeTZListTokens );
1345 ResetSaveProcessData();
1349 ResetSaveProcessData();
1351 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTZList.begin();
1352 iter != ContactEditorData.BusinessTZList.end(); ++iter){
1354 ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1355 &iter, &ContactEditorData.BusinessTZList, &ContactData,
1356 wxT("ALTID"), &ContactEditorData.BusinessTZListAltID,
1357 wxT("PID"), &ContactEditorData.BusinessTZListPID,
1358 wxT("MEDIATYPE"), &ContactEditorData.BusinessTZListMediatype,
1359 wxT("PREF"), &ContactEditorData.BusinessTZListPref,
1360 wxT(""), &ContactEditorData.BusinessTZListTokens );
1362 ResetSaveProcessData();
1366 ResetSaveProcessData();
1368 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralGeographyList.begin();
1369 iter != ContactEditorData.GeneralGeographyList.end(); ++iter){
1371 wxString strGeoFinalValue = iter->second;
1373 ProcessCaptureStrings(&strGeoFinalValue);
1375 if (ContactEditorData.GeneralGeographyListDataType.find(iter->first) !=
1376 ContactEditorData.GeneralGeographyListDataType.end()){
1378 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralGeographyListDataType.find(iter->first);
1380 strGeoFinalValue.insert(0, ":");
1381 strGeoFinalValue.insert(0, DataTypeIter->second);
1385 strGeoFinalValue.insert(0, "geo:");
1389 ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
1390 &iter, &strGeoFinalValue, &ContactData,
1391 wxT("ALTID"), &ContactEditorData.GeneralGeographyListAltID,
1392 wxT("PID"), &ContactEditorData.GeneralGeographyListPID,
1393 wxT("MEDIATYPE"), &ContactEditorData.GeneralGeographyListMediatype,
1394 wxT("PREF"), &ContactEditorData.GeneralGeographyListPref,
1395 wxT(""), &ContactEditorData.GeneralGeographyListTokens );
1397 ResetSaveProcessData();
1401 ResetSaveProcessData();
1403 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeGeographyList.begin();
1404 iter != ContactEditorData.HomeGeographyList.end(); ++iter){
1406 wxString strGeoFinalValue = iter->second;
1408 ProcessCaptureStrings(&strGeoFinalValue);
1410 if (ContactEditorData.HomeGeographyListDataType.find(iter->first) !=
1411 ContactEditorData.HomeGeographyListDataType.end()){
1413 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeGeographyListDataType.find(iter->first);
1415 strGeoFinalValue.insert(0, ":");
1416 strGeoFinalValue.insert(0, DataTypeIter->second);
1420 strGeoFinalValue.insert(0, "geo:");
1424 ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1425 &iter, &strGeoFinalValue, &ContactData,
1426 wxT("ALTID"), &ContactEditorData.HomeGeographyListAltID,
1427 wxT("PID"), &ContactEditorData.HomeGeographyListPID,
1428 wxT("MEDIATYPE"), &ContactEditorData.HomeGeographyListMediatype,
1429 wxT("PREF"), &ContactEditorData.HomeGeographyListPref,
1430 wxT(""), &ContactEditorData.HomeGeographyListTokens );
1432 ResetSaveProcessData();
1436 ResetSaveProcessData();
1438 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessGeographyList.begin();
1439 iter != ContactEditorData.BusinessGeographyList.end(); ++iter){
1441 wxString strGeoFinalValue = iter->second;
1443 ProcessCaptureStrings(&strGeoFinalValue);
1445 if (ContactEditorData.BusinessGeographyListDataType.find(iter->first) !=
1446 ContactEditorData.BusinessGeographyListDataType.end()){
1448 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessGeographyListDataType.find(iter->first);
1450 strGeoFinalValue.insert(0, ":");
1451 strGeoFinalValue.insert(0, DataTypeIter->second);
1455 strGeoFinalValue.insert(0, "geo:");
1459 ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1460 &iter, &strGeoFinalValue, &ContactData,
1461 wxT("ALTID"), &ContactEditorData.BusinessGeographyListAltID,
1462 wxT("PID"), &ContactEditorData.BusinessGeographyListPID,
1463 wxT("MEDIATYPE"), &ContactEditorData.BusinessGeographyListMediatype,
1464 wxT("PREF"), &ContactEditorData.BusinessGeographyListPref,
1465 wxT(""), &ContactEditorData.BusinessGeographyListTokens );
1467 ResetSaveProcessData();
1471 ResetSaveProcessData();
1473 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRelatedList.begin();
1474 iter != ContactEditorData.GeneralRelatedList.end(); ++iter){
1476 ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
1477 &iter, &ContactEditorData.GeneralRelatedList, &ContactData,
1478 wxT("ALTID"), &ContactEditorData.GeneralRelatedListAltID,
1479 wxT("PID"), &ContactEditorData.GeneralRelatedListPID,
1480 wxT("LANGUAGE"), &ContactEditorData.GeneralRelatedListLanguage,
1481 wxT("TYPE"), &ContactEditorData.GeneralRelatedListRelType,
1482 wxT("PREF"), &ContactEditorData.GeneralRelatedListPref,
1483 wxT(""), &ContactEditorData.GeneralRelatedListTokens );
1485 ResetSaveProcessData();
1489 ResetSaveProcessData();
1491 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralWebsiteList.begin();
1492 iter != ContactEditorData.GeneralWebsiteList.end(); ++iter){
1494 ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
1495 &iter, &ContactEditorData.GeneralWebsiteList, &ContactData,
1496 wxT("ALTID"), &ContactEditorData.GeneralWebsiteListAltID,
1497 wxT("PID"), &ContactEditorData.GeneralWebsiteListPID,
1498 wxT("MEDIATYPE"), &ContactEditorData.GeneralWebsiteListMediatype,
1499 wxT("PREF"), &ContactEditorData.GeneralWebsiteListPref,
1500 wxT(""), &ContactEditorData.GeneralWebsiteListTokens );
1502 ResetSaveProcessData();
1506 ResetSaveProcessData();
1508 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeWebsiteList.begin();
1509 iter != ContactEditorData.HomeWebsiteList.end(); ++iter){
1511 ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1512 &iter, &ContactEditorData.HomeWebsiteList, &ContactData,
1513 wxT("ALTID"), &ContactEditorData.HomeWebsiteListAltID,
1514 wxT("PID"), &ContactEditorData.HomeWebsiteListPID,
1515 wxT("MEDIATYPE"), &ContactEditorData.HomeWebsiteListMediatype,
1516 wxT("PREF"), &ContactEditorData.HomeWebsiteListPref,
1517 wxT(""), &ContactEditorData.HomeWebsiteListTokens );
1519 ResetSaveProcessData();
1523 ResetSaveProcessData();
1525 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessWebsiteList.begin();
1526 iter != ContactEditorData.BusinessWebsiteList.end(); ++iter){
1528 ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1529 &iter, &ContactEditorData.BusinessWebsiteList, &ContactData,
1530 wxT("ALTID"), &ContactEditorData.BusinessWebsiteListAltID,
1531 wxT("PID"), &ContactEditorData.BusinessWebsiteListPID,
1532 wxT("MEDIATYPE"), &ContactEditorData.BusinessWebsiteListMediatype,
1533 wxT("PREF"), &ContactEditorData.BusinessWebsiteListPref,
1534 wxT(""), &ContactEditorData.BusinessWebsiteListTokens );
1536 ResetSaveProcessData();
1540 ResetSaveProcessData();
1542 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTitleList.begin();
1543 iter != ContactEditorData.GeneralTitleList.end(); ++iter){
1545 ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
1546 &iter, &ContactEditorData.GeneralTitleList, &ContactData,
1547 wxT("ALTID"), &ContactEditorData.GeneralTitleListAltID,
1548 wxT("PID"), &ContactEditorData.GeneralTitleListPID,
1549 wxT("LANGUAGE"), &ContactEditorData.GeneralTitleListLanguage,
1550 wxT("PREF"), &ContactEditorData.GeneralTitleListPref,
1551 wxT(""), &ContactEditorData.GeneralTitleListTokens );
1553 ResetSaveProcessData();
1557 ResetSaveProcessData();
1559 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTitleList.begin();
1560 iter != ContactEditorData.HomeTitleList.end(); ++iter){
1562 ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1563 &iter, &ContactEditorData.HomeTitleList, &ContactData,
1564 wxT("ALTID"), &ContactEditorData.HomeTitleListAltID,
1565 wxT("PID"), &ContactEditorData.HomeTitleListPID,
1566 wxT("LANGUAGE"), &ContactEditorData.HomeTitleListLanguage,
1567 wxT("PREF"), &ContactEditorData.HomeTitleListPref,
1568 wxT(""), &ContactEditorData.HomeTitleListTokens );
1570 ResetSaveProcessData();
1574 ResetSaveProcessData();
1576 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTitleList.begin();
1577 iter != ContactEditorData.BusinessTitleList.end(); ++iter){
1579 ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1580 &iter, &ContactEditorData.BusinessTitleList, &ContactData,
1581 wxT("ALTID"), &ContactEditorData.BusinessTitleListAltID,
1582 wxT("PID"), &ContactEditorData.BusinessTitleListPID,
1583 wxT("LANGUAGE"), &ContactEditorData.BusinessTitleListLanguage,
1584 wxT("PREF"), &ContactEditorData.BusinessTitleListPref,
1585 wxT(""), &ContactEditorData.BusinessTitleListTokens );
1587 ResetSaveProcessData();
1591 ResetSaveProcessData();
1593 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRoleList.begin();
1594 iter != ContactEditorData.GeneralRoleList.end(); ++iter){
1596 ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
1597 &iter, &ContactEditorData.GeneralRoleList, &ContactData,
1598 wxT("ALTID"), &ContactEditorData.GeneralRoleListAltID,
1599 wxT("PID"), &ContactEditorData.GeneralRoleListPID,
1600 wxT("LANGUAGE"), &ContactEditorData.GeneralRoleListLanguage,
1601 wxT("PREF"), &ContactEditorData.GeneralRoleListPref,
1602 wxT(""), &ContactEditorData.GeneralRoleListTokens );
1604 ResetSaveProcessData();
1608 ResetSaveProcessData();
1610 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeRoleList.begin();
1611 iter != ContactEditorData.HomeRoleList.end(); ++iter){
1613 ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1614 &iter, &ContactEditorData.HomeRoleList, &ContactData,
1615 wxT("ALTID"), &ContactEditorData.HomeRoleListAltID,
1616 wxT("PID"), &ContactEditorData.HomeRoleListPID,
1617 wxT("LANGUAGE"), &ContactEditorData.HomeRoleListLanguage,
1618 wxT("PREF"), &ContactEditorData.HomeRoleListPref,
1619 wxT(""), &ContactEditorData.HomeRoleListTokens );
1621 ResetSaveProcessData();
1625 ResetSaveProcessData();
1627 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessRoleList.begin();
1628 iter != ContactEditorData.BusinessRoleList.end(); ++iter){
1630 ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1631 &iter, &ContactEditorData.BusinessRoleList, &ContactData,
1632 wxT("ALTID"), &ContactEditorData.BusinessRoleListAltID,
1633 wxT("PID"), &ContactEditorData.BusinessRoleListPID,
1634 wxT("LANGUAGE"), &ContactEditorData.BusinessRoleListLanguage,
1635 wxT("PREF"), &ContactEditorData.BusinessRoleListPref,
1636 wxT(""), &ContactEditorData.BusinessRoleListTokens );
1638 ResetSaveProcessData();
1642 ResetSaveProcessData();
1644 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralOrganisationsList.begin();
1645 iter != ContactEditorData.GeneralOrganisationsList.end(); ++iter){
1647 ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
1648 &iter, &ContactEditorData.GeneralOrganisationsList, &ContactData,
1649 wxT("ALTID"), &ContactEditorData.GeneralOrganisationsListAltID,
1650 wxT("PID"), &ContactEditorData.GeneralOrganisationsListPID,
1651 wxT("LANGUAGE"), &ContactEditorData.GeneralOrganisationsListLanguage,
1652 wxT("SORT-AS"), &ContactEditorData.GeneralOrganisationsListSortAs,
1653 wxT("PREF"), &ContactEditorData.GeneralOrganisationsListPref,
1654 wxT(""), &ContactEditorData.GeneralOrganisationsListTokens );
1656 ResetSaveProcessData();
1660 ResetSaveProcessData();
1662 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeOrganisationsList.begin();
1663 iter != ContactEditorData.HomeOrganisationsList.end(); ++iter){
1665 ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1666 &iter, &ContactEditorData.HomeOrganisationsList, &ContactData,
1667 wxT("ALTID"), &ContactEditorData.HomeOrganisationsListAltID,
1668 wxT("PID"), &ContactEditorData.HomeOrganisationsListPID,
1669 wxT("LANGUAGE"), &ContactEditorData.HomeOrganisationsListLanguage,
1670 wxT("SORT-AS"), &ContactEditorData.HomeOrganisationsListSortAs,
1671 wxT("PREF"), &ContactEditorData.HomeOrganisationsListPref,
1672 wxT(""), &ContactEditorData.HomeOrganisationsListTokens );
1674 ResetSaveProcessData();
1678 ResetSaveProcessData();
1680 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessOrganisationsList.begin();
1681 iter != ContactEditorData.BusinessOrganisationsList.end(); ++iter){
1683 ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1684 &iter, &ContactEditorData.BusinessOrganisationsList, &ContactData,
1685 wxT("ALTID"), &ContactEditorData.BusinessOrganisationsListAltID,
1686 wxT("PID"), &ContactEditorData.BusinessOrganisationsListPID,
1687 wxT("LANGUAGE"), &ContactEditorData.BusinessOrganisationsListLanguage,
1688 wxT("SORT-AS"), &ContactEditorData.BusinessOrganisationsListSortAs,
1689 wxT("PREF"), &ContactEditorData.BusinessOrganisationsListPref,
1690 wxT(""), &ContactEditorData.BusinessOrganisationsListTokens );
1692 ResetSaveProcessData();
1696 ResetSaveProcessData();
1698 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNoteList.begin();
1699 iter != ContactEditorData.GeneralNoteList.end(); ++iter){
1701 ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
1702 &iter, &ContactEditorData.GeneralNoteList, &ContactData,
1703 wxT("ALTID"), &ContactEditorData.GeneralNoteListAltID,
1704 wxT("PID"), &ContactEditorData.GeneralNoteListPID,
1705 wxT("LANGUAGE"), &ContactEditorData.GeneralNoteListLanguage,
1706 wxT("PREF"), &ContactEditorData.GeneralNoteListPref,
1707 wxT(""), &ContactEditorData.GeneralNoteListTokens );
1709 ResetSaveProcessData();
1713 ResetSaveProcessData();
1715 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNoteList.begin();
1716 iter != ContactEditorData.HomeNoteList.end(); ++iter){
1718 ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1719 &iter, &ContactEditorData.HomeNoteList, &ContactData,
1720 wxT("ALTID"), &ContactEditorData.HomeNoteListAltID,
1721 wxT("PID"), &ContactEditorData.HomeNoteListPID,
1722 wxT("LANGUAGE"), &ContactEditorData.HomeNoteListLanguage,
1723 wxT("PREF"), &ContactEditorData.HomeNoteListPref,
1724 wxT(""), &ContactEditorData.HomeNoteListTokens );
1726 ResetSaveProcessData();
1730 ResetSaveProcessData();
1732 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNoteList.begin();
1733 iter != ContactEditorData.BusinessNoteList.end(); ++iter){
1735 ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1736 &iter, &ContactEditorData.BusinessNoteList, &ContactData,
1737 wxT("ALTID"), &ContactEditorData.BusinessNoteListAltID,
1738 wxT("PID"), &ContactEditorData.BusinessNoteListPID,
1739 wxT("LANGUAGE"), &ContactEditorData.BusinessNoteListLanguage,
1740 wxT("PREF"), &ContactEditorData.BusinessNoteListPref,
1741 wxT(""), &ContactEditorData.BusinessNoteListTokens );
1743 ResetSaveProcessData();
1747 ResetSaveProcessData();
1749 for (std::map<int,wxString>::iterator iter = ContactEditorData.CategoriesList.begin();
1750 iter != ContactEditorData.CategoriesList.end(); ++iter){
1752 ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
1753 &iter, &ContactEditorData.CategoriesList, &ContactData,
1754 wxT("ALTID"), &ContactEditorData.CategoriesListAltID,
1755 wxT("PID"), &ContactEditorData.CategoriesListPID,
1756 wxT("TYPE"), &ContactEditorData.CategoriesListType,
1757 wxT("PREF"), &ContactEditorData.CategoriesListPref,
1758 wxT(""), &ContactEditorData.CategoriesListTokens );
1760 ResetSaveProcessData();
1766 for (std::map<int, std::string>::iterator iter = ContactEditorData.PicturesList.begin();
1767 iter != ContactEditorData.PicturesList.end(); ++iter){
1769 int intValueIndex = iter->first;
1771 std::map<int, std::string>::iterator stdstriter;
1772 std::map<int, wxString>::iterator enciter;
1774 striter = ContactEditorData.PicturesListPictureType.find(intValueIndex);
1775 enciter = ContactEditorData.PicturesListPicEncType.find(intValueIndex);
1777 ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
1778 &iter, &ContactEditorData.PicturesList, &striter,
1779 &enciter, &ContactData,
1780 wxT("ALTID"), &ContactEditorData.PicturesListAltID,
1781 wxT("PID"), &ContactEditorData.PicturesListPID,
1782 wxT("TYPE"), &ContactEditorData.PicturesListType,
1783 wxT("PREF"), &ContactEditorData.PicturesListPref,
1784 wxT(""), &ContactEditorData.PicturesListTokens);
1786 ResetSaveProcessData();
1790 ResetSaveProcessData();
1794 for (std::map<int, std::string>::iterator iter = ContactEditorData.LogosList.begin();
1795 iter != ContactEditorData.LogosList.end(); ++iter){
1797 int intValueIndex = iter->first;
1799 std::map<int, std::string>::iterator stdstriter;
1800 std::map<int, wxString>::iterator enciter;
1802 striter = ContactEditorData.LogosListPictureType.find(intValueIndex);
1803 enciter = ContactEditorData.LogosListPicEncType.find(intValueIndex);
1805 ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
1806 &iter, &ContactEditorData.LogosList, &striter,
1807 &enciter, &ContactData,
1808 wxT("ALTID"), &ContactEditorData.LogosListAltID,
1809 wxT("PID"), &ContactEditorData.LogosListPID,
1810 wxT("TYPE"), &ContactEditorData.LogosListType,
1811 wxT("PREF"), &ContactEditorData.LogosListPref,
1812 wxT(""), &ContactEditorData.LogosListTokens );
1814 ResetSaveProcessData();
1818 ResetSaveProcessData();
1822 for (std::map<int, std::string>::iterator iter = ContactEditorData.SoundsList.begin();
1823 iter != ContactEditorData.SoundsList.end(); ++iter){
1825 int intValueIndex = iter->first;
1827 std::map<int, std::string>::iterator stdstriter;
1828 std::map<int, wxString>::iterator enciter;
1830 striter = ContactEditorData.SoundsListAudioType.find(intValueIndex);
1831 enciter = ContactEditorData.SoundsListAudioEncType.find(intValueIndex);
1833 ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
1834 &iter, &ContactEditorData.SoundsList, &striter,
1835 &enciter, &ContactData,
1836 wxT("ALTID"), &ContactEditorData.SoundsListAltID,
1837 wxT("PID"), &ContactEditorData.SoundsListPID,
1838 wxT("TYPE"), &ContactEditorData.SoundsListType,
1839 wxT("PREF"), &ContactEditorData.SoundsListPref,
1840 wxT(""), &ContactEditorData.SoundsListTokens );
1842 ResetSaveProcessData();
1846 ResetSaveProcessData();
1848 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarList.begin();
1849 iter != ContactEditorData.CalendarList.end(); ++iter){
1851 ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
1852 &iter, &ContactEditorData.CalendarList, &ContactData,
1853 wxT("ALTID"), &ContactEditorData.CalendarListAltID,
1854 wxT("PID"), &ContactEditorData.CalendarListPID,
1855 wxT("MEDIATYPE"), &ContactEditorData.CalendarListMediatype,
1856 wxT("TYPE"), &ContactEditorData.CalendarListType,
1857 wxT("PREF"), &ContactEditorData.CalendarListPref,
1858 wxT(""), &ContactEditorData.CalendarListTokens );
1860 ResetSaveProcessData();
1864 ResetSaveProcessData();
1866 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarRequestList.begin();
1867 iter != ContactEditorData.CalendarRequestList.end(); ++iter){
1869 ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
1870 &iter, &ContactEditorData.CalendarRequestList, &ContactData,
1871 wxT("ALTID"), &ContactEditorData.CalendarRequestListAltID,
1872 wxT("PID"), &ContactEditorData.CalendarRequestListPID,
1873 wxT("MEDIATYPE"), &ContactEditorData.CalendarRequestListMediatype,
1874 wxT("TYPE"), &ContactEditorData.CalendarRequestListType,
1875 wxT("PREF"), &ContactEditorData.CalendarRequestListPref,
1876 wxT(""), &ContactEditorData.CalendarRequestListTokens );
1878 ResetSaveProcessData();
1882 ResetSaveProcessData();
1884 for (std::map<int,wxString>::iterator iter = ContactEditorData.FreeBusyList.begin();
1885 iter != ContactEditorData.FreeBusyList.end(); ++iter){
1887 ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
1888 &iter, &ContactEditorData.FreeBusyList, &ContactData,
1889 wxT("ALTID"), &ContactEditorData.FreeBusyListAltID,
1890 wxT("PID"), &ContactEditorData.FreeBusyListPID,
1891 wxT("MEDIATYPE"), &ContactEditorData.FreeBusyListMediatype,
1892 wxT("TYPE"), &ContactEditorData.FreeBusyListType,
1893 wxT("PREF"), &ContactEditorData.FreeBusyListPref,
1894 wxT(""), &ContactEditorData.FreeBusyListTokens );
1896 ResetSaveProcessData();
1900 for (std::map<int, wxString>::iterator iter = ContactEditorData.KeyList.begin();
1901 iter != ContactEditorData.KeyList.end(); ++iter){
1903 intValue2 = iter->first;
1905 // Get the key information.
1907 std::map<int, wxString>::iterator enciter;
1909 striter = ContactEditorData.KeyListDataType.find(intValue2);
1910 //enciter = KeyListAudioEncType.find(intValue2);
1912 wxString strValueData;
1914 strValueData = iter->second;
1915 strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));
1917 ProcessSaveData(wxT("KEY"), &strValue2, &boolValue2, &boolValue,
1918 &iter, &strValueData, &ContactData,
1919 wxT("ALTID"), &ContactEditorData.KeyListAltID,
1920 wxT("PID"), &ContactEditorData.KeyListPID,
1921 wxT("TYPE"), &ContactEditorData.KeyListType,
1922 wxT("PREF"), &ContactEditorData.KeyListPref,
1923 wxT(""), &ContactEditorData.KeyListTokens );
1925 ResetSaveProcessData();
1929 // Vendor specific items.
1931 ResetSaveProcessData();
1933 for (std::map<int,wxString>::iterator iter = ContactEditorData.VendorList.begin();
1934 iter != ContactEditorData.VendorList.end(); ++iter){
1936 intValue2 = iter->first;
1938 // Get the IANA PEN number.
1940 striter = ContactEditorData.VendorListPEN.find(intValue2);
1942 if (striter->first == intValue2){
1944 strValue2 = striter->second;
1948 // Get the element name.
1950 striter = ContactEditorData.VendorListElement.find(intValue2);
1952 if (striter->first == intValue2){
1954 strValue3 = striter->second;
1960 striter = ContactEditorData.VendorList.find(intValue2);
1962 if (striter->first == intValue2){
1964 strValue = striter->second;
1968 // Add to the vCard.
1970 if (boolValue == TRUE){
1972 ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
1976 ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
1980 ResetSaveProcessData();
1984 ResetSaveProcessData();
1988 for (std::map<int,wxString>::iterator iter = ContactEditorData.XTokenList.begin();
1989 iter != ContactEditorData.XTokenList.end(); ++iter){
1991 intValue2 = iter->first;
1993 // Get the element name.
1995 striter = ContactEditorData.XTokenListTokens.find(intValue2);
1997 if (striter->first == intValue2){
1999 strValue2 = striter->second;
2005 striter = ContactEditorData.XTokenList.find(intValue2);
2007 if (striter->first == intValue2){
2009 strValue = striter->second;
2013 // Add to the vCard.
2015 if (boolValue == TRUE){
2017 ContactData.AddRaw(wxT("X-") + strValue2, strValue);
2021 ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
2025 ResetSaveProcessData();
2029 ResetSaveProcessData();
2031 if (ContactEditorData.FullNamesList.size() == 0){
2033 wxString FullName = cmbDisplayAs->GetValue();
2034 ContactEditorData.FullNamesList.insert(std::make_pair(0, FullName));
2035 ContactEditorData.FullNamesListAltID.insert(std::make_pair(0, wxT("")));
2036 ContactEditorData.FullNamesListPID.insert(std::make_pair(0, wxT("")));
2037 ContactEditorData.FullNamesListType.insert(std::make_pair(0, wxT("")));
2038 ContactEditorData.FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
2039 ContactEditorData.FullNamesListPref.insert(std::make_pair(0, 0));
2040 ContactEditorData.FullNamesListTokens.insert(std::make_pair(0, wxT("")));
2045 for (std::map<int, wxString>::iterator iter = ContactEditorData.FullNamesList.begin();
2046 iter != ContactEditorData.FullNamesList.end(); ++iter){
2048 if (FNFirst == TRUE){
2050 iter->second = cmbDisplayAs->GetValue();
2055 std::map<int,wxString>::iterator mapS;
2057 mapS = ContactEditorData.FullNamesListTokens.find(iter->first);
2059 ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue,
2060 &iter, &ContactEditorData.FullNamesList, &ContactData,
2061 wxT("ALTID"), &ContactEditorData.FullNamesListAltID,
2062 wxT("PID"), &ContactEditorData.FullNamesListPID,
2063 wxT("TYPE"), &ContactEditorData.FullNamesListType,
2064 wxT("LANGUAGE"), &ContactEditorData.FullNamesListLanguage,
2065 wxT("PREF"), &ContactEditorData.FullNamesListPref,
2066 wxT(""), &ContactEditorData.FullNamesListTokens );
2070 ResetSaveProcessData();
2074 //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
2076 // Insert revision (REV) date.
2078 // Get today's date and time.
2080 wxDateTime DateTimeNow = wxDateTime::Now();
2084 // Set year, month and date.
2086 int intYear = DateTimeNow.GetYear();
2087 int intMonth = DateTimeNow.GetMonth();
2088 int intDay = DateTimeNow.GetDay();
2090 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
2094 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
2098 DateRev.Append(wxString::Format(wxT("%i"), intMonth));
2104 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
2108 DateRev.Append(wxString::Format(wxT("%i"), intDay));
2112 //DateRev.Append(wx);
2113 //DateRev.Append(wx);
2114 //DateRev.Append(wx);
2115 DateRev.Append(wxT("T"));
2117 // Set hour, minute and second.
2119 int intHour = DateTimeNow.GetHour();
2120 int intMinute = DateTimeNow.GetMinute();
2121 int intSecond = DateTimeNow.GetSecond();
2125 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
2129 DateRev.Append(wxString::Format(wxT("%i"), intHour));
2133 if (intMinute < 10){
2135 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
2139 DateRev.Append(wxString::Format(wxT("%i"), intMinute));
2143 if (intSecond < 10){
2145 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
2149 DateRev.Append(wxString::Format(wxT("%i"), intSecond));
2153 // DateRev.Append(wx);
2154 // DateRev.Append(wx);
2155 // DateRev.Append(wxString DateTimeNow->);
2156 DateRev.Append(wxT("Z"));
2158 ContactData.Add(wxT("UID"), ContactEditorData.UIDToken, FALSE);
2160 // End the vCard File.
2162 ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
2165 ContactData.WriteFile(FilenameFinal);
2167 vCard34Conv ConvFileFun;
2171 ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
2173 wxString AccountDirPrefix;
2174 wxString AccountDir;
2177 #if defined(__HAIKU__)
2179 //preffilename = wxT("noo");
2181 #elif defined(__APPLE__)
2183 PrefDir = GetUserPrefDir();
2185 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2187 #elif defined(__WIN32__)
2189 PrefDir = GetUserPrefDir();
2191 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
2195 PrefDir = GetUserPrefDir();
2197 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2201 XABPreferences PrefData(PrefDir);
2203 wxString AccountType;
2205 for (int i = 0; i < PrefData.accounts.GetCount(); i++){
2207 AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
2209 if (AccountDir == wxSContactAccount){
2211 AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
2212 AccountDirPrefix.Trim();
2213 AccountType = PrefData.accounts.GetAccountType(i);
2220 wxString wxSplitFilename;
2221 wxString wxSDataURL;
2223 while(wSTFilename.HasMoreTokens()){
2225 wxSplitFilename = wSTFilename.GetNextToken();
2229 wxSDataURL = wxSplitFilename;
2230 //wxSDataURL.Append(wxSplitFilename);
2232 // Find out if the filename exists in the table.
2234 if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
2236 wxString ETagResult;
2237 wxString ETagOriginal;
2239 ETagDB *ETagDBPtr = NULL;
2241 ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
2243 wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
2244 wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
2246 if (wxSETagOrig.IsEmpty()){
2248 // Generate the ETag.
2250 wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2254 if (wxSETag.IsEmpty()){
2256 // Update empty ETag.
2258 wxSETag = wxSETagOrig;
2259 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
2264 // Don't change original ETag.
2266 wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2267 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
2271 if (EditMode == FALSE){
2273 ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2275 FMTimer.SetFilename(FilenameFinal);
2276 FMTimer.UpdateTimestamp();
2277 FMTimer.Start(10000, FALSE);
2279 wxCommandEvent reloadevent(RELOADCONTACTLIST);
2280 reloadevent.SetString(wxSContactAccount);
2281 wxPostEvent(this->GetParent(), reloadevent);
2286 ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2287 FMTimer.UpdateTimestamp();
2288 FMTimer.Start(10000, FALSE);
2294 // Send a notification to update the main window
2295 // with the new details.
2300 // TODO: Workout nickname settings by priority and
2303 ucd->ContactAccount = wxSContactAccount;
2304 ucd->ContactFilename = FilenameFinal;
2305 ucd->ContactName = cmbDisplayAs->GetValue();
2306 ucd->ContactNameArray = ContactData.GetName();
2308 for (std::map<int,wxString>::iterator gniter = ContactEditorData.GeneralNicknamesList.begin();
2309 gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){
2311 ucd->ContactNickname = gniter->second;
2316 wxCommandEvent event2(CE_UPDATECONTACTLIST);
2317 event2.SetClientData(ucd);
2318 wxPostEvent(MainPtr, event2);
2322 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
2325 // Save the updated contact data and close the form.
2327 wxCommandEvent NullEvent;
2328 this->SaveContact(NullEvent);