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.
157 bool boolValue = FALSE;
158 bool boolValue2 = FALSE;
160 bool NNGeneralFirst = TRUE;
161 bool NNHomeFirst = TRUE;
162 bool NNWorkFirst = TRUE;
164 std::map<int,int>::iterator intiter;
165 std::map<int,wxString>::iterator striter;
167 ContactData.Add(wxT("BEGIN"), wxT("VCARD"), FALSE);
168 ContactData.Add(wxT("VERSION"), wxT("4.0"), FALSE);
170 // Setup the version string.
172 strValue.Append(wxT("-//Xestia//Address Book Version "));
173 strValue.Append(wxT(XSDAB_VERSION));
174 strValue.Append(wxT("//KW"));
176 ContactData.Add(wxT("PRODID"), strValue, FALSE);
182 // Setup the name field.
184 strValue = txtSurname->GetValue() + wxT(";") +
185 txtForename->GetValue() + wxT(";") +
186 txtOtherNames->GetValue() + wxT(";") +
187 txtTitle->GetValue() + wxT(";") +
188 txtSuffix->GetValue();
190 strValue2 = ContactData.Convert(cmbDisplayAs->GetValue(), FALSE);
193 if (ContactEditorData.NameTokens.IsEmpty()){
194 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\""), strValue, FALSE);
196 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\";") + ContactEditorData.NameTokens, strValue, FALSE);
199 if (cmbType->GetCurrentSelection() == 1){
201 ContactData.AddRaw(wxT("KIND"), wxT("individual"));
203 } else if (cmbType->GetCurrentSelection() == 2){
205 ContactData.AddRaw(wxT("KIND"), wxT("group"));
207 // Go through each of the members and write them out.
209 for (std::map<int, wxString>::iterator itemiter = ContactEditorData.GroupsList.begin();
210 itemiter != ContactEditorData.GroupsList.end(); ++itemiter){
212 ContactData.Add(wxT("MEMBER:urn:uuid"), itemiter->second, FALSE);
216 } else if (cmbType->GetCurrentSelection() == 3){
218 ContactData.AddRaw(wxT("KIND"), wxT("org"));
220 } else if (cmbType->GetCurrentSelection() == 4){
222 ContactData.AddRaw(wxT("KIND"), wxT("location"));
227 // Setup the nicknames (General, Home & Business).
240 if (cmbGender->GetCurrentSelection() != 0){
242 switch(cmbGender->GetCurrentSelection()){
273 if (!txtGenderDescription->IsEmpty()){
275 strValue2 = txtGenderDescription->GetValue();
279 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
281 EscapeString(&strValue2, FALSE);
283 if (!ContactEditorData.GenderTokens.IsEmpty()){
285 if (!strValue2.IsEmpty()){
287 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue + wxT(";") + strValue2);
291 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue);
297 if (!strValue2.IsEmpty()){
299 ContactData.AddRaw(wxT("GENDER"), strValue + wxT(";") + strValue2);
303 ContactData.AddRaw(wxT("GENDER"), strValue);
322 strValue3 = ContactEditorData.BirthdayAltID;
324 if (!strValue3.IsEmpty()){
329 strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
335 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
340 strValue3 = ContactEditorData.BirthdayCalScale;
342 if (!strValue3.IsEmpty()){
347 if (boolValue2 == TRUE){
349 strValue2.Append(wxT(";"));
357 strValue2.Append(wxT("CALSCALE=") + strValue3);
365 strValue2 = ContactEditorData.BirthdayTokens;
367 // Get the birthday and write it.
369 ResetSaveProcessData();
371 if (!txtBirthday->IsEmpty()){
373 strValue = txtBirthday->GetValue();
375 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
377 if (!strValue2.IsEmpty()){
379 EscapeString(&strValue2, FALSE);
380 EscapeString(&strValue, FALSE);
382 ContactData.AddRaw(wxT("BDAY;VALUE=text;") + strValue2 + wxT(";"), strValue);
386 EscapeString(&strValue, FALSE);
388 ContactData.AddRaw(wxT("BDAY;VALUE=text"), strValue);
398 // Get Day, Month & Year.
400 wxDateTime BirthdayDate;
401 wxDateTime::Month BirthdayMonth;
404 wxString DataBeforeT;
406 wxString FinalBirthdayString;
407 bool ProcessDataAfterT = FALSE;
409 BirthdayDate = dapBirthday->GetValue();
411 if (BirthdayDate.IsValid()){
413 BirthdayDay = BirthdayDate.GetDay();
414 BirthdayMonth = BirthdayDate.GetMonth();
415 BirthdayYear = BirthdayDate.GetYear();
417 // Look for T and replace data before this.
419 wxStringTokenizer wSTDate(ContactEditorData.Birthday, wxT("T"));
421 while (wSTDate.HasMoreTokens()){
423 if (ProcessDataAfterT == FALSE){
425 DataBeforeT = wSTDate.GetNextToken();
426 ProcessDataAfterT = TRUE;
430 DataAfterT = wSTDate.GetNextToken();
437 // If there is not T then replace altogether.
439 wxString FinalBirthdayDay;
440 wxString FinalBirthdayMonth;
441 wxString FinalBirthdayYear;
443 if (BirthdayDay < 10){
445 FinalBirthdayDay = wxT("0") + wxString::Format(wxT("%i"), BirthdayDay);
449 FinalBirthdayDay = wxString::Format(wxT("%i"), BirthdayDay);
453 if (((int)BirthdayMonth + 1) < 10){
455 FinalBirthdayMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
459 FinalBirthdayMonth = wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
463 if (BirthdayYear == 0){
465 FinalBirthdayYear = wxT("--");
469 FinalBirthdayYear = wxString::Format(wxT("%i"), BirthdayYear);
473 if (!DataAfterT.IsEmpty()){
475 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay + wxT("T") + DataAfterT;
479 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay;
483 if (!FinalBirthdayString.IsEmpty() || !strValue2.IsEmpty()){
485 if (!strValue2.IsEmpty()){
487 EscapeString(&strValue2, FALSE);
488 EscapeString(&strValue, FALSE);
490 ContactData.AddRaw(wxT("BDAY") + strValue2 + wxT(";"), FinalBirthdayString);
494 EscapeString(&strValue, FALSE);
496 ContactData.AddRaw(wxT("BDAY"), FinalBirthdayString);
506 ResetSaveProcessData();
510 strValue3 = ContactEditorData.AnniversaryAltID;
512 if (!strValue3.IsEmpty()){
517 strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
523 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
528 strValue3 = ContactEditorData.AnniversaryCalScale;
530 if (!strValue3.IsEmpty()){
535 if (boolValue2 == TRUE){
537 strValue2.Append(wxT(";"));
545 strValue2.Append(wxT("CALSCALE=") + strValue3);
553 strValue2 = ContactEditorData.AnniversaryTokens;
555 // Deal with ANNIVERSARY.
557 if (!txtAnniversary->IsEmpty()){
559 strValue = txtAnniversary->GetValue();
561 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
563 if (!strValue2.IsEmpty()){
565 EscapeString(&strValue2, FALSE);
566 EscapeString(&strValue, FALSE);
568 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text;") + strValue2 + wxT(";"), strValue);
572 EscapeString(&strValue, FALSE);
574 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text"), strValue);
582 // Look for T and replace data before this.
584 // Get Day, Month & Year.
586 wxDateTime AnniversaryDate;
587 wxDateTime::Month AnniversaryMonth;
590 wxString DataBeforeT;
592 wxString FinalAnniversaryString;
593 bool ProcessDataAfterT = FALSE;
595 AnniversaryDate = dapAnniversary->GetValue();
597 if (AnniversaryDate.IsValid()){
599 AnniversaryDay = AnniversaryDate.GetDay();
600 AnniversaryMonth = AnniversaryDate.GetMonth();
601 AnniversaryYear = AnniversaryDate.GetYear();
603 // Look for T and replace data before this.
605 wxStringTokenizer wSTDate(ContactEditorData.Anniversary, wxT("T"));
607 while (wSTDate.HasMoreTokens()){
609 if (ProcessDataAfterT == FALSE){
611 DataBeforeT = wSTDate.GetNextToken();
612 ProcessDataAfterT = TRUE;
616 DataAfterT = wSTDate.GetNextToken();
623 // If there is not T then replace altogether.
625 wxString FinalAnniversaryDay;
626 wxString FinalAnniversaryMonth;
627 wxString FinalAnniversaryYear;
629 if (AnniversaryDay < 10){
631 FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
635 FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
639 if (((int)AnniversaryMonth + 1) < 10){
641 FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
645 FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
649 if (AnniversaryYear == 0){
651 FinalAnniversaryYear = wxT("--");
655 FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
659 if (!DataAfterT.IsEmpty()){
661 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
665 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
669 if (!FinalAnniversaryString.IsEmpty() || !strValue2.IsEmpty()){
671 if (!strValue2.IsEmpty()){
673 EscapeString(&strValue2, FALSE);
674 EscapeString(&strValue, FALSE);
676 ContactData.AddRaw(wxT("ANNIVERSARY") + strValue2 + wxT(";"), FinalAnniversaryString);
680 EscapeString(&strValue, FALSE);
682 ContactData.AddRaw(wxT("ANNIVERSARY"), FinalAnniversaryString);
692 // Setup the addresses (General, Home, Business).
694 //intValue = GeneralAddressList.size();
695 ResetSaveProcessData();
697 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralAddressList.begin();
698 iter != ContactEditorData.GeneralAddressList.end(); ++iter){
700 int intSeekValue = iter->first;
702 wxString strAddressString;
703 wxString strAddressFinalValue;
704 std::map<int, wxString>::iterator iterValue;
706 strAddressString.Append(wxT(";;"));
710 iterValue = ContactEditorData.GeneralAddressList.find(intSeekValue);
711 strAddressFinalValue = iterValue->second;
712 ProcessCaptureStrings(&strAddressFinalValue);
713 strAddressString.Append(strAddressFinalValue + wxT(";"));
714 strAddressFinalValue.Clear();
718 iterValue = ContactEditorData.GeneralAddressListTown.find(intSeekValue);
719 strAddressFinalValue = iterValue->second;
720 ProcessCaptureStrings(&strAddressFinalValue);
721 strAddressString.Append(strAddressFinalValue + wxT(";"));
722 strAddressFinalValue.Clear();
726 iterValue = ContactEditorData.GeneralAddressListCounty.find(intSeekValue);
727 strAddressFinalValue = iterValue->second;
728 ProcessCaptureStrings(&strAddressFinalValue);
729 strAddressString.Append(strAddressFinalValue + wxT(";"));
730 strAddressFinalValue.Clear();
734 iterValue = ContactEditorData.GeneralAddressListPostCode.find(intSeekValue);
735 strAddressFinalValue = iterValue->second;
736 ProcessCaptureStrings(&strAddressFinalValue);
737 strAddressString.Append(strAddressFinalValue + wxT(";"));
738 strAddressFinalValue.Clear();
742 iterValue = ContactEditorData.GeneralAddressListCountry.find(intSeekValue);
743 strAddressFinalValue = iterValue->second;
744 ProcessCaptureStrings(&strAddressFinalValue);
745 strAddressString.Append(strAddressFinalValue);
746 strAddressFinalValue.Clear();
748 ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
749 &iter, &strAddressString, &ContactData,
750 wxT("LABEL"), &ContactEditorData.GeneralAddressListLabel,
751 wxT("LANGUAGE"), &ContactEditorData.GeneralAddressListLang,
752 wxT("ALTID"), &ContactEditorData.GeneralAddressListAltID,
753 wxT("PID"), &ContactEditorData.GeneralAddressListPID,
754 wxT("GEO"), &ContactEditorData.GeneralAddressListGeo,
755 wxT("TZ"), &ContactEditorData.GeneralAddressListTimezone,
756 wxT("MEDIATYPE"), &ContactEditorData.GeneralAddressListMediatype,
757 wxT("PREF"), &ContactEditorData.GeneralAddressListPref,
758 wxT(""), &ContactEditorData.GeneralAddressListTokens );
760 ResetSaveProcessData();
764 ResetSaveProcessData();
766 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeAddressList.begin();
767 iter != ContactEditorData.HomeAddressList.end(); ++iter){
769 int intSeekValue = iter->first;
771 wxString strAddressString;
772 wxString strAddressFinalValue;
773 std::map<int, wxString>::iterator iterValue;
775 strAddressString.Append(wxT(";;"));
779 iterValue = ContactEditorData.HomeAddressList.find(intSeekValue);
780 strAddressFinalValue = iterValue->second;
781 ProcessCaptureStrings(&strAddressFinalValue);
782 strAddressString.Append(strAddressFinalValue + wxT(";"));
786 iterValue = ContactEditorData.HomeAddressListTown.find(intSeekValue);
787 strAddressFinalValue = iterValue->second;
788 ProcessCaptureStrings(&strAddressFinalValue);
789 strAddressString.Append(strAddressFinalValue + wxT(";"));
793 iterValue = ContactEditorData.HomeAddressListCounty.find(intSeekValue);
794 strAddressFinalValue = iterValue->second;
795 ProcessCaptureStrings(&strAddressFinalValue);
796 strAddressString.Append(strAddressFinalValue + wxT(";"));
800 iterValue = ContactEditorData.HomeAddressListPostCode.find(intSeekValue);
801 strAddressFinalValue = iterValue->second;
802 ProcessCaptureStrings(&strAddressFinalValue);
803 strAddressString.Append(strAddressFinalValue + wxT(";"));
807 iterValue = ContactEditorData.HomeAddressListCountry.find(intSeekValue);
808 strAddressFinalValue = iterValue->second;
809 ProcessCaptureStrings(&strAddressFinalValue);
810 strAddressString.Append(strAddressFinalValue);
812 ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
813 &iter, &strAddressString, &ContactData,
814 wxT("LABEL"), &ContactEditorData.HomeAddressListLabel,
815 wxT("LANGUAGE"), &ContactEditorData.HomeAddressListLang,
816 wxT("ALTID"), &ContactEditorData.HomeAddressListAltID,
817 wxT("PID"), &ContactEditorData.HomeAddressListPID,
818 wxT("GEO"), &ContactEditorData.HomeAddressListGeo,
819 wxT("TZ"), &ContactEditorData.HomeAddressListTimezone,
820 wxT("MEDIATYPE"), &ContactEditorData.HomeAddressListMediatype,
821 wxT("PREF"), &ContactEditorData.HomeAddressListPref,
822 wxT(""), &ContactEditorData.HomeAddressListTokens );
824 ResetSaveProcessData();
828 ResetSaveProcessData();
830 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessAddressList.begin();
831 iter != ContactEditorData.BusinessAddressList.end(); ++iter){
833 int intSeekValue = iter->first;
835 wxString strAddressString;
836 wxString strAddressFinalValue;
837 std::map<int, wxString>::iterator iterValue;
839 strAddressString.Append(wxT(";;"));
843 iterValue = ContactEditorData.BusinessAddressList.find(intSeekValue);
844 strAddressFinalValue = iterValue->second;
845 ProcessCaptureStrings(&strAddressFinalValue);
847 strAddressString.Append(strAddressFinalValue + wxT(";"));
851 iterValue = ContactEditorData.BusinessAddressListTown.find(intSeekValue);
852 strAddressFinalValue = iterValue->second;
853 ProcessCaptureStrings(&strAddressFinalValue);
855 strAddressString.Append(strAddressFinalValue + wxT(";"));
859 iterValue = ContactEditorData.BusinessAddressListCounty.find(intSeekValue);
860 strAddressFinalValue = iterValue->second;
861 ProcessCaptureStrings(&strAddressFinalValue);
863 strAddressString.Append(strAddressFinalValue + wxT(";"));
867 iterValue = ContactEditorData.BusinessAddressListPostCode.find(intSeekValue);
868 strAddressFinalValue = iterValue->second;
869 ProcessCaptureStrings(&strAddressFinalValue);
871 strAddressString.Append(strAddressFinalValue + wxT(";"));
875 iterValue = ContactEditorData.BusinessAddressListCountry.find(intSeekValue);
876 strAddressFinalValue = iterValue->second;
877 ProcessCaptureStrings(&strAddressFinalValue);
879 strAddressString.Append(strAddressFinalValue);
881 ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
882 &iter, &strAddressString, &ContactData,
883 wxT("LABEL"), &ContactEditorData.BusinessAddressListLabel,
884 wxT("LANGUAGE"), &ContactEditorData.BusinessAddressListLang,
885 wxT("ALTID"), &ContactEditorData.BusinessAddressListAltID,
886 wxT("PID"), &ContactEditorData.BusinessAddressListPID,
887 wxT("GEO"), &ContactEditorData.BusinessAddressListGeo,
888 wxT("TZ"), &ContactEditorData.BusinessAddressListTimezone,
889 wxT("MEDIATYPE"), &ContactEditorData.BusinessAddressListMediatype,
890 wxT("PREF"), &ContactEditorData.BusinessAddressListPref,
891 wxT(""), &ContactEditorData.BusinessAddressListTokens );
893 ResetSaveProcessData();
897 // Sort out nicknames (if any).
899 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNicknamesList.begin();
900 iter != ContactEditorData.GeneralNicknamesList.end(); ++iter){
902 intValue2 = iter->first;
904 // Process Alternative ID.
906 ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
907 &iter, &ContactEditorData.GeneralNicknamesList, &ContactData,
908 wxT("LANGUAGE"), &ContactEditorData.GeneralNicknamesListLanguage,
909 wxT("ALTID"), &ContactEditorData.GeneralNicknamesListAltID,
910 wxT("PID"), &ContactEditorData.GeneralNicknamesListPID,
911 wxT("PREF"), &ContactEditorData.GeneralNicknamesListPref,
912 wxT(""), &ContactEditorData.GeneralNicknamesListTokens );
914 ResetSaveProcessData();
918 ResetSaveProcessData();
920 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNicknamesList.begin();
921 iter != ContactEditorData.HomeNicknamesList.end(); ++iter){
923 ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
924 &iter, &ContactEditorData.HomeNicknamesList, &ContactData,
925 wxT("LANGUAGE"), &ContactEditorData.HomeNicknamesListLanguage,
926 wxT("ALTID"), &ContactEditorData.HomeNicknamesListAltID,
927 wxT("PID"), &ContactEditorData.HomeNicknamesListPID,
928 wxT("PREF"), &ContactEditorData.HomeNicknamesListPref,
929 wxT(""), &ContactEditorData.HomeNicknamesListTokens );
931 ResetSaveProcessData();
935 ResetSaveProcessData();
937 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNicknamesList.begin();
938 iter != ContactEditorData.BusinessNicknamesList.end(); ++iter){
940 ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
941 &iter, &ContactEditorData.BusinessNicknamesList, &ContactData,
942 wxT("LANGUAGE"), &ContactEditorData.BusinessNicknamesListLanguage,
943 wxT("ALTID"), &ContactEditorData.BusinessNicknamesListAltID,
944 wxT("PID"), &ContactEditorData.BusinessNicknamesListPID,
945 wxT("PREF"), &ContactEditorData.BusinessNicknamesListPref,
946 wxT(""), &ContactEditorData.BusinessNicknamesListTokens );
948 ResetSaveProcessData();
952 ResetSaveProcessData();
954 // Sort out email (general, home and business).
956 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralEmailList.begin();
957 iter != ContactEditorData.GeneralEmailList.end(); ++iter){
959 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
962 wxString strAddressFinalValue;
963 std::map<int, wxString>::iterator iterValue;
965 ProcessSaveData(wxT("EMAIL"), &strValue2, &boolValue2, &boolValue,
966 &iter, &ContactEditorData.GeneralEmailList, &ContactData,
967 wxT("ALTID"), &ContactEditorData.GeneralEmailListAltID,
968 wxT("PID"), &ContactEditorData.GeneralEmailListPID,
969 wxT("PREF"), &ContactEditorData.GeneralEmailListPref,
970 wxT(""), &ContactEditorData.GeneralEmailListTokens );
972 ResetSaveProcessData();
976 ResetSaveProcessData();
978 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeEmailList.begin();
979 iter != ContactEditorData.HomeEmailList.end(); ++iter){
981 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
984 ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
985 &iter, &ContactEditorData.HomeEmailList, &ContactData,
986 wxT("ALTID"), &ContactEditorData.HomeEmailListAltID,
987 wxT("PID"), &ContactEditorData.HomeEmailListPID,
988 wxT("PREF"), &ContactEditorData.HomeEmailListPref,
989 wxT(""), &ContactEditorData.HomeEmailListTokens );
991 ResetSaveProcessData();
995 ResetSaveProcessData();
997 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessEmailList.begin();
998 iter != ContactEditorData.BusinessEmailList.end(); ++iter){
1000 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1003 ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1004 &iter, &ContactEditorData.BusinessEmailList, &ContactData,
1005 wxT("ALTID"), &ContactEditorData.BusinessEmailListAltID,
1006 wxT("PID"), &ContactEditorData.BusinessEmailListPID,
1007 wxT("PREF"), &ContactEditorData.BusinessEmailListPref,
1008 wxT(""), &ContactEditorData.BusinessEmailListTokens );
1010 ResetSaveProcessData();
1014 ResetSaveProcessData();
1016 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralIMList.begin();
1017 iter != ContactEditorData.GeneralIMList.end(); ++iter){
1019 intValue2 = iter->first;
1021 // Process Alternative ID.
1023 ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
1024 &iter, &ContactEditorData.GeneralIMList, &ContactData,
1025 wxT("ALTID"), &ContactEditorData.GeneralIMListAltID,
1026 wxT("PID"), &ContactEditorData.GeneralIMListPID,
1027 wxT("MEDIATYPE"), &ContactEditorData.GeneralIMListMediatype,
1028 wxT("PREF"), &ContactEditorData.GeneralIMListPref,
1029 wxT(""), &ContactEditorData.GeneralIMListTokens );
1031 ResetSaveProcessData();
1035 ResetSaveProcessData();
1037 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeIMList.begin();
1038 iter != ContactEditorData.HomeIMList.end(); ++iter){
1040 ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1041 &iter, &ContactEditorData.HomeIMList, &ContactData,
1042 wxT("ALTID"), &ContactEditorData.HomeIMListAltID,
1043 wxT("PID"), &ContactEditorData.HomeIMListPID,
1044 wxT("MEDIATYPE"), &ContactEditorData.HomeIMListMediatype,
1045 wxT("PREF"), &ContactEditorData.HomeIMListPref,
1046 wxT(""), &ContactEditorData.HomeIMListTokens );
1048 ResetSaveProcessData();
1052 ResetSaveProcessData();
1054 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessIMList.begin();
1055 iter != ContactEditorData.BusinessIMList.end(); ++iter){
1057 ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1058 &iter, &ContactEditorData.BusinessIMList, &ContactData,
1059 wxT("ALTID"), &ContactEditorData.BusinessIMListAltID,
1060 wxT("PID"), &ContactEditorData.BusinessIMListPID,
1061 wxT("MEDIATYPE"), &ContactEditorData.BusinessIMListMediatype,
1062 wxT("PREF"), &ContactEditorData.BusinessIMListPref,
1063 wxT(""), &ContactEditorData.BusinessIMListTokens );
1065 ResetSaveProcessData();
1069 ResetSaveProcessData();
1071 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTelephoneList.begin();
1072 iter != ContactEditorData.GeneralTelephoneList.end(); ++iter){
1074 wxString strAddressFinalValue = iter->second;
1076 ProcessCaptureStrings(&strAddressFinalValue);
1078 if (ContactEditorData.GeneralTelephoneListDataType.find(iter->first) !=
1079 ContactEditorData.GeneralTelephoneListDataType.end()){
1081 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralTelephoneListDataType.find(iter->first);
1083 strAddressFinalValue.insert(0, ":");
1084 strAddressFinalValue.insert(0, DataTypeIter->second);
1088 strAddressFinalValue.insert(0, "tel:");
1092 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1093 &iter, &strAddressFinalValue, &ContactData,
1094 wxT("ALTID"), &ContactEditorData.GeneralTelephoneListAltID,
1095 wxT("PID"), &ContactEditorData.GeneralTelephoneListPID,
1096 wxT("TYPE"), &ContactEditorData.GeneralTelephoneListType,
1097 wxT("PREF"), &ContactEditorData.GeneralTelephoneListPref,
1098 wxT(""), &ContactEditorData.GeneralTelephoneListTokens );
1100 ResetSaveProcessData();
1104 ResetSaveProcessData();
1106 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTelephoneList.begin();
1107 iter != ContactEditorData.HomeTelephoneList.end(); ++iter){
1109 wxString strAddressFinalValue = iter->second;
1111 ProcessCaptureStrings(&strAddressFinalValue);
1113 if (ContactEditorData.HomeTelephoneListDataType.find(iter->first) !=
1114 ContactEditorData.HomeTelephoneListDataType.end()){
1116 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeTelephoneListDataType.find(iter->first);
1118 strAddressFinalValue.insert(0, ":");
1119 strAddressFinalValue.insert(0, DataTypeIter->second);
1123 strAddressFinalValue.insert(0, "tel:");
1127 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1128 &iter, &strAddressFinalValue, &ContactData,
1129 wxT("ALTID"), &ContactEditorData.HomeTelephoneListAltID,
1130 wxT("PID"), &ContactEditorData.HomeTelephoneListPID,
1131 wxT("TYPE"), &ContactEditorData.HomeTelephoneListType,
1132 wxT("PREF"), &ContactEditorData.HomeTelephoneListPref,
1133 wxT(""), &ContactEditorData.HomeTelephoneListTokens );
1135 ResetSaveProcessData();
1139 ResetSaveProcessData();
1141 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTelephoneList.begin();
1142 iter != ContactEditorData.BusinessTelephoneList.end(); ++iter){
1144 wxString strAddressFinalValue = iter->second;
1146 ProcessCaptureStrings(&strAddressFinalValue);
1148 if (ContactEditorData.BusinessTelephoneListDataType.find(iter->first) !=
1149 ContactEditorData.BusinessTelephoneListDataType.end()){
1151 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessTelephoneListDataType.find(iter->first);
1153 strAddressFinalValue.insert(0, ":");
1154 strAddressFinalValue.insert(0, DataTypeIter->second);
1158 strAddressFinalValue.insert(0, "tel:");
1162 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1163 &iter, &strAddressFinalValue, &ContactData,
1164 wxT("ALTID"), &ContactEditorData.BusinessTelephoneListAltID,
1165 wxT("PID"), &ContactEditorData.BusinessTelephoneListPID,
1166 wxT("TYPE"), &ContactEditorData.BusinessTelephoneListType,
1167 wxT("PREF"), &ContactEditorData.BusinessTelephoneListPref,
1168 wxT(""), &ContactEditorData.BusinessTelephoneListTokens );
1170 ResetSaveProcessData();
1174 ResetSaveProcessData();
1176 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralLanguageList.begin();
1177 iter != ContactEditorData.GeneralLanguageList.end(); ++iter){
1179 intValue2 = iter->first;
1181 ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
1182 &iter, &ContactEditorData.GeneralLanguageList, &ContactData,
1183 wxT("ALTID"), &ContactEditorData.GeneralLanguageListAltID,
1184 wxT("PID"), &ContactEditorData.GeneralLanguageListPID,
1185 wxT("PREF"), &ContactEditorData.GeneralLanguageListPref,
1186 wxT(""), &ContactEditorData.GeneralLanguageListTokens );
1188 ResetSaveProcessData();
1192 ResetSaveProcessData();
1194 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeLanguageList.begin();
1195 iter != ContactEditorData.HomeLanguageList.end(); ++iter){
1197 ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1198 &iter, &ContactEditorData.HomeLanguageList, &ContactData,
1199 wxT("ALTID"), &ContactEditorData.HomeLanguageListAltID,
1200 wxT("PID"), &ContactEditorData.HomeLanguageListPID,
1201 wxT("PREF"), &ContactEditorData.HomeLanguageListPref,
1202 wxT(""), &ContactEditorData.HomeLanguageListTokens );
1204 ResetSaveProcessData();
1208 ResetSaveProcessData();
1210 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessLanguageList.begin();
1211 iter != ContactEditorData.BusinessLanguageList.end(); ++iter){
1213 ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1214 &iter, &ContactEditorData.BusinessLanguageList, &ContactData,
1215 wxT("ALTID"), &ContactEditorData.BusinessLanguageListAltID,
1216 wxT("PID"), &ContactEditorData.BusinessLanguageListPID,
1217 wxT("PREF"), &ContactEditorData.BusinessLanguageListPref,
1218 wxT(""), &ContactEditorData.BusinessLanguageListTokens );
1220 ResetSaveProcessData();
1224 ResetSaveProcessData();
1226 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTZList.begin();
1227 iter != ContactEditorData.GeneralTZList.end(); ++iter){
1229 ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
1230 &iter, &ContactEditorData.GeneralTZList, &ContactData,
1231 wxT("ALTID"), &ContactEditorData.GeneralTZListAltID,
1232 wxT("PID"), &ContactEditorData.GeneralTZListPID,
1233 wxT("MEDIATYPE"), &ContactEditorData.GeneralTZListMediatype,
1234 wxT("PREF"), &ContactEditorData.GeneralTZListPref,
1235 wxT(""), &ContactEditorData.GeneralTZListTokens );
1237 ResetSaveProcessData();
1241 ResetSaveProcessData();
1243 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTZList.begin();
1244 iter != ContactEditorData.HomeTZList.end(); ++iter){
1246 ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1247 &iter, &ContactEditorData.HomeTZList, &ContactData,
1248 wxT("ALTID"), &ContactEditorData.HomeTZListAltID,
1249 wxT("PID"), &ContactEditorData.HomeTZListPID,
1250 wxT("MEDIATYPE"), &ContactEditorData.HomeTZListMediatype,
1251 wxT("PREF"), &ContactEditorData.HomeTZListPref,
1252 wxT(""), &ContactEditorData.HomeTZListTokens );
1254 ResetSaveProcessData();
1258 ResetSaveProcessData();
1260 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTZList.begin();
1261 iter != ContactEditorData.BusinessTZList.end(); ++iter){
1263 ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1264 &iter, &ContactEditorData.BusinessTZList, &ContactData,
1265 wxT("ALTID"), &ContactEditorData.BusinessTZListAltID,
1266 wxT("PID"), &ContactEditorData.BusinessTZListPID,
1267 wxT("MEDIATYPE"), &ContactEditorData.BusinessTZListMediatype,
1268 wxT("PREF"), &ContactEditorData.BusinessTZListPref,
1269 wxT(""), &ContactEditorData.BusinessTZListTokens );
1271 ResetSaveProcessData();
1275 ResetSaveProcessData();
1277 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralGeographyList.begin();
1278 iter != ContactEditorData.GeneralGeographyList.end(); ++iter){
1280 wxString strAddressFinalValue = iter->second;
1282 ProcessCaptureStrings(&strAddressFinalValue);
1284 strAddressFinalValue.insert(0, wxT("geo:"));
1286 ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
1287 &iter, &strAddressFinalValue, &ContactData,
1288 wxT("ALTID"), &ContactEditorData.GeneralGeographyListAltID,
1289 wxT("PID"), &ContactEditorData.GeneralGeographyListPID,
1290 wxT("MEDIATYPE"), &ContactEditorData.GeneralGeographyListMediatype,
1291 wxT("PREF"), &ContactEditorData.GeneralGeographyListPref,
1292 wxT(""), &ContactEditorData.GeneralGeographyListTokens );
1294 ResetSaveProcessData();
1298 ResetSaveProcessData();
1300 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeGeographyList.begin();
1301 iter != ContactEditorData.HomeGeographyList.end(); ++iter){
1303 wxString strAddressFinalValue = iter->second;
1305 ProcessCaptureStrings(&strAddressFinalValue);
1307 strAddressFinalValue.insert(0, wxT("geo:"));
1309 ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1310 &iter, &ContactEditorData.HomeGeographyList, &ContactData,
1311 wxT("ALTID"), &ContactEditorData.HomeGeographyListAltID,
1312 wxT("PID"), &ContactEditorData.HomeGeographyListPID,
1313 wxT("MEDIATYPE"), &ContactEditorData.HomeGeographyListMediatype,
1314 wxT("PREF"), &ContactEditorData.HomeGeographyListPref,
1315 wxT(""), &ContactEditorData.HomeGeographyListTokens );
1317 ResetSaveProcessData();
1321 ResetSaveProcessData();
1323 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessGeographyList.begin();
1324 iter != ContactEditorData.BusinessGeographyList.end(); ++iter){
1326 wxString strAddressFinalValue = iter->second;
1328 ProcessCaptureStrings(&strAddressFinalValue);
1330 strAddressFinalValue.insert(0, wxT("geo:"));
1332 ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1333 &iter, &ContactEditorData.BusinessGeographyList, &ContactData,
1334 wxT("ALTID"), &ContactEditorData.BusinessGeographyListAltID,
1335 wxT("PID"), &ContactEditorData.BusinessGeographyListPID,
1336 wxT("MEDIATYPE"), &ContactEditorData.BusinessGeographyListMediatype,
1337 wxT("PREF"), &ContactEditorData.BusinessGeographyListPref,
1338 wxT(""), &ContactEditorData.BusinessGeographyListTokens );
1340 ResetSaveProcessData();
1344 ResetSaveProcessData();
1346 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRelatedList.begin();
1347 iter != ContactEditorData.GeneralRelatedList.end(); ++iter){
1349 ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
1350 &iter, &ContactEditorData.GeneralRelatedList, &ContactData,
1351 wxT("ALTID"), &ContactEditorData.GeneralRelatedListAltID,
1352 wxT("PID"), &ContactEditorData.GeneralRelatedListPID,
1353 wxT("LANGUAGE"), &ContactEditorData.GeneralRelatedListLanguage,
1354 wxT("TYPE"), &ContactEditorData.GeneralRelatedListRelType,
1355 wxT("PREF"), &ContactEditorData.GeneralRelatedListPref,
1356 wxT(""), &ContactEditorData.GeneralRelatedListTokens );
1358 ResetSaveProcessData();
1362 ResetSaveProcessData();
1364 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralWebsiteList.begin();
1365 iter != ContactEditorData.GeneralWebsiteList.end(); ++iter){
1367 ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
1368 &iter, &ContactEditorData.GeneralWebsiteList, &ContactData,
1369 wxT("ALTID"), &ContactEditorData.GeneralWebsiteListAltID,
1370 wxT("PID"), &ContactEditorData.GeneralWebsiteListPID,
1371 wxT("MEDIATYPE"), &ContactEditorData.GeneralWebsiteListMediatype,
1372 wxT("PREF"), &ContactEditorData.GeneralWebsiteListPref,
1373 wxT(""), &ContactEditorData.GeneralWebsiteListTokens );
1375 ResetSaveProcessData();
1379 ResetSaveProcessData();
1381 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeWebsiteList.begin();
1382 iter != ContactEditorData.HomeWebsiteList.end(); ++iter){
1384 ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1385 &iter, &ContactEditorData.HomeWebsiteList, &ContactData,
1386 wxT("ALTID"), &ContactEditorData.HomeWebsiteListAltID,
1387 wxT("PID"), &ContactEditorData.HomeWebsiteListPID,
1388 wxT("MEDIATYPE"), &ContactEditorData.HomeWebsiteListMediatype,
1389 wxT("PREF"), &ContactEditorData.HomeWebsiteListPref,
1390 wxT(""), &ContactEditorData.HomeWebsiteListTokens );
1392 ResetSaveProcessData();
1396 ResetSaveProcessData();
1398 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessWebsiteList.begin();
1399 iter != ContactEditorData.BusinessWebsiteList.end(); ++iter){
1401 ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1402 &iter, &ContactEditorData.BusinessWebsiteList, &ContactData,
1403 wxT("ALTID"), &ContactEditorData.BusinessWebsiteListAltID,
1404 wxT("PID"), &ContactEditorData.BusinessWebsiteListPID,
1405 wxT("MEDIATYPE"), &ContactEditorData.BusinessWebsiteListMediatype,
1406 wxT("PREF"), &ContactEditorData.BusinessWebsiteListPref,
1407 wxT(""), &ContactEditorData.BusinessWebsiteListTokens );
1409 ResetSaveProcessData();
1413 ResetSaveProcessData();
1415 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTitleList.begin();
1416 iter != ContactEditorData.GeneralTitleList.end(); ++iter){
1418 ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
1419 &iter, &ContactEditorData.GeneralTitleList, &ContactData,
1420 wxT("ALTID"), &ContactEditorData.GeneralTitleListAltID,
1421 wxT("PID"), &ContactEditorData.GeneralTitleListPID,
1422 wxT("LANGUAGE"), &ContactEditorData.GeneralTitleListLanguage,
1423 wxT("PREF"), &ContactEditorData.GeneralTitleListPref,
1424 wxT(""), &ContactEditorData.GeneralTitleListTokens );
1426 ResetSaveProcessData();
1430 ResetSaveProcessData();
1432 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTitleList.begin();
1433 iter != ContactEditorData.HomeTitleList.end(); ++iter){
1435 ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1436 &iter, &ContactEditorData.HomeTitleList, &ContactData,
1437 wxT("ALTID"), &ContactEditorData.HomeTitleListAltID,
1438 wxT("PID"), &ContactEditorData.HomeTitleListPID,
1439 wxT("LANGUAGE"), &ContactEditorData.HomeTitleListLanguage,
1440 wxT("PREF"), &ContactEditorData.HomeTitleListPref,
1441 wxT(""), &ContactEditorData.HomeTitleListTokens );
1443 ResetSaveProcessData();
1447 ResetSaveProcessData();
1449 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTitleList.begin();
1450 iter != ContactEditorData.BusinessTitleList.end(); ++iter){
1452 ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1453 &iter, &ContactEditorData.BusinessTitleList, &ContactData,
1454 wxT("ALTID"), &ContactEditorData.BusinessTitleListAltID,
1455 wxT("PID"), &ContactEditorData.BusinessTitleListPID,
1456 wxT("LANGUAGE"), &ContactEditorData.BusinessTitleListLanguage,
1457 wxT("PREF"), &ContactEditorData.BusinessTitleListPref,
1458 wxT(""), &ContactEditorData.BusinessTitleListTokens );
1460 ResetSaveProcessData();
1464 ResetSaveProcessData();
1466 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRoleList.begin();
1467 iter != ContactEditorData.GeneralRoleList.end(); ++iter){
1469 ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
1470 &iter, &ContactEditorData.GeneralRoleList, &ContactData,
1471 wxT("ALTID"), &ContactEditorData.GeneralRoleListAltID,
1472 wxT("PID"), &ContactEditorData.GeneralRoleListPID,
1473 wxT("LANGUAGE"), &ContactEditorData.GeneralRoleListLanguage,
1474 wxT("PREF"), &ContactEditorData.GeneralRoleListPref,
1475 wxT(""), &ContactEditorData.GeneralRoleListTokens );
1477 ResetSaveProcessData();
1481 ResetSaveProcessData();
1483 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeRoleList.begin();
1484 iter != ContactEditorData.HomeRoleList.end(); ++iter){
1486 ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1487 &iter, &ContactEditorData.HomeRoleList, &ContactData,
1488 wxT("ALTID"), &ContactEditorData.HomeRoleListAltID,
1489 wxT("PID"), &ContactEditorData.HomeRoleListPID,
1490 wxT("LANGUAGE"), &ContactEditorData.HomeRoleListLanguage,
1491 wxT("PREF"), &ContactEditorData.HomeRoleListPref,
1492 wxT(""), &ContactEditorData.HomeRoleListTokens );
1494 ResetSaveProcessData();
1498 ResetSaveProcessData();
1500 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessRoleList.begin();
1501 iter != ContactEditorData.BusinessRoleList.end(); ++iter){
1503 ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1504 &iter, &ContactEditorData.BusinessRoleList, &ContactData,
1505 wxT("ALTID"), &ContactEditorData.BusinessRoleListAltID,
1506 wxT("PID"), &ContactEditorData.BusinessRoleListPID,
1507 wxT("LANGUAGE"), &ContactEditorData.BusinessRoleListLanguage,
1508 wxT("PREF"), &ContactEditorData.BusinessRoleListPref,
1509 wxT(""), &ContactEditorData.BusinessRoleListTokens );
1511 ResetSaveProcessData();
1515 ResetSaveProcessData();
1517 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralOrganisationsList.begin();
1518 iter != ContactEditorData.GeneralOrganisationsList.end(); ++iter){
1520 ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
1521 &iter, &ContactEditorData.GeneralOrganisationsList, &ContactData,
1522 wxT("ALTID"), &ContactEditorData.GeneralOrganisationsListAltID,
1523 wxT("PID"), &ContactEditorData.GeneralOrganisationsListPID,
1524 wxT("LANGUAGE"), &ContactEditorData.GeneralOrganisationsListLanguage,
1525 wxT("SORT-AS"), &ContactEditorData.GeneralOrganisationsListSortAs,
1526 wxT("PREF"), &ContactEditorData.GeneralOrganisationsListPref,
1527 wxT(""), &ContactEditorData.GeneralOrganisationsListTokens );
1529 ResetSaveProcessData();
1533 ResetSaveProcessData();
1535 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeOrganisationsList.begin();
1536 iter != ContactEditorData.HomeOrganisationsList.end(); ++iter){
1538 ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1539 &iter, &ContactEditorData.HomeOrganisationsList, &ContactData,
1540 wxT("ALTID"), &ContactEditorData.HomeOrganisationsListAltID,
1541 wxT("PID"), &ContactEditorData.HomeOrganisationsListPID,
1542 wxT("LANGUAGE"), &ContactEditorData.HomeOrganisationsListLanguage,
1543 wxT("SORT-AS"), &ContactEditorData.HomeOrganisationsListSortAs,
1544 wxT("PREF"), &ContactEditorData.HomeOrganisationsListPref,
1545 wxT(""), &ContactEditorData.HomeOrganisationsListTokens );
1547 ResetSaveProcessData();
1551 ResetSaveProcessData();
1553 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessOrganisationsList.begin();
1554 iter != ContactEditorData.BusinessOrganisationsList.end(); ++iter){
1556 ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1557 &iter, &ContactEditorData.BusinessOrganisationsList, &ContactData,
1558 wxT("ALTID"), &ContactEditorData.BusinessOrganisationsListAltID,
1559 wxT("PID"), &ContactEditorData.BusinessOrganisationsListPID,
1560 wxT("LANGUAGE"), &ContactEditorData.BusinessOrganisationsListLanguage,
1561 wxT("SORT-AS"), &ContactEditorData.BusinessOrganisationsListSortAs,
1562 wxT("PREF"), &ContactEditorData.BusinessOrganisationsListPref,
1563 wxT(""), &ContactEditorData.BusinessOrganisationsListTokens );
1565 ResetSaveProcessData();
1569 ResetSaveProcessData();
1571 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNoteList.begin();
1572 iter != ContactEditorData.GeneralNoteList.end(); ++iter){
1574 ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
1575 &iter, &ContactEditorData.GeneralNoteList, &ContactData,
1576 wxT("ALTID"), &ContactEditorData.GeneralNoteListAltID,
1577 wxT("PID"), &ContactEditorData.GeneralNoteListPID,
1578 wxT("LANGUAGE"), &ContactEditorData.GeneralNoteListLanguage,
1579 wxT("PREF"), &ContactEditorData.GeneralNoteListPref,
1580 wxT(""), &ContactEditorData.GeneralNoteListTokens );
1582 ResetSaveProcessData();
1586 ResetSaveProcessData();
1588 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNoteList.begin();
1589 iter != ContactEditorData.HomeNoteList.end(); ++iter){
1591 ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1592 &iter, &ContactEditorData.HomeNoteList, &ContactData,
1593 wxT("ALTID"), &ContactEditorData.HomeNoteListAltID,
1594 wxT("PID"), &ContactEditorData.HomeNoteListPID,
1595 wxT("LANGUAGE"), &ContactEditorData.HomeNoteListLanguage,
1596 wxT("PREF"), &ContactEditorData.HomeNoteListPref,
1597 wxT(""), &ContactEditorData.HomeNoteListTokens );
1599 ResetSaveProcessData();
1603 ResetSaveProcessData();
1605 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNoteList.begin();
1606 iter != ContactEditorData.BusinessNoteList.end(); ++iter){
1608 ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1609 &iter, &ContactEditorData.BusinessNoteList, &ContactData,
1610 wxT("ALTID"), &ContactEditorData.BusinessNoteListAltID,
1611 wxT("PID"), &ContactEditorData.BusinessNoteListPID,
1612 wxT("LANGUAGE"), &ContactEditorData.BusinessNoteListLanguage,
1613 wxT("PREF"), &ContactEditorData.BusinessNoteListPref,
1614 wxT(""), &ContactEditorData.BusinessNoteListTokens );
1616 ResetSaveProcessData();
1620 ResetSaveProcessData();
1622 for (std::map<int,wxString>::iterator iter = ContactEditorData.CategoriesList.begin();
1623 iter != ContactEditorData.CategoriesList.end(); ++iter){
1625 ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
1626 &iter, &ContactEditorData.CategoriesList, &ContactData,
1627 wxT("ALTID"), &ContactEditorData.CategoriesListAltID,
1628 wxT("PID"), &ContactEditorData.CategoriesListPID,
1629 wxT("TYPE"), &ContactEditorData.CategoriesListType,
1630 wxT("PREF"), &ContactEditorData.CategoriesListPref,
1631 wxT(""), &ContactEditorData.CategoriesListTokens );
1633 ResetSaveProcessData();
1639 for (std::map<int, std::string>::iterator iter = ContactEditorData.PicturesList.begin();
1640 iter != ContactEditorData.PicturesList.end(); ++iter){
1642 int intValueIndex = iter->first;
1644 std::map<int, std::string>::iterator stdstriter;
1645 std::map<int, wxString>::iterator enciter;
1647 striter = ContactEditorData.PicturesListPictureType.find(intValueIndex);
1648 enciter = ContactEditorData.PicturesListPicEncType.find(intValueIndex);
1650 ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
1651 &iter, &ContactEditorData.PicturesList, &striter,
1652 &enciter, &ContactData,
1653 wxT("ALTID"), &ContactEditorData.PicturesListAltID,
1654 wxT("PID"), &ContactEditorData.PicturesListPID,
1655 wxT("TYPE"), &ContactEditorData.PicturesListType,
1656 wxT("PREF"), &ContactEditorData.PicturesListPref,
1657 wxT(""), &ContactEditorData.PicturesListTokens);
1659 ResetSaveProcessData();
1663 ResetSaveProcessData();
1667 for (std::map<int, std::string>::iterator iter = ContactEditorData.LogosList.begin();
1668 iter != ContactEditorData.LogosList.end(); ++iter){
1670 int intValueIndex = iter->first;
1672 std::map<int, std::string>::iterator stdstriter;
1673 std::map<int, wxString>::iterator enciter;
1675 striter = ContactEditorData.LogosListPictureType.find(intValueIndex);
1676 enciter = ContactEditorData.LogosListPicEncType.find(intValueIndex);
1678 ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
1679 &iter, &ContactEditorData.LogosList, &striter,
1680 &enciter, &ContactData,
1681 wxT("ALTID"), &ContactEditorData.LogosListAltID,
1682 wxT("PID"), &ContactEditorData.LogosListPID,
1683 wxT("TYPE"), &ContactEditorData.LogosListType,
1684 wxT("PREF"), &ContactEditorData.LogosListPref,
1685 wxT(""), &ContactEditorData.LogosListTokens );
1687 ResetSaveProcessData();
1691 ResetSaveProcessData();
1695 for (std::map<int, std::string>::iterator iter = ContactEditorData.SoundsList.begin();
1696 iter != ContactEditorData.SoundsList.end(); ++iter){
1698 int intValueIndex = iter->first;
1700 std::map<int, std::string>::iterator stdstriter;
1701 std::map<int, wxString>::iterator enciter;
1703 striter = ContactEditorData.SoundsListAudioType.find(intValueIndex);
1704 enciter = ContactEditorData.SoundsListAudioEncType.find(intValueIndex);
1706 ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
1707 &iter, &ContactEditorData.SoundsList, &striter,
1708 &enciter, &ContactData,
1709 wxT("ALTID"), &ContactEditorData.SoundsListAltID,
1710 wxT("PID"), &ContactEditorData.SoundsListPID,
1711 wxT("TYPE"), &ContactEditorData.SoundsListType,
1712 wxT("PREF"), &ContactEditorData.SoundsListPref,
1713 wxT(""), &ContactEditorData.SoundsListTokens );
1715 ResetSaveProcessData();
1719 ResetSaveProcessData();
1721 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarList.begin();
1722 iter != ContactEditorData.CalendarList.end(); ++iter){
1724 ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
1725 &iter, &ContactEditorData.CalendarList, &ContactData,
1726 wxT("ALTID"), &ContactEditorData.CalendarListAltID,
1727 wxT("PID"), &ContactEditorData.CalendarListPID,
1728 wxT("MEDIATYPE"), &ContactEditorData.CalendarListMediatype,
1729 wxT("TYPE"), &ContactEditorData.CalendarListType,
1730 wxT("PREF"), &ContactEditorData.CalendarListPref,
1731 wxT(""), &ContactEditorData.CalendarListTokens );
1733 ResetSaveProcessData();
1737 ResetSaveProcessData();
1739 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarRequestList.begin();
1740 iter != ContactEditorData.CalendarRequestList.end(); ++iter){
1742 ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
1743 &iter, &ContactEditorData.CalendarRequestList, &ContactData,
1744 wxT("ALTID"), &ContactEditorData.CalendarRequestListAltID,
1745 wxT("PID"), &ContactEditorData.CalendarRequestListPID,
1746 wxT("MEDIATYPE"), &ContactEditorData.CalendarRequestListMediatype,
1747 wxT("TYPE"), &ContactEditorData.CalendarRequestListType,
1748 wxT("PREF"), &ContactEditorData.CalendarRequestListPref,
1749 wxT(""), &ContactEditorData.CalendarRequestListTokens );
1751 ResetSaveProcessData();
1755 ResetSaveProcessData();
1757 for (std::map<int,wxString>::iterator iter = ContactEditorData.FreeBusyList.begin();
1758 iter != ContactEditorData.FreeBusyList.end(); ++iter){
1760 ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
1761 &iter, &ContactEditorData.FreeBusyList, &ContactData,
1762 wxT("ALTID"), &ContactEditorData.FreeBusyListAltID,
1763 wxT("PID"), &ContactEditorData.FreeBusyListPID,
1764 wxT("MEDIATYPE"), &ContactEditorData.FreeBusyListMediatype,
1765 wxT("TYPE"), &ContactEditorData.FreeBusyListType,
1766 wxT("PREF"), &ContactEditorData.FreeBusyListPref,
1767 wxT(""), &ContactEditorData.FreeBusyListTokens );
1769 ResetSaveProcessData();
1773 for (std::map<int, wxString>::iterator iter = ContactEditorData.KeyList.begin();
1774 iter != ContactEditorData.KeyList.end(); ++iter){
1776 intValue2 = iter->first;
1778 // Process Alternative ID.
1780 striter = ContactEditorData.KeyListAltID.find(intValue2);
1782 if (striter->first == intValue2){
1784 strValue3 = striter->second;
1786 if (!strValue3.IsEmpty()){
1791 if (boolValue2 == TRUE){
1793 strValue2.Append(wxT(";"));
1801 strValue2.Append(wxT("ALTID=") + strValue3);
1811 striter = ContactEditorData.KeyListPID.find(intValue2);
1813 if (striter->first == intValue2){
1815 strValue3 = striter->second;
1817 if (!strValue3.IsEmpty()){
1822 if (boolValue2 == TRUE){
1824 strValue2.Append(wxT(";"));
1832 strValue2.Append(wxT("PID=") + strValue3);
1842 striter = ContactEditorData.KeyListType.find(intValue2);
1844 if (striter->first == intValue2){
1846 strValue3 = striter->second;
1848 if (!strValue3.IsEmpty()){
1853 if (boolValue2 == TRUE){
1855 strValue2.Append(wxT(";"));
1863 strValue2.Append(wxT("TYPE=") + strValue3);
1871 intiter = ContactEditorData.KeyListPref.find(intValue2);
1873 if (intiter->first == intValue2){
1875 intValue3 = intiter->second;
1879 if (boolValue2 == TRUE){
1881 strValue2.Append(wxT(";"));
1889 strValue2.Append(wxT("PREF=") + wxString::Format(wxT("%i"), intValue3));
1899 striter = ContactEditorData.KeyListTokens.find(intValue2);
1901 if (striter->first == intValue2){
1903 strValue3 = striter->second;
1905 if (!strValue3.IsEmpty()){
1910 if (boolValue2 == TRUE){
1912 strValue2.Append(wxT(";"));
1920 strValue2.Append(strValue3);
1928 // Get the key information.
1930 std::map<int, wxString>::iterator enciter;
1932 striter = ContactEditorData.KeyListDataType.find(intValue2);
1933 //enciter = KeyListAudioEncType.find(intValue2);
1935 wxString strValueData;
1937 strValueData = iter->second;
1938 //strValueData.insert(0, wxT("data:") + striter->second + wxT(";") + enciter->second + wxT(","));
1939 strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));
1942 // Add to the vCard.
1944 if (boolValue == TRUE){
1946 ContactData.AddRaw(wxT("KEY;") + strValue2, strValueData);
1950 ContactData.Add(wxT("KEY"), strValueData, TRUE);
1954 ResetSaveProcessData();
1958 // Vendor specific items.
1960 ResetSaveProcessData();
1962 for (std::map<int,wxString>::iterator iter = ContactEditorData.VendorList.begin();
1963 iter != ContactEditorData.VendorList.end(); ++iter){
1965 intValue2 = iter->first;
1967 // Get the IANA PEN number.
1969 striter = ContactEditorData.VendorListPEN.find(intValue2);
1971 if (striter->first == intValue2){
1973 strValue2 = striter->second;
1977 // Get the element name.
1979 striter = ContactEditorData.VendorListElement.find(intValue2);
1981 if (striter->first == intValue2){
1983 strValue3 = striter->second;
1989 striter = ContactEditorData.VendorList.find(intValue2);
1991 if (striter->first == intValue2){
1993 strValue = striter->second;
1997 // Add to the vCard.
1999 if (boolValue == TRUE){
2001 ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
2005 ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
2009 ResetSaveProcessData();
2013 ResetSaveProcessData();
2017 for (std::map<int,wxString>::iterator iter = ContactEditorData.XTokenList.begin();
2018 iter != ContactEditorData.XTokenList.end(); ++iter){
2020 intValue2 = iter->first;
2022 // Get the element name.
2024 striter = ContactEditorData.XTokenListTokens.find(intValue2);
2026 if (striter->first == intValue2){
2028 strValue2 = striter->second;
2034 striter = ContactEditorData.XTokenList.find(intValue2);
2036 if (striter->first == intValue2){
2038 strValue = striter->second;
2042 // Add to the vCard.
2044 if (boolValue == TRUE){
2046 ContactData.AddRaw(wxT("X-") + strValue2, strValue);
2050 ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
2054 ResetSaveProcessData();
2058 ResetSaveProcessData();
2060 if (ContactEditorData.FullNamesList.size() == 0){
2062 wxString FullName = cmbDisplayAs->GetValue();
2063 ContactEditorData.FullNamesList.insert(std::make_pair(0, FullName));
2064 ContactEditorData.FullNamesListAltID.insert(std::make_pair(0, wxT("")));
2065 ContactEditorData.FullNamesListPID.insert(std::make_pair(0, wxT("")));
2066 ContactEditorData.FullNamesListType.insert(std::make_pair(0, wxT("")));
2067 ContactEditorData.FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
2068 ContactEditorData.FullNamesListPref.insert(std::make_pair(0, 0));
2069 ContactEditorData.FullNamesListTokens.insert(std::make_pair(0, wxT("")));
2074 for (std::map<int, wxString>::iterator iter = ContactEditorData.FullNamesList.begin();
2075 iter != ContactEditorData.FullNamesList.end(); ++iter){
2077 if (FNFirst == TRUE){
2079 iter->second = cmbDisplayAs->GetValue();
2084 std::map<int,wxString>::iterator mapS;
2086 mapS = ContactEditorData.FullNamesListTokens.find(iter->first);
2088 ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue,
2089 &iter, &ContactEditorData.FullNamesList, &ContactData,
2090 wxT("ALTID"), &ContactEditorData.FullNamesListAltID,
2091 wxT("PID"), &ContactEditorData.FullNamesListPID,
2092 wxT("TYPE"), &ContactEditorData.FullNamesListType,
2093 wxT("LANGUAGE"), &ContactEditorData.FullNamesListLanguage,
2094 wxT("PREF"), &ContactEditorData.FullNamesListPref,
2095 wxT(""), &ContactEditorData.FullNamesListTokens );
2099 ResetSaveProcessData();
2103 //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
2105 // Insert revision (REV) date.
2107 // Get today's date and time.
2109 wxDateTime DateTimeNow = wxDateTime::Now();
2113 // Set year, month and date.
2115 int intYear = DateTimeNow.GetYear();
2116 int intMonth = DateTimeNow.GetMonth();
2117 int intDay = DateTimeNow.GetDay();
2119 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
2123 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
2127 DateRev.Append(wxString::Format(wxT("%i"), intMonth));
2133 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
2137 DateRev.Append(wxString::Format(wxT("%i"), intDay));
2141 //DateRev.Append(wx);
2142 //DateRev.Append(wx);
2143 //DateRev.Append(wx);
2144 DateRev.Append(wxT("T"));
2146 // Set hour, minute and second.
2148 int intHour = DateTimeNow.GetHour();
2149 int intMinute = DateTimeNow.GetMinute();
2150 int intSecond = DateTimeNow.GetSecond();
2154 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
2158 DateRev.Append(wxString::Format(wxT("%i"), intHour));
2162 if (intMinute < 10){
2164 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
2168 DateRev.Append(wxString::Format(wxT("%i"), intMinute));
2172 if (intSecond < 10){
2174 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
2178 DateRev.Append(wxString::Format(wxT("%i"), intSecond));
2182 // DateRev.Append(wx);
2183 // DateRev.Append(wx);
2184 // DateRev.Append(wxString DateTimeNow->);
2185 DateRev.Append(wxT("Z"));
2187 ContactData.Add(wxT("UID"), ContactEditorData.UIDToken, FALSE);
2189 // End the vCard File.
2191 ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
2194 ContactData.WriteFile(FilenameFinal);
2196 vCard34Conv ConvFileFun;
2200 ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
2202 wxString AccountDirPrefix;
2203 wxString AccountDir;
2206 #if defined(__HAIKU__)
2208 //preffilename = wxT("noo");
2210 #elif defined(__APPLE__)
2212 PrefDir = GetUserPrefDir();
2214 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2216 #elif defined(__WIN32__)
2218 PrefDir = GetUserPrefDir();
2220 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
2224 PrefDir = GetUserPrefDir();
2226 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2230 XABPreferences PrefData(PrefDir);
2232 wxString AccountType;
2234 for (int i = 0; i < PrefData.accounts.GetCount(); i++){
2236 AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
2238 if (AccountDir == wxSContactAccount){
2240 AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
2241 AccountDirPrefix.Trim();
2242 AccountType = PrefData.accounts.GetAccountType(i);
2249 wxString wxSplitFilename;
2250 wxString wxSDataURL;
2252 while(wSTFilename.HasMoreTokens()){
2254 wxSplitFilename = wSTFilename.GetNextToken();
2258 wxSDataURL = wxSplitFilename;
2259 //wxSDataURL.Append(wxSplitFilename);
2261 // Find out if the filename exists in the table.
2263 if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
2265 wxString ETagResult;
2266 wxString ETagOriginal;
2268 ETagDB *ETagDBPtr = NULL;
2270 ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
2272 wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
2273 wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
2275 if (wxSETagOrig.IsEmpty()){
2277 // Generate the ETag.
2279 wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2283 if (wxSETag.IsEmpty()){
2285 // Update empty ETag.
2287 wxSETag = wxSETagOrig;
2288 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
2293 // Don't change original ETag.
2295 wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2296 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
2300 if (EditMode == FALSE){
2302 ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2304 FMTimer.SetFilename(FilenameFinal);
2305 FMTimer.UpdateTimestamp();
2306 FMTimer.Start(10000, FALSE);
2308 wxCommandEvent reloadevent(RELOADCONTACTLIST);
2309 reloadevent.SetString(wxSContactAccount);
2310 wxPostEvent(this->GetParent(), reloadevent);
2315 ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2316 FMTimer.UpdateTimestamp();
2317 FMTimer.Start(10000, FALSE);
2323 // Send a notification to update the main window
2324 // with the new details.
2329 // TODO: Workout nickname settings by priority and
2332 ucd->ContactAccount = wxSContactAccount;
2333 ucd->ContactFilename = FilenameFinal;
2334 ucd->ContactName = cmbDisplayAs->GetValue();
2335 ucd->ContactNameArray = ContactData.GetName();
2337 for (std::map<int,wxString>::iterator gniter = ContactEditorData.GeneralNicknamesList.begin();
2338 gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){
2340 ucd->ContactNickname = gniter->second;
2345 wxCommandEvent event2(CE_UPDATECONTACTLIST);
2346 event2.SetClientData(ucd);
2347 wxPostEvent(MainPtr, event2);
2351 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
2354 // Save the updated contact data and close the form.
2356 wxCommandEvent NullEvent;
2357 this->SaveContact(NullEvent);