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 strAddressFinalValue.insert(0, wxT("tel:"));
1080 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1081 &iter, &strAddressFinalValue, &ContactData,
1082 wxT("ALTID"), &ContactEditorData.GeneralTelephoneListAltID,
1083 wxT("PID"), &ContactEditorData.GeneralTelephoneListPID,
1084 wxT("TYPE"), &ContactEditorData.GeneralTelephoneListType,
1085 wxT("PREF"), &ContactEditorData.GeneralTelephoneListPref,
1086 wxT(""), &ContactEditorData.GeneralTelephoneListTokens );
1088 ResetSaveProcessData();
1092 ResetSaveProcessData();
1094 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTelephoneList.begin();
1095 iter != ContactEditorData.HomeTelephoneList.end(); ++iter){
1097 wxString strAddressFinalValue = iter->second;
1099 ProcessCaptureStrings(&strAddressFinalValue);
1101 strAddressFinalValue.insert(0, wxT("tel:"));
1103 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1104 &iter, &strAddressFinalValue, &ContactData,
1105 wxT("ALTID"), &ContactEditorData.HomeTelephoneListAltID,
1106 wxT("PID"), &ContactEditorData.HomeTelephoneListPID,
1107 wxT("TYPE"), &ContactEditorData.HomeTelephoneListType,
1108 wxT("PREF"), &ContactEditorData.HomeTelephoneListPref,
1109 wxT(""), &ContactEditorData.HomeTelephoneListTokens );
1111 ResetSaveProcessData();
1115 ResetSaveProcessData();
1117 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTelephoneList.begin();
1118 iter != ContactEditorData.BusinessTelephoneList.end(); ++iter){
1120 wxString strAddressFinalValue = iter->second;
1122 ProcessCaptureStrings(&strAddressFinalValue);
1124 strAddressFinalValue.insert(0, wxT("tel:"));
1126 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1127 &iter, &strAddressFinalValue, &ContactData,
1128 wxT("ALTID"), &ContactEditorData.BusinessTelephoneListAltID,
1129 wxT("PID"), &ContactEditorData.BusinessTelephoneListPID,
1130 wxT("TYPE"), &ContactEditorData.BusinessTelephoneListType,
1131 wxT("PREF"), &ContactEditorData.BusinessTelephoneListPref,
1132 wxT(""), &ContactEditorData.BusinessTelephoneListTokens );
1134 ResetSaveProcessData();
1138 ResetSaveProcessData();
1140 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralLanguageList.begin();
1141 iter != ContactEditorData.GeneralLanguageList.end(); ++iter){
1143 intValue2 = iter->first;
1145 ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
1146 &iter, &ContactEditorData.GeneralLanguageList, &ContactData,
1147 wxT("ALTID"), &ContactEditorData.GeneralLanguageListAltID,
1148 wxT("PID"), &ContactEditorData.GeneralLanguageListPID,
1149 wxT("PREF"), &ContactEditorData.GeneralLanguageListPref,
1150 wxT(""), &ContactEditorData.GeneralLanguageListTokens );
1152 ResetSaveProcessData();
1156 ResetSaveProcessData();
1158 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeLanguageList.begin();
1159 iter != ContactEditorData.HomeLanguageList.end(); ++iter){
1161 ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1162 &iter, &ContactEditorData.HomeLanguageList, &ContactData,
1163 wxT("ALTID"), &ContactEditorData.HomeLanguageListAltID,
1164 wxT("PID"), &ContactEditorData.HomeLanguageListPID,
1165 wxT("PREF"), &ContactEditorData.HomeLanguageListPref,
1166 wxT(""), &ContactEditorData.HomeLanguageListTokens );
1168 ResetSaveProcessData();
1172 ResetSaveProcessData();
1174 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessLanguageList.begin();
1175 iter != ContactEditorData.BusinessLanguageList.end(); ++iter){
1177 ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1178 &iter, &ContactEditorData.BusinessLanguageList, &ContactData,
1179 wxT("ALTID"), &ContactEditorData.BusinessLanguageListAltID,
1180 wxT("PID"), &ContactEditorData.BusinessLanguageListPID,
1181 wxT("PREF"), &ContactEditorData.BusinessLanguageListPref,
1182 wxT(""), &ContactEditorData.BusinessLanguageListTokens );
1184 ResetSaveProcessData();
1188 ResetSaveProcessData();
1190 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTZList.begin();
1191 iter != ContactEditorData.GeneralTZList.end(); ++iter){
1193 ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
1194 &iter, &ContactEditorData.GeneralTZList, &ContactData,
1195 wxT("ALTID"), &ContactEditorData.GeneralTZListAltID,
1196 wxT("PID"), &ContactEditorData.GeneralTZListPID,
1197 wxT("MEDIATYPE"), &ContactEditorData.GeneralTZListMediatype,
1198 wxT("PREF"), &ContactEditorData.GeneralTZListPref,
1199 wxT(""), &ContactEditorData.GeneralTZListTokens );
1201 ResetSaveProcessData();
1205 ResetSaveProcessData();
1207 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTZList.begin();
1208 iter != ContactEditorData.HomeTZList.end(); ++iter){
1210 ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1211 &iter, &ContactEditorData.HomeTZList, &ContactData,
1212 wxT("ALTID"), &ContactEditorData.HomeTZListAltID,
1213 wxT("PID"), &ContactEditorData.HomeTZListPID,
1214 wxT("MEDIATYPE"), &ContactEditorData.HomeTZListMediatype,
1215 wxT("PREF"), &ContactEditorData.HomeTZListPref,
1216 wxT(""), &ContactEditorData.HomeTZListTokens );
1218 ResetSaveProcessData();
1222 ResetSaveProcessData();
1224 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTZList.begin();
1225 iter != ContactEditorData.BusinessTZList.end(); ++iter){
1227 ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1228 &iter, &ContactEditorData.BusinessTZList, &ContactData,
1229 wxT("ALTID"), &ContactEditorData.BusinessTZListAltID,
1230 wxT("PID"), &ContactEditorData.BusinessTZListPID,
1231 wxT("MEDIATYPE"), &ContactEditorData.BusinessTZListMediatype,
1232 wxT("PREF"), &ContactEditorData.BusinessTZListPref,
1233 wxT(""), &ContactEditorData.BusinessTZListTokens );
1235 ResetSaveProcessData();
1239 ResetSaveProcessData();
1241 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralGeographyList.begin();
1242 iter != ContactEditorData.GeneralGeographyList.end(); ++iter){
1244 wxString strAddressFinalValue = iter->second;
1246 ProcessCaptureStrings(&strAddressFinalValue);
1248 strAddressFinalValue.insert(0, wxT("geo:"));
1250 ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
1251 &iter, &strAddressFinalValue, &ContactData,
1252 wxT("ALTID"), &ContactEditorData.GeneralGeographyListAltID,
1253 wxT("PID"), &ContactEditorData.GeneralGeographyListPID,
1254 wxT("MEDIATYPE"), &ContactEditorData.GeneralGeographyListMediatype,
1255 wxT("PREF"), &ContactEditorData.GeneralGeographyListPref,
1256 wxT(""), &ContactEditorData.GeneralGeographyListTokens );
1258 ResetSaveProcessData();
1262 ResetSaveProcessData();
1264 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeGeographyList.begin();
1265 iter != ContactEditorData.HomeGeographyList.end(); ++iter){
1267 wxString strAddressFinalValue = iter->second;
1269 ProcessCaptureStrings(&strAddressFinalValue);
1271 strAddressFinalValue.insert(0, wxT("geo:"));
1273 ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1274 &iter, &ContactEditorData.HomeGeographyList, &ContactData,
1275 wxT("ALTID"), &ContactEditorData.HomeGeographyListAltID,
1276 wxT("PID"), &ContactEditorData.HomeGeographyListPID,
1277 wxT("MEDIATYPE"), &ContactEditorData.HomeGeographyListMediatype,
1278 wxT("PREF"), &ContactEditorData.HomeGeographyListPref,
1279 wxT(""), &ContactEditorData.HomeGeographyListTokens );
1281 ResetSaveProcessData();
1285 ResetSaveProcessData();
1287 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessGeographyList.begin();
1288 iter != ContactEditorData.BusinessGeographyList.end(); ++iter){
1290 wxString strAddressFinalValue = iter->second;
1292 ProcessCaptureStrings(&strAddressFinalValue);
1294 strAddressFinalValue.insert(0, wxT("geo:"));
1296 ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1297 &iter, &ContactEditorData.BusinessGeographyList, &ContactData,
1298 wxT("ALTID"), &ContactEditorData.BusinessGeographyListAltID,
1299 wxT("PID"), &ContactEditorData.BusinessGeographyListPID,
1300 wxT("MEDIATYPE"), &ContactEditorData.BusinessGeographyListMediatype,
1301 wxT("PREF"), &ContactEditorData.BusinessGeographyListPref,
1302 wxT(""), &ContactEditorData.BusinessGeographyListTokens );
1304 ResetSaveProcessData();
1308 ResetSaveProcessData();
1310 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRelatedList.begin();
1311 iter != ContactEditorData.GeneralRelatedList.end(); ++iter){
1313 ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
1314 &iter, &ContactEditorData.GeneralRelatedList, &ContactData,
1315 wxT("ALTID"), &ContactEditorData.GeneralRelatedListAltID,
1316 wxT("PID"), &ContactEditorData.GeneralRelatedListPID,
1317 wxT("LANGUAGE"), &ContactEditorData.GeneralRelatedListLanguage,
1318 wxT("TYPE"), &ContactEditorData.GeneralRelatedListRelType,
1319 wxT("PREF"), &ContactEditorData.GeneralRelatedListPref,
1320 wxT(""), &ContactEditorData.GeneralRelatedListTokens );
1322 ResetSaveProcessData();
1326 ResetSaveProcessData();
1328 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralWebsiteList.begin();
1329 iter != ContactEditorData.GeneralWebsiteList.end(); ++iter){
1331 ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
1332 &iter, &ContactEditorData.GeneralWebsiteList, &ContactData,
1333 wxT("ALTID"), &ContactEditorData.GeneralWebsiteListAltID,
1334 wxT("PID"), &ContactEditorData.GeneralWebsiteListPID,
1335 wxT("MEDIATYPE"), &ContactEditorData.GeneralWebsiteListMediatype,
1336 wxT("PREF"), &ContactEditorData.GeneralWebsiteListPref,
1337 wxT(""), &ContactEditorData.GeneralWebsiteListTokens );
1339 ResetSaveProcessData();
1343 ResetSaveProcessData();
1345 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeWebsiteList.begin();
1346 iter != ContactEditorData.HomeWebsiteList.end(); ++iter){
1348 ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1349 &iter, &ContactEditorData.HomeWebsiteList, &ContactData,
1350 wxT("ALTID"), &ContactEditorData.HomeWebsiteListAltID,
1351 wxT("PID"), &ContactEditorData.HomeWebsiteListPID,
1352 wxT("MEDIATYPE"), &ContactEditorData.HomeWebsiteListMediatype,
1353 wxT("PREF"), &ContactEditorData.HomeWebsiteListPref,
1354 wxT(""), &ContactEditorData.HomeWebsiteListTokens );
1356 ResetSaveProcessData();
1360 ResetSaveProcessData();
1362 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessWebsiteList.begin();
1363 iter != ContactEditorData.BusinessWebsiteList.end(); ++iter){
1365 ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1366 &iter, &ContactEditorData.BusinessWebsiteList, &ContactData,
1367 wxT("ALTID"), &ContactEditorData.BusinessWebsiteListAltID,
1368 wxT("PID"), &ContactEditorData.BusinessWebsiteListPID,
1369 wxT("MEDIATYPE"), &ContactEditorData.BusinessWebsiteListMediatype,
1370 wxT("PREF"), &ContactEditorData.BusinessWebsiteListPref,
1371 wxT(""), &ContactEditorData.BusinessWebsiteListTokens );
1373 ResetSaveProcessData();
1377 ResetSaveProcessData();
1379 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTitleList.begin();
1380 iter != ContactEditorData.GeneralTitleList.end(); ++iter){
1382 ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
1383 &iter, &ContactEditorData.GeneralTitleList, &ContactData,
1384 wxT("ALTID"), &ContactEditorData.GeneralTitleListAltID,
1385 wxT("PID"), &ContactEditorData.GeneralTitleListPID,
1386 wxT("LANGUAGE"), &ContactEditorData.GeneralTitleListLanguage,
1387 wxT("PREF"), &ContactEditorData.GeneralTitleListPref,
1388 wxT(""), &ContactEditorData.GeneralTitleListTokens );
1390 ResetSaveProcessData();
1394 ResetSaveProcessData();
1396 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTitleList.begin();
1397 iter != ContactEditorData.HomeTitleList.end(); ++iter){
1399 ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1400 &iter, &ContactEditorData.HomeTitleList, &ContactData,
1401 wxT("ALTID"), &ContactEditorData.HomeTitleListAltID,
1402 wxT("PID"), &ContactEditorData.HomeTitleListPID,
1403 wxT("LANGUAGE"), &ContactEditorData.HomeTitleListLanguage,
1404 wxT("PREF"), &ContactEditorData.HomeTitleListPref,
1405 wxT(""), &ContactEditorData.HomeTitleListTokens );
1407 ResetSaveProcessData();
1411 ResetSaveProcessData();
1413 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTitleList.begin();
1414 iter != ContactEditorData.BusinessTitleList.end(); ++iter){
1416 ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1417 &iter, &ContactEditorData.BusinessTitleList, &ContactData,
1418 wxT("ALTID"), &ContactEditorData.BusinessTitleListAltID,
1419 wxT("PID"), &ContactEditorData.BusinessTitleListPID,
1420 wxT("LANGUAGE"), &ContactEditorData.BusinessTitleListLanguage,
1421 wxT("PREF"), &ContactEditorData.BusinessTitleListPref,
1422 wxT(""), &ContactEditorData.BusinessTitleListTokens );
1424 ResetSaveProcessData();
1428 ResetSaveProcessData();
1430 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRoleList.begin();
1431 iter != ContactEditorData.GeneralRoleList.end(); ++iter){
1433 ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
1434 &iter, &ContactEditorData.GeneralRoleList, &ContactData,
1435 wxT("ALTID"), &ContactEditorData.GeneralRoleListAltID,
1436 wxT("PID"), &ContactEditorData.GeneralRoleListPID,
1437 wxT("LANGUAGE"), &ContactEditorData.GeneralRoleListLanguage,
1438 wxT("PREF"), &ContactEditorData.GeneralRoleListPref,
1439 wxT(""), &ContactEditorData.GeneralRoleListTokens );
1441 ResetSaveProcessData();
1445 ResetSaveProcessData();
1447 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeRoleList.begin();
1448 iter != ContactEditorData.HomeRoleList.end(); ++iter){
1450 ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1451 &iter, &ContactEditorData.HomeRoleList, &ContactData,
1452 wxT("ALTID"), &ContactEditorData.HomeRoleListAltID,
1453 wxT("PID"), &ContactEditorData.HomeRoleListPID,
1454 wxT("LANGUAGE"), &ContactEditorData.HomeRoleListLanguage,
1455 wxT("PREF"), &ContactEditorData.HomeRoleListPref,
1456 wxT(""), &ContactEditorData.HomeRoleListTokens );
1458 ResetSaveProcessData();
1462 ResetSaveProcessData();
1464 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessRoleList.begin();
1465 iter != ContactEditorData.BusinessRoleList.end(); ++iter){
1467 ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1468 &iter, &ContactEditorData.BusinessRoleList, &ContactData,
1469 wxT("ALTID"), &ContactEditorData.BusinessRoleListAltID,
1470 wxT("PID"), &ContactEditorData.BusinessRoleListPID,
1471 wxT("LANGUAGE"), &ContactEditorData.BusinessRoleListLanguage,
1472 wxT("PREF"), &ContactEditorData.BusinessRoleListPref,
1473 wxT(""), &ContactEditorData.BusinessRoleListTokens );
1475 ResetSaveProcessData();
1479 ResetSaveProcessData();
1481 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralOrganisationsList.begin();
1482 iter != ContactEditorData.GeneralOrganisationsList.end(); ++iter){
1484 ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
1485 &iter, &ContactEditorData.GeneralOrganisationsList, &ContactData,
1486 wxT("ALTID"), &ContactEditorData.GeneralOrganisationsListAltID,
1487 wxT("PID"), &ContactEditorData.GeneralOrganisationsListPID,
1488 wxT("LANGUAGE"), &ContactEditorData.GeneralOrganisationsListLanguage,
1489 wxT("SORT-AS"), &ContactEditorData.GeneralOrganisationsListSortAs,
1490 wxT("PREF"), &ContactEditorData.GeneralOrganisationsListPref,
1491 wxT(""), &ContactEditorData.GeneralOrganisationsListTokens );
1493 ResetSaveProcessData();
1497 ResetSaveProcessData();
1499 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeOrganisationsList.begin();
1500 iter != ContactEditorData.HomeOrganisationsList.end(); ++iter){
1502 ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1503 &iter, &ContactEditorData.HomeOrganisationsList, &ContactData,
1504 wxT("ALTID"), &ContactEditorData.HomeOrganisationsListAltID,
1505 wxT("PID"), &ContactEditorData.HomeOrganisationsListPID,
1506 wxT("LANGUAGE"), &ContactEditorData.HomeOrganisationsListLanguage,
1507 wxT("SORT-AS"), &ContactEditorData.HomeOrganisationsListSortAs,
1508 wxT("PREF"), &ContactEditorData.HomeOrganisationsListPref,
1509 wxT(""), &ContactEditorData.HomeOrganisationsListTokens );
1511 ResetSaveProcessData();
1515 ResetSaveProcessData();
1517 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessOrganisationsList.begin();
1518 iter != ContactEditorData.BusinessOrganisationsList.end(); ++iter){
1520 ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1521 &iter, &ContactEditorData.BusinessOrganisationsList, &ContactData,
1522 wxT("ALTID"), &ContactEditorData.BusinessOrganisationsListAltID,
1523 wxT("PID"), &ContactEditorData.BusinessOrganisationsListPID,
1524 wxT("LANGUAGE"), &ContactEditorData.BusinessOrganisationsListLanguage,
1525 wxT("SORT-AS"), &ContactEditorData.BusinessOrganisationsListSortAs,
1526 wxT("PREF"), &ContactEditorData.BusinessOrganisationsListPref,
1527 wxT(""), &ContactEditorData.BusinessOrganisationsListTokens );
1529 ResetSaveProcessData();
1533 ResetSaveProcessData();
1535 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNoteList.begin();
1536 iter != ContactEditorData.GeneralNoteList.end(); ++iter){
1538 ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
1539 &iter, &ContactEditorData.GeneralNoteList, &ContactData,
1540 wxT("ALTID"), &ContactEditorData.GeneralNoteListAltID,
1541 wxT("PID"), &ContactEditorData.GeneralNoteListPID,
1542 wxT("LANGUAGE"), &ContactEditorData.GeneralNoteListLanguage,
1543 wxT("PREF"), &ContactEditorData.GeneralNoteListPref,
1544 wxT(""), &ContactEditorData.GeneralNoteListTokens );
1546 ResetSaveProcessData();
1550 ResetSaveProcessData();
1552 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNoteList.begin();
1553 iter != ContactEditorData.HomeNoteList.end(); ++iter){
1555 ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1556 &iter, &ContactEditorData.HomeNoteList, &ContactData,
1557 wxT("ALTID"), &ContactEditorData.HomeNoteListAltID,
1558 wxT("PID"), &ContactEditorData.HomeNoteListPID,
1559 wxT("LANGUAGE"), &ContactEditorData.HomeNoteListLanguage,
1560 wxT("PREF"), &ContactEditorData.HomeNoteListPref,
1561 wxT(""), &ContactEditorData.HomeNoteListTokens );
1563 ResetSaveProcessData();
1567 ResetSaveProcessData();
1569 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNoteList.begin();
1570 iter != ContactEditorData.BusinessNoteList.end(); ++iter){
1572 ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1573 &iter, &ContactEditorData.BusinessNoteList, &ContactData,
1574 wxT("ALTID"), &ContactEditorData.BusinessNoteListAltID,
1575 wxT("PID"), &ContactEditorData.BusinessNoteListPID,
1576 wxT("LANGUAGE"), &ContactEditorData.BusinessNoteListLanguage,
1577 wxT("PREF"), &ContactEditorData.BusinessNoteListPref,
1578 wxT(""), &ContactEditorData.BusinessNoteListTokens );
1580 ResetSaveProcessData();
1584 ResetSaveProcessData();
1586 for (std::map<int,wxString>::iterator iter = ContactEditorData.CategoriesList.begin();
1587 iter != ContactEditorData.CategoriesList.end(); ++iter){
1589 ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
1590 &iter, &ContactEditorData.CategoriesList, &ContactData,
1591 wxT("ALTID"), &ContactEditorData.CategoriesListAltID,
1592 wxT("PID"), &ContactEditorData.CategoriesListPID,
1593 wxT("TYPE"), &ContactEditorData.CategoriesListType,
1594 wxT("PREF"), &ContactEditorData.CategoriesListPref,
1595 wxT(""), &ContactEditorData.CategoriesListTokens );
1597 ResetSaveProcessData();
1603 for (std::map<int, std::string>::iterator iter = ContactEditorData.PicturesList.begin();
1604 iter != ContactEditorData.PicturesList.end(); ++iter){
1606 int intValueIndex = iter->first;
1608 std::map<int, std::string>::iterator stdstriter;
1609 std::map<int, wxString>::iterator enciter;
1611 striter = ContactEditorData.PicturesListPictureType.find(intValueIndex);
1612 enciter = ContactEditorData.PicturesListPicEncType.find(intValueIndex);
1614 ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
1615 &iter, &ContactEditorData.PicturesList, &striter,
1616 &enciter, &ContactData,
1617 wxT("ALTID"), &ContactEditorData.PicturesListAltID,
1618 wxT("PID"), &ContactEditorData.PicturesListPID,
1619 wxT("TYPE"), &ContactEditorData.PicturesListType,
1620 wxT("PREF"), &ContactEditorData.PicturesListPref,
1621 wxT(""), &ContactEditorData.PicturesListTokens);
1623 ResetSaveProcessData();
1627 ResetSaveProcessData();
1631 for (std::map<int, std::string>::iterator iter = ContactEditorData.LogosList.begin();
1632 iter != ContactEditorData.LogosList.end(); ++iter){
1634 int intValueIndex = iter->first;
1636 std::map<int, std::string>::iterator stdstriter;
1637 std::map<int, wxString>::iterator enciter;
1639 striter = ContactEditorData.LogosListPictureType.find(intValueIndex);
1640 enciter = ContactEditorData.LogosListPicEncType.find(intValueIndex);
1642 ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
1643 &iter, &ContactEditorData.LogosList, &striter,
1644 &enciter, &ContactData,
1645 wxT("ALTID"), &ContactEditorData.LogosListAltID,
1646 wxT("PID"), &ContactEditorData.LogosListPID,
1647 wxT("TYPE"), &ContactEditorData.LogosListType,
1648 wxT("PREF"), &ContactEditorData.LogosListPref,
1649 wxT(""), &ContactEditorData.LogosListTokens );
1651 ResetSaveProcessData();
1655 ResetSaveProcessData();
1659 for (std::map<int, std::string>::iterator iter = ContactEditorData.SoundsList.begin();
1660 iter != ContactEditorData.SoundsList.end(); ++iter){
1662 int intValueIndex = iter->first;
1664 std::map<int, std::string>::iterator stdstriter;
1665 std::map<int, wxString>::iterator enciter;
1667 striter = ContactEditorData.SoundsListAudioType.find(intValueIndex);
1668 enciter = ContactEditorData.SoundsListAudioEncType.find(intValueIndex);
1670 ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
1671 &iter, &ContactEditorData.SoundsList, &striter,
1672 &enciter, &ContactData,
1673 wxT("ALTID"), &ContactEditorData.SoundsListAltID,
1674 wxT("PID"), &ContactEditorData.SoundsListPID,
1675 wxT("TYPE"), &ContactEditorData.SoundsListType,
1676 wxT("PREF"), &ContactEditorData.SoundsListPref,
1677 wxT(""), &ContactEditorData.SoundsListTokens );
1679 ResetSaveProcessData();
1683 ResetSaveProcessData();
1685 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarList.begin();
1686 iter != ContactEditorData.CalendarList.end(); ++iter){
1688 ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
1689 &iter, &ContactEditorData.CalendarList, &ContactData,
1690 wxT("ALTID"), &ContactEditorData.CalendarListAltID,
1691 wxT("PID"), &ContactEditorData.CalendarListPID,
1692 wxT("MEDIATYPE"), &ContactEditorData.CalendarListMediatype,
1693 wxT("TYPE"), &ContactEditorData.CalendarListType,
1694 wxT("PREF"), &ContactEditorData.CalendarListPref,
1695 wxT(""), &ContactEditorData.CalendarListTokens );
1697 ResetSaveProcessData();
1701 ResetSaveProcessData();
1703 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarRequestList.begin();
1704 iter != ContactEditorData.CalendarRequestList.end(); ++iter){
1706 ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
1707 &iter, &ContactEditorData.CalendarRequestList, &ContactData,
1708 wxT("ALTID"), &ContactEditorData.CalendarRequestListAltID,
1709 wxT("PID"), &ContactEditorData.CalendarRequestListPID,
1710 wxT("MEDIATYPE"), &ContactEditorData.CalendarRequestListMediatype,
1711 wxT("TYPE"), &ContactEditorData.CalendarRequestListType,
1712 wxT("PREF"), &ContactEditorData.CalendarRequestListPref,
1713 wxT(""), &ContactEditorData.CalendarRequestListTokens );
1715 ResetSaveProcessData();
1719 ResetSaveProcessData();
1721 for (std::map<int,wxString>::iterator iter = ContactEditorData.FreeBusyList.begin();
1722 iter != ContactEditorData.FreeBusyList.end(); ++iter){
1724 ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
1725 &iter, &ContactEditorData.FreeBusyList, &ContactData,
1726 wxT("ALTID"), &ContactEditorData.FreeBusyListAltID,
1727 wxT("PID"), &ContactEditorData.FreeBusyListPID,
1728 wxT("MEDIATYPE"), &ContactEditorData.FreeBusyListMediatype,
1729 wxT("TYPE"), &ContactEditorData.FreeBusyListType,
1730 wxT("PREF"), &ContactEditorData.FreeBusyListPref,
1731 wxT(""), &ContactEditorData.FreeBusyListTokens );
1733 ResetSaveProcessData();
1737 for (std::map<int, wxString>::iterator iter = ContactEditorData.KeyList.begin();
1738 iter != ContactEditorData.KeyList.end(); ++iter){
1740 intValue2 = iter->first;
1742 // Process Alternative ID.
1744 striter = ContactEditorData.KeyListAltID.find(intValue2);
1746 if (striter->first == intValue2){
1748 strValue3 = striter->second;
1750 if (!strValue3.IsEmpty()){
1755 if (boolValue2 == TRUE){
1757 strValue2.Append(wxT(";"));
1765 strValue2.Append(wxT("ALTID=") + strValue3);
1775 striter = ContactEditorData.KeyListPID.find(intValue2);
1777 if (striter->first == intValue2){
1779 strValue3 = striter->second;
1781 if (!strValue3.IsEmpty()){
1786 if (boolValue2 == TRUE){
1788 strValue2.Append(wxT(";"));
1796 strValue2.Append(wxT("PID=") + strValue3);
1806 striter = ContactEditorData.KeyListType.find(intValue2);
1808 if (striter->first == intValue2){
1810 strValue3 = striter->second;
1812 if (!strValue3.IsEmpty()){
1817 if (boolValue2 == TRUE){
1819 strValue2.Append(wxT(";"));
1827 strValue2.Append(wxT("TYPE=") + strValue3);
1835 intiter = ContactEditorData.KeyListPref.find(intValue2);
1837 if (intiter->first == intValue2){
1839 intValue3 = intiter->second;
1843 if (boolValue2 == TRUE){
1845 strValue2.Append(wxT(";"));
1853 strValue2.Append(wxT("PREF=") + wxString::Format(wxT("%i"), intValue3));
1863 striter = ContactEditorData.KeyListTokens.find(intValue2);
1865 if (striter->first == intValue2){
1867 strValue3 = striter->second;
1869 if (!strValue3.IsEmpty()){
1874 if (boolValue2 == TRUE){
1876 strValue2.Append(wxT(";"));
1884 strValue2.Append(strValue3);
1892 // Get the key information.
1894 std::map<int, wxString>::iterator enciter;
1896 striter = ContactEditorData.KeyListDataType.find(intValue2);
1897 //enciter = KeyListAudioEncType.find(intValue2);
1899 wxString strValueData;
1901 strValueData = iter->second;
1902 //strValueData.insert(0, wxT("data:") + striter->second + wxT(";") + enciter->second + wxT(","));
1903 strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));
1906 // Add to the vCard.
1908 if (boolValue == TRUE){
1910 ContactData.AddRaw(wxT("KEY;") + strValue2, strValueData);
1914 ContactData.Add(wxT("KEY"), strValueData, TRUE);
1918 ResetSaveProcessData();
1922 // Vendor specific items.
1924 ResetSaveProcessData();
1926 for (std::map<int,wxString>::iterator iter = ContactEditorData.VendorList.begin();
1927 iter != ContactEditorData.VendorList.end(); ++iter){
1929 intValue2 = iter->first;
1931 // Get the IANA PEN number.
1933 striter = ContactEditorData.VendorListPEN.find(intValue2);
1935 if (striter->first == intValue2){
1937 strValue2 = striter->second;
1941 // Get the element name.
1943 striter = ContactEditorData.VendorListElement.find(intValue2);
1945 if (striter->first == intValue2){
1947 strValue3 = striter->second;
1953 striter = ContactEditorData.VendorList.find(intValue2);
1955 if (striter->first == intValue2){
1957 strValue = striter->second;
1961 // Add to the vCard.
1963 if (boolValue == TRUE){
1965 ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
1969 ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
1973 ResetSaveProcessData();
1977 ResetSaveProcessData();
1981 for (std::map<int,wxString>::iterator iter = ContactEditorData.XTokenList.begin();
1982 iter != ContactEditorData.XTokenList.end(); ++iter){
1984 intValue2 = iter->first;
1986 // Get the element name.
1988 striter = ContactEditorData.XTokenListTokens.find(intValue2);
1990 if (striter->first == intValue2){
1992 strValue2 = striter->second;
1998 striter = ContactEditorData.XTokenList.find(intValue2);
2000 if (striter->first == intValue2){
2002 strValue = striter->second;
2006 // Add to the vCard.
2008 if (boolValue == TRUE){
2010 ContactData.AddRaw(wxT("X-") + strValue2, strValue);
2014 ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
2018 ResetSaveProcessData();
2022 ResetSaveProcessData();
2024 if (ContactEditorData.FullNamesList.size() == 0){
2026 wxString FullName = cmbDisplayAs->GetValue();
2027 ContactEditorData.FullNamesList.insert(std::make_pair(0, FullName));
2028 ContactEditorData.FullNamesListAltID.insert(std::make_pair(0, wxT("")));
2029 ContactEditorData.FullNamesListPID.insert(std::make_pair(0, wxT("")));
2030 ContactEditorData.FullNamesListType.insert(std::make_pair(0, wxT("")));
2031 ContactEditorData.FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
2032 ContactEditorData.FullNamesListPref.insert(std::make_pair(0, 0));
2033 ContactEditorData.FullNamesListTokens.insert(std::make_pair(0, wxT("")));
2038 for (std::map<int, wxString>::iterator iter = ContactEditorData.FullNamesList.begin();
2039 iter != ContactEditorData.FullNamesList.end(); ++iter){
2041 if (FNFirst == TRUE){
2043 iter->second = cmbDisplayAs->GetValue();
2048 std::map<int,wxString>::iterator mapS;
2050 mapS = ContactEditorData.FullNamesListTokens.find(iter->first);
2052 ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue,
2053 &iter, &ContactEditorData.FullNamesList, &ContactData,
2054 wxT("ALTID"), &ContactEditorData.FullNamesListAltID,
2055 wxT("PID"), &ContactEditorData.FullNamesListPID,
2056 wxT("TYPE"), &ContactEditorData.FullNamesListType,
2057 wxT("LANGUAGE"), &ContactEditorData.FullNamesListLanguage,
2058 wxT("PREF"), &ContactEditorData.FullNamesListPref,
2059 wxT(""), &ContactEditorData.FullNamesListTokens );
2063 ResetSaveProcessData();
2067 //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
2069 // Insert revision (REV) date.
2071 // Get today's date and time.
2073 wxDateTime DateTimeNow = wxDateTime::Now();
2077 // Set year, month and date.
2079 int intYear = DateTimeNow.GetYear();
2080 int intMonth = DateTimeNow.GetMonth();
2081 int intDay = DateTimeNow.GetDay();
2083 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
2087 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
2091 DateRev.Append(wxString::Format(wxT("%i"), intMonth));
2097 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
2101 DateRev.Append(wxString::Format(wxT("%i"), intDay));
2105 //DateRev.Append(wx);
2106 //DateRev.Append(wx);
2107 //DateRev.Append(wx);
2108 DateRev.Append(wxT("T"));
2110 // Set hour, minute and second.
2112 int intHour = DateTimeNow.GetHour();
2113 int intMinute = DateTimeNow.GetMinute();
2114 int intSecond = DateTimeNow.GetSecond();
2118 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
2122 DateRev.Append(wxString::Format(wxT("%i"), intHour));
2126 if (intMinute < 10){
2128 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
2132 DateRev.Append(wxString::Format(wxT("%i"), intMinute));
2136 if (intSecond < 10){
2138 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
2142 DateRev.Append(wxString::Format(wxT("%i"), intSecond));
2146 // DateRev.Append(wx);
2147 // DateRev.Append(wx);
2148 // DateRev.Append(wxString DateTimeNow->);
2149 DateRev.Append(wxT("Z"));
2151 ContactData.Add(wxT("UID"), ContactEditorData.UIDToken, FALSE);
2153 // End the vCard File.
2155 ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
2158 ContactData.WriteFile(FilenameFinal);
2160 vCard34Conv ConvFileFun;
2164 ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
2166 wxString AccountDirPrefix;
2167 wxString AccountDir;
2170 #if defined(__HAIKU__)
2172 //preffilename = wxT("noo");
2174 #elif defined(__APPLE__)
2176 PrefDir = GetUserPrefDir();
2178 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2180 #elif defined(__WIN32__)
2182 PrefDir = GetUserPrefDir();
2184 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
2188 PrefDir = GetUserPrefDir();
2190 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2194 XABPreferences PrefData(PrefDir);
2196 wxString AccountType;
2198 for (int i = 0; i < PrefData.accounts.GetCount(); i++){
2200 AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
2202 if (AccountDir == wxSContactAccount){
2204 AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
2205 AccountDirPrefix.Trim();
2206 AccountType = PrefData.accounts.GetAccountType(i);
2213 wxString wxSplitFilename;
2214 wxString wxSDataURL;
2216 while(wSTFilename.HasMoreTokens()){
2218 wxSplitFilename = wSTFilename.GetNextToken();
2222 wxSDataURL = wxSplitFilename;
2223 //wxSDataURL.Append(wxSplitFilename);
2225 // Find out if the filename exists in the table.
2227 if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
2229 wxString ETagResult;
2230 wxString ETagOriginal;
2232 ETagDB *ETagDBPtr = NULL;
2234 ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
2236 wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
2237 wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
2239 if (wxSETagOrig.IsEmpty()){
2241 // Generate the ETag.
2243 wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2247 if (wxSETag.IsEmpty()){
2249 // Update empty ETag.
2251 wxSETag = wxSETagOrig;
2252 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
2257 // Don't change original ETag.
2259 wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2260 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
2264 if (EditMode == FALSE){
2266 ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2268 FMTimer.SetFilename(FilenameFinal);
2269 FMTimer.UpdateTimestamp();
2270 FMTimer.Start(10000, FALSE);
2272 wxCommandEvent reloadevent(RELOADCONTACTLIST);
2273 reloadevent.SetString(wxSContactAccount);
2274 wxPostEvent(this->GetParent(), reloadevent);
2279 ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2280 FMTimer.UpdateTimestamp();
2281 FMTimer.Start(10000, FALSE);
2287 // Send a notification to update the main window
2288 // with the new details.
2293 // TODO: Workout nickname settings by priority and
2296 ucd->ContactAccount = wxSContactAccount;
2297 ucd->ContactFilename = FilenameFinal;
2298 ucd->ContactName = cmbDisplayAs->GetValue();
2299 ucd->ContactNameArray = ContactData.GetName();
2301 for (std::map<int,wxString>::iterator gniter = ContactEditorData.GeneralNicknamesList.begin();
2302 gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){
2304 ucd->ContactNickname = gniter->second;
2309 wxCommandEvent event2(CE_UPDATECONTACTLIST);
2310 event2.SetClientData(ucd);
2311 wxPostEvent(MainPtr, event2);
2315 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
2318 // Save the updated contact data and close the form.
2320 wxCommandEvent NullEvent;
2321 this->SaveContact(NullEvent);