1 #include "frmContactEditor.h"
3 #include "../version.h"
4 #include "../vcard/vcard.h"
5 #include "../vcard/vcard34conv.h"
6 #include "../common/textprocessing.h"
7 #include "../common/preferences.h"
8 #include "../common/uuid.h"
9 #include "../common/dirs.h"
11 void frmContactEditor::SaveContact( wxCommandEvent& event )
14 // Check if Display As combo box has a value in it.
15 // Do not go any further if there is no value.
17 wxString cmbDisplayAsValue = cmbDisplayAs->GetValue();
19 if (cmbDisplayAsValue.IsEmpty()){
21 wxMessageBox(_("Display As value cannot be left blank."), _("Display As value empty"), wxICON_ERROR);
26 // Save the updated contact data.
29 wxString FilenameFinal;
30 bool ReplaceContact = FALSE;
32 if (cmbType->GetCurrentSelection() == 1 ||
33 cmbType->GetCurrentSelection() == 3 ||
34 cmbType->GetCurrentSelection() == 4){
38 // Mark contact for replacing.
40 ReplaceContact = TRUE;
44 } else if (cmbType->GetCurrentSelection() == 2){
48 // Mark contact for replacing.
50 ReplaceContact = TRUE;
56 if (ReplaceContact == TRUE){
58 wxString wxDelSplitFilename;
59 wxString wxDelFinalFilename;
60 wxString wxSDelDataURL;
61 wxStringTokenizer wSTDelFilename(wxSContactFilename, wxT("/"));
62 while(wSTDelFilename.HasMoreTokens()){
64 wxDelSplitFilename = wSTDelFilename.GetNextToken();
68 wxSDelDataURL = wxDelSplitFilename;
70 // Delete the contact from the server as it will be useless in certain
71 // address book clients.
73 ActMgrPtr->AddTask(2, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDelDataURL, wxDelSplitFilename, wxSContactFilename, wxT(""));
75 // Clear the filename so the trigger to recreate the UID is done.
77 wxSContactFilename.Clear();
82 if (wxSContactFilename.IsEmpty()){
84 // Generate a random UUID.
86 UIDToken = GenerateUUID();
87 UIDToken = UIDToken.MakeUpper();
89 // Setup the filename.
91 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
93 #if defined(__HAIKU__)
95 //preffilename = wxT("noo");
97 #elif defined(__WIN32__)
99 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
100 FilenameFinal.Append(UIDToken);
101 FilenameFinal.Append(wxT(".vcf"));
102 wxSContactFilename = FilenameFinal;
106 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
107 FilenameFinal.Append(UIDToken);
108 FilenameFinal.Append(wxT(".vcf"));
109 wxSContactFilename = FilenameFinal;
115 if (UIDToken.IsEmpty()){
117 // UID Token is empty. (Shouldn't be).
118 // Generate a new UID Token.
120 /*boost::uuids::uuid ContactUUID = boost::uuids::random_generator()();
121 std::string sstContactUUID = boost::uuids::to_string(ContactUUID);
122 wxString strContactUUID(sstContactUUID.c_str(), wxConvUTF8);
123 UIDToken = strContactUUID;*/
124 UIDToken = GenerateUUID();
125 UIDToken = UIDToken.MakeUpper();
128 FilenameFinal = wxSContactFilename;
132 // Setup the data and write it into the account folder.
134 // Begin preperations to write the contact to a file.
136 bool boolValue = FALSE;
137 bool boolValue2 = FALSE;
139 bool NNGeneralFirst = TRUE;
140 bool NNHomeFirst = TRUE;
141 bool NNWorkFirst = TRUE;
143 std::map<int,int>::iterator intiter;
144 std::map<int,wxString>::iterator striter;
146 ContactData.Add(wxT("BEGIN"), wxT("VCARD"), FALSE);
147 ContactData.Add(wxT("VERSION"), wxT("4.0"), FALSE);
149 // Setup the version string.
151 strValue.Append(wxT("-//Xestia//Address Book Version "));
152 strValue.Append(wxT(XSDAB_VERSION));
153 strValue.Append(wxT("//KW"));
155 ContactData.Add(wxT("PRODID"), strValue, FALSE);
161 // Setup the name field.
163 strValue = txtSurname->GetValue() + wxT(";") +
164 txtForename->GetValue() + wxT(";") +
165 txtOtherNames->GetValue() + wxT(";") +
166 txtTitle->GetValue() + wxT(";") +
167 txtSuffix->GetValue();
169 strValue2 = ContactData.Convert(cmbDisplayAs->GetValue(), FALSE);
172 if (NameTokens.IsEmpty()){
173 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\""), strValue, FALSE);
175 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\";") + NameTokens, strValue, FALSE);
178 if (cmbType->GetCurrentSelection() == 1){
180 ContactData.AddRaw(wxT("KIND"), wxT("individual"));
182 } else if (cmbType->GetCurrentSelection() == 2){
184 ContactData.AddRaw(wxT("KIND"), wxT("group"));
186 // Go through each of the members and write them out.
188 for (std::map<int, wxString>::iterator itemiter = GroupsList.begin();
189 itemiter != GroupsList.end(); ++itemiter){
191 ContactData.Add(wxT("MEMBER:urn:uuid"), itemiter->second, FALSE);
195 } else if (cmbType->GetCurrentSelection() == 3){
197 ContactData.AddRaw(wxT("KIND"), wxT("org"));
199 } else if (cmbType->GetCurrentSelection() == 4){
201 ContactData.AddRaw(wxT("KIND"), wxT("location"));
206 // Setup the nicknames (General, Home & Business).
219 if (cmbGender->GetCurrentSelection() != 0){
221 switch(cmbGender->GetCurrentSelection()){
252 if (!txtGenderDescription->IsEmpty()){
254 strValue2 = txtGenderDescription->GetValue();
258 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
260 EscapeString(&strValue2, FALSE);
262 if (!GenderTokens.IsEmpty()){
264 if (!strValue2.IsEmpty()){
266 ContactData.AddRaw(wxT("GENDER;") + GenderTokens, strValue + wxT(";") + strValue2);
270 ContactData.AddRaw(wxT("GENDER;") + GenderTokens, strValue);
276 if (!strValue2.IsEmpty()){
278 ContactData.AddRaw(wxT("GENDER"), strValue + wxT(";") + strValue2);
282 ContactData.AddRaw(wxT("GENDER"), strValue);
301 strValue3 = BirthdayAltID;
303 if (!strValue3.IsEmpty()){
308 strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
314 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
319 strValue3 = BirthdayCalScale;
321 if (!strValue3.IsEmpty()){
326 if (boolValue2 == TRUE){
328 strValue2.Append(wxT(";"));
336 strValue2.Append(wxT("CALSCALE=") + strValue3);
344 strValue2 = BirthdayTokens;
346 // Get the birthday and write it.
348 ResetSaveProcessData();
350 if (!txtBirthday->IsEmpty()){
352 strValue = txtBirthday->GetValue();
354 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
356 if (!strValue2.IsEmpty()){
358 EscapeString(&strValue2, FALSE);
359 EscapeString(&strValue, FALSE);
361 ContactData.AddRaw(wxT("BDAY;VALUE=text;") + strValue2 + wxT(";"), strValue);
365 EscapeString(&strValue, FALSE);
367 ContactData.AddRaw(wxT("BDAY;VALUE=text"), strValue);
377 // Get Day, Month & Year.
379 wxDateTime BirthdayDate;
380 wxDateTime::Month BirthdayMonth;
383 wxString DataBeforeT;
385 wxString FinalBirthdayString;
386 bool ProcessDataAfterT = FALSE;
388 BirthdayDate = dapBirthday->GetValue();
390 if (BirthdayDate.IsValid()){
392 BirthdayDay = BirthdayDate.GetDay();
393 BirthdayMonth = BirthdayDate.GetMonth();
394 BirthdayYear = BirthdayDate.GetYear();
396 // Look for T and replace data before this.
398 wxStringTokenizer wSTDate(Birthday, wxT("T"));
400 while (wSTDate.HasMoreTokens()){
402 if (ProcessDataAfterT == FALSE){
404 DataBeforeT = wSTDate.GetNextToken();
405 ProcessDataAfterT = TRUE;
409 DataAfterT = wSTDate.GetNextToken();
416 // If there is not T then replace altogether.
418 wxString FinalBirthdayDay;
419 wxString FinalBirthdayMonth;
420 wxString FinalBirthdayYear;
422 if (BirthdayDay < 10){
424 FinalBirthdayDay = wxT("0") + wxString::Format(wxT("%i"), BirthdayDay);
428 FinalBirthdayDay = wxString::Format(wxT("%i"), BirthdayDay);
432 if (((int)BirthdayMonth + 1) < 10){
434 FinalBirthdayMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
438 FinalBirthdayMonth = wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
442 if (BirthdayYear == 0){
444 FinalBirthdayYear = wxT("--");
448 FinalBirthdayYear = wxString::Format(wxT("%i"), BirthdayYear);
452 if (!DataAfterT.IsEmpty()){
454 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay + wxT("T") + DataAfterT;
458 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay;
462 if (!FinalBirthdayString.IsEmpty() || !strValue2.IsEmpty()){
464 if (!strValue2.IsEmpty()){
466 EscapeString(&strValue2, FALSE);
467 EscapeString(&strValue, FALSE);
469 ContactData.AddRaw(wxT("BDAY") + strValue2 + wxT(";"), FinalBirthdayString);
473 EscapeString(&strValue, FALSE);
475 ContactData.AddRaw(wxT("BDAY"), FinalBirthdayString);
485 ResetSaveProcessData();
489 strValue3 = AnniversaryAltID;
491 if (!strValue3.IsEmpty()){
496 strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
502 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
507 strValue3 = AnniversaryCalScale;
509 if (!strValue3.IsEmpty()){
514 if (boolValue2 == TRUE){
516 strValue2.Append(wxT(";"));
524 strValue2.Append(wxT("CALSCALE=") + strValue3);
532 strValue2 = AnniversaryTokens;
534 // Deal with ANNIVERSARY.
536 if (!txtAnniversary->IsEmpty()){
538 strValue = txtAnniversary->GetValue();
540 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
542 if (!strValue2.IsEmpty()){
544 EscapeString(&strValue2, FALSE);
545 EscapeString(&strValue, FALSE);
547 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text;") + strValue2 + wxT(";"), strValue);
551 EscapeString(&strValue, FALSE);
553 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text"), strValue);
561 // Look for T and replace data before this.
563 // Get Day, Month & Year.
565 wxDateTime AnniversaryDate;
566 wxDateTime::Month AnniversaryMonth;
569 wxString DataBeforeT;
571 wxString FinalAnniversaryString;
572 bool ProcessDataAfterT = FALSE;
574 AnniversaryDate = dapAnniversary->GetValue();
576 if (AnniversaryDate.IsValid()){
578 AnniversaryDay = AnniversaryDate.GetDay();
579 AnniversaryMonth = AnniversaryDate.GetMonth();
580 AnniversaryYear = AnniversaryDate.GetYear();
582 // Look for T and replace data before this.
584 wxStringTokenizer wSTDate(Anniversary, wxT("T"));
586 while (wSTDate.HasMoreTokens()){
588 if (ProcessDataAfterT == FALSE){
590 DataBeforeT = wSTDate.GetNextToken();
591 ProcessDataAfterT = TRUE;
595 DataAfterT = wSTDate.GetNextToken();
602 // If there is not T then replace altogether.
604 wxString FinalAnniversaryDay;
605 wxString FinalAnniversaryMonth;
606 wxString FinalAnniversaryYear;
608 if (AnniversaryDay < 10){
610 FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
614 FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
618 if (((int)AnniversaryMonth + 1) < 10){
620 FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
624 FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
628 if (AnniversaryYear == 0){
630 FinalAnniversaryYear = wxT("--");
634 FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
638 if (!DataAfterT.IsEmpty()){
640 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
644 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
648 if (!FinalAnniversaryString.IsEmpty() || !strValue2.IsEmpty()){
650 if (!strValue2.IsEmpty()){
652 EscapeString(&strValue2, FALSE);
653 EscapeString(&strValue, FALSE);
655 ContactData.AddRaw(wxT("ANNIVERSARY") + strValue2 + wxT(";"), FinalAnniversaryString);
659 EscapeString(&strValue, FALSE);
661 ContactData.AddRaw(wxT("ANNIVERSARY"), FinalAnniversaryString);
671 // Setup the addresses (General, Home, Business).
673 //intValue = GeneralAddressList.size();
674 ResetSaveProcessData();
676 for (std::map<int,wxString>::iterator iter = GeneralAddressList.begin();
677 iter != GeneralAddressList.end(); ++iter){
679 int intSeekValue = iter->first;
681 wxString strAddressString;
682 wxString strAddressFinalValue;
683 std::map<int, wxString>::iterator iterValue;
685 strAddressString.Append(wxT(";;"));
689 iterValue = GeneralAddressList.find(intSeekValue);
690 strAddressFinalValue = iterValue->second;
691 ProcessCaptureStrings(&strAddressFinalValue);
692 strAddressString.Append(strAddressFinalValue + wxT(";"));
693 strAddressFinalValue.Clear();
697 iterValue = GeneralAddressListTown.find(intSeekValue);
698 strAddressFinalValue = iterValue->second;
699 ProcessCaptureStrings(&strAddressFinalValue);
700 strAddressString.Append(strAddressFinalValue + wxT(";"));
701 strAddressFinalValue.Clear();
705 iterValue = GeneralAddressListCounty.find(intSeekValue);
706 strAddressFinalValue = iterValue->second;
707 ProcessCaptureStrings(&strAddressFinalValue);
708 strAddressString.Append(strAddressFinalValue + wxT(";"));
709 strAddressFinalValue.Clear();
713 iterValue = GeneralAddressListPostCode.find(intSeekValue);
714 strAddressFinalValue = iterValue->second;
715 ProcessCaptureStrings(&strAddressFinalValue);
716 strAddressString.Append(strAddressFinalValue + wxT(";"));
717 strAddressFinalValue.Clear();
721 iterValue = GeneralAddressListCountry.find(intSeekValue);
722 strAddressFinalValue = iterValue->second;
723 ProcessCaptureStrings(&strAddressFinalValue);
724 strAddressString.Append(strAddressFinalValue);
725 strAddressFinalValue.Clear();
727 ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
728 &iter, &strAddressString, &ContactData,
729 wxT("LABEL"), &GeneralAddressListLabel,
730 wxT("LANGUAGE"), &GeneralAddressListLang,
731 wxT("ALTID"), &GeneralAddressListAltID,
732 wxT("PID"), &GeneralAddressListPID,
733 wxT("GEO"), &GeneralAddressListGeo,
734 wxT("TZ"), &GeneralAddressListTimezone,
735 wxT("MEDIATYPE"), &GeneralAddressListMediatype,
736 wxT("PREF"), &GeneralAddressListPref,
737 wxT(""), &GeneralAddressListTokens );
739 ResetSaveProcessData();
743 ResetSaveProcessData();
745 for (std::map<int,wxString>::iterator iter = HomeAddressList.begin();
746 iter != HomeAddressList.end(); ++iter){
748 int intSeekValue = iter->first;
750 wxString strAddressString;
751 wxString strAddressFinalValue;
752 std::map<int, wxString>::iterator iterValue;
754 strAddressString.Append(wxT(";;"));
758 iterValue = HomeAddressList.find(intSeekValue);
759 strAddressFinalValue = iterValue->second;
760 ProcessCaptureStrings(&strAddressFinalValue);
762 strAddressString.Append(strAddressFinalValue + wxT(";"));
766 iterValue = HomeAddressListTown.find(intSeekValue);
767 strAddressFinalValue = iterValue->second;
768 ProcessCaptureStrings(&strAddressFinalValue);
770 strAddressString.Append(strAddressFinalValue + wxT(";"));
774 iterValue = HomeAddressListCounty.find(intSeekValue);
775 strAddressFinalValue = iterValue->second;
776 ProcessCaptureStrings(&strAddressFinalValue);
778 strAddressString.Append(strAddressFinalValue + wxT(";"));
782 iterValue = HomeAddressListPostCode.find(intSeekValue);
783 strAddressFinalValue = iterValue->second;
784 ProcessCaptureStrings(&strAddressFinalValue);
786 strAddressString.Append(strAddressFinalValue + wxT(";"));
790 iterValue = HomeAddressListCountry.find(intSeekValue);
791 strAddressFinalValue = iterValue->second;
792 ProcessCaptureStrings(&strAddressFinalValue);
794 strAddressString.Append(strAddressFinalValue);
796 ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
797 &iter, &strAddressString, &ContactData,
798 wxT("LABEL"), &HomeAddressListLabel,
799 wxT("LANGUAGE"), &HomeAddressListLang,
800 wxT("ALTID"), &HomeAddressListAltID,
801 wxT("PID"), &HomeAddressListPID,
802 wxT("GEO"), &HomeAddressListGeo,
803 wxT("TZ"), &HomeAddressListTimezone,
804 wxT("MEDIATYPE"), &HomeAddressListMediatype,
805 wxT("PREF"), &HomeAddressListPref,
806 wxT(""), &HomeAddressListTokens );
808 ResetSaveProcessData();
812 ResetSaveProcessData();
814 for (std::map<int,wxString>::iterator iter = BusinessAddressList.begin();
815 iter != BusinessAddressList.end(); ++iter){
817 int intSeekValue = iter->first;
819 wxString strAddressString;
820 wxString strAddressFinalValue;
821 std::map<int, wxString>::iterator iterValue;
823 strAddressString.Append(wxT(";;"));
827 iterValue = BusinessAddressList.find(intSeekValue);
828 strAddressFinalValue = iterValue->second;
829 ProcessCaptureStrings(&strAddressFinalValue);
831 strAddressString.Append(strAddressFinalValue + wxT(";"));
835 iterValue = BusinessAddressListTown.find(intSeekValue);
836 strAddressFinalValue = iterValue->second;
837 ProcessCaptureStrings(&strAddressFinalValue);
839 strAddressString.Append(strAddressFinalValue + wxT(";"));
843 iterValue = BusinessAddressListCounty.find(intSeekValue);
844 strAddressFinalValue = iterValue->second;
845 ProcessCaptureStrings(&strAddressFinalValue);
847 strAddressString.Append(strAddressFinalValue + wxT(";"));
851 iterValue = BusinessAddressListPostCode.find(intSeekValue);
852 strAddressFinalValue = iterValue->second;
853 ProcessCaptureStrings(&strAddressFinalValue);
855 strAddressString.Append(strAddressFinalValue + wxT(";"));
859 iterValue = BusinessAddressListCountry.find(intSeekValue);
860 strAddressFinalValue = iterValue->second;
861 ProcessCaptureStrings(&strAddressFinalValue);
863 strAddressString.Append(strAddressFinalValue);
865 ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
866 &iter, &strAddressString, &ContactData,
867 wxT("LABEL"), &BusinessAddressListLabel,
868 wxT("LANGUAGE"), &BusinessAddressListLang,
869 wxT("ALTID"), &BusinessAddressListAltID,
870 wxT("PID"), &BusinessAddressListPID,
871 wxT("GEO"), &BusinessAddressListGeo,
872 wxT("TZ"), &BusinessAddressListTimezone,
873 wxT("MEDIATYPE"), &BusinessAddressListMediatype,
874 wxT("PREF"), &BusinessAddressListPref,
875 wxT(""), &BusinessAddressListTokens );
877 ResetSaveProcessData();
881 // Sort out nicknames (if any).
883 for (std::map<int,wxString>::iterator iter = GeneralNicknamesList.begin();
884 iter != GeneralNicknamesList.end(); ++iter){
886 intValue2 = iter->first;
888 // Process Alternative ID.
890 ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
891 &iter, &GeneralNicknamesList, &ContactData,
892 wxT("LANGUAGE"), &GeneralNicknamesListLanguage,
893 wxT("ALTID"), &GeneralNicknamesListAltID,
894 wxT("PID"), &GeneralNicknamesListPID,
895 wxT("PREF"), &GeneralNicknamesListPref,
896 wxT(""), &GeneralNicknamesListTokens );
898 ResetSaveProcessData();
902 ResetSaveProcessData();
904 for (std::map<int,wxString>::iterator iter = HomeNicknamesList.begin();
905 iter != HomeNicknamesList.end(); ++iter){
907 ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
908 &iter, &HomeNicknamesList, &ContactData,
909 wxT("LANGUAGE"), &HomeNicknamesListLanguage,
910 wxT("ALTID"), &HomeNicknamesListAltID,
911 wxT("PID"), &HomeNicknamesListPID,
912 wxT("PREF"), &HomeNicknamesListPref,
913 wxT(""), &HomeNicknamesListTokens );
915 ResetSaveProcessData();
919 ResetSaveProcessData();
921 for (std::map<int,wxString>::iterator iter = BusinessNicknamesList.begin();
922 iter != BusinessNicknamesList.end(); ++iter){
924 ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
925 &iter, &BusinessNicknamesList, &ContactData,
926 wxT("LANGUAGE"), &BusinessNicknamesListLanguage,
927 wxT("ALTID"), &BusinessNicknamesListAltID,
928 wxT("PID"), &BusinessNicknamesListPID,
929 wxT("PREF"), &BusinessNicknamesListPref,
930 wxT(""), &BusinessNicknamesListTokens );
932 ResetSaveProcessData();
936 ResetSaveProcessData();
938 // Sort out email (general, home and business).
940 for (std::map<int,wxString>::iterator iter = GeneralEmailList.begin();
941 iter != GeneralEmailList.end(); ++iter){
943 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
946 wxString strAddressFinalValue;
947 std::map<int, wxString>::iterator iterValue;
949 ProcessSaveData(wxT("EMAIL"), &strValue2, &boolValue2, &boolValue,
950 &iter, &GeneralEmailList, &ContactData,
951 wxT("ALTID"), &GeneralEmailListAltID,
952 wxT("PID"), &GeneralEmailListPID,
953 wxT("PREF"), &GeneralEmailListPref,
954 wxT(""), &GeneralEmailListTokens );
956 ResetSaveProcessData();
960 ResetSaveProcessData();
962 for (std::map<int,wxString>::iterator iter = HomeEmailList.begin();
963 iter != HomeEmailList.end(); ++iter){
965 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
968 ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
969 &iter, &HomeEmailList, &ContactData,
970 wxT("ALTID"), &HomeEmailListAltID,
971 wxT("PID"), &HomeEmailListPID,
972 wxT("PREF"), &HomeEmailListPref,
973 wxT(""), &HomeEmailListTokens );
975 ResetSaveProcessData();
979 ResetSaveProcessData();
981 for (std::map<int,wxString>::iterator iter = BusinessEmailList.begin();
982 iter != BusinessEmailList.end(); ++iter){
984 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
987 ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
988 &iter, &BusinessEmailList, &ContactData,
989 wxT("ALTID"), &BusinessEmailListAltID,
990 wxT("PID"), &BusinessEmailListPID,
991 wxT("PREF"), &BusinessEmailListPref,
992 wxT(""), &BusinessEmailListTokens );
994 ResetSaveProcessData();
998 ResetSaveProcessData();
1000 for (std::map<int,wxString>::iterator iter = GeneralIMList.begin();
1001 iter != GeneralIMList.end(); ++iter){
1003 intValue2 = iter->first;
1005 // Process Alternative ID.
1007 ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
1008 &iter, &GeneralIMList, &ContactData,
1009 wxT("ALTID"), &GeneralIMListAltID,
1010 wxT("PID"), &GeneralIMListPID,
1011 wxT("MEDIATYPE"), &GeneralIMListMediatype,
1012 wxT("PREF"), &GeneralIMListPref,
1013 wxT(""), &GeneralIMListTokens );
1015 ResetSaveProcessData();
1019 ResetSaveProcessData();
1021 for (std::map<int,wxString>::iterator iter = HomeIMList.begin();
1022 iter != HomeIMList.end(); ++iter){
1024 ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1025 &iter, &HomeIMList, &ContactData,
1026 wxT("ALTID"), &HomeIMListAltID,
1027 wxT("PID"), &HomeIMListPID,
1028 wxT("MEDIATYPE"), &HomeIMListMediatype,
1029 wxT("PREF"), &HomeIMListPref,
1030 wxT(""), &HomeIMListTokens );
1032 ResetSaveProcessData();
1036 ResetSaveProcessData();
1038 for (std::map<int,wxString>::iterator iter = BusinessIMList.begin();
1039 iter != BusinessIMList.end(); ++iter){
1041 ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1042 &iter, &BusinessIMList, &ContactData,
1043 wxT("ALTID"), &BusinessIMListAltID,
1044 wxT("PID"), &BusinessIMListPID,
1045 wxT("MEDIATYPE"), &BusinessIMListMediatype,
1046 wxT("PREF"), &BusinessIMListPref,
1047 wxT(""), &BusinessIMListTokens );
1049 ResetSaveProcessData();
1053 ResetSaveProcessData();
1055 for (std::map<int,wxString>::iterator iter = GeneralTelephoneList.begin();
1056 iter != GeneralTelephoneList.end(); ++iter){
1058 wxString strAddressFinalValue = iter->second;
1060 ProcessCaptureStrings(&strAddressFinalValue);
1062 strAddressFinalValue.insert(0, wxT("tel:"));
1064 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1065 &iter, &strAddressFinalValue, &ContactData,
1066 wxT("ALTID"), &GeneralTelephoneListAltID,
1067 wxT("PID"), &GeneralTelephoneListPID,
1068 wxT("TYPE"), &GeneralTelephoneListType,
1069 wxT("PREF"), &GeneralTelephoneListPref,
1070 wxT(""), &GeneralTelephoneListTokens );
1072 ResetSaveProcessData();
1076 ResetSaveProcessData();
1078 for (std::map<int,wxString>::iterator iter = HomeTelephoneList.begin();
1079 iter != HomeTelephoneList.end(); ++iter){
1081 wxString strAddressFinalValue = iter->second;
1083 ProcessCaptureStrings(&strAddressFinalValue);
1085 strAddressFinalValue.insert(0, wxT("tel:"));
1087 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1088 &iter, &strAddressFinalValue, &ContactData,
1089 wxT("ALTID"), &HomeTelephoneListAltID,
1090 wxT("PID"), &HomeTelephoneListPID,
1091 wxT("TYPE"), &HomeTelephoneListType,
1092 wxT("PREF"), &HomeTelephoneListPref,
1093 wxT(""), &HomeTelephoneListTokens );
1095 ResetSaveProcessData();
1099 ResetSaveProcessData();
1101 for (std::map<int,wxString>::iterator iter = BusinessTelephoneList.begin();
1102 iter != BusinessTelephoneList.end(); ++iter){
1104 wxString strAddressFinalValue = iter->second;
1106 ProcessCaptureStrings(&strAddressFinalValue);
1108 strAddressFinalValue.insert(0, wxT("tel:"));
1110 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1111 &iter, &strAddressFinalValue, &ContactData,
1112 wxT("ALTID"), &BusinessTelephoneListAltID,
1113 wxT("PID"), &BusinessTelephoneListPID,
1114 wxT("TYPE"), &BusinessTelephoneListType,
1115 wxT("PREF"), &BusinessTelephoneListPref,
1116 wxT(""), &BusinessTelephoneListTokens );
1118 ResetSaveProcessData();
1122 ResetSaveProcessData();
1124 for (std::map<int,wxString>::iterator iter = GeneralLanguageList.begin();
1125 iter != GeneralLanguageList.end(); ++iter){
1127 intValue2 = iter->first;
1129 ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
1130 &iter, &GeneralLanguageList, &ContactData,
1131 wxT("ALTID"), &GeneralLanguageListAltID,
1132 wxT("PID"), &GeneralLanguageListPID,
1133 wxT("PREF"), &GeneralLanguageListPref,
1134 wxT(""), &GeneralLanguageListTokens );
1136 ResetSaveProcessData();
1140 ResetSaveProcessData();
1142 for (std::map<int,wxString>::iterator iter = HomeLanguageList.begin();
1143 iter != HomeLanguageList.end(); ++iter){
1145 ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1146 &iter, &HomeLanguageList, &ContactData,
1147 wxT("ALTID"), &HomeLanguageListAltID,
1148 wxT("PID"), &HomeLanguageListPID,
1149 wxT("PREF"), &HomeLanguageListPref,
1150 wxT(""), &HomeLanguageListTokens );
1152 ResetSaveProcessData();
1156 ResetSaveProcessData();
1158 for (std::map<int,wxString>::iterator iter = BusinessLanguageList.begin();
1159 iter != BusinessLanguageList.end(); ++iter){
1161 ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1162 &iter, &BusinessLanguageList, &ContactData,
1163 wxT("ALTID"), &BusinessLanguageListAltID,
1164 wxT("PID"), &BusinessLanguageListPID,
1165 wxT("PREF"), &BusinessLanguageListPref,
1166 wxT(""), &BusinessLanguageListTokens );
1168 ResetSaveProcessData();
1172 ResetSaveProcessData();
1174 for (std::map<int,wxString>::iterator iter = GeneralTZList.begin();
1175 iter != GeneralTZList.end(); ++iter){
1177 ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
1178 &iter, &GeneralTZList, &ContactData,
1179 wxT("ALTID"), &GeneralTZListAltID,
1180 wxT("PID"), &GeneralTZListPID,
1181 wxT("MEDIATYPE"), &GeneralTZListMediatype,
1182 wxT("PREF"), &GeneralTZListPref,
1183 wxT(""), &GeneralTZListTokens );
1185 ResetSaveProcessData();
1189 ResetSaveProcessData();
1191 for (std::map<int,wxString>::iterator iter = HomeTZList.begin();
1192 iter != HomeTZList.end(); ++iter){
1194 ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1195 &iter, &HomeTZList, &ContactData,
1196 wxT("ALTID"), &HomeTZListAltID,
1197 wxT("PID"), &HomeTZListPID,
1198 wxT("MEDIATYPE"), &HomeTZListMediatype,
1199 wxT("PREF"), &HomeTZListPref,
1200 wxT(""), &HomeTZListTokens );
1202 ResetSaveProcessData();
1206 ResetSaveProcessData();
1208 for (std::map<int,wxString>::iterator iter = BusinessTZList.begin();
1209 iter != BusinessTZList.end(); ++iter){
1211 ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1212 &iter, &BusinessTZList, &ContactData,
1213 wxT("ALTID"), &BusinessTZListAltID,
1214 wxT("PID"), &BusinessTZListPID,
1215 wxT("MEDIATYPE"), &BusinessTZListMediatype,
1216 wxT("PREF"), &BusinessTZListPref,
1217 wxT(""), &BusinessTZListTokens );
1219 ResetSaveProcessData();
1223 ResetSaveProcessData();
1225 for (std::map<int,wxString>::iterator iter = GeneralGeographyList.begin();
1226 iter != GeneralGeographyList.end(); ++iter){
1228 wxString strAddressFinalValue = iter->second;
1230 ProcessCaptureStrings(&strAddressFinalValue);
1232 strAddressFinalValue.insert(0, wxT("geo:"));
1234 ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
1235 &iter, &strAddressFinalValue, &ContactData,
1236 wxT("ALTID"), &GeneralGeographyListAltID,
1237 wxT("PID"), &GeneralGeographyListPID,
1238 wxT("MEDIATYPE"), &GeneralGeographyListMediatype,
1239 wxT("PREF"), &GeneralGeographyListPref,
1240 wxT(""), &GeneralGeographyListTokens );
1242 ResetSaveProcessData();
1246 ResetSaveProcessData();
1248 for (std::map<int,wxString>::iterator iter = HomeGeographyList.begin();
1249 iter != HomeGeographyList.end(); ++iter){
1251 wxString strAddressFinalValue = iter->second;
1253 ProcessCaptureStrings(&strAddressFinalValue);
1255 strAddressFinalValue.insert(0, wxT("geo:"));
1257 ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1258 &iter, &HomeGeographyList, &ContactData,
1259 wxT("ALTID"), &HomeGeographyListAltID,
1260 wxT("PID"), &HomeGeographyListPID,
1261 wxT("MEDIATYPE"), &HomeGeographyListMediatype,
1262 wxT("PREF"), &HomeGeographyListPref,
1263 wxT(""), &HomeGeographyListTokens );
1265 ResetSaveProcessData();
1269 ResetSaveProcessData();
1271 for (std::map<int,wxString>::iterator iter = BusinessGeographyList.begin();
1272 iter != BusinessGeographyList.end(); ++iter){
1274 wxString strAddressFinalValue = iter->second;
1276 ProcessCaptureStrings(&strAddressFinalValue);
1278 strAddressFinalValue.insert(0, wxT("geo:"));
1280 ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1281 &iter, &BusinessGeographyList, &ContactData,
1282 wxT("ALTID"), &BusinessGeographyListAltID,
1283 wxT("PID"), &BusinessGeographyListPID,
1284 wxT("MEDIATYPE"), &BusinessGeographyListMediatype,
1285 wxT("PREF"), &BusinessGeographyListPref,
1286 wxT(""), &BusinessGeographyListTokens );
1288 ResetSaveProcessData();
1292 ResetSaveProcessData();
1294 for (std::map<int,wxString>::iterator iter = GeneralRelatedList.begin();
1295 iter != GeneralRelatedList.end(); ++iter){
1297 ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
1298 &iter, &GeneralRelatedList, &ContactData,
1299 wxT("ALTID"), &GeneralRelatedListAltID,
1300 wxT("PID"), &GeneralRelatedListPID,
1301 wxT("LANGUAGE"), &GeneralRelatedListLanguage,
1302 wxT("TYPE"), &GeneralRelatedListRelType,
1303 wxT("PREF"), &GeneralRelatedListPref,
1304 wxT(""), &GeneralRelatedListTokens );
1306 ResetSaveProcessData();
1310 ResetSaveProcessData();
1312 for (std::map<int,wxString>::iterator iter = GeneralWebsiteList.begin();
1313 iter != GeneralWebsiteList.end(); ++iter){
1315 ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
1316 &iter, &GeneralWebsiteList, &ContactData,
1317 wxT("ALTID"), &GeneralWebsiteListAltID,
1318 wxT("PID"), &GeneralWebsiteListPID,
1319 wxT("MEDIATYPE"), &GeneralWebsiteListMediatype,
1320 wxT("PREF"), &GeneralWebsiteListPref,
1321 wxT(""), &GeneralWebsiteListTokens );
1323 ResetSaveProcessData();
1327 ResetSaveProcessData();
1329 for (std::map<int,wxString>::iterator iter = HomeWebsiteList.begin();
1330 iter != HomeWebsiteList.end(); ++iter){
1332 ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1333 &iter, &HomeWebsiteList, &ContactData,
1334 wxT("ALTID"), &HomeWebsiteListAltID,
1335 wxT("PID"), &HomeWebsiteListPID,
1336 wxT("MEDIATYPE"), &HomeWebsiteListMediatype,
1337 wxT("PREF"), &HomeWebsiteListPref,
1338 wxT(""), &HomeWebsiteListTokens );
1340 ResetSaveProcessData();
1344 ResetSaveProcessData();
1346 for (std::map<int,wxString>::iterator iter = BusinessWebsiteList.begin();
1347 iter != BusinessWebsiteList.end(); ++iter){
1349 ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1350 &iter, &BusinessWebsiteList, &ContactData,
1351 wxT("ALTID"), &BusinessWebsiteListAltID,
1352 wxT("PID"), &BusinessWebsiteListPID,
1353 wxT("MEDIATYPE"), &BusinessWebsiteListMediatype,
1354 wxT("PREF"), &BusinessWebsiteListPref,
1355 wxT(""), &BusinessWebsiteListTokens );
1357 ResetSaveProcessData();
1361 ResetSaveProcessData();
1363 for (std::map<int,wxString>::iterator iter = GeneralTitleList.begin();
1364 iter != GeneralTitleList.end(); ++iter){
1366 ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
1367 &iter, &GeneralTitleList, &ContactData,
1368 wxT("ALTID"), &GeneralTitleListAltID,
1369 wxT("PID"), &GeneralTitleListPID,
1370 wxT("LANGUAGE"), &GeneralTitleListLanguage,
1371 wxT("PREF"), &GeneralTitleListPref,
1372 wxT(""), &GeneralTitleListTokens );
1374 ResetSaveProcessData();
1378 ResetSaveProcessData();
1380 for (std::map<int,wxString>::iterator iter = HomeTitleList.begin();
1381 iter != HomeTitleList.end(); ++iter){
1383 ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1384 &iter, &HomeTitleList, &ContactData,
1385 wxT("ALTID"), &HomeTitleListAltID,
1386 wxT("PID"), &HomeTitleListPID,
1387 wxT("LANGUAGE"), &HomeTitleListLanguage,
1388 wxT("PREF"), &HomeTitleListPref,
1389 wxT(""), &HomeTitleListTokens );
1391 ResetSaveProcessData();
1395 ResetSaveProcessData();
1397 for (std::map<int,wxString>::iterator iter = BusinessTitleList.begin();
1398 iter != BusinessTitleList.end(); ++iter){
1400 ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1401 &iter, &BusinessTitleList, &ContactData,
1402 wxT("ALTID"), &BusinessTitleListAltID,
1403 wxT("PID"), &BusinessTitleListPID,
1404 wxT("LANGUAGE"), &BusinessTitleListLanguage,
1405 wxT("PREF"), &BusinessTitleListPref,
1406 wxT(""), &BusinessTitleListTokens );
1408 ResetSaveProcessData();
1412 ResetSaveProcessData();
1414 for (std::map<int,wxString>::iterator iter = GeneralRoleList.begin();
1415 iter != GeneralRoleList.end(); ++iter){
1417 ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
1418 &iter, &GeneralRoleList, &ContactData,
1419 wxT("ALTID"), &GeneralRoleListAltID,
1420 wxT("PID"), &GeneralRoleListPID,
1421 wxT("LANGUAGE"), &GeneralRoleListLanguage,
1422 wxT("PREF"), &GeneralRoleListPref,
1423 wxT(""), &GeneralRoleListTokens );
1425 ResetSaveProcessData();
1429 ResetSaveProcessData();
1431 for (std::map<int,wxString>::iterator iter = HomeRoleList.begin();
1432 iter != HomeRoleList.end(); ++iter){
1434 ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1435 &iter, &HomeRoleList, &ContactData,
1436 wxT("ALTID"), &HomeRoleListAltID,
1437 wxT("PID"), &HomeRoleListPID,
1438 wxT("LANGUAGE"), &HomeRoleListLanguage,
1439 wxT("PREF"), &HomeRoleListPref,
1440 wxT(""), &HomeRoleListTokens );
1442 ResetSaveProcessData();
1446 ResetSaveProcessData();
1448 for (std::map<int,wxString>::iterator iter = BusinessRoleList.begin();
1449 iter != BusinessRoleList.end(); ++iter){
1451 ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1452 &iter, &BusinessRoleList, &ContactData,
1453 wxT("ALTID"), &BusinessRoleListAltID,
1454 wxT("PID"), &BusinessRoleListPID,
1455 wxT("LANGUAGE"), &BusinessRoleListLanguage,
1456 wxT("PREF"), &BusinessRoleListPref,
1457 wxT(""), &BusinessRoleListTokens );
1459 ResetSaveProcessData();
1463 ResetSaveProcessData();
1465 for (std::map<int,wxString>::iterator iter = GeneralOrganisationsList.begin();
1466 iter != GeneralOrganisationsList.end(); ++iter){
1468 ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
1469 &iter, &GeneralOrganisationsList, &ContactData,
1470 wxT("ALTID"), &GeneralOrganisationsListAltID,
1471 wxT("PID"), &GeneralOrganisationsListPID,
1472 wxT("LANGUAGE"), &GeneralOrganisationsListLanguage,
1473 wxT("SORT-AS"), &GeneralOrganisationsListSortAs,
1474 wxT("PREF"), &GeneralOrganisationsListPref,
1475 wxT(""), &GeneralOrganisationsListTokens );
1477 ResetSaveProcessData();
1481 ResetSaveProcessData();
1483 for (std::map<int,wxString>::iterator iter = HomeOrganisationsList.begin();
1484 iter != HomeOrganisationsList.end(); ++iter){
1486 ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1487 &iter, &HomeOrganisationsList, &ContactData,
1488 wxT("ALTID"), &HomeOrganisationsListAltID,
1489 wxT("PID"), &HomeOrganisationsListPID,
1490 wxT("LANGUAGE"), &HomeOrganisationsListLanguage,
1491 wxT("SORT-AS"), &HomeOrganisationsListSortAs,
1492 wxT("PREF"), &HomeOrganisationsListPref,
1493 wxT(""), &HomeOrganisationsListTokens );
1495 ResetSaveProcessData();
1499 ResetSaveProcessData();
1501 for (std::map<int,wxString>::iterator iter = BusinessOrganisationsList.begin();
1502 iter != BusinessOrganisationsList.end(); ++iter){
1504 ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1505 &iter, &BusinessOrganisationsList, &ContactData,
1506 wxT("ALTID"), &BusinessOrganisationsListAltID,
1507 wxT("PID"), &BusinessOrganisationsListPID,
1508 wxT("LANGUAGE"), &BusinessOrganisationsListLanguage,
1509 wxT("SORT-AS"), &BusinessOrganisationsListSortAs,
1510 wxT("PREF"), &BusinessOrganisationsListPref,
1511 wxT(""), &BusinessOrganisationsListTokens );
1513 ResetSaveProcessData();
1517 ResetSaveProcessData();
1519 for (std::map<int,wxString>::iterator iter = GeneralNoteList.begin();
1520 iter != GeneralNoteList.end(); ++iter){
1522 ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
1523 &iter, &GeneralNoteList, &ContactData,
1524 wxT("ALTID"), &GeneralNoteListAltID,
1525 wxT("PID"), &GeneralNoteListPID,
1526 wxT("LANGUAGE"), &GeneralNoteListLanguage,
1527 wxT("PREF"), &GeneralNoteListPref,
1528 wxT(""), &GeneralNoteListTokens );
1530 ResetSaveProcessData();
1534 ResetSaveProcessData();
1536 for (std::map<int,wxString>::iterator iter = HomeNoteList.begin();
1537 iter != HomeNoteList.end(); ++iter){
1539 ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1540 &iter, &HomeNoteList, &ContactData,
1541 wxT("ALTID"), &HomeNoteListAltID,
1542 wxT("PID"), &HomeNoteListPID,
1543 wxT("LANGUAGE"), &HomeNoteListLanguage,
1544 wxT("PREF"), &HomeNoteListPref,
1545 wxT(""), &HomeNoteListTokens );
1547 ResetSaveProcessData();
1551 ResetSaveProcessData();
1553 for (std::map<int,wxString>::iterator iter = BusinessNoteList.begin();
1554 iter != BusinessNoteList.end(); ++iter){
1556 ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1557 &iter, &BusinessNoteList, &ContactData,
1558 wxT("ALTID"), &BusinessNoteListAltID,
1559 wxT("PID"), &BusinessNoteListPID,
1560 wxT("LANGUAGE"), &BusinessNoteListLanguage,
1561 wxT("PREF"), &BusinessNoteListPref,
1562 wxT(""), &BusinessNoteListTokens );
1564 ResetSaveProcessData();
1568 ResetSaveProcessData();
1570 for (std::map<int,wxString>::iterator iter = CategoriesList.begin();
1571 iter != CategoriesList.end(); ++iter){
1573 ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
1574 &iter, &CategoriesList, &ContactData,
1575 wxT("ALTID"), &CategoriesListAltID,
1576 wxT("PID"), &CategoriesListPID,
1577 wxT("TYPE"), &CategoriesListType,
1578 wxT("PREF"), &CategoriesListPref,
1579 wxT(""), &CategoriesListTokens );
1581 ResetSaveProcessData();
1587 for (std::map<int, std::string>::iterator iter = PicturesList.begin();
1588 iter != PicturesList.end(); ++iter){
1590 int intValueIndex = iter->first;
1592 std::map<int, std::string>::iterator stdstriter;
1593 std::map<int, wxString>::iterator enciter;
1595 striter = PicturesListPictureType.find(intValueIndex);
1596 enciter = PicturesListPicEncType.find(intValueIndex);
1598 ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
1599 &iter, &PicturesList, &striter,
1600 &enciter, &ContactData,
1601 wxT("ALTID"), &PicturesListAltID,
1602 wxT("PID"), &PicturesListPID,
1603 wxT("TYPE"), &PicturesListType,
1604 wxT("PREF"), &PicturesListPref,
1605 wxT(""), &PicturesListTokens);
1607 ResetSaveProcessData();
1611 ResetSaveProcessData();
1615 for (std::map<int, std::string>::iterator iter = LogosList.begin();
1616 iter != LogosList.end(); ++iter){
1618 int intValueIndex = iter->first;
1620 std::map<int, std::string>::iterator stdstriter;
1621 std::map<int, wxString>::iterator enciter;
1623 striter = LogosListPictureType.find(intValueIndex);
1624 enciter = LogosListPicEncType.find(intValueIndex);
1626 ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
1627 &iter, &LogosList, &striter,
1628 &enciter, &ContactData,
1629 wxT("ALTID"), &LogosListAltID,
1630 wxT("PID"), &LogosListPID,
1631 wxT("TYPE"), &LogosListType,
1632 wxT("PREF"), &LogosListPref,
1633 wxT(""), &LogosListTokens );
1635 ResetSaveProcessData();
1639 ResetSaveProcessData();
1643 for (std::map<int, std::string>::iterator iter = SoundsList.begin();
1644 iter != SoundsList.end(); ++iter){
1646 int intValueIndex = iter->first;
1648 std::map<int, std::string>::iterator stdstriter;
1649 std::map<int, wxString>::iterator enciter;
1651 striter = SoundsListAudioType.find(intValueIndex);
1652 enciter = SoundsListAudioEncType.find(intValueIndex);
1654 ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
1655 &iter, &SoundsList, &striter,
1656 &enciter, &ContactData,
1657 wxT("ALTID"), &SoundsListAltID,
1658 wxT("PID"), &SoundsListPID,
1659 wxT("TYPE"), &SoundsListType,
1660 wxT("PREF"), &SoundsListPref,
1661 wxT(""), &SoundsListTokens );
1663 ResetSaveProcessData();
1667 ResetSaveProcessData();
1669 for (std::map<int,wxString>::iterator iter = CalendarList.begin();
1670 iter != CalendarList.end(); ++iter){
1672 ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
1673 &iter, &CalendarList, &ContactData,
1674 wxT("ALTID"), &CalendarListAltID,
1675 wxT("PID"), &CalendarListPID,
1676 wxT("MEDIATYPE"), &CalendarListMediatype,
1677 wxT("TYPE"), &CalendarListType,
1678 wxT("PREF"), &CalendarListPref,
1679 wxT(""), &CalendarListTokens );
1681 ResetSaveProcessData();
1685 ResetSaveProcessData();
1687 for (std::map<int,wxString>::iterator iter = CalendarRequestList.begin();
1688 iter != CalendarRequestList.end(); ++iter){
1690 ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
1691 &iter, &CalendarRequestList, &ContactData,
1692 wxT("ALTID"), &CalendarRequestListAltID,
1693 wxT("PID"), &CalendarRequestListPID,
1694 wxT("MEDIATYPE"), &CalendarRequestListMediatype,
1695 wxT("TYPE"), &CalendarRequestListType,
1696 wxT("PREF"), &CalendarRequestListPref,
1697 wxT(""), &CalendarRequestListTokens );
1699 ResetSaveProcessData();
1703 ResetSaveProcessData();
1705 for (std::map<int,wxString>::iterator iter = FreeBusyList.begin();
1706 iter != FreeBusyList.end(); ++iter){
1708 ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
1709 &iter, &FreeBusyList, &ContactData,
1710 wxT("ALTID"), &FreeBusyListAltID,
1711 wxT("PID"), &FreeBusyListPID,
1712 wxT("MEDIATYPE"), &FreeBusyListMediatype,
1713 wxT("TYPE"), &FreeBusyListType,
1714 wxT("PREF"), &FreeBusyListPref,
1715 wxT(""), &FreeBusyListTokens );
1717 ResetSaveProcessData();
1721 for (std::map<int, wxString>::iterator iter = KeyList.begin();
1722 iter != KeyList.end(); ++iter){
1724 intValue2 = iter->first;
1726 // Process Alternative ID.
1728 striter = KeyListAltID.find(intValue2);
1730 if (striter->first == intValue2){
1732 strValue3 = striter->second;
1734 if (!strValue3.IsEmpty()){
1739 if (boolValue2 == TRUE){
1741 strValue2.Append(wxT(";"));
1749 strValue2.Append(wxT("ALTID=") + strValue3);
1759 striter = KeyListPID.find(intValue2);
1761 if (striter->first == intValue2){
1763 strValue3 = striter->second;
1765 if (!strValue3.IsEmpty()){
1770 if (boolValue2 == TRUE){
1772 strValue2.Append(wxT(";"));
1780 strValue2.Append(wxT("PID=") + strValue3);
1790 striter = KeyListType.find(intValue2);
1792 if (striter->first == intValue2){
1794 strValue3 = striter->second;
1796 if (!strValue3.IsEmpty()){
1801 if (boolValue2 == TRUE){
1803 strValue2.Append(wxT(";"));
1811 strValue2.Append(wxT("TYPE=") + strValue3);
1819 intiter = KeyListPref.find(intValue2);
1821 if (intiter->first == intValue2){
1823 intValue3 = intiter->second;
1827 if (boolValue2 == TRUE){
1829 strValue2.Append(wxT(";"));
1837 strValue2.Append(wxT("PREF=") + wxString::Format(wxT("%i"), intValue3));
1847 striter = KeyListTokens.find(intValue2);
1849 if (striter->first == intValue2){
1851 strValue3 = striter->second;
1853 if (!strValue3.IsEmpty()){
1858 if (boolValue2 == TRUE){
1860 strValue2.Append(wxT(";"));
1868 strValue2.Append(strValue3);
1876 // Get the key information.
1878 std::map<int, wxString>::iterator enciter;
1880 striter = KeyListDataType.find(intValue2);
1881 //enciter = KeyListAudioEncType.find(intValue2);
1883 wxString strValueData;
1885 strValueData = iter->second;
1886 //strValueData.insert(0, wxT("data:") + striter->second + wxT(";") + enciter->second + wxT(","));
1887 strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));
1890 // Add to the vCard.
1892 if (boolValue == TRUE){
1894 ContactData.AddRaw(wxT("KEY;") + strValue2, strValueData);
1898 ContactData.Add(wxT("KEY"), strValueData, TRUE);
1902 ResetSaveProcessData();
1906 // Vendor specific items.
1908 ResetSaveProcessData();
1910 for (std::map<int,wxString>::iterator iter = VendorList.begin();
1911 iter != VendorList.end(); ++iter){
1913 intValue2 = iter->first;
1915 // Get the IANA PEN number.
1917 striter = VendorListPEN.find(intValue2);
1919 if (striter->first == intValue2){
1921 strValue2 = striter->second;
1925 // Get the element name.
1927 striter = VendorListElement.find(intValue2);
1929 if (striter->first == intValue2){
1931 strValue3 = striter->second;
1937 striter = VendorList.find(intValue2);
1939 if (striter->first == intValue2){
1941 strValue = striter->second;
1945 // Add to the vCard.
1947 if (boolValue == TRUE){
1949 ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
1953 ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
1957 ResetSaveProcessData();
1961 ResetSaveProcessData();
1965 for (std::map<int,wxString>::iterator iter = XTokenList.begin();
1966 iter != XTokenList.end(); ++iter){
1968 intValue2 = iter->first;
1970 // Get the element name.
1972 striter = XTokenListTokens.find(intValue2);
1974 if (striter->first == intValue2){
1976 strValue2 = striter->second;
1982 striter = XTokenList.find(intValue2);
1984 if (striter->first == intValue2){
1986 strValue = striter->second;
1990 // Add to the vCard.
1992 if (boolValue == TRUE){
1994 ContactData.AddRaw(wxT("X-") + strValue2, strValue);
1998 ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
2002 ResetSaveProcessData();
2006 ResetSaveProcessData();
2008 if (FullNamesList.size() == 0){
2010 wxString FullName = cmbDisplayAs->GetValue();
2011 FullNamesList.insert(std::make_pair(0, FullName));
2012 FullNamesListAltID.insert(std::make_pair(0, wxT("")));
2013 FullNamesListPID.insert(std::make_pair(0, wxT("")));
2014 FullNamesListType.insert(std::make_pair(0, wxT("")));
2015 FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
2016 FullNamesListPref.insert(std::make_pair(0, 0));
2017 FullNamesListTokens.insert(std::make_pair(0, wxT("")));
2022 for (std::map<int, wxString>::iterator iter = FullNamesList.begin();
2023 iter != FullNamesList.end(); ++iter){
2025 if (FNFirst == TRUE){
2027 iter->second = cmbDisplayAs->GetValue();
2032 std::map<int,wxString>::iterator mapS;
2034 mapS = FullNamesListTokens.find(iter->first);
2036 ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue,
2037 &iter, &FullNamesList, &ContactData,
2038 wxT("ALTID"), &FullNamesListAltID,
2039 wxT("PID"), &FullNamesListPID,
2040 wxT("TYPE"), &FullNamesListType,
2041 wxT("LANGUAGE"), &FullNamesListLanguage,
2042 wxT("PREF"), &FullNamesListPref,
2043 wxT(""), &FullNamesListTokens );
2047 ResetSaveProcessData();
2051 //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
2053 // Insert revision (REV) date.
2055 // Get today's date and time.
2057 wxDateTime DateTimeNow = wxDateTime::Now();
2061 // Set year, month and date.
2063 int intYear = DateTimeNow.GetYear();
2064 int intMonth = DateTimeNow.GetMonth();
2065 int intDay = DateTimeNow.GetDay();
2067 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
2071 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
2075 DateRev.Append(wxString::Format(wxT("%i"), intMonth));
2081 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
2085 DateRev.Append(wxString::Format(wxT("%i"), intDay));
2089 //DateRev.Append(wx);
2090 //DateRev.Append(wx);
2091 //DateRev.Append(wx);
2092 DateRev.Append(wxT("T"));
2094 // Set hour, minute and second.
2096 int intHour = DateTimeNow.GetHour();
2097 int intMinute = DateTimeNow.GetMinute();
2098 int intSecond = DateTimeNow.GetSecond();
2102 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
2106 DateRev.Append(wxString::Format(wxT("%i"), intHour));
2110 if (intMinute < 10){
2112 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
2116 DateRev.Append(wxString::Format(wxT("%i"), intMinute));
2120 if (intSecond < 10){
2122 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
2126 DateRev.Append(wxString::Format(wxT("%i"), intSecond));
2130 // DateRev.Append(wx);
2131 // DateRev.Append(wx);
2132 // DateRev.Append(wxString DateTimeNow->);
2133 DateRev.Append(wxT("Z"));
2135 ContactData.Add(wxT("UID"), UIDToken, FALSE);
2137 // End the vCard File.
2139 ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
2142 ContactData.WriteFile(FilenameFinal);
2144 vCard34Conv ConvFileFun;
2148 ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
2150 wxString AccountDirPrefix;
2151 wxString AccountDir;
2154 #if defined(__HAIKU__)
2156 //preffilename = wxT("noo");
2158 #elif defined(__APPLE__)
2160 PrefDir = GetUserPrefDir();
2162 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2164 #elif defined(__WIN32__)
2166 PrefDir = GetUserPrefDir();
2168 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
2172 PrefDir = GetUserPrefDir();
2174 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2178 XABPreferences PrefData(PrefDir);
2180 wxString AccountType;
2182 for (int i = 0; i < PrefData.accounts.GetCount(); i++){
2184 AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
2186 if (AccountDir == wxSContactAccount){
2188 AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
2189 AccountDirPrefix.Trim();
2190 AccountType = PrefData.accounts.GetAccountType(i);
2197 wxString wxSplitFilename;
2198 wxString wxSDataURL;
2200 while(wSTFilename.HasMoreTokens()){
2202 wxSplitFilename = wSTFilename.GetNextToken();
2206 wxSDataURL = wxSplitFilename;
2207 //wxSDataURL.Append(wxSplitFilename);
2209 // Find out if the filename exists in the table.
2211 if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
2213 wxString ETagResult;
2214 wxString ETagOriginal;
2216 ETagDB *ETagDBPtr = NULL;
2218 ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
2220 wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
2221 wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
2223 if (wxSETagOrig.IsEmpty()){
2225 // Generate the ETag.
2227 wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2231 if (wxSETag.IsEmpty()){
2233 // Update empty ETag.
2235 wxSETag = wxSETagOrig;
2236 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
2241 // Don't change original ETag.
2243 wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2244 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
2248 if (EditMode == FALSE){
2250 ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2252 FMTimer.SetFilename(FilenameFinal);
2253 FMTimer.UpdateTimestamp();
2254 FMTimer.Start(10000, FALSE);
2256 wxCommandEvent reloadevent(RELOADCONTACTLIST);
2257 reloadevent.SetString(wxSContactAccount);
2258 wxPostEvent(this->GetParent(), reloadevent);
2263 ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2264 FMTimer.UpdateTimestamp();
2265 FMTimer.Start(10000, FALSE);
2271 // Send a notification to update the main window
2272 // with the new details.
2277 // TODO: Workout nickname settings by priority and
2280 ucd->ContactAccount = wxSContactAccount;
2281 ucd->ContactFilename = FilenameFinal;
2282 ucd->ContactName = cmbDisplayAs->GetValue();
2283 ucd->ContactNameArray = ContactData.GetName();
2285 for (std::map<int,wxString>::iterator gniter = GeneralNicknamesList.begin();
2286 gniter != GeneralNicknamesList.end(); gniter++){
2288 ucd->ContactNickname = gniter->second;
2293 wxCommandEvent event2(CE_UPDATECONTACTLIST);
2294 event2.SetClientData(ucd);
2295 wxPostEvent(MainPtr, event2);
2299 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
2302 // Save the updated contact data and close the form.
2304 wxCommandEvent NullEvent;
2305 this->SaveContact(NullEvent);