1 // frmContactEditor-Save.cpp - frmContactEditor save contact subroutines.
3 // (c) 2012-2016 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "frmContactEditor.h"
21 #include "../version.h"
22 #include "../vcard/vcard.h"
23 #include "../vcard/vcard34conv.h"
24 #include "../common/textprocessing.h"
25 #include "../common/preferences.h"
26 #include "../common/uuid.h"
27 #include "../common/dirs.h"
29 void frmContactEditor::SaveContact( wxCommandEvent& event )
32 // Check if Display As combo box has a value in it.
33 // Do not go any further if there is no value.
35 wxString cmbDisplayAsValue = cmbDisplayAs->GetValue();
37 if (cmbDisplayAsValue.IsEmpty()){
39 wxMessageBox(_("Display As value cannot be left blank."), _("Display As value empty"), wxICON_ERROR);
44 // Save the updated contact data.
47 wxString FilenameFinal;
48 bool ReplaceContact = FALSE;
50 if (StartupEditMode == TRUE){
52 if (cmbType->GetCurrentSelection() == 1 ||
53 cmbType->GetCurrentSelection() == 3 ||
54 cmbType->GetCurrentSelection() == 4){
58 // Mark contact for replacing.
60 ReplaceContact = TRUE;
65 } else if (cmbType->GetCurrentSelection() == 2){
67 if (IsGroup == FALSE){
69 // Mark contact for replacing.
71 ReplaceContact = TRUE;
78 if (ReplaceContact == TRUE){
80 wxString wxDelSplitFilename;
81 wxString wxDelFinalFilename;
82 wxString wxSDelDataURL;
83 wxStringTokenizer wSTDelFilename(wxSContactFilename, wxT("/"));
84 while(wSTDelFilename.HasMoreTokens()){
86 wxDelSplitFilename = wSTDelFilename.GetNextToken();
90 wxSDelDataURL = wxDelSplitFilename;
92 // Delete the contact from the server as it will be useless in certain
93 // address book clients.
95 ActMgrPtr->AddTask(2, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDelDataURL, wxDelSplitFilename, wxSContactFilename, wxT(""));
97 // Clear the filename so the trigger to recreate the UID is done.
99 wxSContactFilename.Clear();
106 if (wxSContactFilename.IsEmpty()){
108 // Generate a random UUID.
110 ContactEditorData.UIDToken = GenerateUUID();
111 ContactEditorData.UIDToken = ContactEditorData.UIDToken.MakeUpper();
113 // Setup the filename.
115 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
117 #if defined(__HAIKU__)
119 //preffilename = wxT("noo");
121 #elif defined(__WIN32__)
123 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
124 FilenameFinal.Append(ContactEditorData.UIDToken);
125 FilenameFinal.Append(wxT(".vcf"));
126 wxSContactFilename = FilenameFinal;
130 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
131 FilenameFinal.Append(ContactEditorData.UIDToken);
132 FilenameFinal.Append(wxT(".vcf"));
133 wxSContactFilename = FilenameFinal;
139 if (ContactEditorData.UIDToken.IsEmpty()){
141 // UID Token is empty. (Shouldn't be).
142 // Generate a new UID Token.
144 ContactEditorData.UIDToken = GenerateUUID();
145 ContactEditorData.UIDToken = ContactEditorData.UIDToken.MakeUpper();
149 FilenameFinal = wxSContactFilename;
153 // Setup the data and write it into the account folder.
155 // Begin preperations to write the contact to a file.
158 bool NNGeneralFirst = TRUE;
159 bool NNHomeFirst = TRUE;
160 bool NNWorkFirst = TRUE;
162 std::map<int,int>::iterator intiter;
163 std::map<int,wxString>::iterator striter;
165 ContactData.Add(wxT("BEGIN"), wxT("VCARD"), FALSE);
166 ContactData.Add(wxT("VERSION"), wxT("4.0"), FALSE);
168 // Setup the version string.
170 strValue.Append(wxT("-//Xestia//Address Book Version "));
171 strValue.Append(wxT(XSDAB_VERSION));
172 strValue.Append(wxT("//KW"));
174 ContactData.Add(wxT("PRODID"), strValue, FALSE);
180 // Setup the name field.
182 strValue = txtSurname->GetValue() + wxT(";") +
183 txtForename->GetValue() + wxT(";") +
184 txtOtherNames->GetValue() + wxT(";") +
185 txtTitle->GetValue() + wxT(";") +
186 txtSuffix->GetValue();
188 strValue2 = ContactData.Convert(cmbDisplayAs->GetValue(), FALSE);
191 if (ContactEditorData.NameTokens.IsEmpty()){
192 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\""), strValue, FALSE);
194 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\";") + ContactEditorData.NameTokens, strValue, FALSE);
197 if (cmbType->GetCurrentSelection() == 1){
199 ContactData.AddRaw(wxT("KIND"), wxT("individual"));
201 } else if (cmbType->GetCurrentSelection() == 2){
203 ContactData.AddRaw(wxT("KIND"), wxT("group"));
205 // Go through each of the members and write them out.
207 for (std::map<int, wxString>::iterator itemiter = ContactEditorData.GroupsList.begin();
208 itemiter != ContactEditorData.GroupsList.end(); ++itemiter){
210 ContactData.Add(wxT("MEMBER:urn:uuid"), itemiter->second, FALSE);
214 } else if (cmbType->GetCurrentSelection() == 3){
216 ContactData.AddRaw(wxT("KIND"), wxT("org"));
218 } else if (cmbType->GetCurrentSelection() == 4){
220 ContactData.AddRaw(wxT("KIND"), wxT("location"));
225 // Setup the nicknames (General, Home & Business).
238 if (cmbGender->GetCurrentSelection() != 0){
240 switch(cmbGender->GetCurrentSelection()){
271 if (!txtGenderDescription->IsEmpty()){
273 strValue2 = txtGenderDescription->GetValue();
277 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
279 EscapeString(&strValue2, FALSE);
281 if (!ContactEditorData.GenderTokens.IsEmpty()){
283 if (!strValue2.IsEmpty()){
285 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue + wxT(";") + strValue2);
289 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue);
295 if (!strValue2.IsEmpty()){
297 ContactData.AddRaw(wxT("GENDER"), strValue + wxT(";") + strValue2);
301 ContactData.AddRaw(wxT("GENDER"), strValue);
320 strValue3 = ContactEditorData.BirthdayAltID;
322 if (!strValue3.IsEmpty()){
327 strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
333 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
338 strValue3 = ContactEditorData.BirthdayCalScale;
340 if (!strValue3.IsEmpty()){
345 if (boolValue2 == TRUE){
347 strValue2.Append(wxT(";"));
355 strValue2.Append(wxT("CALSCALE=") + strValue3);
363 strValue2 = ContactEditorData.BirthdayTokens;
365 // Get the birthday and write it.
367 ResetSaveProcessData();
369 if (!txtBirthday->IsEmpty()){
371 strValue = txtBirthday->GetValue();
373 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
375 if (!strValue2.IsEmpty()){
377 EscapeString(&strValue2, FALSE);
378 EscapeString(&strValue, FALSE);
380 ContactData.AddRaw(wxT("BDAY;VALUE=text;") + strValue2 + wxT(";"), strValue);
384 EscapeString(&strValue, FALSE);
386 ContactData.AddRaw(wxT("BDAY;VALUE=text"), strValue);
396 // Get Day, Month & Year.
398 wxDateTime BirthdayDate;
399 wxDateTime::Month BirthdayMonth;
402 wxString DataBeforeT;
404 wxString FinalBirthdayString;
405 bool ProcessDataAfterT = FALSE;
407 BirthdayDate = dapBirthday->GetValue();
409 if (BirthdayDate.IsValid()){
411 BirthdayDay = BirthdayDate.GetDay();
412 BirthdayMonth = BirthdayDate.GetMonth();
413 BirthdayYear = BirthdayDate.GetYear();
415 // Look for T and replace data before this.
417 wxStringTokenizer wSTDate(ContactEditorData.Birthday, wxT("T"));
419 while (wSTDate.HasMoreTokens()){
421 if (ProcessDataAfterT == FALSE){
423 DataBeforeT = wSTDate.GetNextToken();
424 ProcessDataAfterT = TRUE;
428 DataAfterT = wSTDate.GetNextToken();
435 // If there is not T then replace altogether.
437 wxString FinalBirthdayDay;
438 wxString FinalBirthdayMonth;
439 wxString FinalBirthdayYear;
441 if (BirthdayDay < 10){
443 FinalBirthdayDay = wxT("0") + wxString::Format(wxT("%i"), BirthdayDay);
447 FinalBirthdayDay = wxString::Format(wxT("%i"), BirthdayDay);
451 if (((int)BirthdayMonth + 1) < 10){
453 FinalBirthdayMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
457 FinalBirthdayMonth = wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
461 if (BirthdayYear == 0){
463 FinalBirthdayYear = wxT("--");
467 FinalBirthdayYear = wxString::Format(wxT("%i"), BirthdayYear);
471 if (!DataAfterT.IsEmpty()){
473 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay + wxT("T") + DataAfterT;
477 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay;
481 if (!FinalBirthdayString.IsEmpty() || !strValue2.IsEmpty()){
483 if (!strValue2.IsEmpty()){
485 EscapeString(&strValue2, FALSE);
486 EscapeString(&strValue, FALSE);
488 ContactData.AddRaw(wxT("BDAY") + strValue2 + wxT(";"), FinalBirthdayString);
492 EscapeString(&strValue, FALSE);
494 ContactData.AddRaw(wxT("BDAY"), FinalBirthdayString);
504 ResetSaveProcessData();
508 strValue3 = ContactEditorData.AnniversaryAltID;
510 if (!strValue3.IsEmpty()){
515 strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
521 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
526 strValue3 = ContactEditorData.AnniversaryCalScale;
528 if (!strValue3.IsEmpty()){
533 if (boolValue2 == TRUE){
535 strValue2.Append(wxT(";"));
543 strValue2.Append(wxT("CALSCALE=") + strValue3);
551 strValue2 = ContactEditorData.AnniversaryTokens;
553 // Deal with ANNIVERSARY.
555 if (!txtAnniversary->IsEmpty()){
557 strValue = txtAnniversary->GetValue();
559 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
561 if (!strValue2.IsEmpty()){
563 EscapeString(&strValue2, FALSE);
564 EscapeString(&strValue, FALSE);
566 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text;") + strValue2 + wxT(";"), strValue);
570 EscapeString(&strValue, FALSE);
572 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text"), strValue);
580 // Look for T and replace data before this.
582 // Get Day, Month & Year.
584 wxDateTime AnniversaryDate;
585 wxDateTime::Month AnniversaryMonth;
588 wxString DataBeforeT;
590 wxString FinalAnniversaryString;
591 bool ProcessDataAfterT = FALSE;
593 AnniversaryDate = dapAnniversary->GetValue();
595 if (AnniversaryDate.IsValid()){
597 AnniversaryDay = AnniversaryDate.GetDay();
598 AnniversaryMonth = AnniversaryDate.GetMonth();
599 AnniversaryYear = AnniversaryDate.GetYear();
601 // Look for T and replace data before this.
603 wxStringTokenizer wSTDate(ContactEditorData.Anniversary, wxT("T"));
605 while (wSTDate.HasMoreTokens()){
607 if (ProcessDataAfterT == FALSE){
609 DataBeforeT = wSTDate.GetNextToken();
610 ProcessDataAfterT = TRUE;
614 DataAfterT = wSTDate.GetNextToken();
621 // If there is not T then replace altogether.
623 wxString FinalAnniversaryDay;
624 wxString FinalAnniversaryMonth;
625 wxString FinalAnniversaryYear;
627 if (AnniversaryDay < 10){
629 FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
633 FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
637 if (((int)AnniversaryMonth + 1) < 10){
639 FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
643 FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
647 if (AnniversaryYear == 0){
649 FinalAnniversaryYear = wxT("--");
653 FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
657 if (!DataAfterT.IsEmpty()){
659 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
663 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
667 if (!FinalAnniversaryString.IsEmpty() || !strValue2.IsEmpty()){
669 if (!strValue2.IsEmpty()){
671 EscapeString(&strValue2, FALSE);
672 EscapeString(&strValue, FALSE);
674 ContactData.AddRaw(wxT("ANNIVERSARY") + strValue2 + wxT(";"), FinalAnniversaryString);
678 EscapeString(&strValue, FALSE);
680 ContactData.AddRaw(wxT("ANNIVERSARY"), FinalAnniversaryString);
690 // Setup the addresses (General, Home, Business).
692 //intValue = GeneralAddressList.size();
693 ResetSaveProcessData();
695 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralAddressList.begin();
696 iter != ContactEditorData.GeneralAddressList.end(); ++iter){
698 int intSeekValue = iter->first;
700 wxString strAddressString;
701 wxString strAddressFinalValue;
702 std::map<int, wxString>::iterator iterValue;
704 strAddressString.Append(wxT(";;"));
708 iterValue = ContactEditorData.GeneralAddressList.find(intSeekValue);
709 strAddressFinalValue = iterValue->second;
710 ProcessCaptureStrings(&strAddressFinalValue);
711 strAddressString.Append(strAddressFinalValue + wxT(";"));
712 strAddressFinalValue.Clear();
716 iterValue = ContactEditorData.GeneralAddressListTown.find(intSeekValue);
717 strAddressFinalValue = iterValue->second;
718 ProcessCaptureStrings(&strAddressFinalValue);
719 strAddressString.Append(strAddressFinalValue + wxT(";"));
720 strAddressFinalValue.Clear();
724 iterValue = ContactEditorData.GeneralAddressListCounty.find(intSeekValue);
725 strAddressFinalValue = iterValue->second;
726 ProcessCaptureStrings(&strAddressFinalValue);
727 strAddressString.Append(strAddressFinalValue + wxT(";"));
728 strAddressFinalValue.Clear();
732 iterValue = ContactEditorData.GeneralAddressListPostCode.find(intSeekValue);
733 strAddressFinalValue = iterValue->second;
734 ProcessCaptureStrings(&strAddressFinalValue);
735 strAddressString.Append(strAddressFinalValue + wxT(";"));
736 strAddressFinalValue.Clear();
740 iterValue = ContactEditorData.GeneralAddressListCountry.find(intSeekValue);
741 strAddressFinalValue = iterValue->second;
742 ProcessCaptureStrings(&strAddressFinalValue);
743 strAddressString.Append(strAddressFinalValue);
744 strAddressFinalValue.Clear();
746 ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
747 &iter, &strAddressString, &ContactData,
748 wxT("LABEL"), &ContactEditorData.GeneralAddressListLabel,
749 wxT("LANGUAGE"), &ContactEditorData.GeneralAddressListLang,
750 wxT("ALTID"), &ContactEditorData.GeneralAddressListAltID,
751 wxT("PID"), &ContactEditorData.GeneralAddressListPID,
752 wxT("GEO"), &ContactEditorData.GeneralAddressListGeo,
753 wxT("TZ"), &ContactEditorData.GeneralAddressListTimezone,
754 wxT("MEDIATYPE"), &ContactEditorData.GeneralAddressListMediatype,
755 wxT("PREF"), &ContactEditorData.GeneralAddressListPref,
756 wxT(""), &ContactEditorData.GeneralAddressListTokens );
758 ResetSaveProcessData();
762 ResetSaveProcessData();
764 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeAddressList.begin();
765 iter != ContactEditorData.HomeAddressList.end(); ++iter){
767 int intSeekValue = iter->first;
769 wxString strAddressString;
770 wxString strAddressFinalValue;
771 std::map<int, wxString>::iterator iterValue;
773 strAddressString.Append(wxT(";;"));
777 iterValue = ContactEditorData.HomeAddressList.find(intSeekValue);
778 strAddressFinalValue = iterValue->second;
779 ProcessCaptureStrings(&strAddressFinalValue);
780 strAddressString.Append(strAddressFinalValue + wxT(";"));
784 iterValue = ContactEditorData.HomeAddressListTown.find(intSeekValue);
785 strAddressFinalValue = iterValue->second;
786 ProcessCaptureStrings(&strAddressFinalValue);
787 strAddressString.Append(strAddressFinalValue + wxT(";"));
791 iterValue = ContactEditorData.HomeAddressListCounty.find(intSeekValue);
792 strAddressFinalValue = iterValue->second;
793 ProcessCaptureStrings(&strAddressFinalValue);
794 strAddressString.Append(strAddressFinalValue + wxT(";"));
798 iterValue = ContactEditorData.HomeAddressListPostCode.find(intSeekValue);
799 strAddressFinalValue = iterValue->second;
800 ProcessCaptureStrings(&strAddressFinalValue);
801 strAddressString.Append(strAddressFinalValue + wxT(";"));
805 iterValue = ContactEditorData.HomeAddressListCountry.find(intSeekValue);
806 strAddressFinalValue = iterValue->second;
807 ProcessCaptureStrings(&strAddressFinalValue);
808 strAddressString.Append(strAddressFinalValue);
810 ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
811 &iter, &strAddressString, &ContactData,
812 wxT("LABEL"), &ContactEditorData.HomeAddressListLabel,
813 wxT("LANGUAGE"), &ContactEditorData.HomeAddressListLang,
814 wxT("ALTID"), &ContactEditorData.HomeAddressListAltID,
815 wxT("PID"), &ContactEditorData.HomeAddressListPID,
816 wxT("GEO"), &ContactEditorData.HomeAddressListGeo,
817 wxT("TZ"), &ContactEditorData.HomeAddressListTimezone,
818 wxT("MEDIATYPE"), &ContactEditorData.HomeAddressListMediatype,
819 wxT("PREF"), &ContactEditorData.HomeAddressListPref,
820 wxT(""), &ContactEditorData.HomeAddressListTokens );
822 ResetSaveProcessData();
826 ResetSaveProcessData();
828 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessAddressList.begin();
829 iter != ContactEditorData.BusinessAddressList.end(); ++iter){
831 int intSeekValue = iter->first;
833 wxString strAddressString;
834 wxString strAddressFinalValue;
835 std::map<int, wxString>::iterator iterValue;
837 strAddressString.Append(wxT(";;"));
841 iterValue = ContactEditorData.BusinessAddressList.find(intSeekValue);
842 strAddressFinalValue = iterValue->second;
843 ProcessCaptureStrings(&strAddressFinalValue);
845 strAddressString.Append(strAddressFinalValue + wxT(";"));
849 iterValue = ContactEditorData.BusinessAddressListTown.find(intSeekValue);
850 strAddressFinalValue = iterValue->second;
851 ProcessCaptureStrings(&strAddressFinalValue);
853 strAddressString.Append(strAddressFinalValue + wxT(";"));
857 iterValue = ContactEditorData.BusinessAddressListCounty.find(intSeekValue);
858 strAddressFinalValue = iterValue->second;
859 ProcessCaptureStrings(&strAddressFinalValue);
861 strAddressString.Append(strAddressFinalValue + wxT(";"));
865 iterValue = ContactEditorData.BusinessAddressListPostCode.find(intSeekValue);
866 strAddressFinalValue = iterValue->second;
867 ProcessCaptureStrings(&strAddressFinalValue);
869 strAddressString.Append(strAddressFinalValue + wxT(";"));
873 iterValue = ContactEditorData.BusinessAddressListCountry.find(intSeekValue);
874 strAddressFinalValue = iterValue->second;
875 ProcessCaptureStrings(&strAddressFinalValue);
877 strAddressString.Append(strAddressFinalValue);
879 ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
880 &iter, &strAddressString, &ContactData,
881 wxT("LABEL"), &ContactEditorData.BusinessAddressListLabel,
882 wxT("LANGUAGE"), &ContactEditorData.BusinessAddressListLang,
883 wxT("ALTID"), &ContactEditorData.BusinessAddressListAltID,
884 wxT("PID"), &ContactEditorData.BusinessAddressListPID,
885 wxT("GEO"), &ContactEditorData.BusinessAddressListGeo,
886 wxT("TZ"), &ContactEditorData.BusinessAddressListTimezone,
887 wxT("MEDIATYPE"), &ContactEditorData.BusinessAddressListMediatype,
888 wxT("PREF"), &ContactEditorData.BusinessAddressListPref,
889 wxT(""), &ContactEditorData.BusinessAddressListTokens );
891 ResetSaveProcessData();
895 // Sort out nicknames (if any).
897 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNicknamesList.begin();
898 iter != ContactEditorData.GeneralNicknamesList.end(); ++iter){
900 intValue2 = iter->first;
902 // Process Alternative ID.
904 ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
905 &iter, &ContactEditorData.GeneralNicknamesList, &ContactData,
906 wxT("LANGUAGE"), &ContactEditorData.GeneralNicknamesListLanguage,
907 wxT("ALTID"), &ContactEditorData.GeneralNicknamesListAltID,
908 wxT("PID"), &ContactEditorData.GeneralNicknamesListPID,
909 wxT("PREF"), &ContactEditorData.GeneralNicknamesListPref,
910 wxT(""), &ContactEditorData.GeneralNicknamesListTokens );
912 ResetSaveProcessData();
916 ResetSaveProcessData();
918 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNicknamesList.begin();
919 iter != ContactEditorData.HomeNicknamesList.end(); ++iter){
921 ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
922 &iter, &ContactEditorData.HomeNicknamesList, &ContactData,
923 wxT("LANGUAGE"), &ContactEditorData.HomeNicknamesListLanguage,
924 wxT("ALTID"), &ContactEditorData.HomeNicknamesListAltID,
925 wxT("PID"), &ContactEditorData.HomeNicknamesListPID,
926 wxT("PREF"), &ContactEditorData.HomeNicknamesListPref,
927 wxT(""), &ContactEditorData.HomeNicknamesListTokens );
929 ResetSaveProcessData();
933 ResetSaveProcessData();
935 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNicknamesList.begin();
936 iter != ContactEditorData.BusinessNicknamesList.end(); ++iter){
938 ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
939 &iter, &ContactEditorData.BusinessNicknamesList, &ContactData,
940 wxT("LANGUAGE"), &ContactEditorData.BusinessNicknamesListLanguage,
941 wxT("ALTID"), &ContactEditorData.BusinessNicknamesListAltID,
942 wxT("PID"), &ContactEditorData.BusinessNicknamesListPID,
943 wxT("PREF"), &ContactEditorData.BusinessNicknamesListPref,
944 wxT(""), &ContactEditorData.BusinessNicknamesListTokens );
946 ResetSaveProcessData();
950 ResetSaveProcessData();
952 // Sort out email (general, home and business).
954 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralEmailList.begin();
955 iter != ContactEditorData.GeneralEmailList.end(); ++iter){
957 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
960 wxString strAddressFinalValue;
961 std::map<int, wxString>::iterator iterValue;
963 ProcessSaveData(wxT("EMAIL"), &strValue2, &boolValue2, &boolValue,
964 &iter, &ContactEditorData.GeneralEmailList, &ContactData,
965 wxT("ALTID"), &ContactEditorData.GeneralEmailListAltID,
966 wxT("PID"), &ContactEditorData.GeneralEmailListPID,
967 wxT("PREF"), &ContactEditorData.GeneralEmailListPref,
968 wxT(""), &ContactEditorData.GeneralEmailListTokens );
970 ResetSaveProcessData();
974 ResetSaveProcessData();
976 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeEmailList.begin();
977 iter != ContactEditorData.HomeEmailList.end(); ++iter){
979 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
982 ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
983 &iter, &ContactEditorData.HomeEmailList, &ContactData,
984 wxT("ALTID"), &ContactEditorData.HomeEmailListAltID,
985 wxT("PID"), &ContactEditorData.HomeEmailListPID,
986 wxT("PREF"), &ContactEditorData.HomeEmailListPref,
987 wxT(""), &ContactEditorData.HomeEmailListTokens );
989 ResetSaveProcessData();
993 ResetSaveProcessData();
995 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessEmailList.begin();
996 iter != ContactEditorData.BusinessEmailList.end(); ++iter){
998 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1001 ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1002 &iter, &ContactEditorData.BusinessEmailList, &ContactData,
1003 wxT("ALTID"), &ContactEditorData.BusinessEmailListAltID,
1004 wxT("PID"), &ContactEditorData.BusinessEmailListPID,
1005 wxT("PREF"), &ContactEditorData.BusinessEmailListPref,
1006 wxT(""), &ContactEditorData.BusinessEmailListTokens );
1008 ResetSaveProcessData();
1012 ResetSaveProcessData();
1014 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralIMList.begin();
1015 iter != ContactEditorData.GeneralIMList.end(); ++iter){
1017 intValue2 = iter->first;
1019 // Process Alternative ID.
1021 ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
1022 &iter, &ContactEditorData.GeneralIMList, &ContactData,
1023 wxT("ALTID"), &ContactEditorData.GeneralIMListAltID,
1024 wxT("PID"), &ContactEditorData.GeneralIMListPID,
1025 wxT("MEDIATYPE"), &ContactEditorData.GeneralIMListMediatype,
1026 wxT("PREF"), &ContactEditorData.GeneralIMListPref,
1027 wxT(""), &ContactEditorData.GeneralIMListTokens );
1029 ResetSaveProcessData();
1033 ResetSaveProcessData();
1035 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeIMList.begin();
1036 iter != ContactEditorData.HomeIMList.end(); ++iter){
1038 ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1039 &iter, &ContactEditorData.HomeIMList, &ContactData,
1040 wxT("ALTID"), &ContactEditorData.HomeIMListAltID,
1041 wxT("PID"), &ContactEditorData.HomeIMListPID,
1042 wxT("MEDIATYPE"), &ContactEditorData.HomeIMListMediatype,
1043 wxT("PREF"), &ContactEditorData.HomeIMListPref,
1044 wxT(""), &ContactEditorData.HomeIMListTokens );
1046 ResetSaveProcessData();
1050 ResetSaveProcessData();
1052 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessIMList.begin();
1053 iter != ContactEditorData.BusinessIMList.end(); ++iter){
1055 ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1056 &iter, &ContactEditorData.BusinessIMList, &ContactData,
1057 wxT("ALTID"), &ContactEditorData.BusinessIMListAltID,
1058 wxT("PID"), &ContactEditorData.BusinessIMListPID,
1059 wxT("MEDIATYPE"), &ContactEditorData.BusinessIMListMediatype,
1060 wxT("PREF"), &ContactEditorData.BusinessIMListPref,
1061 wxT(""), &ContactEditorData.BusinessIMListTokens );
1063 ResetSaveProcessData();
1067 ResetSaveProcessData();
1069 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTelephoneList.begin();
1070 iter != ContactEditorData.GeneralTelephoneList.end(); ++iter){
1072 wxString strAddressFinalValue = iter->second;
1074 ProcessCaptureStrings(&strAddressFinalValue);
1076 if (ContactEditorData.GeneralTelephoneListDataType.find(iter->first) !=
1077 ContactEditorData.GeneralTelephoneListDataType.end()){
1079 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralTelephoneListDataType.find(iter->first);
1081 strAddressFinalValue.insert(0, ":");
1082 strAddressFinalValue.insert(0, DataTypeIter->second);
1086 strAddressFinalValue.insert(0, "tel:");
1090 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1091 &iter, &strAddressFinalValue, &ContactData,
1092 wxT("ALTID"), &ContactEditorData.GeneralTelephoneListAltID,
1093 wxT("PID"), &ContactEditorData.GeneralTelephoneListPID,
1094 wxT("TYPE"), &ContactEditorData.GeneralTelephoneListType,
1095 wxT("PREF"), &ContactEditorData.GeneralTelephoneListPref,
1096 wxT(""), &ContactEditorData.GeneralTelephoneListTokens );
1098 ResetSaveProcessData();
1102 ResetSaveProcessData();
1104 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTelephoneList.begin();
1105 iter != ContactEditorData.HomeTelephoneList.end(); ++iter){
1107 wxString strAddressFinalValue = iter->second;
1109 ProcessCaptureStrings(&strAddressFinalValue);
1111 if (ContactEditorData.HomeTelephoneListDataType.find(iter->first) !=
1112 ContactEditorData.HomeTelephoneListDataType.end()){
1114 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeTelephoneListDataType.find(iter->first);
1116 strAddressFinalValue.insert(0, ":");
1117 strAddressFinalValue.insert(0, DataTypeIter->second);
1121 strAddressFinalValue.insert(0, "tel:");
1125 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1126 &iter, &strAddressFinalValue, &ContactData,
1127 wxT("ALTID"), &ContactEditorData.HomeTelephoneListAltID,
1128 wxT("PID"), &ContactEditorData.HomeTelephoneListPID,
1129 wxT("TYPE"), &ContactEditorData.HomeTelephoneListType,
1130 wxT("PREF"), &ContactEditorData.HomeTelephoneListPref,
1131 wxT(""), &ContactEditorData.HomeTelephoneListTokens );
1133 ResetSaveProcessData();
1137 ResetSaveProcessData();
1139 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTelephoneList.begin();
1140 iter != ContactEditorData.BusinessTelephoneList.end(); ++iter){
1142 wxString strAddressFinalValue = iter->second;
1144 ProcessCaptureStrings(&strAddressFinalValue);
1146 if (ContactEditorData.BusinessTelephoneListDataType.find(iter->first) !=
1147 ContactEditorData.BusinessTelephoneListDataType.end()){
1149 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessTelephoneListDataType.find(iter->first);
1151 strAddressFinalValue.insert(0, ":");
1152 strAddressFinalValue.insert(0, DataTypeIter->second);
1156 strAddressFinalValue.insert(0, "tel:");
1160 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1161 &iter, &strAddressFinalValue, &ContactData,
1162 wxT("ALTID"), &ContactEditorData.BusinessTelephoneListAltID,
1163 wxT("PID"), &ContactEditorData.BusinessTelephoneListPID,
1164 wxT("TYPE"), &ContactEditorData.BusinessTelephoneListType,
1165 wxT("PREF"), &ContactEditorData.BusinessTelephoneListPref,
1166 wxT(""), &ContactEditorData.BusinessTelephoneListTokens );
1168 ResetSaveProcessData();
1172 ResetSaveProcessData();
1174 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralLanguageList.begin();
1175 iter != ContactEditorData.GeneralLanguageList.end(); ++iter){
1177 intValue2 = iter->first;
1179 ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
1180 &iter, &ContactEditorData.GeneralLanguageList, &ContactData,
1181 wxT("ALTID"), &ContactEditorData.GeneralLanguageListAltID,
1182 wxT("PID"), &ContactEditorData.GeneralLanguageListPID,
1183 wxT("PREF"), &ContactEditorData.GeneralLanguageListPref,
1184 wxT(""), &ContactEditorData.GeneralLanguageListTokens );
1186 ResetSaveProcessData();
1190 ResetSaveProcessData();
1192 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeLanguageList.begin();
1193 iter != ContactEditorData.HomeLanguageList.end(); ++iter){
1195 ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1196 &iter, &ContactEditorData.HomeLanguageList, &ContactData,
1197 wxT("ALTID"), &ContactEditorData.HomeLanguageListAltID,
1198 wxT("PID"), &ContactEditorData.HomeLanguageListPID,
1199 wxT("PREF"), &ContactEditorData.HomeLanguageListPref,
1200 wxT(""), &ContactEditorData.HomeLanguageListTokens );
1202 ResetSaveProcessData();
1206 ResetSaveProcessData();
1208 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessLanguageList.begin();
1209 iter != ContactEditorData.BusinessLanguageList.end(); ++iter){
1211 ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1212 &iter, &ContactEditorData.BusinessLanguageList, &ContactData,
1213 wxT("ALTID"), &ContactEditorData.BusinessLanguageListAltID,
1214 wxT("PID"), &ContactEditorData.BusinessLanguageListPID,
1215 wxT("PREF"), &ContactEditorData.BusinessLanguageListPref,
1216 wxT(""), &ContactEditorData.BusinessLanguageListTokens );
1218 ResetSaveProcessData();
1222 ResetSaveProcessData();
1224 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTZList.begin();
1225 iter != ContactEditorData.GeneralTZList.end(); ++iter){
1227 ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
1228 &iter, &ContactEditorData.GeneralTZList, &ContactData,
1229 wxT("ALTID"), &ContactEditorData.GeneralTZListAltID,
1230 wxT("PID"), &ContactEditorData.GeneralTZListPID,
1231 wxT("MEDIATYPE"), &ContactEditorData.GeneralTZListMediatype,
1232 wxT("PREF"), &ContactEditorData.GeneralTZListPref,
1233 wxT(""), &ContactEditorData.GeneralTZListTokens );
1235 ResetSaveProcessData();
1239 ResetSaveProcessData();
1241 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTZList.begin();
1242 iter != ContactEditorData.HomeTZList.end(); ++iter){
1244 ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1245 &iter, &ContactEditorData.HomeTZList, &ContactData,
1246 wxT("ALTID"), &ContactEditorData.HomeTZListAltID,
1247 wxT("PID"), &ContactEditorData.HomeTZListPID,
1248 wxT("MEDIATYPE"), &ContactEditorData.HomeTZListMediatype,
1249 wxT("PREF"), &ContactEditorData.HomeTZListPref,
1250 wxT(""), &ContactEditorData.HomeTZListTokens );
1252 ResetSaveProcessData();
1256 ResetSaveProcessData();
1258 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTZList.begin();
1259 iter != ContactEditorData.BusinessTZList.end(); ++iter){
1261 ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1262 &iter, &ContactEditorData.BusinessTZList, &ContactData,
1263 wxT("ALTID"), &ContactEditorData.BusinessTZListAltID,
1264 wxT("PID"), &ContactEditorData.BusinessTZListPID,
1265 wxT("MEDIATYPE"), &ContactEditorData.BusinessTZListMediatype,
1266 wxT("PREF"), &ContactEditorData.BusinessTZListPref,
1267 wxT(""), &ContactEditorData.BusinessTZListTokens );
1269 ResetSaveProcessData();
1273 ResetSaveProcessData();
1275 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralGeographyList.begin();
1276 iter != ContactEditorData.GeneralGeographyList.end(); ++iter){
1278 wxString strAddressFinalValue = iter->second;
1280 ProcessCaptureStrings(&strAddressFinalValue);
1282 strAddressFinalValue.insert(0, wxT("geo:"));
1284 ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
1285 &iter, &strAddressFinalValue, &ContactData,
1286 wxT("ALTID"), &ContactEditorData.GeneralGeographyListAltID,
1287 wxT("PID"), &ContactEditorData.GeneralGeographyListPID,
1288 wxT("MEDIATYPE"), &ContactEditorData.GeneralGeographyListMediatype,
1289 wxT("PREF"), &ContactEditorData.GeneralGeographyListPref,
1290 wxT(""), &ContactEditorData.GeneralGeographyListTokens );
1292 ResetSaveProcessData();
1296 ResetSaveProcessData();
1298 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeGeographyList.begin();
1299 iter != ContactEditorData.HomeGeographyList.end(); ++iter){
1301 wxString strAddressFinalValue = iter->second;
1303 ProcessCaptureStrings(&strAddressFinalValue);
1305 strAddressFinalValue.insert(0, wxT("geo:"));
1307 ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1308 &iter, &ContactEditorData.HomeGeographyList, &ContactData,
1309 wxT("ALTID"), &ContactEditorData.HomeGeographyListAltID,
1310 wxT("PID"), &ContactEditorData.HomeGeographyListPID,
1311 wxT("MEDIATYPE"), &ContactEditorData.HomeGeographyListMediatype,
1312 wxT("PREF"), &ContactEditorData.HomeGeographyListPref,
1313 wxT(""), &ContactEditorData.HomeGeographyListTokens );
1315 ResetSaveProcessData();
1319 ResetSaveProcessData();
1321 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessGeographyList.begin();
1322 iter != ContactEditorData.BusinessGeographyList.end(); ++iter){
1324 wxString strAddressFinalValue = iter->second;
1326 ProcessCaptureStrings(&strAddressFinalValue);
1328 strAddressFinalValue.insert(0, wxT("geo:"));
1330 ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1331 &iter, &ContactEditorData.BusinessGeographyList, &ContactData,
1332 wxT("ALTID"), &ContactEditorData.BusinessGeographyListAltID,
1333 wxT("PID"), &ContactEditorData.BusinessGeographyListPID,
1334 wxT("MEDIATYPE"), &ContactEditorData.BusinessGeographyListMediatype,
1335 wxT("PREF"), &ContactEditorData.BusinessGeographyListPref,
1336 wxT(""), &ContactEditorData.BusinessGeographyListTokens );
1338 ResetSaveProcessData();
1342 ResetSaveProcessData();
1344 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRelatedList.begin();
1345 iter != ContactEditorData.GeneralRelatedList.end(); ++iter){
1347 ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
1348 &iter, &ContactEditorData.GeneralRelatedList, &ContactData,
1349 wxT("ALTID"), &ContactEditorData.GeneralRelatedListAltID,
1350 wxT("PID"), &ContactEditorData.GeneralRelatedListPID,
1351 wxT("LANGUAGE"), &ContactEditorData.GeneralRelatedListLanguage,
1352 wxT("TYPE"), &ContactEditorData.GeneralRelatedListRelType,
1353 wxT("PREF"), &ContactEditorData.GeneralRelatedListPref,
1354 wxT(""), &ContactEditorData.GeneralRelatedListTokens );
1356 ResetSaveProcessData();
1360 ResetSaveProcessData();
1362 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralWebsiteList.begin();
1363 iter != ContactEditorData.GeneralWebsiteList.end(); ++iter){
1365 ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
1366 &iter, &ContactEditorData.GeneralWebsiteList, &ContactData,
1367 wxT("ALTID"), &ContactEditorData.GeneralWebsiteListAltID,
1368 wxT("PID"), &ContactEditorData.GeneralWebsiteListPID,
1369 wxT("MEDIATYPE"), &ContactEditorData.GeneralWebsiteListMediatype,
1370 wxT("PREF"), &ContactEditorData.GeneralWebsiteListPref,
1371 wxT(""), &ContactEditorData.GeneralWebsiteListTokens );
1373 ResetSaveProcessData();
1377 ResetSaveProcessData();
1379 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeWebsiteList.begin();
1380 iter != ContactEditorData.HomeWebsiteList.end(); ++iter){
1382 ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1383 &iter, &ContactEditorData.HomeWebsiteList, &ContactData,
1384 wxT("ALTID"), &ContactEditorData.HomeWebsiteListAltID,
1385 wxT("PID"), &ContactEditorData.HomeWebsiteListPID,
1386 wxT("MEDIATYPE"), &ContactEditorData.HomeWebsiteListMediatype,
1387 wxT("PREF"), &ContactEditorData.HomeWebsiteListPref,
1388 wxT(""), &ContactEditorData.HomeWebsiteListTokens );
1390 ResetSaveProcessData();
1394 ResetSaveProcessData();
1396 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessWebsiteList.begin();
1397 iter != ContactEditorData.BusinessWebsiteList.end(); ++iter){
1399 ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1400 &iter, &ContactEditorData.BusinessWebsiteList, &ContactData,
1401 wxT("ALTID"), &ContactEditorData.BusinessWebsiteListAltID,
1402 wxT("PID"), &ContactEditorData.BusinessWebsiteListPID,
1403 wxT("MEDIATYPE"), &ContactEditorData.BusinessWebsiteListMediatype,
1404 wxT("PREF"), &ContactEditorData.BusinessWebsiteListPref,
1405 wxT(""), &ContactEditorData.BusinessWebsiteListTokens );
1407 ResetSaveProcessData();
1411 ResetSaveProcessData();
1413 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTitleList.begin();
1414 iter != ContactEditorData.GeneralTitleList.end(); ++iter){
1416 ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
1417 &iter, &ContactEditorData.GeneralTitleList, &ContactData,
1418 wxT("ALTID"), &ContactEditorData.GeneralTitleListAltID,
1419 wxT("PID"), &ContactEditorData.GeneralTitleListPID,
1420 wxT("LANGUAGE"), &ContactEditorData.GeneralTitleListLanguage,
1421 wxT("PREF"), &ContactEditorData.GeneralTitleListPref,
1422 wxT(""), &ContactEditorData.GeneralTitleListTokens );
1424 ResetSaveProcessData();
1428 ResetSaveProcessData();
1430 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTitleList.begin();
1431 iter != ContactEditorData.HomeTitleList.end(); ++iter){
1433 ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1434 &iter, &ContactEditorData.HomeTitleList, &ContactData,
1435 wxT("ALTID"), &ContactEditorData.HomeTitleListAltID,
1436 wxT("PID"), &ContactEditorData.HomeTitleListPID,
1437 wxT("LANGUAGE"), &ContactEditorData.HomeTitleListLanguage,
1438 wxT("PREF"), &ContactEditorData.HomeTitleListPref,
1439 wxT(""), &ContactEditorData.HomeTitleListTokens );
1441 ResetSaveProcessData();
1445 ResetSaveProcessData();
1447 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTitleList.begin();
1448 iter != ContactEditorData.BusinessTitleList.end(); ++iter){
1450 ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1451 &iter, &ContactEditorData.BusinessTitleList, &ContactData,
1452 wxT("ALTID"), &ContactEditorData.BusinessTitleListAltID,
1453 wxT("PID"), &ContactEditorData.BusinessTitleListPID,
1454 wxT("LANGUAGE"), &ContactEditorData.BusinessTitleListLanguage,
1455 wxT("PREF"), &ContactEditorData.BusinessTitleListPref,
1456 wxT(""), &ContactEditorData.BusinessTitleListTokens );
1458 ResetSaveProcessData();
1462 ResetSaveProcessData();
1464 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRoleList.begin();
1465 iter != ContactEditorData.GeneralRoleList.end(); ++iter){
1467 ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
1468 &iter, &ContactEditorData.GeneralRoleList, &ContactData,
1469 wxT("ALTID"), &ContactEditorData.GeneralRoleListAltID,
1470 wxT("PID"), &ContactEditorData.GeneralRoleListPID,
1471 wxT("LANGUAGE"), &ContactEditorData.GeneralRoleListLanguage,
1472 wxT("PREF"), &ContactEditorData.GeneralRoleListPref,
1473 wxT(""), &ContactEditorData.GeneralRoleListTokens );
1475 ResetSaveProcessData();
1479 ResetSaveProcessData();
1481 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeRoleList.begin();
1482 iter != ContactEditorData.HomeRoleList.end(); ++iter){
1484 ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1485 &iter, &ContactEditorData.HomeRoleList, &ContactData,
1486 wxT("ALTID"), &ContactEditorData.HomeRoleListAltID,
1487 wxT("PID"), &ContactEditorData.HomeRoleListPID,
1488 wxT("LANGUAGE"), &ContactEditorData.HomeRoleListLanguage,
1489 wxT("PREF"), &ContactEditorData.HomeRoleListPref,
1490 wxT(""), &ContactEditorData.HomeRoleListTokens );
1492 ResetSaveProcessData();
1496 ResetSaveProcessData();
1498 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessRoleList.begin();
1499 iter != ContactEditorData.BusinessRoleList.end(); ++iter){
1501 ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1502 &iter, &ContactEditorData.BusinessRoleList, &ContactData,
1503 wxT("ALTID"), &ContactEditorData.BusinessRoleListAltID,
1504 wxT("PID"), &ContactEditorData.BusinessRoleListPID,
1505 wxT("LANGUAGE"), &ContactEditorData.BusinessRoleListLanguage,
1506 wxT("PREF"), &ContactEditorData.BusinessRoleListPref,
1507 wxT(""), &ContactEditorData.BusinessRoleListTokens );
1509 ResetSaveProcessData();
1513 ResetSaveProcessData();
1515 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralOrganisationsList.begin();
1516 iter != ContactEditorData.GeneralOrganisationsList.end(); ++iter){
1518 ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
1519 &iter, &ContactEditorData.GeneralOrganisationsList, &ContactData,
1520 wxT("ALTID"), &ContactEditorData.GeneralOrganisationsListAltID,
1521 wxT("PID"), &ContactEditorData.GeneralOrganisationsListPID,
1522 wxT("LANGUAGE"), &ContactEditorData.GeneralOrganisationsListLanguage,
1523 wxT("SORT-AS"), &ContactEditorData.GeneralOrganisationsListSortAs,
1524 wxT("PREF"), &ContactEditorData.GeneralOrganisationsListPref,
1525 wxT(""), &ContactEditorData.GeneralOrganisationsListTokens );
1527 ResetSaveProcessData();
1531 ResetSaveProcessData();
1533 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeOrganisationsList.begin();
1534 iter != ContactEditorData.HomeOrganisationsList.end(); ++iter){
1536 ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1537 &iter, &ContactEditorData.HomeOrganisationsList, &ContactData,
1538 wxT("ALTID"), &ContactEditorData.HomeOrganisationsListAltID,
1539 wxT("PID"), &ContactEditorData.HomeOrganisationsListPID,
1540 wxT("LANGUAGE"), &ContactEditorData.HomeOrganisationsListLanguage,
1541 wxT("SORT-AS"), &ContactEditorData.HomeOrganisationsListSortAs,
1542 wxT("PREF"), &ContactEditorData.HomeOrganisationsListPref,
1543 wxT(""), &ContactEditorData.HomeOrganisationsListTokens );
1545 ResetSaveProcessData();
1549 ResetSaveProcessData();
1551 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessOrganisationsList.begin();
1552 iter != ContactEditorData.BusinessOrganisationsList.end(); ++iter){
1554 ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1555 &iter, &ContactEditorData.BusinessOrganisationsList, &ContactData,
1556 wxT("ALTID"), &ContactEditorData.BusinessOrganisationsListAltID,
1557 wxT("PID"), &ContactEditorData.BusinessOrganisationsListPID,
1558 wxT("LANGUAGE"), &ContactEditorData.BusinessOrganisationsListLanguage,
1559 wxT("SORT-AS"), &ContactEditorData.BusinessOrganisationsListSortAs,
1560 wxT("PREF"), &ContactEditorData.BusinessOrganisationsListPref,
1561 wxT(""), &ContactEditorData.BusinessOrganisationsListTokens );
1563 ResetSaveProcessData();
1567 ResetSaveProcessData();
1569 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNoteList.begin();
1570 iter != ContactEditorData.GeneralNoteList.end(); ++iter){
1572 ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
1573 &iter, &ContactEditorData.GeneralNoteList, &ContactData,
1574 wxT("ALTID"), &ContactEditorData.GeneralNoteListAltID,
1575 wxT("PID"), &ContactEditorData.GeneralNoteListPID,
1576 wxT("LANGUAGE"), &ContactEditorData.GeneralNoteListLanguage,
1577 wxT("PREF"), &ContactEditorData.GeneralNoteListPref,
1578 wxT(""), &ContactEditorData.GeneralNoteListTokens );
1580 ResetSaveProcessData();
1584 ResetSaveProcessData();
1586 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNoteList.begin();
1587 iter != ContactEditorData.HomeNoteList.end(); ++iter){
1589 ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1590 &iter, &ContactEditorData.HomeNoteList, &ContactData,
1591 wxT("ALTID"), &ContactEditorData.HomeNoteListAltID,
1592 wxT("PID"), &ContactEditorData.HomeNoteListPID,
1593 wxT("LANGUAGE"), &ContactEditorData.HomeNoteListLanguage,
1594 wxT("PREF"), &ContactEditorData.HomeNoteListPref,
1595 wxT(""), &ContactEditorData.HomeNoteListTokens );
1597 ResetSaveProcessData();
1601 ResetSaveProcessData();
1603 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNoteList.begin();
1604 iter != ContactEditorData.BusinessNoteList.end(); ++iter){
1606 ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1607 &iter, &ContactEditorData.BusinessNoteList, &ContactData,
1608 wxT("ALTID"), &ContactEditorData.BusinessNoteListAltID,
1609 wxT("PID"), &ContactEditorData.BusinessNoteListPID,
1610 wxT("LANGUAGE"), &ContactEditorData.BusinessNoteListLanguage,
1611 wxT("PREF"), &ContactEditorData.BusinessNoteListPref,
1612 wxT(""), &ContactEditorData.BusinessNoteListTokens );
1614 ResetSaveProcessData();
1618 ResetSaveProcessData();
1620 for (std::map<int,wxString>::iterator iter = ContactEditorData.CategoriesList.begin();
1621 iter != ContactEditorData.CategoriesList.end(); ++iter){
1623 ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
1624 &iter, &ContactEditorData.CategoriesList, &ContactData,
1625 wxT("ALTID"), &ContactEditorData.CategoriesListAltID,
1626 wxT("PID"), &ContactEditorData.CategoriesListPID,
1627 wxT("TYPE"), &ContactEditorData.CategoriesListType,
1628 wxT("PREF"), &ContactEditorData.CategoriesListPref,
1629 wxT(""), &ContactEditorData.CategoriesListTokens );
1631 ResetSaveProcessData();
1637 for (std::map<int, std::string>::iterator iter = ContactEditorData.PicturesList.begin();
1638 iter != ContactEditorData.PicturesList.end(); ++iter){
1640 int intValueIndex = iter->first;
1642 std::map<int, std::string>::iterator stdstriter;
1643 std::map<int, wxString>::iterator enciter;
1645 striter = ContactEditorData.PicturesListPictureType.find(intValueIndex);
1646 enciter = ContactEditorData.PicturesListPicEncType.find(intValueIndex);
1648 ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
1649 &iter, &ContactEditorData.PicturesList, &striter,
1650 &enciter, &ContactData,
1651 wxT("ALTID"), &ContactEditorData.PicturesListAltID,
1652 wxT("PID"), &ContactEditorData.PicturesListPID,
1653 wxT("TYPE"), &ContactEditorData.PicturesListType,
1654 wxT("PREF"), &ContactEditorData.PicturesListPref,
1655 wxT(""), &ContactEditorData.PicturesListTokens);
1657 ResetSaveProcessData();
1661 ResetSaveProcessData();
1665 for (std::map<int, std::string>::iterator iter = ContactEditorData.LogosList.begin();
1666 iter != ContactEditorData.LogosList.end(); ++iter){
1668 int intValueIndex = iter->first;
1670 std::map<int, std::string>::iterator stdstriter;
1671 std::map<int, wxString>::iterator enciter;
1673 striter = ContactEditorData.LogosListPictureType.find(intValueIndex);
1674 enciter = ContactEditorData.LogosListPicEncType.find(intValueIndex);
1676 ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
1677 &iter, &ContactEditorData.LogosList, &striter,
1678 &enciter, &ContactData,
1679 wxT("ALTID"), &ContactEditorData.LogosListAltID,
1680 wxT("PID"), &ContactEditorData.LogosListPID,
1681 wxT("TYPE"), &ContactEditorData.LogosListType,
1682 wxT("PREF"), &ContactEditorData.LogosListPref,
1683 wxT(""), &ContactEditorData.LogosListTokens );
1685 ResetSaveProcessData();
1689 ResetSaveProcessData();
1693 for (std::map<int, std::string>::iterator iter = ContactEditorData.SoundsList.begin();
1694 iter != ContactEditorData.SoundsList.end(); ++iter){
1696 int intValueIndex = iter->first;
1698 std::map<int, std::string>::iterator stdstriter;
1699 std::map<int, wxString>::iterator enciter;
1701 striter = ContactEditorData.SoundsListAudioType.find(intValueIndex);
1702 enciter = ContactEditorData.SoundsListAudioEncType.find(intValueIndex);
1704 ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
1705 &iter, &ContactEditorData.SoundsList, &striter,
1706 &enciter, &ContactData,
1707 wxT("ALTID"), &ContactEditorData.SoundsListAltID,
1708 wxT("PID"), &ContactEditorData.SoundsListPID,
1709 wxT("TYPE"), &ContactEditorData.SoundsListType,
1710 wxT("PREF"), &ContactEditorData.SoundsListPref,
1711 wxT(""), &ContactEditorData.SoundsListTokens );
1713 ResetSaveProcessData();
1717 ResetSaveProcessData();
1719 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarList.begin();
1720 iter != ContactEditorData.CalendarList.end(); ++iter){
1722 ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
1723 &iter, &ContactEditorData.CalendarList, &ContactData,
1724 wxT("ALTID"), &ContactEditorData.CalendarListAltID,
1725 wxT("PID"), &ContactEditorData.CalendarListPID,
1726 wxT("MEDIATYPE"), &ContactEditorData.CalendarListMediatype,
1727 wxT("TYPE"), &ContactEditorData.CalendarListType,
1728 wxT("PREF"), &ContactEditorData.CalendarListPref,
1729 wxT(""), &ContactEditorData.CalendarListTokens );
1731 ResetSaveProcessData();
1735 ResetSaveProcessData();
1737 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarRequestList.begin();
1738 iter != ContactEditorData.CalendarRequestList.end(); ++iter){
1740 ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
1741 &iter, &ContactEditorData.CalendarRequestList, &ContactData,
1742 wxT("ALTID"), &ContactEditorData.CalendarRequestListAltID,
1743 wxT("PID"), &ContactEditorData.CalendarRequestListPID,
1744 wxT("MEDIATYPE"), &ContactEditorData.CalendarRequestListMediatype,
1745 wxT("TYPE"), &ContactEditorData.CalendarRequestListType,
1746 wxT("PREF"), &ContactEditorData.CalendarRequestListPref,
1747 wxT(""), &ContactEditorData.CalendarRequestListTokens );
1749 ResetSaveProcessData();
1753 ResetSaveProcessData();
1755 for (std::map<int,wxString>::iterator iter = ContactEditorData.FreeBusyList.begin();
1756 iter != ContactEditorData.FreeBusyList.end(); ++iter){
1758 ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
1759 &iter, &ContactEditorData.FreeBusyList, &ContactData,
1760 wxT("ALTID"), &ContactEditorData.FreeBusyListAltID,
1761 wxT("PID"), &ContactEditorData.FreeBusyListPID,
1762 wxT("MEDIATYPE"), &ContactEditorData.FreeBusyListMediatype,
1763 wxT("TYPE"), &ContactEditorData.FreeBusyListType,
1764 wxT("PREF"), &ContactEditorData.FreeBusyListPref,
1765 wxT(""), &ContactEditorData.FreeBusyListTokens );
1767 ResetSaveProcessData();
1771 for (std::map<int, wxString>::iterator iter = ContactEditorData.KeyList.begin();
1772 iter != ContactEditorData.KeyList.end(); ++iter){
1774 intValue2 = iter->first;
1776 // Get the key information.
1778 std::map<int, wxString>::iterator enciter;
1780 striter = ContactEditorData.KeyListDataType.find(intValue2);
1781 //enciter = KeyListAudioEncType.find(intValue2);
1783 wxString strValueData;
1785 strValueData = iter->second;
1786 strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));
1788 ProcessSaveData(wxT("KEY"), &strValue2, &boolValue2, &boolValue,
1789 &iter, &strValueData, &ContactData,
1790 wxT("ALTID"), &ContactEditorData.KeyListAltID,
1791 wxT("PID"), &ContactEditorData.KeyListPID,
1792 wxT("TYPE"), &ContactEditorData.KeyListType,
1793 wxT("PREF"), &ContactEditorData.KeyListPref,
1794 wxT(""), &ContactEditorData.KeyListTokens );
1796 ResetSaveProcessData();
1800 // Vendor specific items.
1802 ResetSaveProcessData();
1804 for (std::map<int,wxString>::iterator iter = ContactEditorData.VendorList.begin();
1805 iter != ContactEditorData.VendorList.end(); ++iter){
1807 intValue2 = iter->first;
1809 // Get the IANA PEN number.
1811 striter = ContactEditorData.VendorListPEN.find(intValue2);
1813 if (striter->first == intValue2){
1815 strValue2 = striter->second;
1819 // Get the element name.
1821 striter = ContactEditorData.VendorListElement.find(intValue2);
1823 if (striter->first == intValue2){
1825 strValue3 = striter->second;
1831 striter = ContactEditorData.VendorList.find(intValue2);
1833 if (striter->first == intValue2){
1835 strValue = striter->second;
1839 // Add to the vCard.
1841 if (boolValue == TRUE){
1843 ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
1847 ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
1851 ResetSaveProcessData();
1855 ResetSaveProcessData();
1859 for (std::map<int,wxString>::iterator iter = ContactEditorData.XTokenList.begin();
1860 iter != ContactEditorData.XTokenList.end(); ++iter){
1862 intValue2 = iter->first;
1864 // Get the element name.
1866 striter = ContactEditorData.XTokenListTokens.find(intValue2);
1868 if (striter->first == intValue2){
1870 strValue2 = striter->second;
1876 striter = ContactEditorData.XTokenList.find(intValue2);
1878 if (striter->first == intValue2){
1880 strValue = striter->second;
1884 // Add to the vCard.
1886 if (boolValue == TRUE){
1888 ContactData.AddRaw(wxT("X-") + strValue2, strValue);
1892 ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
1896 ResetSaveProcessData();
1900 ResetSaveProcessData();
1902 if (ContactEditorData.FullNamesList.size() == 0){
1904 wxString FullName = cmbDisplayAs->GetValue();
1905 ContactEditorData.FullNamesList.insert(std::make_pair(0, FullName));
1906 ContactEditorData.FullNamesListAltID.insert(std::make_pair(0, wxT("")));
1907 ContactEditorData.FullNamesListPID.insert(std::make_pair(0, wxT("")));
1908 ContactEditorData.FullNamesListType.insert(std::make_pair(0, wxT("")));
1909 ContactEditorData.FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
1910 ContactEditorData.FullNamesListPref.insert(std::make_pair(0, 0));
1911 ContactEditorData.FullNamesListTokens.insert(std::make_pair(0, wxT("")));
1916 for (std::map<int, wxString>::iterator iter = ContactEditorData.FullNamesList.begin();
1917 iter != ContactEditorData.FullNamesList.end(); ++iter){
1919 if (FNFirst == TRUE){
1921 iter->second = cmbDisplayAs->GetValue();
1926 std::map<int,wxString>::iterator mapS;
1928 mapS = ContactEditorData.FullNamesListTokens.find(iter->first);
1930 ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue,
1931 &iter, &ContactEditorData.FullNamesList, &ContactData,
1932 wxT("ALTID"), &ContactEditorData.FullNamesListAltID,
1933 wxT("PID"), &ContactEditorData.FullNamesListPID,
1934 wxT("TYPE"), &ContactEditorData.FullNamesListType,
1935 wxT("LANGUAGE"), &ContactEditorData.FullNamesListLanguage,
1936 wxT("PREF"), &ContactEditorData.FullNamesListPref,
1937 wxT(""), &ContactEditorData.FullNamesListTokens );
1941 ResetSaveProcessData();
1945 //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
1947 // Insert revision (REV) date.
1949 // Get today's date and time.
1951 wxDateTime DateTimeNow = wxDateTime::Now();
1955 // Set year, month and date.
1957 int intYear = DateTimeNow.GetYear();
1958 int intMonth = DateTimeNow.GetMonth();
1959 int intDay = DateTimeNow.GetDay();
1961 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
1965 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
1969 DateRev.Append(wxString::Format(wxT("%i"), intMonth));
1975 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
1979 DateRev.Append(wxString::Format(wxT("%i"), intDay));
1983 //DateRev.Append(wx);
1984 //DateRev.Append(wx);
1985 //DateRev.Append(wx);
1986 DateRev.Append(wxT("T"));
1988 // Set hour, minute and second.
1990 int intHour = DateTimeNow.GetHour();
1991 int intMinute = DateTimeNow.GetMinute();
1992 int intSecond = DateTimeNow.GetSecond();
1996 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
2000 DateRev.Append(wxString::Format(wxT("%i"), intHour));
2004 if (intMinute < 10){
2006 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
2010 DateRev.Append(wxString::Format(wxT("%i"), intMinute));
2014 if (intSecond < 10){
2016 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
2020 DateRev.Append(wxString::Format(wxT("%i"), intSecond));
2024 // DateRev.Append(wx);
2025 // DateRev.Append(wx);
2026 // DateRev.Append(wxString DateTimeNow->);
2027 DateRev.Append(wxT("Z"));
2029 ContactData.Add(wxT("UID"), ContactEditorData.UIDToken, FALSE);
2031 // End the vCard File.
2033 ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
2036 ContactData.WriteFile(FilenameFinal);
2038 vCard34Conv ConvFileFun;
2042 ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
2044 wxString AccountDirPrefix;
2045 wxString AccountDir;
2048 #if defined(__HAIKU__)
2050 //preffilename = wxT("noo");
2052 #elif defined(__APPLE__)
2054 PrefDir = GetUserPrefDir();
2056 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2058 #elif defined(__WIN32__)
2060 PrefDir = GetUserPrefDir();
2062 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
2066 PrefDir = GetUserPrefDir();
2068 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2072 XABPreferences PrefData(PrefDir);
2074 wxString AccountType;
2076 for (int i = 0; i < PrefData.accounts.GetCount(); i++){
2078 AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
2080 if (AccountDir == wxSContactAccount){
2082 AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
2083 AccountDirPrefix.Trim();
2084 AccountType = PrefData.accounts.GetAccountType(i);
2091 wxString wxSplitFilename;
2092 wxString wxSDataURL;
2094 while(wSTFilename.HasMoreTokens()){
2096 wxSplitFilename = wSTFilename.GetNextToken();
2100 wxSDataURL = wxSplitFilename;
2101 //wxSDataURL.Append(wxSplitFilename);
2103 // Find out if the filename exists in the table.
2105 if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
2107 wxString ETagResult;
2108 wxString ETagOriginal;
2110 ETagDB *ETagDBPtr = NULL;
2112 ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
2114 wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
2115 wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
2117 if (wxSETagOrig.IsEmpty()){
2119 // Generate the ETag.
2121 wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2125 if (wxSETag.IsEmpty()){
2127 // Update empty ETag.
2129 wxSETag = wxSETagOrig;
2130 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
2135 // Don't change original ETag.
2137 wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2138 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
2142 if (EditMode == FALSE){
2144 ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2146 FMTimer.SetFilename(FilenameFinal);
2147 FMTimer.UpdateTimestamp();
2148 FMTimer.Start(10000, FALSE);
2150 wxCommandEvent reloadevent(RELOADCONTACTLIST);
2151 reloadevent.SetString(wxSContactAccount);
2152 wxPostEvent(this->GetParent(), reloadevent);
2157 ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2158 FMTimer.UpdateTimestamp();
2159 FMTimer.Start(10000, FALSE);
2165 // Send a notification to update the main window
2166 // with the new details.
2171 // TODO: Workout nickname settings by priority and
2174 ucd->ContactAccount = wxSContactAccount;
2175 ucd->ContactFilename = FilenameFinal;
2176 ucd->ContactName = cmbDisplayAs->GetValue();
2177 ucd->ContactNameArray = ContactData.GetName();
2179 for (std::map<int,wxString>::iterator gniter = ContactEditorData.GeneralNicknamesList.begin();
2180 gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){
2182 ucd->ContactNickname = gniter->second;
2187 wxCommandEvent event2(CE_UPDATECONTACTLIST);
2188 event2.SetClientData(ucd);
2189 wxPostEvent(MainPtr, event2);
2193 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
2196 // Save the updated contact data and close the form.
2198 wxCommandEvent NullEvent;
2199 this->SaveContact(NullEvent);