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 std::map<int,int>::iterator intiter;
159 std::map<int,wxString>::iterator striter;
161 ContactData.Add(wxT("BEGIN"), wxT("VCARD"), FALSE);
162 ContactData.Add(wxT("VERSION"), wxT("4.0"), FALSE);
164 // Setup the version string.
166 strValue.Append(wxT("-//Xestia//Address Book Version "));
167 strValue.Append(wxT(XSDAB_VERSION));
168 strValue.Append(wxT("//KW"));
170 ContactData.Add(wxT("PRODID"), strValue, FALSE);
172 // Process the REV property.
174 wxDateTime DateTimeSave;
175 DateTimeSave = DateTimeSave.SetToCurrent();
176 wxString DateTimeSaveValue;
178 DateTimeSaveValue += wxString::Format("%04i", DateTimeSave.GetYear());
179 DateTimeSaveValue += wxString::Format("%02i", (DateTimeSave.GetMonth() + 1));
180 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetDay());
181 DateTimeSaveValue += "T";
182 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetHour());
183 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetMinute());
184 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetSecond());
186 if (!ContactEditorData.RevisionTokens.IsEmpty()){
187 ContactData.AddRaw("REV;" + ContactEditorData.RevisionTokens, DateTimeSaveValue);
189 ContactData.AddRaw("REV", DateTimeSaveValue);
191 // Process the XML properties.
193 for (std::map<int,wxString>::iterator iter = ContactEditorData.XMLList.begin();
194 iter != ContactEditorData.XMLList.end(); ++iter){
196 wxString strOrigValue;
198 strOrigValue = ContactEditorData.XMLList.find(iter->first)->second;
200 ResetUnusedString(&strOrigValue);
202 ProcessSaveData(wxT("XML"), &strValue2, &boolValue2, &boolValue,
203 &iter, &strOrigValue, &ContactData,
204 wxT("ALTID"), &ContactEditorData.XMLListAltID );
206 ResetSaveProcessData();
210 // Process the CLIENTPIDMAP properties.
212 for (std::map<int,wxString>::iterator iter = ContactEditorData.ClientPIDList.begin();
213 iter != ContactEditorData.ClientPIDList.end(); ++iter){
215 wxString strOrigValue;
217 strOrigValue = ContactEditorData.ClientPIDList.find(iter->first)->second;
219 ResetUnusedString(&strOrigValue);
221 ProcessSaveData(wxT("CLIENTPIDMAP"), &strValue2, &boolValue2, &boolValue,
222 &iter, &strOrigValue, &ContactData,
223 wxT(""), &ContactEditorData.ClientPIDListTokens );
225 ResetSaveProcessData();
229 // Process the SOURCE properties.
231 for (std::map<int,wxString>::iterator iter = ContactEditorData.SourceList.begin();
232 iter != ContactEditorData.SourceList.end(); ++iter){
234 wxString strOrigValue;
236 strOrigValue = ContactEditorData.SourceList.find(iter->first)->second;
238 ResetUnusedString(&strOrigValue);
240 ProcessSaveData(wxT("SOURCE"), &strValue2, &boolValue2, &boolValue,
241 &iter, &strOrigValue, &ContactData,
242 wxT("ALTID"), &ContactEditorData.SourceListAltID,
243 wxT("PID"), &ContactEditorData.SourceListPID,
244 wxT("TYPE"), &ContactEditorData.SourceListType,
245 wxT("PREF"), &ContactEditorData.SourceListPref,
246 wxT("MEDIATYPE"), &ContactEditorData.SourceListMediatype,
247 wxT(""), &ContactEditorData.SourceListTokens );
249 ResetSaveProcessData();
257 // Setup the name field.
259 strValue = txtSurname->GetValue() + wxT(";") +
260 txtForename->GetValue() + wxT(";") +
261 txtOtherNames->GetValue() + wxT(";") +
262 txtTitle->GetValue() + wxT(";") +
263 txtSuffix->GetValue();
265 strValue2 = ContactData.Convert(cmbDisplayAs->GetValue(), FALSE);
268 if (ContactEditorData.NameTokens.IsEmpty()){
269 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\""), strValue, FALSE);
271 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\";") + ContactEditorData.NameTokens, strValue, FALSE);
274 if (cmbType->GetCurrentSelection() == 1){
276 ContactData.AddRaw(wxT("KIND"), wxT("individual"));
278 } else if (cmbType->GetCurrentSelection() == 2){
280 ContactData.AddRaw(wxT("KIND"), wxT("group"));
282 // Go through each of the members and write them out.
284 for (std::map<int, wxString>::iterator itemiter = ContactEditorData.GroupsList.begin();
285 itemiter != ContactEditorData.GroupsList.end(); ++itemiter){
287 ContactData.Add(wxT("MEMBER:urn:uuid"), itemiter->second, FALSE);
291 } else if (cmbType->GetCurrentSelection() == 3){
293 ContactData.AddRaw(wxT("KIND"), wxT("org"));
295 } else if (cmbType->GetCurrentSelection() == 4){
297 ContactData.AddRaw(wxT("KIND"), wxT("location"));
302 // Setup the nicknames (General, Home & Business).
315 if (cmbGender->GetCurrentSelection() != 0){
317 switch(cmbGender->GetCurrentSelection()){
348 if (!txtGenderDescription->IsEmpty()){
350 strValue2 = txtGenderDescription->GetValue();
354 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
356 EscapeString(&strValue2, FALSE);
358 if (!ContactEditorData.GenderTokens.IsEmpty()){
360 if (!strValue2.IsEmpty()){
362 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue + wxT(";") + strValue2);
366 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue);
372 if (!strValue2.IsEmpty()){
374 ContactData.AddRaw(wxT("GENDER"), strValue + wxT(";") + strValue2);
378 ContactData.AddRaw(wxT("GENDER"), strValue);
386 ResetSaveProcessData();
388 // Build the values for the BDAY property.
392 if (!ContactEditorData.BirthdayAltID.IsEmpty()){
395 DataValue = ContactEditorData.BirthdayAltID;
397 EscapeString(&DataValue, FALSE);
399 strValue3.Append("ALTID=");
400 strValue3.Append(DataValue);
408 if (!ContactEditorData.BirthdayCalScale.IsEmpty()){
411 DataValue = ContactEditorData.BirthdayCalScale;
413 EscapeString(&DataValue, FALSE);
415 if (boolValue2 == TRUE){
417 strValue3.Append(";");
421 strValue3.Append("CALSCALE=");
422 strValue3.Append(DataValue);
430 if (!ContactEditorData.BirthdayTokens.IsEmpty()){
433 DataValue = ContactEditorData.BirthdayTokens;
435 EscapeString(&DataValue, FALSE);
437 if (boolValue2 == TRUE){
439 strValue3.Append(";");
443 strValue3.Append(DataValue);
447 // Write the BDAY property.
449 if (!txtBirthday->IsEmpty()){
451 if (!txtBirthday->GetValue().IsEmpty()){
453 strValue = txtBirthday->GetValue();
455 if (!strValue3.IsEmpty()){
457 ContactData.AddRaw("BDAY;VALUE=text;" + strValue3, strValue);
461 ContactData.AddRaw("BDAY;VALUE=text", strValue);
471 // Get Day, Month & Year.
473 wxDateTime BirthdayDate;
474 wxDateTime::Month BirthdayMonth;
477 wxString DataBeforeT;
479 wxString FinalBirthdayString;
480 bool ProcessDataAfterT = FALSE;
482 BirthdayDate = dapBirthday->GetValue();
484 if (BirthdayDate.IsValid()){
486 BirthdayDay = BirthdayDate.GetDay();
487 BirthdayMonth = BirthdayDate.GetMonth();
488 BirthdayYear = BirthdayDate.GetYear();
490 // Look for T and replace data before this.
492 wxStringTokenizer wSTDate(ContactEditorData.Birthday, wxT("T"));
494 while (wSTDate.HasMoreTokens()){
496 if (ProcessDataAfterT == FALSE){
498 DataBeforeT = wSTDate.GetNextToken();
499 ProcessDataAfterT = TRUE;
503 DataAfterT = wSTDate.GetNextToken();
510 // If there is not T then replace altogether.
512 wxString FinalBirthdayDay;
513 wxString FinalBirthdayMonth;
514 wxString FinalBirthdayYear;
516 if (BirthdayDay < 10){
518 FinalBirthdayDay = wxT("0") + wxString::Format(wxT("%i"), BirthdayDay);
522 FinalBirthdayDay = wxString::Format(wxT("%i"), BirthdayDay);
526 if (((int)BirthdayMonth + 1) < 10){
528 FinalBirthdayMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
532 FinalBirthdayMonth = wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
536 if (BirthdayYear == 0){
538 FinalBirthdayYear = wxT("--");
542 FinalBirthdayYear = wxString::Format(wxT("%i"), BirthdayYear);
546 if (!DataAfterT.IsEmpty()){
548 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay + wxT("T") + DataAfterT;
552 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay;
556 if (!FinalBirthdayString.IsEmpty() || !strValue3.IsEmpty()){
558 if (!strValue3.IsEmpty()){
560 EscapeString(&strValue2, FALSE);
561 EscapeString(&strValue, FALSE);
563 ContactData.AddRaw(wxT("BDAY;") + strValue3, FinalBirthdayString);
567 EscapeString(&strValue, FALSE);
569 ContactData.AddRaw(wxT("BDAY"), FinalBirthdayString);
579 ResetSaveProcessData();
581 // Build the values for the ANNIVERSARY property.
585 if (!ContactEditorData.AnniversaryAltID.IsEmpty()){
588 DataValue = ContactEditorData.AnniversaryAltID;
590 EscapeString(&DataValue, FALSE);
592 strValue3.Append("ALTID=");
593 strValue3.Append(DataValue);
601 if (!ContactEditorData.AnniversaryCalScale.IsEmpty()){
604 DataValue = ContactEditorData.AnniversaryCalScale;
606 EscapeString(&DataValue, FALSE);
608 if (boolValue2 == TRUE){
610 strValue3.Append(";");
614 strValue3.Append("CALSCALE=");
615 strValue3.Append(DataValue);
623 if (!ContactEditorData.AnniversaryTokens.IsEmpty()){
626 DataValue = ContactEditorData.AnniversaryTokens;
628 EscapeString(&DataValue, FALSE);
630 if (boolValue2 == TRUE){
632 strValue3.Append(";");
636 strValue3.Append(DataValue);
640 // Write the ANNIVERSARY property.
642 if (!txtAnniversary->IsEmpty()){
644 if (!txtAnniversary->GetValue().IsEmpty()){
646 strValue = txtAnniversary->GetValue();
648 if (!strValue3.IsEmpty()){
650 ContactData.AddRaw("ANNIVERSARY;VALUE=text;" + strValue3, strValue);
654 ContactData.AddRaw("ANNIVERSARY;VALUE=text", strValue);
662 // Look for T and replace data before this.
664 // Get Day, Month & Year.
666 wxDateTime AnniversaryDate;
667 wxDateTime::Month AnniversaryMonth;
670 wxString DataBeforeT;
672 wxString FinalAnniversaryString;
673 bool ProcessDataAfterT = FALSE;
675 AnniversaryDate = dapAnniversary->GetValue();
677 if (AnniversaryDate.IsValid()){
679 AnniversaryDay = AnniversaryDate.GetDay();
680 AnniversaryMonth = AnniversaryDate.GetMonth();
681 AnniversaryYear = AnniversaryDate.GetYear();
683 // Look for T and replace data before this.
685 wxStringTokenizer wSTDate(ContactEditorData.Anniversary, wxT("T"));
687 while (wSTDate.HasMoreTokens()){
689 if (ProcessDataAfterT == FALSE){
691 DataBeforeT = wSTDate.GetNextToken();
692 ProcessDataAfterT = TRUE;
696 DataAfterT = wSTDate.GetNextToken();
703 // If there is not T then replace altogether.
705 wxString FinalAnniversaryDay;
706 wxString FinalAnniversaryMonth;
707 wxString FinalAnniversaryYear;
709 if (AnniversaryDay < 10){
711 FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
715 FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
719 if (((int)AnniversaryMonth + 1) < 10){
721 FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
725 FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
729 if (AnniversaryYear == 0){
731 FinalAnniversaryYear = wxT("--");
735 FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
739 if (!DataAfterT.IsEmpty()){
741 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
745 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
749 if (!FinalAnniversaryString.IsEmpty() || !strValue3.IsEmpty()){
751 if (!strValue3.IsEmpty()){
753 EscapeString(&strValue2, FALSE);
754 EscapeString(&strValue, FALSE);
756 ContactData.AddRaw(wxT("ANNIVERSARY;") + strValue3, FinalAnniversaryString);
760 EscapeString(&strValue, FALSE);
762 ContactData.AddRaw(wxT("ANNIVERSARY"), FinalAnniversaryString);
772 // Setup the addresses (General, Home, Business).
774 ResetSaveProcessData();
776 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralAddressList.begin();
777 iter != ContactEditorData.GeneralAddressList.end(); ++iter){
779 int intSeekValue = iter->first;
781 wxString strAddressString;
782 wxString strAddressFinalValue;
783 std::map<int, wxString>::iterator iterValue;
785 strAddressString.Append(wxT(";;"));
789 iterValue = ContactEditorData.GeneralAddressList.find(intSeekValue);
790 strAddressFinalValue = iterValue->second;
791 ProcessCaptureStrings(&strAddressFinalValue);
792 strAddressString.Append(strAddressFinalValue + wxT(";"));
793 strAddressFinalValue.Clear();
797 iterValue = ContactEditorData.GeneralAddressListTown.find(intSeekValue);
798 strAddressFinalValue = iterValue->second;
799 ProcessCaptureStrings(&strAddressFinalValue);
800 strAddressString.Append(strAddressFinalValue + wxT(";"));
801 strAddressFinalValue.Clear();
805 iterValue = ContactEditorData.GeneralAddressListCounty.find(intSeekValue);
806 strAddressFinalValue = iterValue->second;
807 ProcessCaptureStrings(&strAddressFinalValue);
808 strAddressString.Append(strAddressFinalValue + wxT(";"));
809 strAddressFinalValue.Clear();
813 iterValue = ContactEditorData.GeneralAddressListPostCode.find(intSeekValue);
814 strAddressFinalValue = iterValue->second;
815 ProcessCaptureStrings(&strAddressFinalValue);
816 strAddressString.Append(strAddressFinalValue + wxT(";"));
817 strAddressFinalValue.Clear();
821 iterValue = ContactEditorData.GeneralAddressListCountry.find(intSeekValue);
822 strAddressFinalValue = iterValue->second;
823 ProcessCaptureStrings(&strAddressFinalValue);
824 strAddressString.Append(strAddressFinalValue);
825 strAddressFinalValue.Clear();
827 ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
828 &iter, &strAddressString, &ContactData,
829 wxT("LABEL"), &ContactEditorData.GeneralAddressListLabel,
830 wxT("LANGUAGE"), &ContactEditorData.GeneralAddressListLang,
831 wxT("ALTID"), &ContactEditorData.GeneralAddressListAltID,
832 wxT("PID"), &ContactEditorData.GeneralAddressListPID,
833 wxT("GEO"), &ContactEditorData.GeneralAddressListGeo,
834 wxT("TZ"), &ContactEditorData.GeneralAddressListTimezone,
835 wxT("MEDIATYPE"), &ContactEditorData.GeneralAddressListMediatype,
836 wxT("PREF"), &ContactEditorData.GeneralAddressListPref,
837 wxT(""), &ContactEditorData.GeneralAddressListTokens );
839 ResetSaveProcessData();
843 ResetSaveProcessData();
845 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeAddressList.begin();
846 iter != ContactEditorData.HomeAddressList.end(); ++iter){
848 int intSeekValue = iter->first;
850 wxString strAddressString;
851 wxString strAddressFinalValue;
852 std::map<int, wxString>::iterator iterValue;
854 strAddressString.Append(wxT(";;"));
858 iterValue = ContactEditorData.HomeAddressList.find(intSeekValue);
859 strAddressFinalValue = iterValue->second;
860 ProcessCaptureStrings(&strAddressFinalValue);
861 strAddressString.Append(strAddressFinalValue + wxT(";"));
865 iterValue = ContactEditorData.HomeAddressListTown.find(intSeekValue);
866 strAddressFinalValue = iterValue->second;
867 ProcessCaptureStrings(&strAddressFinalValue);
868 strAddressString.Append(strAddressFinalValue + wxT(";"));
872 iterValue = ContactEditorData.HomeAddressListCounty.find(intSeekValue);
873 strAddressFinalValue = iterValue->second;
874 ProcessCaptureStrings(&strAddressFinalValue);
875 strAddressString.Append(strAddressFinalValue + wxT(";"));
879 iterValue = ContactEditorData.HomeAddressListPostCode.find(intSeekValue);
880 strAddressFinalValue = iterValue->second;
881 ProcessCaptureStrings(&strAddressFinalValue);
882 strAddressString.Append(strAddressFinalValue + wxT(";"));
886 iterValue = ContactEditorData.HomeAddressListCountry.find(intSeekValue);
887 strAddressFinalValue = iterValue->second;
888 ProcessCaptureStrings(&strAddressFinalValue);
889 strAddressString.Append(strAddressFinalValue);
891 ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
892 &iter, &strAddressString, &ContactData,
893 wxT("LABEL"), &ContactEditorData.HomeAddressListLabel,
894 wxT("LANGUAGE"), &ContactEditorData.HomeAddressListLang,
895 wxT("ALTID"), &ContactEditorData.HomeAddressListAltID,
896 wxT("PID"), &ContactEditorData.HomeAddressListPID,
897 wxT("GEO"), &ContactEditorData.HomeAddressListGeo,
898 wxT("TZ"), &ContactEditorData.HomeAddressListTimezone,
899 wxT("MEDIATYPE"), &ContactEditorData.HomeAddressListMediatype,
900 wxT("PREF"), &ContactEditorData.HomeAddressListPref,
901 wxT(""), &ContactEditorData.HomeAddressListTokens );
903 ResetSaveProcessData();
907 ResetSaveProcessData();
909 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessAddressList.begin();
910 iter != ContactEditorData.BusinessAddressList.end(); ++iter){
912 int intSeekValue = iter->first;
914 wxString strAddressString;
915 wxString strAddressFinalValue;
916 std::map<int, wxString>::iterator iterValue;
918 strAddressString.Append(wxT(";;"));
922 iterValue = ContactEditorData.BusinessAddressList.find(intSeekValue);
923 strAddressFinalValue = iterValue->second;
924 ProcessCaptureStrings(&strAddressFinalValue);
926 strAddressString.Append(strAddressFinalValue + wxT(";"));
930 iterValue = ContactEditorData.BusinessAddressListTown.find(intSeekValue);
931 strAddressFinalValue = iterValue->second;
932 ProcessCaptureStrings(&strAddressFinalValue);
934 strAddressString.Append(strAddressFinalValue + wxT(";"));
938 iterValue = ContactEditorData.BusinessAddressListCounty.find(intSeekValue);
939 strAddressFinalValue = iterValue->second;
940 ProcessCaptureStrings(&strAddressFinalValue);
942 strAddressString.Append(strAddressFinalValue + wxT(";"));
946 iterValue = ContactEditorData.BusinessAddressListPostCode.find(intSeekValue);
947 strAddressFinalValue = iterValue->second;
948 ProcessCaptureStrings(&strAddressFinalValue);
950 strAddressString.Append(strAddressFinalValue + wxT(";"));
954 iterValue = ContactEditorData.BusinessAddressListCountry.find(intSeekValue);
955 strAddressFinalValue = iterValue->second;
956 ProcessCaptureStrings(&strAddressFinalValue);
958 strAddressString.Append(strAddressFinalValue);
960 ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
961 &iter, &strAddressString, &ContactData,
962 wxT("LABEL"), &ContactEditorData.BusinessAddressListLabel,
963 wxT("LANGUAGE"), &ContactEditorData.BusinessAddressListLang,
964 wxT("ALTID"), &ContactEditorData.BusinessAddressListAltID,
965 wxT("PID"), &ContactEditorData.BusinessAddressListPID,
966 wxT("GEO"), &ContactEditorData.BusinessAddressListGeo,
967 wxT("TZ"), &ContactEditorData.BusinessAddressListTimezone,
968 wxT("MEDIATYPE"), &ContactEditorData.BusinessAddressListMediatype,
969 wxT("PREF"), &ContactEditorData.BusinessAddressListPref,
970 wxT(""), &ContactEditorData.BusinessAddressListTokens );
972 ResetSaveProcessData();
976 // Sort out nicknames (if any).
978 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNicknamesList.begin();
979 iter != ContactEditorData.GeneralNicknamesList.end(); ++iter){
981 intValue2 = iter->first;
983 // Process Alternative ID.
985 ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
986 &iter, &ContactEditorData.GeneralNicknamesList, &ContactData,
987 wxT("LANGUAGE"), &ContactEditorData.GeneralNicknamesListLanguage,
988 wxT("ALTID"), &ContactEditorData.GeneralNicknamesListAltID,
989 wxT("PID"), &ContactEditorData.GeneralNicknamesListPID,
990 wxT("PREF"), &ContactEditorData.GeneralNicknamesListPref,
991 wxT(""), &ContactEditorData.GeneralNicknamesListTokens );
993 ResetSaveProcessData();
997 ResetSaveProcessData();
999 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNicknamesList.begin();
1000 iter != ContactEditorData.HomeNicknamesList.end(); ++iter){
1002 ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1003 &iter, &ContactEditorData.HomeNicknamesList, &ContactData,
1004 wxT("LANGUAGE"), &ContactEditorData.HomeNicknamesListLanguage,
1005 wxT("ALTID"), &ContactEditorData.HomeNicknamesListAltID,
1006 wxT("PID"), &ContactEditorData.HomeNicknamesListPID,
1007 wxT("PREF"), &ContactEditorData.HomeNicknamesListPref,
1008 wxT(""), &ContactEditorData.HomeNicknamesListTokens );
1010 ResetSaveProcessData();
1014 ResetSaveProcessData();
1016 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNicknamesList.begin();
1017 iter != ContactEditorData.BusinessNicknamesList.end(); ++iter){
1019 ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1020 &iter, &ContactEditorData.BusinessNicknamesList, &ContactData,
1021 wxT("LANGUAGE"), &ContactEditorData.BusinessNicknamesListLanguage,
1022 wxT("ALTID"), &ContactEditorData.BusinessNicknamesListAltID,
1023 wxT("PID"), &ContactEditorData.BusinessNicknamesListPID,
1024 wxT("PREF"), &ContactEditorData.BusinessNicknamesListPref,
1025 wxT(""), &ContactEditorData.BusinessNicknamesListTokens );
1027 ResetSaveProcessData();
1031 ResetSaveProcessData();
1033 // Sort out email (general, home and business).
1035 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralEmailList.begin();
1036 iter != ContactEditorData.GeneralEmailList.end(); ++iter){
1038 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1041 wxString strAddressFinalValue;
1042 std::map<int, wxString>::iterator iterValue;
1044 ProcessSaveData(wxT("EMAIL"), &strValue2, &boolValue2, &boolValue,
1045 &iter, &ContactEditorData.GeneralEmailList, &ContactData,
1046 wxT("ALTID"), &ContactEditorData.GeneralEmailListAltID,
1047 wxT("PID"), &ContactEditorData.GeneralEmailListPID,
1048 wxT("PREF"), &ContactEditorData.GeneralEmailListPref,
1049 wxT(""), &ContactEditorData.GeneralEmailListTokens );
1051 ResetSaveProcessData();
1055 ResetSaveProcessData();
1057 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeEmailList.begin();
1058 iter != ContactEditorData.HomeEmailList.end(); ++iter){
1060 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1063 ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1064 &iter, &ContactEditorData.HomeEmailList, &ContactData,
1065 wxT("ALTID"), &ContactEditorData.HomeEmailListAltID,
1066 wxT("PID"), &ContactEditorData.HomeEmailListPID,
1067 wxT("PREF"), &ContactEditorData.HomeEmailListPref,
1068 wxT(""), &ContactEditorData.HomeEmailListTokens );
1070 ResetSaveProcessData();
1074 ResetSaveProcessData();
1076 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessEmailList.begin();
1077 iter != ContactEditorData.BusinessEmailList.end(); ++iter){
1079 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1082 ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1083 &iter, &ContactEditorData.BusinessEmailList, &ContactData,
1084 wxT("ALTID"), &ContactEditorData.BusinessEmailListAltID,
1085 wxT("PID"), &ContactEditorData.BusinessEmailListPID,
1086 wxT("PREF"), &ContactEditorData.BusinessEmailListPref,
1087 wxT(""), &ContactEditorData.BusinessEmailListTokens );
1089 ResetSaveProcessData();
1093 ResetSaveProcessData();
1095 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralIMList.begin();
1096 iter != ContactEditorData.GeneralIMList.end(); ++iter){
1098 intValue2 = iter->first;
1100 wxString strIMFinalValue = iter->second;
1102 ProcessCaptureStrings(&strIMFinalValue);
1104 if (ContactEditorData.GeneralIMListTypeInfo.find(iter->first) !=
1105 ContactEditorData.GeneralIMListTypeInfo.end()){
1107 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralIMListTypeInfo.find(iter->first);
1109 strIMFinalValue.insert(0, ":");
1110 strIMFinalValue.insert(0, DataTypeIter->second);
1114 strIMFinalValue.insert(0, "none:");
1118 // Process Alternative ID.
1120 ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
1121 &iter, &strIMFinalValue, &ContactData,
1122 wxT("ALTID"), &ContactEditorData.GeneralIMListAltID,
1123 wxT("PID"), &ContactEditorData.GeneralIMListPID,
1124 wxT("MEDIATYPE"), &ContactEditorData.GeneralIMListMediatype,
1125 wxT("PREF"), &ContactEditorData.GeneralIMListPref,
1126 wxT(""), &ContactEditorData.GeneralIMListTokens );
1128 ResetSaveProcessData();
1132 ResetSaveProcessData();
1134 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeIMList.begin();
1135 iter != ContactEditorData.HomeIMList.end(); ++iter){
1137 wxString strIMFinalValue = iter->second;
1139 ProcessCaptureStrings(&strIMFinalValue);
1141 if (ContactEditorData.HomeIMListTypeInfo.find(iter->first) !=
1142 ContactEditorData.HomeIMListTypeInfo.end()){
1144 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeIMListTypeInfo.find(iter->first);
1146 strIMFinalValue.insert(0, ":");
1147 strIMFinalValue.insert(0, DataTypeIter->second);
1151 strIMFinalValue.insert(0, "none:");
1155 ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1156 &iter, &ContactEditorData.HomeIMList, &ContactData,
1157 wxT("ALTID"), &ContactEditorData.HomeIMListAltID,
1158 wxT("PID"), &ContactEditorData.HomeIMListPID,
1159 wxT("MEDIATYPE"), &ContactEditorData.HomeIMListMediatype,
1160 wxT("PREF"), &ContactEditorData.HomeIMListPref,
1161 wxT(""), &ContactEditorData.HomeIMListTokens );
1163 ResetSaveProcessData();
1167 ResetSaveProcessData();
1169 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessIMList.begin();
1170 iter != ContactEditorData.BusinessIMList.end(); ++iter){
1172 wxString strIMFinalValue = iter->second;
1174 ProcessCaptureStrings(&strIMFinalValue);
1176 if (ContactEditorData.BusinessIMListTypeInfo.find(iter->first) !=
1177 ContactEditorData.BusinessIMListTypeInfo.end()){
1179 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessIMListTypeInfo.find(iter->first);
1181 strIMFinalValue.insert(0, ":");
1182 strIMFinalValue.insert(0, DataTypeIter->second);
1186 strIMFinalValue.insert(0, "none:");
1190 ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1191 &iter, &ContactEditorData.BusinessIMList, &ContactData,
1192 wxT("ALTID"), &ContactEditorData.BusinessIMListAltID,
1193 wxT("PID"), &ContactEditorData.BusinessIMListPID,
1194 wxT("MEDIATYPE"), &ContactEditorData.BusinessIMListMediatype,
1195 wxT("PREF"), &ContactEditorData.BusinessIMListPref,
1196 wxT(""), &ContactEditorData.BusinessIMListTokens );
1198 ResetSaveProcessData();
1202 ResetSaveProcessData();
1204 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTelephoneList.begin();
1205 iter != ContactEditorData.GeneralTelephoneList.end(); ++iter){
1207 wxString strAddressFinalValue = iter->second;
1208 int DataID = iter->first;
1210 ProcessCaptureStrings(&strAddressFinalValue);
1212 if (MapDataExists(&DataID, &ContactEditorData.GeneralTelephoneListDataType)){
1214 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralTelephoneListDataType.find(iter->first);
1216 strAddressFinalValue.insert(0, ":");
1217 strAddressFinalValue.insert(0, DataTypeIter->second);
1221 strAddressFinalValue.insert(0, "tel:");
1225 wxString strAddressTypeInfo;
1227 if (MapDataExists(&DataID, &ContactEditorData.GeneralTelephoneListTypeInfo)){
1229 strAddressTypeInfo = ContactEditorData.GeneralTelephoneListTypeInfo.find(iter->first)->second;
1233 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1234 &iter, &strAddressFinalValue, &ContactData,
1235 wxT("ALTID"), &ContactEditorData.GeneralTelephoneListAltID,
1236 wxT("PID"), &ContactEditorData.GeneralTelephoneListPID,
1237 wxT("TYPE"), &ContactEditorData.GeneralTelephoneListTypeInfo,
1238 wxT("PREF"), &ContactEditorData.GeneralTelephoneListPref,
1239 wxT(""), &ContactEditorData.GeneralTelephoneListTokens );
1241 ResetSaveProcessData();
1245 ResetSaveProcessData();
1247 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTelephoneList.begin();
1248 iter != ContactEditorData.HomeTelephoneList.end(); ++iter){
1250 wxString strAddressFinalValue = iter->second;
1252 ProcessCaptureStrings(&strAddressFinalValue);
1254 if (ContactEditorData.HomeTelephoneListDataType.find(iter->first) !=
1255 ContactEditorData.HomeTelephoneListDataType.end()){
1257 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeTelephoneListDataType.find(iter->first);
1259 strAddressFinalValue.insert(0, ":");
1260 strAddressFinalValue.insert(0, DataTypeIter->second);
1264 strAddressFinalValue.insert(0, "tel:");
1268 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1269 &iter, &strAddressFinalValue, &ContactData,
1270 wxT("ALTID"), &ContactEditorData.HomeTelephoneListAltID,
1271 wxT("PID"), &ContactEditorData.HomeTelephoneListPID,
1272 wxT("TYPE"), &ContactEditorData.HomeTelephoneListTypeInfo,
1273 wxT("PREF"), &ContactEditorData.HomeTelephoneListPref,
1274 wxT(""), &ContactEditorData.HomeTelephoneListTokens );
1276 ResetSaveProcessData();
1280 ResetSaveProcessData();
1282 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTelephoneList.begin();
1283 iter != ContactEditorData.BusinessTelephoneList.end(); ++iter){
1285 wxString strAddressFinalValue = iter->second;
1287 ProcessCaptureStrings(&strAddressFinalValue);
1289 if (ContactEditorData.BusinessTelephoneListDataType.find(iter->first) !=
1290 ContactEditorData.BusinessTelephoneListDataType.end()){
1292 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessTelephoneListDataType.find(iter->first);
1294 strAddressFinalValue.insert(0, ":");
1295 strAddressFinalValue.insert(0, DataTypeIter->second);
1299 strAddressFinalValue.insert(0, "tel:");
1303 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1304 &iter, &strAddressFinalValue, &ContactData,
1305 wxT("ALTID"), &ContactEditorData.BusinessTelephoneListAltID,
1306 wxT("PID"), &ContactEditorData.BusinessTelephoneListPID,
1307 wxT("TYPE"), &ContactEditorData.BusinessTelephoneListTypeInfo,
1308 wxT("PREF"), &ContactEditorData.BusinessTelephoneListPref,
1309 wxT(""), &ContactEditorData.BusinessTelephoneListTokens );
1311 ResetSaveProcessData();
1315 ResetSaveProcessData();
1317 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralLanguageList.begin();
1318 iter != ContactEditorData.GeneralLanguageList.end(); ++iter){
1320 intValue2 = iter->first;
1322 ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
1323 &iter, &ContactEditorData.GeneralLanguageList, &ContactData,
1324 wxT("ALTID"), &ContactEditorData.GeneralLanguageListAltID,
1325 wxT("PID"), &ContactEditorData.GeneralLanguageListPID,
1326 wxT("PREF"), &ContactEditorData.GeneralLanguageListPref,
1327 wxT(""), &ContactEditorData.GeneralLanguageListTokens );
1329 ResetSaveProcessData();
1333 ResetSaveProcessData();
1335 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeLanguageList.begin();
1336 iter != ContactEditorData.HomeLanguageList.end(); ++iter){
1338 ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1339 &iter, &ContactEditorData.HomeLanguageList, &ContactData,
1340 wxT("ALTID"), &ContactEditorData.HomeLanguageListAltID,
1341 wxT("PID"), &ContactEditorData.HomeLanguageListPID,
1342 wxT("PREF"), &ContactEditorData.HomeLanguageListPref,
1343 wxT(""), &ContactEditorData.HomeLanguageListTokens );
1345 ResetSaveProcessData();
1349 ResetSaveProcessData();
1351 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessLanguageList.begin();
1352 iter != ContactEditorData.BusinessLanguageList.end(); ++iter){
1354 ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1355 &iter, &ContactEditorData.BusinessLanguageList, &ContactData,
1356 wxT("ALTID"), &ContactEditorData.BusinessLanguageListAltID,
1357 wxT("PID"), &ContactEditorData.BusinessLanguageListPID,
1358 wxT("PREF"), &ContactEditorData.BusinessLanguageListPref,
1359 wxT(""), &ContactEditorData.BusinessLanguageListTokens );
1361 ResetSaveProcessData();
1365 ResetSaveProcessData();
1367 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTZList.begin();
1368 iter != ContactEditorData.GeneralTZList.end(); ++iter){
1370 ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
1371 &iter, &ContactEditorData.GeneralTZList, &ContactData,
1372 wxT("ALTID"), &ContactEditorData.GeneralTZListAltID,
1373 wxT("PID"), &ContactEditorData.GeneralTZListPID,
1374 wxT("MEDIATYPE"), &ContactEditorData.GeneralTZListMediatype,
1375 wxT("PREF"), &ContactEditorData.GeneralTZListPref,
1376 wxT(""), &ContactEditorData.GeneralTZListTokens );
1378 ResetSaveProcessData();
1382 ResetSaveProcessData();
1384 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTZList.begin();
1385 iter != ContactEditorData.HomeTZList.end(); ++iter){
1387 ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1388 &iter, &ContactEditorData.HomeTZList, &ContactData,
1389 wxT("ALTID"), &ContactEditorData.HomeTZListAltID,
1390 wxT("PID"), &ContactEditorData.HomeTZListPID,
1391 wxT("MEDIATYPE"), &ContactEditorData.HomeTZListMediatype,
1392 wxT("PREF"), &ContactEditorData.HomeTZListPref,
1393 wxT(""), &ContactEditorData.HomeTZListTokens );
1395 ResetSaveProcessData();
1399 ResetSaveProcessData();
1401 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTZList.begin();
1402 iter != ContactEditorData.BusinessTZList.end(); ++iter){
1404 ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1405 &iter, &ContactEditorData.BusinessTZList, &ContactData,
1406 wxT("ALTID"), &ContactEditorData.BusinessTZListAltID,
1407 wxT("PID"), &ContactEditorData.BusinessTZListPID,
1408 wxT("MEDIATYPE"), &ContactEditorData.BusinessTZListMediatype,
1409 wxT("PREF"), &ContactEditorData.BusinessTZListPref,
1410 wxT(""), &ContactEditorData.BusinessTZListTokens );
1412 ResetSaveProcessData();
1416 ResetSaveProcessData();
1418 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralGeographyList.begin();
1419 iter != ContactEditorData.GeneralGeographyList.end(); ++iter){
1421 wxString strGeoFinalValue = iter->second;
1423 ProcessCaptureStrings(&strGeoFinalValue);
1425 if (ContactEditorData.GeneralGeographyListDataType.find(iter->first) !=
1426 ContactEditorData.GeneralGeographyListDataType.end()){
1428 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralGeographyListDataType.find(iter->first);
1430 strGeoFinalValue.insert(0, ":");
1431 strGeoFinalValue.insert(0, DataTypeIter->second);
1435 strGeoFinalValue.insert(0, "geo:");
1439 ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
1440 &iter, &strGeoFinalValue, &ContactData,
1441 wxT("ALTID"), &ContactEditorData.GeneralGeographyListAltID,
1442 wxT("PID"), &ContactEditorData.GeneralGeographyListPID,
1443 wxT("MEDIATYPE"), &ContactEditorData.GeneralGeographyListMediatype,
1444 wxT("PREF"), &ContactEditorData.GeneralGeographyListPref,
1445 wxT(""), &ContactEditorData.GeneralGeographyListTokens );
1447 ResetSaveProcessData();
1451 ResetSaveProcessData();
1453 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeGeographyList.begin();
1454 iter != ContactEditorData.HomeGeographyList.end(); ++iter){
1456 wxString strGeoFinalValue = iter->second;
1458 ProcessCaptureStrings(&strGeoFinalValue);
1460 if (ContactEditorData.HomeGeographyListDataType.find(iter->first) !=
1461 ContactEditorData.HomeGeographyListDataType.end()){
1463 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeGeographyListDataType.find(iter->first);
1465 strGeoFinalValue.insert(0, ":");
1466 strGeoFinalValue.insert(0, DataTypeIter->second);
1470 strGeoFinalValue.insert(0, "geo:");
1474 ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1475 &iter, &strGeoFinalValue, &ContactData,
1476 wxT("ALTID"), &ContactEditorData.HomeGeographyListAltID,
1477 wxT("PID"), &ContactEditorData.HomeGeographyListPID,
1478 wxT("MEDIATYPE"), &ContactEditorData.HomeGeographyListMediatype,
1479 wxT("PREF"), &ContactEditorData.HomeGeographyListPref,
1480 wxT(""), &ContactEditorData.HomeGeographyListTokens );
1482 ResetSaveProcessData();
1486 ResetSaveProcessData();
1488 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessGeographyList.begin();
1489 iter != ContactEditorData.BusinessGeographyList.end(); ++iter){
1491 wxString strGeoFinalValue = iter->second;
1493 ProcessCaptureStrings(&strGeoFinalValue);
1495 if (ContactEditorData.BusinessGeographyListDataType.find(iter->first) !=
1496 ContactEditorData.BusinessGeographyListDataType.end()){
1498 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessGeographyListDataType.find(iter->first);
1500 strGeoFinalValue.insert(0, ":");
1501 strGeoFinalValue.insert(0, DataTypeIter->second);
1505 strGeoFinalValue.insert(0, "geo:");
1509 ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1510 &iter, &strGeoFinalValue, &ContactData,
1511 wxT("ALTID"), &ContactEditorData.BusinessGeographyListAltID,
1512 wxT("PID"), &ContactEditorData.BusinessGeographyListPID,
1513 wxT("MEDIATYPE"), &ContactEditorData.BusinessGeographyListMediatype,
1514 wxT("PREF"), &ContactEditorData.BusinessGeographyListPref,
1515 wxT(""), &ContactEditorData.BusinessGeographyListTokens );
1517 ResetSaveProcessData();
1521 ResetSaveProcessData();
1523 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRelatedList.begin();
1524 iter != ContactEditorData.GeneralRelatedList.end(); ++iter){
1526 ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
1527 &iter, &ContactEditorData.GeneralRelatedList, &ContactData,
1528 wxT("ALTID"), &ContactEditorData.GeneralRelatedListAltID,
1529 wxT("PID"), &ContactEditorData.GeneralRelatedListPID,
1530 wxT("LANGUAGE"), &ContactEditorData.GeneralRelatedListLanguage,
1531 wxT("TYPE"), &ContactEditorData.GeneralRelatedListRelType,
1532 wxT("PREF"), &ContactEditorData.GeneralRelatedListPref,
1533 wxT(""), &ContactEditorData.GeneralRelatedListTokens );
1535 ResetSaveProcessData();
1539 ResetSaveProcessData();
1541 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralWebsiteList.begin();
1542 iter != ContactEditorData.GeneralWebsiteList.end(); ++iter){
1544 ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
1545 &iter, &ContactEditorData.GeneralWebsiteList, &ContactData,
1546 wxT("ALTID"), &ContactEditorData.GeneralWebsiteListAltID,
1547 wxT("PID"), &ContactEditorData.GeneralWebsiteListPID,
1548 wxT("MEDIATYPE"), &ContactEditorData.GeneralWebsiteListMediatype,
1549 wxT("PREF"), &ContactEditorData.GeneralWebsiteListPref,
1550 wxT(""), &ContactEditorData.GeneralWebsiteListTokens );
1552 ResetSaveProcessData();
1556 ResetSaveProcessData();
1558 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeWebsiteList.begin();
1559 iter != ContactEditorData.HomeWebsiteList.end(); ++iter){
1561 ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1562 &iter, &ContactEditorData.HomeWebsiteList, &ContactData,
1563 wxT("ALTID"), &ContactEditorData.HomeWebsiteListAltID,
1564 wxT("PID"), &ContactEditorData.HomeWebsiteListPID,
1565 wxT("MEDIATYPE"), &ContactEditorData.HomeWebsiteListMediatype,
1566 wxT("PREF"), &ContactEditorData.HomeWebsiteListPref,
1567 wxT(""), &ContactEditorData.HomeWebsiteListTokens );
1569 ResetSaveProcessData();
1573 ResetSaveProcessData();
1575 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessWebsiteList.begin();
1576 iter != ContactEditorData.BusinessWebsiteList.end(); ++iter){
1578 ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1579 &iter, &ContactEditorData.BusinessWebsiteList, &ContactData,
1580 wxT("ALTID"), &ContactEditorData.BusinessWebsiteListAltID,
1581 wxT("PID"), &ContactEditorData.BusinessWebsiteListPID,
1582 wxT("MEDIATYPE"), &ContactEditorData.BusinessWebsiteListMediatype,
1583 wxT("PREF"), &ContactEditorData.BusinessWebsiteListPref,
1584 wxT(""), &ContactEditorData.BusinessWebsiteListTokens );
1586 ResetSaveProcessData();
1590 ResetSaveProcessData();
1592 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTitleList.begin();
1593 iter != ContactEditorData.GeneralTitleList.end(); ++iter){
1595 ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
1596 &iter, &ContactEditorData.GeneralTitleList, &ContactData,
1597 wxT("ALTID"), &ContactEditorData.GeneralTitleListAltID,
1598 wxT("PID"), &ContactEditorData.GeneralTitleListPID,
1599 wxT("LANGUAGE"), &ContactEditorData.GeneralTitleListLanguage,
1600 wxT("PREF"), &ContactEditorData.GeneralTitleListPref,
1601 wxT(""), &ContactEditorData.GeneralTitleListTokens );
1603 ResetSaveProcessData();
1607 ResetSaveProcessData();
1609 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTitleList.begin();
1610 iter != ContactEditorData.HomeTitleList.end(); ++iter){
1612 ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1613 &iter, &ContactEditorData.HomeTitleList, &ContactData,
1614 wxT("ALTID"), &ContactEditorData.HomeTitleListAltID,
1615 wxT("PID"), &ContactEditorData.HomeTitleListPID,
1616 wxT("LANGUAGE"), &ContactEditorData.HomeTitleListLanguage,
1617 wxT("PREF"), &ContactEditorData.HomeTitleListPref,
1618 wxT(""), &ContactEditorData.HomeTitleListTokens );
1620 ResetSaveProcessData();
1624 ResetSaveProcessData();
1626 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTitleList.begin();
1627 iter != ContactEditorData.BusinessTitleList.end(); ++iter){
1629 ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1630 &iter, &ContactEditorData.BusinessTitleList, &ContactData,
1631 wxT("ALTID"), &ContactEditorData.BusinessTitleListAltID,
1632 wxT("PID"), &ContactEditorData.BusinessTitleListPID,
1633 wxT("LANGUAGE"), &ContactEditorData.BusinessTitleListLanguage,
1634 wxT("PREF"), &ContactEditorData.BusinessTitleListPref,
1635 wxT(""), &ContactEditorData.BusinessTitleListTokens );
1637 ResetSaveProcessData();
1641 ResetSaveProcessData();
1643 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRoleList.begin();
1644 iter != ContactEditorData.GeneralRoleList.end(); ++iter){
1646 ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
1647 &iter, &ContactEditorData.GeneralRoleList, &ContactData,
1648 wxT("ALTID"), &ContactEditorData.GeneralRoleListAltID,
1649 wxT("PID"), &ContactEditorData.GeneralRoleListPID,
1650 wxT("LANGUAGE"), &ContactEditorData.GeneralRoleListLanguage,
1651 wxT("PREF"), &ContactEditorData.GeneralRoleListPref,
1652 wxT(""), &ContactEditorData.GeneralRoleListTokens );
1654 ResetSaveProcessData();
1658 ResetSaveProcessData();
1660 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeRoleList.begin();
1661 iter != ContactEditorData.HomeRoleList.end(); ++iter){
1663 ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1664 &iter, &ContactEditorData.HomeRoleList, &ContactData,
1665 wxT("ALTID"), &ContactEditorData.HomeRoleListAltID,
1666 wxT("PID"), &ContactEditorData.HomeRoleListPID,
1667 wxT("LANGUAGE"), &ContactEditorData.HomeRoleListLanguage,
1668 wxT("PREF"), &ContactEditorData.HomeRoleListPref,
1669 wxT(""), &ContactEditorData.HomeRoleListTokens );
1671 ResetSaveProcessData();
1675 ResetSaveProcessData();
1677 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessRoleList.begin();
1678 iter != ContactEditorData.BusinessRoleList.end(); ++iter){
1680 ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1681 &iter, &ContactEditorData.BusinessRoleList, &ContactData,
1682 wxT("ALTID"), &ContactEditorData.BusinessRoleListAltID,
1683 wxT("PID"), &ContactEditorData.BusinessRoleListPID,
1684 wxT("LANGUAGE"), &ContactEditorData.BusinessRoleListLanguage,
1685 wxT("PREF"), &ContactEditorData.BusinessRoleListPref,
1686 wxT(""), &ContactEditorData.BusinessRoleListTokens );
1688 ResetSaveProcessData();
1692 ResetSaveProcessData();
1694 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralOrganisationsList.begin();
1695 iter != ContactEditorData.GeneralOrganisationsList.end(); ++iter){
1697 ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
1698 &iter, &ContactEditorData.GeneralOrganisationsList, &ContactData,
1699 wxT("ALTID"), &ContactEditorData.GeneralOrganisationsListAltID,
1700 wxT("PID"), &ContactEditorData.GeneralOrganisationsListPID,
1701 wxT("LANGUAGE"), &ContactEditorData.GeneralOrganisationsListLanguage,
1702 wxT("SORT-AS"), &ContactEditorData.GeneralOrganisationsListSortAs,
1703 wxT("PREF"), &ContactEditorData.GeneralOrganisationsListPref,
1704 wxT(""), &ContactEditorData.GeneralOrganisationsListTokens );
1706 ResetSaveProcessData();
1710 ResetSaveProcessData();
1712 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeOrganisationsList.begin();
1713 iter != ContactEditorData.HomeOrganisationsList.end(); ++iter){
1715 ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1716 &iter, &ContactEditorData.HomeOrganisationsList, &ContactData,
1717 wxT("ALTID"), &ContactEditorData.HomeOrganisationsListAltID,
1718 wxT("PID"), &ContactEditorData.HomeOrganisationsListPID,
1719 wxT("LANGUAGE"), &ContactEditorData.HomeOrganisationsListLanguage,
1720 wxT("SORT-AS"), &ContactEditorData.HomeOrganisationsListSortAs,
1721 wxT("PREF"), &ContactEditorData.HomeOrganisationsListPref,
1722 wxT(""), &ContactEditorData.HomeOrganisationsListTokens );
1724 ResetSaveProcessData();
1728 ResetSaveProcessData();
1730 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessOrganisationsList.begin();
1731 iter != ContactEditorData.BusinessOrganisationsList.end(); ++iter){
1733 ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1734 &iter, &ContactEditorData.BusinessOrganisationsList, &ContactData,
1735 wxT("ALTID"), &ContactEditorData.BusinessOrganisationsListAltID,
1736 wxT("PID"), &ContactEditorData.BusinessOrganisationsListPID,
1737 wxT("LANGUAGE"), &ContactEditorData.BusinessOrganisationsListLanguage,
1738 wxT("SORT-AS"), &ContactEditorData.BusinessOrganisationsListSortAs,
1739 wxT("PREF"), &ContactEditorData.BusinessOrganisationsListPref,
1740 wxT(""), &ContactEditorData.BusinessOrganisationsListTokens );
1742 ResetSaveProcessData();
1746 ResetSaveProcessData();
1748 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNoteList.begin();
1749 iter != ContactEditorData.GeneralNoteList.end(); ++iter){
1751 ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
1752 &iter, &ContactEditorData.GeneralNoteList, &ContactData,
1753 wxT("ALTID"), &ContactEditorData.GeneralNoteListAltID,
1754 wxT("PID"), &ContactEditorData.GeneralNoteListPID,
1755 wxT("LANGUAGE"), &ContactEditorData.GeneralNoteListLanguage,
1756 wxT("PREF"), &ContactEditorData.GeneralNoteListPref,
1757 wxT(""), &ContactEditorData.GeneralNoteListTokens );
1759 ResetSaveProcessData();
1763 ResetSaveProcessData();
1765 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNoteList.begin();
1766 iter != ContactEditorData.HomeNoteList.end(); ++iter){
1768 ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1769 &iter, &ContactEditorData.HomeNoteList, &ContactData,
1770 wxT("ALTID"), &ContactEditorData.HomeNoteListAltID,
1771 wxT("PID"), &ContactEditorData.HomeNoteListPID,
1772 wxT("LANGUAGE"), &ContactEditorData.HomeNoteListLanguage,
1773 wxT("PREF"), &ContactEditorData.HomeNoteListPref,
1774 wxT(""), &ContactEditorData.HomeNoteListTokens );
1776 ResetSaveProcessData();
1780 ResetSaveProcessData();
1782 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNoteList.begin();
1783 iter != ContactEditorData.BusinessNoteList.end(); ++iter){
1785 ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1786 &iter, &ContactEditorData.BusinessNoteList, &ContactData,
1787 wxT("ALTID"), &ContactEditorData.BusinessNoteListAltID,
1788 wxT("PID"), &ContactEditorData.BusinessNoteListPID,
1789 wxT("LANGUAGE"), &ContactEditorData.BusinessNoteListLanguage,
1790 wxT("PREF"), &ContactEditorData.BusinessNoteListPref,
1791 wxT(""), &ContactEditorData.BusinessNoteListTokens );
1793 ResetSaveProcessData();
1797 ResetSaveProcessData();
1799 for (std::map<int,wxString>::iterator iter = ContactEditorData.CategoriesList.begin();
1800 iter != ContactEditorData.CategoriesList.end(); ++iter){
1802 ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
1803 &iter, &ContactEditorData.CategoriesList, &ContactData,
1804 wxT("ALTID"), &ContactEditorData.CategoriesListAltID,
1805 wxT("PID"), &ContactEditorData.CategoriesListPID,
1806 wxT("TYPE"), &ContactEditorData.CategoriesListType,
1807 wxT("PREF"), &ContactEditorData.CategoriesListPref,
1808 wxT(""), &ContactEditorData.CategoriesListTokens );
1810 ResetSaveProcessData();
1816 for (std::map<int, std::string>::iterator iter = ContactEditorData.PicturesList.begin();
1817 iter != ContactEditorData.PicturesList.end(); ++iter){
1819 int intValueIndex = iter->first;
1821 std::map<int, std::string>::iterator stdstriter;
1822 std::map<int, wxString>::iterator enciter;
1824 striter = ContactEditorData.PicturesListPictureType.find(intValueIndex);
1825 enciter = ContactEditorData.PicturesListPicEncType.find(intValueIndex);
1827 ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
1828 &iter, &ContactEditorData.PicturesList, &striter,
1829 &enciter, &ContactData,
1830 wxT("ALTID"), &ContactEditorData.PicturesListAltID,
1831 wxT("PID"), &ContactEditorData.PicturesListPID,
1832 wxT("TYPE"), &ContactEditorData.PicturesListType,
1833 wxT("PREF"), &ContactEditorData.PicturesListPref,
1834 wxT(""), &ContactEditorData.PicturesListTokens);
1836 ResetSaveProcessData();
1840 ResetSaveProcessData();
1844 for (std::map<int, std::string>::iterator iter = ContactEditorData.LogosList.begin();
1845 iter != ContactEditorData.LogosList.end(); ++iter){
1847 int intValueIndex = iter->first;
1849 std::map<int, std::string>::iterator stdstriter;
1850 std::map<int, wxString>::iterator enciter;
1852 striter = ContactEditorData.LogosListPictureType.find(intValueIndex);
1853 enciter = ContactEditorData.LogosListPicEncType.find(intValueIndex);
1855 ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
1856 &iter, &ContactEditorData.LogosList, &striter,
1857 &enciter, &ContactData,
1858 wxT("ALTID"), &ContactEditorData.LogosListAltID,
1859 wxT("PID"), &ContactEditorData.LogosListPID,
1860 wxT("TYPE"), &ContactEditorData.LogosListType,
1861 wxT("PREF"), &ContactEditorData.LogosListPref,
1862 wxT(""), &ContactEditorData.LogosListTokens );
1864 ResetSaveProcessData();
1868 ResetSaveProcessData();
1872 for (std::map<int, std::string>::iterator iter = ContactEditorData.SoundsList.begin();
1873 iter != ContactEditorData.SoundsList.end(); ++iter){
1875 int intValueIndex = iter->first;
1877 std::map<int, std::string>::iterator stdstriter;
1878 std::map<int, wxString>::iterator enciter;
1880 striter = ContactEditorData.SoundsListAudioType.find(intValueIndex);
1881 enciter = ContactEditorData.SoundsListAudioEncType.find(intValueIndex);
1883 ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
1884 &iter, &ContactEditorData.SoundsList, &striter,
1885 &enciter, &ContactData,
1886 wxT("ALTID"), &ContactEditorData.SoundsListAltID,
1887 wxT("PID"), &ContactEditorData.SoundsListPID,
1888 wxT("TYPE"), &ContactEditorData.SoundsListType,
1889 wxT("PREF"), &ContactEditorData.SoundsListPref,
1890 wxT(""), &ContactEditorData.SoundsListTokens );
1892 ResetSaveProcessData();
1896 ResetSaveProcessData();
1898 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarList.begin();
1899 iter != ContactEditorData.CalendarList.end(); ++iter){
1901 ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
1902 &iter, &ContactEditorData.CalendarList, &ContactData,
1903 wxT("ALTID"), &ContactEditorData.CalendarListAltID,
1904 wxT("PID"), &ContactEditorData.CalendarListPID,
1905 wxT("MEDIATYPE"), &ContactEditorData.CalendarListMediatype,
1906 wxT("TYPE"), &ContactEditorData.CalendarListType,
1907 wxT("PREF"), &ContactEditorData.CalendarListPref,
1908 wxT(""), &ContactEditorData.CalendarListTokens );
1910 ResetSaveProcessData();
1914 ResetSaveProcessData();
1916 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarRequestList.begin();
1917 iter != ContactEditorData.CalendarRequestList.end(); ++iter){
1919 ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
1920 &iter, &ContactEditorData.CalendarRequestList, &ContactData,
1921 wxT("ALTID"), &ContactEditorData.CalendarRequestListAltID,
1922 wxT("PID"), &ContactEditorData.CalendarRequestListPID,
1923 wxT("MEDIATYPE"), &ContactEditorData.CalendarRequestListMediatype,
1924 wxT("TYPE"), &ContactEditorData.CalendarRequestListType,
1925 wxT("PREF"), &ContactEditorData.CalendarRequestListPref,
1926 wxT(""), &ContactEditorData.CalendarRequestListTokens );
1928 ResetSaveProcessData();
1932 ResetSaveProcessData();
1934 for (std::map<int,wxString>::iterator iter = ContactEditorData.FreeBusyList.begin();
1935 iter != ContactEditorData.FreeBusyList.end(); ++iter){
1937 ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
1938 &iter, &ContactEditorData.FreeBusyList, &ContactData,
1939 wxT("ALTID"), &ContactEditorData.FreeBusyListAltID,
1940 wxT("PID"), &ContactEditorData.FreeBusyListPID,
1941 wxT("MEDIATYPE"), &ContactEditorData.FreeBusyListMediatype,
1942 wxT("TYPE"), &ContactEditorData.FreeBusyListType,
1943 wxT("PREF"), &ContactEditorData.FreeBusyListPref,
1944 wxT(""), &ContactEditorData.FreeBusyListTokens );
1946 ResetSaveProcessData();
1950 for (std::map<int, wxString>::iterator iter = ContactEditorData.KeyList.begin();
1951 iter != ContactEditorData.KeyList.end(); ++iter){
1953 intValue2 = iter->first;
1955 // Get the key information.
1957 std::map<int, wxString>::iterator enciter;
1959 striter = ContactEditorData.KeyListDataType.find(intValue2);
1960 //enciter = KeyListAudioEncType.find(intValue2);
1962 wxString strValueData;
1964 strValueData = iter->second;
1965 strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));
1967 ProcessSaveData(wxT("KEY"), &strValue2, &boolValue2, &boolValue,
1968 &iter, &strValueData, &ContactData,
1969 wxT("ALTID"), &ContactEditorData.KeyListAltID,
1970 wxT("PID"), &ContactEditorData.KeyListPID,
1971 wxT("TYPE"), &ContactEditorData.KeyListType,
1972 wxT("PREF"), &ContactEditorData.KeyListPref,
1973 wxT(""), &ContactEditorData.KeyListTokens );
1975 ResetSaveProcessData();
1979 // Vendor specific items.
1981 ResetSaveProcessData();
1983 for (std::map<int,wxString>::iterator iter = ContactEditorData.VendorList.begin();
1984 iter != ContactEditorData.VendorList.end(); ++iter){
1986 intValue2 = iter->first;
1988 // Get the IANA PEN number.
1990 striter = ContactEditorData.VendorListPEN.find(intValue2);
1992 if (striter->first == intValue2){
1994 strValue2 = striter->second;
1998 // Get the element name.
2000 striter = ContactEditorData.VendorListElement.find(intValue2);
2002 if (striter->first == intValue2){
2004 strValue3 = striter->second;
2010 striter = ContactEditorData.VendorList.find(intValue2);
2012 if (striter->first == intValue2){
2014 strValue = striter->second;
2018 // Add to the vCard.
2020 if (boolValue == TRUE){
2022 ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
2026 ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
2030 ResetSaveProcessData();
2034 ResetSaveProcessData();
2038 for (std::map<int,wxString>::iterator iter = ContactEditorData.XTokenList.begin();
2039 iter != ContactEditorData.XTokenList.end(); ++iter){
2041 intValue2 = iter->first;
2043 // Get the element name.
2045 striter = ContactEditorData.XTokenListTokens.find(intValue2);
2047 if (striter->first == intValue2){
2049 strValue2 = striter->second;
2055 striter = ContactEditorData.XTokenList.find(intValue2);
2057 if (striter->first == intValue2){
2059 strValue = striter->second;
2063 // Add to the vCard.
2065 if (boolValue == TRUE){
2067 ContactData.AddRaw(wxT("X-") + strValue2, strValue);
2071 ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
2075 ResetSaveProcessData();
2079 ResetSaveProcessData();
2081 if (ContactEditorData.FullNamesList.size() == 0){
2083 wxString FullName = cmbDisplayAs->GetValue();
2084 ContactEditorData.FullNamesList.insert(std::make_pair(0, FullName));
2085 ContactEditorData.FullNamesListAltID.insert(std::make_pair(0, wxT("")));
2086 ContactEditorData.FullNamesListPID.insert(std::make_pair(0, wxT("")));
2087 ContactEditorData.FullNamesListType.insert(std::make_pair(0, wxT("")));
2088 ContactEditorData.FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
2089 ContactEditorData.FullNamesListPref.insert(std::make_pair(0, 0));
2090 ContactEditorData.FullNamesListTokens.insert(std::make_pair(0, wxT("")));
2095 for (std::map<int, wxString>::iterator iter = ContactEditorData.FullNamesList.begin();
2096 iter != ContactEditorData.FullNamesList.end(); ++iter){
2098 if (FNFirst == TRUE){
2100 iter->second = cmbDisplayAs->GetValue();
2105 std::map<int,wxString>::iterator mapS;
2107 mapS = ContactEditorData.FullNamesListTokens.find(iter->first);
2109 ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue,
2110 &iter, &ContactEditorData.FullNamesList, &ContactData,
2111 wxT("ALTID"), &ContactEditorData.FullNamesListAltID,
2112 wxT("PID"), &ContactEditorData.FullNamesListPID,
2113 wxT("TYPE"), &ContactEditorData.FullNamesListType,
2114 wxT("LANGUAGE"), &ContactEditorData.FullNamesListLanguage,
2115 wxT("PREF"), &ContactEditorData.FullNamesListPref,
2116 wxT(""), &ContactEditorData.FullNamesListTokens );
2120 ResetSaveProcessData();
2124 //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
2126 // Insert revision (REV) date.
2128 // Get today's date and time.
2130 wxDateTime DateTimeNow = wxDateTime::Now();
2134 // Set year, month and date.
2136 int intYear = DateTimeNow.GetYear();
2137 int intMonth = DateTimeNow.GetMonth();
2138 int intDay = DateTimeNow.GetDay();
2140 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
2144 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
2148 DateRev.Append(wxString::Format(wxT("%i"), intMonth));
2154 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
2158 DateRev.Append(wxString::Format(wxT("%i"), intDay));
2162 //DateRev.Append(wx);
2163 //DateRev.Append(wx);
2164 //DateRev.Append(wx);
2165 DateRev.Append(wxT("T"));
2167 // Set hour, minute and second.
2169 int intHour = DateTimeNow.GetHour();
2170 int intMinute = DateTimeNow.GetMinute();
2171 int intSecond = DateTimeNow.GetSecond();
2175 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
2179 DateRev.Append(wxString::Format(wxT("%i"), intHour));
2183 if (intMinute < 10){
2185 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
2189 DateRev.Append(wxString::Format(wxT("%i"), intMinute));
2193 if (intSecond < 10){
2195 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
2199 DateRev.Append(wxString::Format(wxT("%i"), intSecond));
2203 // DateRev.Append(wx);
2204 // DateRev.Append(wx);
2205 // DateRev.Append(wxString DateTimeNow->);
2206 DateRev.Append(wxT("Z"));
2208 ContactData.Add(wxT("UID"), ContactEditorData.UIDToken, FALSE);
2210 // End the vCard File.
2212 ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
2215 ContactData.WriteFile(FilenameFinal);
2217 vCard34Conv ConvFileFun;
2221 ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
2223 wxString AccountDirPrefix;
2224 wxString AccountDir;
2227 #if defined(__HAIKU__)
2229 //preffilename = wxT("noo");
2231 #elif defined(__APPLE__)
2233 PrefDir = GetUserPrefDir();
2235 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2237 #elif defined(__WIN32__)
2239 PrefDir = GetUserPrefDir();
2241 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
2245 PrefDir = GetUserPrefDir();
2247 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2251 XABPreferences PrefData(PrefDir);
2253 wxString AccountType;
2255 for (int i = 0; i < PrefData.accounts.GetCount(); i++){
2257 AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
2259 if (AccountDir == wxSContactAccount){
2261 AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
2262 AccountDirPrefix.Trim();
2263 AccountType = PrefData.accounts.GetAccountType(i);
2270 wxString wxSplitFilename;
2271 wxString wxSDataURL;
2273 while(wSTFilename.HasMoreTokens()){
2275 wxSplitFilename = wSTFilename.GetNextToken();
2279 wxSDataURL = wxSplitFilename;
2280 //wxSDataURL.Append(wxSplitFilename);
2282 // Find out if the filename exists in the table.
2284 if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
2286 wxString ETagResult;
2287 wxString ETagOriginal;
2289 ETagDB *ETagDBPtr = NULL;
2291 ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
2293 wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
2294 wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
2296 if (wxSETagOrig.IsEmpty()){
2298 // Generate the ETag.
2300 wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2304 if (wxSETag.IsEmpty()){
2306 // Update empty ETag.
2308 wxSETag = wxSETagOrig;
2309 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
2314 // Don't change original ETag.
2316 wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2317 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
2321 if (EditMode == FALSE){
2323 ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2325 FMTimer.SetFilename(FilenameFinal);
2326 FMTimer.UpdateTimestamp();
2327 FMTimer.Start(10000, FALSE);
2329 wxCommandEvent reloadevent(RELOADCONTACTLIST);
2330 reloadevent.SetString(wxSContactAccount);
2331 wxPostEvent(this->GetParent(), reloadevent);
2336 ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2337 FMTimer.UpdateTimestamp();
2338 FMTimer.Start(10000, FALSE);
2344 // Send a notification to update the main window
2345 // with the new details.
2350 // TODO: Workout nickname settings by priority and
2353 ucd->ContactAccount = wxSContactAccount;
2354 ucd->ContactFilename = FilenameFinal;
2355 ucd->ContactName = cmbDisplayAs->GetValue();
2356 ucd->ContactNameArray = ContactData.GetName();
2358 for (std::map<int,wxString>::iterator gniter = ContactEditorData.GeneralNicknamesList.begin();
2359 gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){
2361 ucd->ContactNickname = gniter->second;
2366 wxCommandEvent event2(CE_UPDATECONTACTLIST);
2367 event2.SetClientData(ucd);
2368 wxPostEvent(MainPtr, event2);
2372 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
2375 // Save the updated contact data and close the form.
2377 wxCommandEvent NullEvent;
2378 this->SaveContact(NullEvent);