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 (StartupEditMode == TRUE){
34 if (cmbType->GetCurrentSelection() == 1 ||
35 cmbType->GetCurrentSelection() == 3 ||
36 cmbType->GetCurrentSelection() == 4){
40 // Mark contact for replacing.
42 ReplaceContact = TRUE;
47 } else if (cmbType->GetCurrentSelection() == 2){
49 if (IsGroup == FALSE){
51 // Mark contact for replacing.
53 ReplaceContact = TRUE;
60 if (ReplaceContact == TRUE){
62 wxString wxDelSplitFilename;
63 wxString wxDelFinalFilename;
64 wxString wxSDelDataURL;
65 wxStringTokenizer wSTDelFilename(wxSContactFilename, wxT("/"));
66 while(wSTDelFilename.HasMoreTokens()){
68 wxDelSplitFilename = wSTDelFilename.GetNextToken();
72 wxSDelDataURL = wxDelSplitFilename;
74 // Delete the contact from the server as it will be useless in certain
75 // address book clients.
77 ActMgrPtr->AddTask(2, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDelDataURL, wxDelSplitFilename, wxSContactFilename, wxT(""));
79 // Clear the filename so the trigger to recreate the UID is done.
81 wxSContactFilename.Clear();
88 if (wxSContactFilename.IsEmpty()){
90 // Generate a random UUID.
92 UIDToken = GenerateUUID();
93 UIDToken = UIDToken.MakeUpper();
95 // Setup the filename.
97 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
99 #if defined(__HAIKU__)
101 //preffilename = wxT("noo");
103 #elif defined(__WIN32__)
105 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
106 FilenameFinal.Append(UIDToken);
107 FilenameFinal.Append(wxT(".vcf"));
108 wxSContactFilename = FilenameFinal;
112 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
113 FilenameFinal.Append(UIDToken);
114 FilenameFinal.Append(wxT(".vcf"));
115 wxSContactFilename = FilenameFinal;
121 if (UIDToken.IsEmpty()){
123 // UID Token is empty. (Shouldn't be).
124 // Generate a new UID Token.
126 /*boost::uuids::uuid ContactUUID = boost::uuids::random_generator()();
127 std::string sstContactUUID = boost::uuids::to_string(ContactUUID);
128 wxString strContactUUID(sstContactUUID.c_str(), wxConvUTF8);
129 UIDToken = strContactUUID;*/
130 UIDToken = GenerateUUID();
131 UIDToken = UIDToken.MakeUpper();
134 FilenameFinal = wxSContactFilename;
138 // Setup the data and write it into the account folder.
140 // Begin preperations to write the contact to a file.
142 bool boolValue = FALSE;
143 bool boolValue2 = FALSE;
145 bool NNGeneralFirst = TRUE;
146 bool NNHomeFirst = TRUE;
147 bool NNWorkFirst = TRUE;
149 std::map<int,int>::iterator intiter;
150 std::map<int,wxString>::iterator striter;
152 ContactData.Add(wxT("BEGIN"), wxT("VCARD"), FALSE);
153 ContactData.Add(wxT("VERSION"), wxT("4.0"), FALSE);
155 // Setup the version string.
157 strValue.Append(wxT("-//Xestia//Address Book Version "));
158 strValue.Append(wxT(XSDAB_VERSION));
159 strValue.Append(wxT("//KW"));
161 ContactData.Add(wxT("PRODID"), strValue, FALSE);
167 // Setup the name field.
169 strValue = txtSurname->GetValue() + wxT(";") +
170 txtForename->GetValue() + wxT(";") +
171 txtOtherNames->GetValue() + wxT(";") +
172 txtTitle->GetValue() + wxT(";") +
173 txtSuffix->GetValue();
175 strValue2 = ContactData.Convert(cmbDisplayAs->GetValue(), FALSE);
178 if (NameTokens.IsEmpty()){
179 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\""), strValue, FALSE);
181 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\";") + NameTokens, strValue, FALSE);
184 if (cmbType->GetCurrentSelection() == 1){
186 ContactData.AddRaw(wxT("KIND"), wxT("individual"));
188 } else if (cmbType->GetCurrentSelection() == 2){
190 ContactData.AddRaw(wxT("KIND"), wxT("group"));
192 // Go through each of the members and write them out.
194 for (std::map<int, wxString>::iterator itemiter = GroupsList.begin();
195 itemiter != GroupsList.end(); ++itemiter){
197 ContactData.Add(wxT("MEMBER:urn:uuid"), itemiter->second, FALSE);
201 } else if (cmbType->GetCurrentSelection() == 3){
203 ContactData.AddRaw(wxT("KIND"), wxT("org"));
205 } else if (cmbType->GetCurrentSelection() == 4){
207 ContactData.AddRaw(wxT("KIND"), wxT("location"));
212 // Setup the nicknames (General, Home & Business).
225 if (cmbGender->GetCurrentSelection() != 0){
227 switch(cmbGender->GetCurrentSelection()){
258 if (!txtGenderDescription->IsEmpty()){
260 strValue2 = txtGenderDescription->GetValue();
264 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
266 EscapeString(&strValue2, FALSE);
268 if (!GenderTokens.IsEmpty()){
270 if (!strValue2.IsEmpty()){
272 ContactData.AddRaw(wxT("GENDER;") + GenderTokens, strValue + wxT(";") + strValue2);
276 ContactData.AddRaw(wxT("GENDER;") + GenderTokens, strValue);
282 if (!strValue2.IsEmpty()){
284 ContactData.AddRaw(wxT("GENDER"), strValue + wxT(";") + strValue2);
288 ContactData.AddRaw(wxT("GENDER"), strValue);
307 strValue3 = BirthdayAltID;
309 if (!strValue3.IsEmpty()){
314 strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
320 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
325 strValue3 = BirthdayCalScale;
327 if (!strValue3.IsEmpty()){
332 if (boolValue2 == TRUE){
334 strValue2.Append(wxT(";"));
342 strValue2.Append(wxT("CALSCALE=") + strValue3);
350 strValue2 = BirthdayTokens;
352 // Get the birthday and write it.
354 ResetSaveProcessData();
356 if (!txtBirthday->IsEmpty()){
358 strValue = txtBirthday->GetValue();
360 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
362 if (!strValue2.IsEmpty()){
364 EscapeString(&strValue2, FALSE);
365 EscapeString(&strValue, FALSE);
367 ContactData.AddRaw(wxT("BDAY;VALUE=text;") + strValue2 + wxT(";"), strValue);
371 EscapeString(&strValue, FALSE);
373 ContactData.AddRaw(wxT("BDAY;VALUE=text"), strValue);
383 // Get Day, Month & Year.
385 wxDateTime BirthdayDate;
386 wxDateTime::Month BirthdayMonth;
389 wxString DataBeforeT;
391 wxString FinalBirthdayString;
392 bool ProcessDataAfterT = FALSE;
394 BirthdayDate = dapBirthday->GetValue();
396 if (BirthdayDate.IsValid()){
398 BirthdayDay = BirthdayDate.GetDay();
399 BirthdayMonth = BirthdayDate.GetMonth();
400 BirthdayYear = BirthdayDate.GetYear();
402 // Look for T and replace data before this.
404 wxStringTokenizer wSTDate(Birthday, wxT("T"));
406 while (wSTDate.HasMoreTokens()){
408 if (ProcessDataAfterT == FALSE){
410 DataBeforeT = wSTDate.GetNextToken();
411 ProcessDataAfterT = TRUE;
415 DataAfterT = wSTDate.GetNextToken();
422 // If there is not T then replace altogether.
424 wxString FinalBirthdayDay;
425 wxString FinalBirthdayMonth;
426 wxString FinalBirthdayYear;
428 if (BirthdayDay < 10){
430 FinalBirthdayDay = wxT("0") + wxString::Format(wxT("%i"), BirthdayDay);
434 FinalBirthdayDay = wxString::Format(wxT("%i"), BirthdayDay);
438 if (((int)BirthdayMonth + 1) < 10){
440 FinalBirthdayMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
444 FinalBirthdayMonth = wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
448 if (BirthdayYear == 0){
450 FinalBirthdayYear = wxT("--");
454 FinalBirthdayYear = wxString::Format(wxT("%i"), BirthdayYear);
458 if (!DataAfterT.IsEmpty()){
460 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay + wxT("T") + DataAfterT;
464 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay;
468 if (!FinalBirthdayString.IsEmpty() || !strValue2.IsEmpty()){
470 if (!strValue2.IsEmpty()){
472 EscapeString(&strValue2, FALSE);
473 EscapeString(&strValue, FALSE);
475 ContactData.AddRaw(wxT("BDAY") + strValue2 + wxT(";"), FinalBirthdayString);
479 EscapeString(&strValue, FALSE);
481 ContactData.AddRaw(wxT("BDAY"), FinalBirthdayString);
491 ResetSaveProcessData();
495 strValue3 = AnniversaryAltID;
497 if (!strValue3.IsEmpty()){
502 strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
508 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
513 strValue3 = AnniversaryCalScale;
515 if (!strValue3.IsEmpty()){
520 if (boolValue2 == TRUE){
522 strValue2.Append(wxT(";"));
530 strValue2.Append(wxT("CALSCALE=") + strValue3);
538 strValue2 = AnniversaryTokens;
540 // Deal with ANNIVERSARY.
542 if (!txtAnniversary->IsEmpty()){
544 strValue = txtAnniversary->GetValue();
546 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
548 if (!strValue2.IsEmpty()){
550 EscapeString(&strValue2, FALSE);
551 EscapeString(&strValue, FALSE);
553 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text;") + strValue2 + wxT(";"), strValue);
557 EscapeString(&strValue, FALSE);
559 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text"), strValue);
567 // Look for T and replace data before this.
569 // Get Day, Month & Year.
571 wxDateTime AnniversaryDate;
572 wxDateTime::Month AnniversaryMonth;
575 wxString DataBeforeT;
577 wxString FinalAnniversaryString;
578 bool ProcessDataAfterT = FALSE;
580 AnniversaryDate = dapAnniversary->GetValue();
582 if (AnniversaryDate.IsValid()){
584 AnniversaryDay = AnniversaryDate.GetDay();
585 AnniversaryMonth = AnniversaryDate.GetMonth();
586 AnniversaryYear = AnniversaryDate.GetYear();
588 // Look for T and replace data before this.
590 wxStringTokenizer wSTDate(Anniversary, wxT("T"));
592 while (wSTDate.HasMoreTokens()){
594 if (ProcessDataAfterT == FALSE){
596 DataBeforeT = wSTDate.GetNextToken();
597 ProcessDataAfterT = TRUE;
601 DataAfterT = wSTDate.GetNextToken();
608 // If there is not T then replace altogether.
610 wxString FinalAnniversaryDay;
611 wxString FinalAnniversaryMonth;
612 wxString FinalAnniversaryYear;
614 if (AnniversaryDay < 10){
616 FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
620 FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
624 if (((int)AnniversaryMonth + 1) < 10){
626 FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
630 FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
634 if (AnniversaryYear == 0){
636 FinalAnniversaryYear = wxT("--");
640 FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
644 if (!DataAfterT.IsEmpty()){
646 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
650 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
654 if (!FinalAnniversaryString.IsEmpty() || !strValue2.IsEmpty()){
656 if (!strValue2.IsEmpty()){
658 EscapeString(&strValue2, FALSE);
659 EscapeString(&strValue, FALSE);
661 ContactData.AddRaw(wxT("ANNIVERSARY") + strValue2 + wxT(";"), FinalAnniversaryString);
665 EscapeString(&strValue, FALSE);
667 ContactData.AddRaw(wxT("ANNIVERSARY"), FinalAnniversaryString);
677 // Setup the addresses (General, Home, Business).
679 //intValue = GeneralAddressList.size();
680 ResetSaveProcessData();
682 for (std::map<int,wxString>::iterator iter = GeneralAddressList.begin();
683 iter != GeneralAddressList.end(); ++iter){
685 int intSeekValue = iter->first;
687 wxString strAddressString;
688 wxString strAddressFinalValue;
689 std::map<int, wxString>::iterator iterValue;
691 strAddressString.Append(wxT(";;"));
695 iterValue = GeneralAddressList.find(intSeekValue);
696 strAddressFinalValue = iterValue->second;
697 ProcessCaptureStrings(&strAddressFinalValue);
698 strAddressString.Append(strAddressFinalValue + wxT(";"));
699 strAddressFinalValue.Clear();
703 iterValue = GeneralAddressListTown.find(intSeekValue);
704 strAddressFinalValue = iterValue->second;
705 ProcessCaptureStrings(&strAddressFinalValue);
706 strAddressString.Append(strAddressFinalValue + wxT(";"));
707 strAddressFinalValue.Clear();
711 iterValue = GeneralAddressListCounty.find(intSeekValue);
712 strAddressFinalValue = iterValue->second;
713 ProcessCaptureStrings(&strAddressFinalValue);
714 strAddressString.Append(strAddressFinalValue + wxT(";"));
715 strAddressFinalValue.Clear();
719 iterValue = GeneralAddressListPostCode.find(intSeekValue);
720 strAddressFinalValue = iterValue->second;
721 ProcessCaptureStrings(&strAddressFinalValue);
722 strAddressString.Append(strAddressFinalValue + wxT(";"));
723 strAddressFinalValue.Clear();
727 iterValue = GeneralAddressListCountry.find(intSeekValue);
728 strAddressFinalValue = iterValue->second;
729 ProcessCaptureStrings(&strAddressFinalValue);
730 strAddressString.Append(strAddressFinalValue);
731 strAddressFinalValue.Clear();
733 ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
734 &iter, &strAddressString, &ContactData,
735 wxT("LABEL"), &GeneralAddressListLabel,
736 wxT("LANGUAGE"), &GeneralAddressListLang,
737 wxT("ALTID"), &GeneralAddressListAltID,
738 wxT("PID"), &GeneralAddressListPID,
739 wxT("GEO"), &GeneralAddressListGeo,
740 wxT("TZ"), &GeneralAddressListTimezone,
741 wxT("MEDIATYPE"), &GeneralAddressListMediatype,
742 wxT("PREF"), &GeneralAddressListPref,
743 wxT(""), &GeneralAddressListTokens );
745 ResetSaveProcessData();
749 ResetSaveProcessData();
751 for (std::map<int,wxString>::iterator iter = HomeAddressList.begin();
752 iter != HomeAddressList.end(); ++iter){
754 int intSeekValue = iter->first;
756 wxString strAddressString;
757 wxString strAddressFinalValue;
758 std::map<int, wxString>::iterator iterValue;
760 strAddressString.Append(wxT(";;"));
764 iterValue = HomeAddressList.find(intSeekValue);
765 strAddressFinalValue = iterValue->second;
766 ProcessCaptureStrings(&strAddressFinalValue);
768 strAddressString.Append(strAddressFinalValue + wxT(";"));
772 iterValue = HomeAddressListTown.find(intSeekValue);
773 strAddressFinalValue = iterValue->second;
774 ProcessCaptureStrings(&strAddressFinalValue);
776 strAddressString.Append(strAddressFinalValue + wxT(";"));
780 iterValue = HomeAddressListCounty.find(intSeekValue);
781 strAddressFinalValue = iterValue->second;
782 ProcessCaptureStrings(&strAddressFinalValue);
784 strAddressString.Append(strAddressFinalValue + wxT(";"));
788 iterValue = HomeAddressListPostCode.find(intSeekValue);
789 strAddressFinalValue = iterValue->second;
790 ProcessCaptureStrings(&strAddressFinalValue);
792 strAddressString.Append(strAddressFinalValue + wxT(";"));
796 iterValue = HomeAddressListCountry.find(intSeekValue);
797 strAddressFinalValue = iterValue->second;
798 ProcessCaptureStrings(&strAddressFinalValue);
800 strAddressString.Append(strAddressFinalValue);
802 ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
803 &iter, &strAddressString, &ContactData,
804 wxT("LABEL"), &HomeAddressListLabel,
805 wxT("LANGUAGE"), &HomeAddressListLang,
806 wxT("ALTID"), &HomeAddressListAltID,
807 wxT("PID"), &HomeAddressListPID,
808 wxT("GEO"), &HomeAddressListGeo,
809 wxT("TZ"), &HomeAddressListTimezone,
810 wxT("MEDIATYPE"), &HomeAddressListMediatype,
811 wxT("PREF"), &HomeAddressListPref,
812 wxT(""), &HomeAddressListTokens );
814 ResetSaveProcessData();
818 ResetSaveProcessData();
820 for (std::map<int,wxString>::iterator iter = BusinessAddressList.begin();
821 iter != BusinessAddressList.end(); ++iter){
823 int intSeekValue = iter->first;
825 wxString strAddressString;
826 wxString strAddressFinalValue;
827 std::map<int, wxString>::iterator iterValue;
829 strAddressString.Append(wxT(";;"));
833 iterValue = BusinessAddressList.find(intSeekValue);
834 strAddressFinalValue = iterValue->second;
835 ProcessCaptureStrings(&strAddressFinalValue);
837 strAddressString.Append(strAddressFinalValue + wxT(";"));
841 iterValue = BusinessAddressListTown.find(intSeekValue);
842 strAddressFinalValue = iterValue->second;
843 ProcessCaptureStrings(&strAddressFinalValue);
845 strAddressString.Append(strAddressFinalValue + wxT(";"));
849 iterValue = BusinessAddressListCounty.find(intSeekValue);
850 strAddressFinalValue = iterValue->second;
851 ProcessCaptureStrings(&strAddressFinalValue);
853 strAddressString.Append(strAddressFinalValue + wxT(";"));
857 iterValue = BusinessAddressListPostCode.find(intSeekValue);
858 strAddressFinalValue = iterValue->second;
859 ProcessCaptureStrings(&strAddressFinalValue);
861 strAddressString.Append(strAddressFinalValue + wxT(";"));
865 iterValue = BusinessAddressListCountry.find(intSeekValue);
866 strAddressFinalValue = iterValue->second;
867 ProcessCaptureStrings(&strAddressFinalValue);
869 strAddressString.Append(strAddressFinalValue);
871 ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
872 &iter, &strAddressString, &ContactData,
873 wxT("LABEL"), &BusinessAddressListLabel,
874 wxT("LANGUAGE"), &BusinessAddressListLang,
875 wxT("ALTID"), &BusinessAddressListAltID,
876 wxT("PID"), &BusinessAddressListPID,
877 wxT("GEO"), &BusinessAddressListGeo,
878 wxT("TZ"), &BusinessAddressListTimezone,
879 wxT("MEDIATYPE"), &BusinessAddressListMediatype,
880 wxT("PREF"), &BusinessAddressListPref,
881 wxT(""), &BusinessAddressListTokens );
883 ResetSaveProcessData();
887 // Sort out nicknames (if any).
889 for (std::map<int,wxString>::iterator iter = GeneralNicknamesList.begin();
890 iter != GeneralNicknamesList.end(); ++iter){
892 intValue2 = iter->first;
894 // Process Alternative ID.
896 ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
897 &iter, &GeneralNicknamesList, &ContactData,
898 wxT("LANGUAGE"), &GeneralNicknamesListLanguage,
899 wxT("ALTID"), &GeneralNicknamesListAltID,
900 wxT("PID"), &GeneralNicknamesListPID,
901 wxT("PREF"), &GeneralNicknamesListPref,
902 wxT(""), &GeneralNicknamesListTokens );
904 ResetSaveProcessData();
908 ResetSaveProcessData();
910 for (std::map<int,wxString>::iterator iter = HomeNicknamesList.begin();
911 iter != HomeNicknamesList.end(); ++iter){
913 ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
914 &iter, &HomeNicknamesList, &ContactData,
915 wxT("LANGUAGE"), &HomeNicknamesListLanguage,
916 wxT("ALTID"), &HomeNicknamesListAltID,
917 wxT("PID"), &HomeNicknamesListPID,
918 wxT("PREF"), &HomeNicknamesListPref,
919 wxT(""), &HomeNicknamesListTokens );
921 ResetSaveProcessData();
925 ResetSaveProcessData();
927 for (std::map<int,wxString>::iterator iter = BusinessNicknamesList.begin();
928 iter != BusinessNicknamesList.end(); ++iter){
930 ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
931 &iter, &BusinessNicknamesList, &ContactData,
932 wxT("LANGUAGE"), &BusinessNicknamesListLanguage,
933 wxT("ALTID"), &BusinessNicknamesListAltID,
934 wxT("PID"), &BusinessNicknamesListPID,
935 wxT("PREF"), &BusinessNicknamesListPref,
936 wxT(""), &BusinessNicknamesListTokens );
938 ResetSaveProcessData();
942 ResetSaveProcessData();
944 // Sort out email (general, home and business).
946 for (std::map<int,wxString>::iterator iter = GeneralEmailList.begin();
947 iter != GeneralEmailList.end(); ++iter){
949 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
952 wxString strAddressFinalValue;
953 std::map<int, wxString>::iterator iterValue;
955 ProcessSaveData(wxT("EMAIL"), &strValue2, &boolValue2, &boolValue,
956 &iter, &GeneralEmailList, &ContactData,
957 wxT("ALTID"), &GeneralEmailListAltID,
958 wxT("PID"), &GeneralEmailListPID,
959 wxT("PREF"), &GeneralEmailListPref,
960 wxT(""), &GeneralEmailListTokens );
962 ResetSaveProcessData();
966 ResetSaveProcessData();
968 for (std::map<int,wxString>::iterator iter = HomeEmailList.begin();
969 iter != HomeEmailList.end(); ++iter){
971 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
974 ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
975 &iter, &HomeEmailList, &ContactData,
976 wxT("ALTID"), &HomeEmailListAltID,
977 wxT("PID"), &HomeEmailListPID,
978 wxT("PREF"), &HomeEmailListPref,
979 wxT(""), &HomeEmailListTokens );
981 ResetSaveProcessData();
985 ResetSaveProcessData();
987 for (std::map<int,wxString>::iterator iter = BusinessEmailList.begin();
988 iter != BusinessEmailList.end(); ++iter){
990 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
993 ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
994 &iter, &BusinessEmailList, &ContactData,
995 wxT("ALTID"), &BusinessEmailListAltID,
996 wxT("PID"), &BusinessEmailListPID,
997 wxT("PREF"), &BusinessEmailListPref,
998 wxT(""), &BusinessEmailListTokens );
1000 ResetSaveProcessData();
1004 ResetSaveProcessData();
1006 for (std::map<int,wxString>::iterator iter = GeneralIMList.begin();
1007 iter != GeneralIMList.end(); ++iter){
1009 intValue2 = iter->first;
1011 // Process Alternative ID.
1013 ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
1014 &iter, &GeneralIMList, &ContactData,
1015 wxT("ALTID"), &GeneralIMListAltID,
1016 wxT("PID"), &GeneralIMListPID,
1017 wxT("MEDIATYPE"), &GeneralIMListMediatype,
1018 wxT("PREF"), &GeneralIMListPref,
1019 wxT(""), &GeneralIMListTokens );
1021 ResetSaveProcessData();
1025 ResetSaveProcessData();
1027 for (std::map<int,wxString>::iterator iter = HomeIMList.begin();
1028 iter != HomeIMList.end(); ++iter){
1030 ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1031 &iter, &HomeIMList, &ContactData,
1032 wxT("ALTID"), &HomeIMListAltID,
1033 wxT("PID"), &HomeIMListPID,
1034 wxT("MEDIATYPE"), &HomeIMListMediatype,
1035 wxT("PREF"), &HomeIMListPref,
1036 wxT(""), &HomeIMListTokens );
1038 ResetSaveProcessData();
1042 ResetSaveProcessData();
1044 for (std::map<int,wxString>::iterator iter = BusinessIMList.begin();
1045 iter != BusinessIMList.end(); ++iter){
1047 ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1048 &iter, &BusinessIMList, &ContactData,
1049 wxT("ALTID"), &BusinessIMListAltID,
1050 wxT("PID"), &BusinessIMListPID,
1051 wxT("MEDIATYPE"), &BusinessIMListMediatype,
1052 wxT("PREF"), &BusinessIMListPref,
1053 wxT(""), &BusinessIMListTokens );
1055 ResetSaveProcessData();
1059 ResetSaveProcessData();
1061 for (std::map<int,wxString>::iterator iter = GeneralTelephoneList.begin();
1062 iter != GeneralTelephoneList.end(); ++iter){
1064 wxString strAddressFinalValue = iter->second;
1066 ProcessCaptureStrings(&strAddressFinalValue);
1068 strAddressFinalValue.insert(0, wxT("tel:"));
1070 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1071 &iter, &strAddressFinalValue, &ContactData,
1072 wxT("ALTID"), &GeneralTelephoneListAltID,
1073 wxT("PID"), &GeneralTelephoneListPID,
1074 wxT("TYPE"), &GeneralTelephoneListType,
1075 wxT("PREF"), &GeneralTelephoneListPref,
1076 wxT(""), &GeneralTelephoneListTokens );
1078 ResetSaveProcessData();
1082 ResetSaveProcessData();
1084 for (std::map<int,wxString>::iterator iter = HomeTelephoneList.begin();
1085 iter != HomeTelephoneList.end(); ++iter){
1087 wxString strAddressFinalValue = iter->second;
1089 ProcessCaptureStrings(&strAddressFinalValue);
1091 strAddressFinalValue.insert(0, wxT("tel:"));
1093 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1094 &iter, &strAddressFinalValue, &ContactData,
1095 wxT("ALTID"), &HomeTelephoneListAltID,
1096 wxT("PID"), &HomeTelephoneListPID,
1097 wxT("TYPE"), &HomeTelephoneListType,
1098 wxT("PREF"), &HomeTelephoneListPref,
1099 wxT(""), &HomeTelephoneListTokens );
1101 ResetSaveProcessData();
1105 ResetSaveProcessData();
1107 for (std::map<int,wxString>::iterator iter = BusinessTelephoneList.begin();
1108 iter != BusinessTelephoneList.end(); ++iter){
1110 wxString strAddressFinalValue = iter->second;
1112 ProcessCaptureStrings(&strAddressFinalValue);
1114 strAddressFinalValue.insert(0, wxT("tel:"));
1116 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1117 &iter, &strAddressFinalValue, &ContactData,
1118 wxT("ALTID"), &BusinessTelephoneListAltID,
1119 wxT("PID"), &BusinessTelephoneListPID,
1120 wxT("TYPE"), &BusinessTelephoneListType,
1121 wxT("PREF"), &BusinessTelephoneListPref,
1122 wxT(""), &BusinessTelephoneListTokens );
1124 ResetSaveProcessData();
1128 ResetSaveProcessData();
1130 for (std::map<int,wxString>::iterator iter = GeneralLanguageList.begin();
1131 iter != GeneralLanguageList.end(); ++iter){
1133 intValue2 = iter->first;
1135 ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
1136 &iter, &GeneralLanguageList, &ContactData,
1137 wxT("ALTID"), &GeneralLanguageListAltID,
1138 wxT("PID"), &GeneralLanguageListPID,
1139 wxT("PREF"), &GeneralLanguageListPref,
1140 wxT(""), &GeneralLanguageListTokens );
1142 ResetSaveProcessData();
1146 ResetSaveProcessData();
1148 for (std::map<int,wxString>::iterator iter = HomeLanguageList.begin();
1149 iter != HomeLanguageList.end(); ++iter){
1151 ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1152 &iter, &HomeLanguageList, &ContactData,
1153 wxT("ALTID"), &HomeLanguageListAltID,
1154 wxT("PID"), &HomeLanguageListPID,
1155 wxT("PREF"), &HomeLanguageListPref,
1156 wxT(""), &HomeLanguageListTokens );
1158 ResetSaveProcessData();
1162 ResetSaveProcessData();
1164 for (std::map<int,wxString>::iterator iter = BusinessLanguageList.begin();
1165 iter != BusinessLanguageList.end(); ++iter){
1167 ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1168 &iter, &BusinessLanguageList, &ContactData,
1169 wxT("ALTID"), &BusinessLanguageListAltID,
1170 wxT("PID"), &BusinessLanguageListPID,
1171 wxT("PREF"), &BusinessLanguageListPref,
1172 wxT(""), &BusinessLanguageListTokens );
1174 ResetSaveProcessData();
1178 ResetSaveProcessData();
1180 for (std::map<int,wxString>::iterator iter = GeneralTZList.begin();
1181 iter != GeneralTZList.end(); ++iter){
1183 ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
1184 &iter, &GeneralTZList, &ContactData,
1185 wxT("ALTID"), &GeneralTZListAltID,
1186 wxT("PID"), &GeneralTZListPID,
1187 wxT("MEDIATYPE"), &GeneralTZListMediatype,
1188 wxT("PREF"), &GeneralTZListPref,
1189 wxT(""), &GeneralTZListTokens );
1191 ResetSaveProcessData();
1195 ResetSaveProcessData();
1197 for (std::map<int,wxString>::iterator iter = HomeTZList.begin();
1198 iter != HomeTZList.end(); ++iter){
1200 ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1201 &iter, &HomeTZList, &ContactData,
1202 wxT("ALTID"), &HomeTZListAltID,
1203 wxT("PID"), &HomeTZListPID,
1204 wxT("MEDIATYPE"), &HomeTZListMediatype,
1205 wxT("PREF"), &HomeTZListPref,
1206 wxT(""), &HomeTZListTokens );
1208 ResetSaveProcessData();
1212 ResetSaveProcessData();
1214 for (std::map<int,wxString>::iterator iter = BusinessTZList.begin();
1215 iter != BusinessTZList.end(); ++iter){
1217 ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1218 &iter, &BusinessTZList, &ContactData,
1219 wxT("ALTID"), &BusinessTZListAltID,
1220 wxT("PID"), &BusinessTZListPID,
1221 wxT("MEDIATYPE"), &BusinessTZListMediatype,
1222 wxT("PREF"), &BusinessTZListPref,
1223 wxT(""), &BusinessTZListTokens );
1225 ResetSaveProcessData();
1229 ResetSaveProcessData();
1231 for (std::map<int,wxString>::iterator iter = GeneralGeographyList.begin();
1232 iter != GeneralGeographyList.end(); ++iter){
1234 wxString strAddressFinalValue = iter->second;
1236 ProcessCaptureStrings(&strAddressFinalValue);
1238 strAddressFinalValue.insert(0, wxT("geo:"));
1240 ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
1241 &iter, &strAddressFinalValue, &ContactData,
1242 wxT("ALTID"), &GeneralGeographyListAltID,
1243 wxT("PID"), &GeneralGeographyListPID,
1244 wxT("MEDIATYPE"), &GeneralGeographyListMediatype,
1245 wxT("PREF"), &GeneralGeographyListPref,
1246 wxT(""), &GeneralGeographyListTokens );
1248 ResetSaveProcessData();
1252 ResetSaveProcessData();
1254 for (std::map<int,wxString>::iterator iter = HomeGeographyList.begin();
1255 iter != HomeGeographyList.end(); ++iter){
1257 wxString strAddressFinalValue = iter->second;
1259 ProcessCaptureStrings(&strAddressFinalValue);
1261 strAddressFinalValue.insert(0, wxT("geo:"));
1263 ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1264 &iter, &HomeGeographyList, &ContactData,
1265 wxT("ALTID"), &HomeGeographyListAltID,
1266 wxT("PID"), &HomeGeographyListPID,
1267 wxT("MEDIATYPE"), &HomeGeographyListMediatype,
1268 wxT("PREF"), &HomeGeographyListPref,
1269 wxT(""), &HomeGeographyListTokens );
1271 ResetSaveProcessData();
1275 ResetSaveProcessData();
1277 for (std::map<int,wxString>::iterator iter = BusinessGeographyList.begin();
1278 iter != BusinessGeographyList.end(); ++iter){
1280 wxString strAddressFinalValue = iter->second;
1282 ProcessCaptureStrings(&strAddressFinalValue);
1284 strAddressFinalValue.insert(0, wxT("geo:"));
1286 ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1287 &iter, &BusinessGeographyList, &ContactData,
1288 wxT("ALTID"), &BusinessGeographyListAltID,
1289 wxT("PID"), &BusinessGeographyListPID,
1290 wxT("MEDIATYPE"), &BusinessGeographyListMediatype,
1291 wxT("PREF"), &BusinessGeographyListPref,
1292 wxT(""), &BusinessGeographyListTokens );
1294 ResetSaveProcessData();
1298 ResetSaveProcessData();
1300 for (std::map<int,wxString>::iterator iter = GeneralRelatedList.begin();
1301 iter != GeneralRelatedList.end(); ++iter){
1303 ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
1304 &iter, &GeneralRelatedList, &ContactData,
1305 wxT("ALTID"), &GeneralRelatedListAltID,
1306 wxT("PID"), &GeneralRelatedListPID,
1307 wxT("LANGUAGE"), &GeneralRelatedListLanguage,
1308 wxT("TYPE"), &GeneralRelatedListRelType,
1309 wxT("PREF"), &GeneralRelatedListPref,
1310 wxT(""), &GeneralRelatedListTokens );
1312 ResetSaveProcessData();
1316 ResetSaveProcessData();
1318 for (std::map<int,wxString>::iterator iter = GeneralWebsiteList.begin();
1319 iter != GeneralWebsiteList.end(); ++iter){
1321 ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
1322 &iter, &GeneralWebsiteList, &ContactData,
1323 wxT("ALTID"), &GeneralWebsiteListAltID,
1324 wxT("PID"), &GeneralWebsiteListPID,
1325 wxT("MEDIATYPE"), &GeneralWebsiteListMediatype,
1326 wxT("PREF"), &GeneralWebsiteListPref,
1327 wxT(""), &GeneralWebsiteListTokens );
1329 ResetSaveProcessData();
1333 ResetSaveProcessData();
1335 for (std::map<int,wxString>::iterator iter = HomeWebsiteList.begin();
1336 iter != HomeWebsiteList.end(); ++iter){
1338 ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1339 &iter, &HomeWebsiteList, &ContactData,
1340 wxT("ALTID"), &HomeWebsiteListAltID,
1341 wxT("PID"), &HomeWebsiteListPID,
1342 wxT("MEDIATYPE"), &HomeWebsiteListMediatype,
1343 wxT("PREF"), &HomeWebsiteListPref,
1344 wxT(""), &HomeWebsiteListTokens );
1346 ResetSaveProcessData();
1350 ResetSaveProcessData();
1352 for (std::map<int,wxString>::iterator iter = BusinessWebsiteList.begin();
1353 iter != BusinessWebsiteList.end(); ++iter){
1355 ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1356 &iter, &BusinessWebsiteList, &ContactData,
1357 wxT("ALTID"), &BusinessWebsiteListAltID,
1358 wxT("PID"), &BusinessWebsiteListPID,
1359 wxT("MEDIATYPE"), &BusinessWebsiteListMediatype,
1360 wxT("PREF"), &BusinessWebsiteListPref,
1361 wxT(""), &BusinessWebsiteListTokens );
1363 ResetSaveProcessData();
1367 ResetSaveProcessData();
1369 for (std::map<int,wxString>::iterator iter = GeneralTitleList.begin();
1370 iter != GeneralTitleList.end(); ++iter){
1372 ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
1373 &iter, &GeneralTitleList, &ContactData,
1374 wxT("ALTID"), &GeneralTitleListAltID,
1375 wxT("PID"), &GeneralTitleListPID,
1376 wxT("LANGUAGE"), &GeneralTitleListLanguage,
1377 wxT("PREF"), &GeneralTitleListPref,
1378 wxT(""), &GeneralTitleListTokens );
1380 ResetSaveProcessData();
1384 ResetSaveProcessData();
1386 for (std::map<int,wxString>::iterator iter = HomeTitleList.begin();
1387 iter != HomeTitleList.end(); ++iter){
1389 ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1390 &iter, &HomeTitleList, &ContactData,
1391 wxT("ALTID"), &HomeTitleListAltID,
1392 wxT("PID"), &HomeTitleListPID,
1393 wxT("LANGUAGE"), &HomeTitleListLanguage,
1394 wxT("PREF"), &HomeTitleListPref,
1395 wxT(""), &HomeTitleListTokens );
1397 ResetSaveProcessData();
1401 ResetSaveProcessData();
1403 for (std::map<int,wxString>::iterator iter = BusinessTitleList.begin();
1404 iter != BusinessTitleList.end(); ++iter){
1406 ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1407 &iter, &BusinessTitleList, &ContactData,
1408 wxT("ALTID"), &BusinessTitleListAltID,
1409 wxT("PID"), &BusinessTitleListPID,
1410 wxT("LANGUAGE"), &BusinessTitleListLanguage,
1411 wxT("PREF"), &BusinessTitleListPref,
1412 wxT(""), &BusinessTitleListTokens );
1414 ResetSaveProcessData();
1418 ResetSaveProcessData();
1420 for (std::map<int,wxString>::iterator iter = GeneralRoleList.begin();
1421 iter != GeneralRoleList.end(); ++iter){
1423 ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
1424 &iter, &GeneralRoleList, &ContactData,
1425 wxT("ALTID"), &GeneralRoleListAltID,
1426 wxT("PID"), &GeneralRoleListPID,
1427 wxT("LANGUAGE"), &GeneralRoleListLanguage,
1428 wxT("PREF"), &GeneralRoleListPref,
1429 wxT(""), &GeneralRoleListTokens );
1431 ResetSaveProcessData();
1435 ResetSaveProcessData();
1437 for (std::map<int,wxString>::iterator iter = HomeRoleList.begin();
1438 iter != HomeRoleList.end(); ++iter){
1440 ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1441 &iter, &HomeRoleList, &ContactData,
1442 wxT("ALTID"), &HomeRoleListAltID,
1443 wxT("PID"), &HomeRoleListPID,
1444 wxT("LANGUAGE"), &HomeRoleListLanguage,
1445 wxT("PREF"), &HomeRoleListPref,
1446 wxT(""), &HomeRoleListTokens );
1448 ResetSaveProcessData();
1452 ResetSaveProcessData();
1454 for (std::map<int,wxString>::iterator iter = BusinessRoleList.begin();
1455 iter != BusinessRoleList.end(); ++iter){
1457 ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1458 &iter, &BusinessRoleList, &ContactData,
1459 wxT("ALTID"), &BusinessRoleListAltID,
1460 wxT("PID"), &BusinessRoleListPID,
1461 wxT("LANGUAGE"), &BusinessRoleListLanguage,
1462 wxT("PREF"), &BusinessRoleListPref,
1463 wxT(""), &BusinessRoleListTokens );
1465 ResetSaveProcessData();
1469 ResetSaveProcessData();
1471 for (std::map<int,wxString>::iterator iter = GeneralOrganisationsList.begin();
1472 iter != GeneralOrganisationsList.end(); ++iter){
1474 ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
1475 &iter, &GeneralOrganisationsList, &ContactData,
1476 wxT("ALTID"), &GeneralOrganisationsListAltID,
1477 wxT("PID"), &GeneralOrganisationsListPID,
1478 wxT("LANGUAGE"), &GeneralOrganisationsListLanguage,
1479 wxT("SORT-AS"), &GeneralOrganisationsListSortAs,
1480 wxT("PREF"), &GeneralOrganisationsListPref,
1481 wxT(""), &GeneralOrganisationsListTokens );
1483 ResetSaveProcessData();
1487 ResetSaveProcessData();
1489 for (std::map<int,wxString>::iterator iter = HomeOrganisationsList.begin();
1490 iter != HomeOrganisationsList.end(); ++iter){
1492 ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1493 &iter, &HomeOrganisationsList, &ContactData,
1494 wxT("ALTID"), &HomeOrganisationsListAltID,
1495 wxT("PID"), &HomeOrganisationsListPID,
1496 wxT("LANGUAGE"), &HomeOrganisationsListLanguage,
1497 wxT("SORT-AS"), &HomeOrganisationsListSortAs,
1498 wxT("PREF"), &HomeOrganisationsListPref,
1499 wxT(""), &HomeOrganisationsListTokens );
1501 ResetSaveProcessData();
1505 ResetSaveProcessData();
1507 for (std::map<int,wxString>::iterator iter = BusinessOrganisationsList.begin();
1508 iter != BusinessOrganisationsList.end(); ++iter){
1510 ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1511 &iter, &BusinessOrganisationsList, &ContactData,
1512 wxT("ALTID"), &BusinessOrganisationsListAltID,
1513 wxT("PID"), &BusinessOrganisationsListPID,
1514 wxT("LANGUAGE"), &BusinessOrganisationsListLanguage,
1515 wxT("SORT-AS"), &BusinessOrganisationsListSortAs,
1516 wxT("PREF"), &BusinessOrganisationsListPref,
1517 wxT(""), &BusinessOrganisationsListTokens );
1519 ResetSaveProcessData();
1523 ResetSaveProcessData();
1525 for (std::map<int,wxString>::iterator iter = GeneralNoteList.begin();
1526 iter != GeneralNoteList.end(); ++iter){
1528 ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
1529 &iter, &GeneralNoteList, &ContactData,
1530 wxT("ALTID"), &GeneralNoteListAltID,
1531 wxT("PID"), &GeneralNoteListPID,
1532 wxT("LANGUAGE"), &GeneralNoteListLanguage,
1533 wxT("PREF"), &GeneralNoteListPref,
1534 wxT(""), &GeneralNoteListTokens );
1536 ResetSaveProcessData();
1540 ResetSaveProcessData();
1542 for (std::map<int,wxString>::iterator iter = HomeNoteList.begin();
1543 iter != HomeNoteList.end(); ++iter){
1545 ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1546 &iter, &HomeNoteList, &ContactData,
1547 wxT("ALTID"), &HomeNoteListAltID,
1548 wxT("PID"), &HomeNoteListPID,
1549 wxT("LANGUAGE"), &HomeNoteListLanguage,
1550 wxT("PREF"), &HomeNoteListPref,
1551 wxT(""), &HomeNoteListTokens );
1553 ResetSaveProcessData();
1557 ResetSaveProcessData();
1559 for (std::map<int,wxString>::iterator iter = BusinessNoteList.begin();
1560 iter != BusinessNoteList.end(); ++iter){
1562 ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1563 &iter, &BusinessNoteList, &ContactData,
1564 wxT("ALTID"), &BusinessNoteListAltID,
1565 wxT("PID"), &BusinessNoteListPID,
1566 wxT("LANGUAGE"), &BusinessNoteListLanguage,
1567 wxT("PREF"), &BusinessNoteListPref,
1568 wxT(""), &BusinessNoteListTokens );
1570 ResetSaveProcessData();
1574 ResetSaveProcessData();
1576 for (std::map<int,wxString>::iterator iter = CategoriesList.begin();
1577 iter != CategoriesList.end(); ++iter){
1579 ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
1580 &iter, &CategoriesList, &ContactData,
1581 wxT("ALTID"), &CategoriesListAltID,
1582 wxT("PID"), &CategoriesListPID,
1583 wxT("TYPE"), &CategoriesListType,
1584 wxT("PREF"), &CategoriesListPref,
1585 wxT(""), &CategoriesListTokens );
1587 ResetSaveProcessData();
1593 for (std::map<int, std::string>::iterator iter = PicturesList.begin();
1594 iter != PicturesList.end(); ++iter){
1596 int intValueIndex = iter->first;
1598 std::map<int, std::string>::iterator stdstriter;
1599 std::map<int, wxString>::iterator enciter;
1601 striter = PicturesListPictureType.find(intValueIndex);
1602 enciter = PicturesListPicEncType.find(intValueIndex);
1604 ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
1605 &iter, &PicturesList, &striter,
1606 &enciter, &ContactData,
1607 wxT("ALTID"), &PicturesListAltID,
1608 wxT("PID"), &PicturesListPID,
1609 wxT("TYPE"), &PicturesListType,
1610 wxT("PREF"), &PicturesListPref,
1611 wxT(""), &PicturesListTokens);
1613 ResetSaveProcessData();
1617 ResetSaveProcessData();
1621 for (std::map<int, std::string>::iterator iter = LogosList.begin();
1622 iter != LogosList.end(); ++iter){
1624 int intValueIndex = iter->first;
1626 std::map<int, std::string>::iterator stdstriter;
1627 std::map<int, wxString>::iterator enciter;
1629 striter = LogosListPictureType.find(intValueIndex);
1630 enciter = LogosListPicEncType.find(intValueIndex);
1632 ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
1633 &iter, &LogosList, &striter,
1634 &enciter, &ContactData,
1635 wxT("ALTID"), &LogosListAltID,
1636 wxT("PID"), &LogosListPID,
1637 wxT("TYPE"), &LogosListType,
1638 wxT("PREF"), &LogosListPref,
1639 wxT(""), &LogosListTokens );
1641 ResetSaveProcessData();
1645 ResetSaveProcessData();
1649 for (std::map<int, std::string>::iterator iter = SoundsList.begin();
1650 iter != SoundsList.end(); ++iter){
1652 int intValueIndex = iter->first;
1654 std::map<int, std::string>::iterator stdstriter;
1655 std::map<int, wxString>::iterator enciter;
1657 striter = SoundsListAudioType.find(intValueIndex);
1658 enciter = SoundsListAudioEncType.find(intValueIndex);
1660 ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
1661 &iter, &SoundsList, &striter,
1662 &enciter, &ContactData,
1663 wxT("ALTID"), &SoundsListAltID,
1664 wxT("PID"), &SoundsListPID,
1665 wxT("TYPE"), &SoundsListType,
1666 wxT("PREF"), &SoundsListPref,
1667 wxT(""), &SoundsListTokens );
1669 ResetSaveProcessData();
1673 ResetSaveProcessData();
1675 for (std::map<int,wxString>::iterator iter = CalendarList.begin();
1676 iter != CalendarList.end(); ++iter){
1678 ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
1679 &iter, &CalendarList, &ContactData,
1680 wxT("ALTID"), &CalendarListAltID,
1681 wxT("PID"), &CalendarListPID,
1682 wxT("MEDIATYPE"), &CalendarListMediatype,
1683 wxT("TYPE"), &CalendarListType,
1684 wxT("PREF"), &CalendarListPref,
1685 wxT(""), &CalendarListTokens );
1687 ResetSaveProcessData();
1691 ResetSaveProcessData();
1693 for (std::map<int,wxString>::iterator iter = CalendarRequestList.begin();
1694 iter != CalendarRequestList.end(); ++iter){
1696 ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
1697 &iter, &CalendarRequestList, &ContactData,
1698 wxT("ALTID"), &CalendarRequestListAltID,
1699 wxT("PID"), &CalendarRequestListPID,
1700 wxT("MEDIATYPE"), &CalendarRequestListMediatype,
1701 wxT("TYPE"), &CalendarRequestListType,
1702 wxT("PREF"), &CalendarRequestListPref,
1703 wxT(""), &CalendarRequestListTokens );
1705 ResetSaveProcessData();
1709 ResetSaveProcessData();
1711 for (std::map<int,wxString>::iterator iter = FreeBusyList.begin();
1712 iter != FreeBusyList.end(); ++iter){
1714 ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
1715 &iter, &FreeBusyList, &ContactData,
1716 wxT("ALTID"), &FreeBusyListAltID,
1717 wxT("PID"), &FreeBusyListPID,
1718 wxT("MEDIATYPE"), &FreeBusyListMediatype,
1719 wxT("TYPE"), &FreeBusyListType,
1720 wxT("PREF"), &FreeBusyListPref,
1721 wxT(""), &FreeBusyListTokens );
1723 ResetSaveProcessData();
1727 for (std::map<int, wxString>::iterator iter = KeyList.begin();
1728 iter != KeyList.end(); ++iter){
1730 intValue2 = iter->first;
1732 // Process Alternative ID.
1734 striter = KeyListAltID.find(intValue2);
1736 if (striter->first == intValue2){
1738 strValue3 = striter->second;
1740 if (!strValue3.IsEmpty()){
1745 if (boolValue2 == TRUE){
1747 strValue2.Append(wxT(";"));
1755 strValue2.Append(wxT("ALTID=") + strValue3);
1765 striter = KeyListPID.find(intValue2);
1767 if (striter->first == intValue2){
1769 strValue3 = striter->second;
1771 if (!strValue3.IsEmpty()){
1776 if (boolValue2 == TRUE){
1778 strValue2.Append(wxT(";"));
1786 strValue2.Append(wxT("PID=") + strValue3);
1796 striter = KeyListType.find(intValue2);
1798 if (striter->first == intValue2){
1800 strValue3 = striter->second;
1802 if (!strValue3.IsEmpty()){
1807 if (boolValue2 == TRUE){
1809 strValue2.Append(wxT(";"));
1817 strValue2.Append(wxT("TYPE=") + strValue3);
1825 intiter = KeyListPref.find(intValue2);
1827 if (intiter->first == intValue2){
1829 intValue3 = intiter->second;
1833 if (boolValue2 == TRUE){
1835 strValue2.Append(wxT(";"));
1843 strValue2.Append(wxT("PREF=") + wxString::Format(wxT("%i"), intValue3));
1853 striter = KeyListTokens.find(intValue2);
1855 if (striter->first == intValue2){
1857 strValue3 = striter->second;
1859 if (!strValue3.IsEmpty()){
1864 if (boolValue2 == TRUE){
1866 strValue2.Append(wxT(";"));
1874 strValue2.Append(strValue3);
1882 // Get the key information.
1884 std::map<int, wxString>::iterator enciter;
1886 striter = KeyListDataType.find(intValue2);
1887 //enciter = KeyListAudioEncType.find(intValue2);
1889 wxString strValueData;
1891 strValueData = iter->second;
1892 //strValueData.insert(0, wxT("data:") + striter->second + wxT(";") + enciter->second + wxT(","));
1893 strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));
1896 // Add to the vCard.
1898 if (boolValue == TRUE){
1900 ContactData.AddRaw(wxT("KEY;") + strValue2, strValueData);
1904 ContactData.Add(wxT("KEY"), strValueData, TRUE);
1908 ResetSaveProcessData();
1912 // Vendor specific items.
1914 ResetSaveProcessData();
1916 for (std::map<int,wxString>::iterator iter = VendorList.begin();
1917 iter != VendorList.end(); ++iter){
1919 intValue2 = iter->first;
1921 // Get the IANA PEN number.
1923 striter = VendorListPEN.find(intValue2);
1925 if (striter->first == intValue2){
1927 strValue2 = striter->second;
1931 // Get the element name.
1933 striter = VendorListElement.find(intValue2);
1935 if (striter->first == intValue2){
1937 strValue3 = striter->second;
1943 striter = VendorList.find(intValue2);
1945 if (striter->first == intValue2){
1947 strValue = striter->second;
1951 // Add to the vCard.
1953 if (boolValue == TRUE){
1955 ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
1959 ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
1963 ResetSaveProcessData();
1967 ResetSaveProcessData();
1971 for (std::map<int,wxString>::iterator iter = XTokenList.begin();
1972 iter != XTokenList.end(); ++iter){
1974 intValue2 = iter->first;
1976 // Get the element name.
1978 striter = XTokenListTokens.find(intValue2);
1980 if (striter->first == intValue2){
1982 strValue2 = striter->second;
1988 striter = XTokenList.find(intValue2);
1990 if (striter->first == intValue2){
1992 strValue = striter->second;
1996 // Add to the vCard.
1998 if (boolValue == TRUE){
2000 ContactData.AddRaw(wxT("X-") + strValue2, strValue);
2004 ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
2008 ResetSaveProcessData();
2012 ResetSaveProcessData();
2014 if (FullNamesList.size() == 0){
2016 wxString FullName = cmbDisplayAs->GetValue();
2017 FullNamesList.insert(std::make_pair(0, FullName));
2018 FullNamesListAltID.insert(std::make_pair(0, wxT("")));
2019 FullNamesListPID.insert(std::make_pair(0, wxT("")));
2020 FullNamesListType.insert(std::make_pair(0, wxT("")));
2021 FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
2022 FullNamesListPref.insert(std::make_pair(0, 0));
2023 FullNamesListTokens.insert(std::make_pair(0, wxT("")));
2028 for (std::map<int, wxString>::iterator iter = FullNamesList.begin();
2029 iter != FullNamesList.end(); ++iter){
2031 if (FNFirst == TRUE){
2033 iter->second = cmbDisplayAs->GetValue();
2038 std::map<int,wxString>::iterator mapS;
2040 mapS = FullNamesListTokens.find(iter->first);
2042 ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue,
2043 &iter, &FullNamesList, &ContactData,
2044 wxT("ALTID"), &FullNamesListAltID,
2045 wxT("PID"), &FullNamesListPID,
2046 wxT("TYPE"), &FullNamesListType,
2047 wxT("LANGUAGE"), &FullNamesListLanguage,
2048 wxT("PREF"), &FullNamesListPref,
2049 wxT(""), &FullNamesListTokens );
2053 ResetSaveProcessData();
2057 //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
2059 // Insert revision (REV) date.
2061 // Get today's date and time.
2063 wxDateTime DateTimeNow = wxDateTime::Now();
2067 // Set year, month and date.
2069 int intYear = DateTimeNow.GetYear();
2070 int intMonth = DateTimeNow.GetMonth();
2071 int intDay = DateTimeNow.GetDay();
2073 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
2077 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
2081 DateRev.Append(wxString::Format(wxT("%i"), intMonth));
2087 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
2091 DateRev.Append(wxString::Format(wxT("%i"), intDay));
2095 //DateRev.Append(wx);
2096 //DateRev.Append(wx);
2097 //DateRev.Append(wx);
2098 DateRev.Append(wxT("T"));
2100 // Set hour, minute and second.
2102 int intHour = DateTimeNow.GetHour();
2103 int intMinute = DateTimeNow.GetMinute();
2104 int intSecond = DateTimeNow.GetSecond();
2108 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
2112 DateRev.Append(wxString::Format(wxT("%i"), intHour));
2116 if (intMinute < 10){
2118 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
2122 DateRev.Append(wxString::Format(wxT("%i"), intMinute));
2126 if (intSecond < 10){
2128 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
2132 DateRev.Append(wxString::Format(wxT("%i"), intSecond));
2136 // DateRev.Append(wx);
2137 // DateRev.Append(wx);
2138 // DateRev.Append(wxString DateTimeNow->);
2139 DateRev.Append(wxT("Z"));
2141 ContactData.Add(wxT("UID"), UIDToken, FALSE);
2143 // End the vCard File.
2145 ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
2148 ContactData.WriteFile(FilenameFinal);
2150 vCard34Conv ConvFileFun;
2154 ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
2156 wxString AccountDirPrefix;
2157 wxString AccountDir;
2160 #if defined(__HAIKU__)
2162 //preffilename = wxT("noo");
2164 #elif defined(__APPLE__)
2166 PrefDir = GetUserPrefDir();
2168 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2170 #elif defined(__WIN32__)
2172 PrefDir = GetUserPrefDir();
2174 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
2178 PrefDir = GetUserPrefDir();
2180 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2184 XABPreferences PrefData(PrefDir);
2186 wxString AccountType;
2188 for (int i = 0; i < PrefData.accounts.GetCount(); i++){
2190 AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
2192 if (AccountDir == wxSContactAccount){
2194 AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
2195 AccountDirPrefix.Trim();
2196 AccountType = PrefData.accounts.GetAccountType(i);
2203 wxString wxSplitFilename;
2204 wxString wxSDataURL;
2206 while(wSTFilename.HasMoreTokens()){
2208 wxSplitFilename = wSTFilename.GetNextToken();
2212 wxSDataURL = wxSplitFilename;
2213 //wxSDataURL.Append(wxSplitFilename);
2215 // Find out if the filename exists in the table.
2217 if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
2219 wxString ETagResult;
2220 wxString ETagOriginal;
2222 ETagDB *ETagDBPtr = NULL;
2224 ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
2226 wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
2227 wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
2229 if (wxSETagOrig.IsEmpty()){
2231 // Generate the ETag.
2233 wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2237 if (wxSETag.IsEmpty()){
2239 // Update empty ETag.
2241 wxSETag = wxSETagOrig;
2242 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
2247 // Don't change original ETag.
2249 wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2250 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
2254 if (EditMode == FALSE){
2256 ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2258 FMTimer.SetFilename(FilenameFinal);
2259 FMTimer.UpdateTimestamp();
2260 FMTimer.Start(10000, FALSE);
2262 wxCommandEvent reloadevent(RELOADCONTACTLIST);
2263 reloadevent.SetString(wxSContactAccount);
2264 wxPostEvent(this->GetParent(), reloadevent);
2269 ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2270 FMTimer.UpdateTimestamp();
2271 FMTimer.Start(10000, FALSE);
2277 // Send a notification to update the main window
2278 // with the new details.
2283 // TODO: Workout nickname settings by priority and
2286 ucd->ContactAccount = wxSContactAccount;
2287 ucd->ContactFilename = FilenameFinal;
2288 ucd->ContactName = cmbDisplayAs->GetValue();
2289 ucd->ContactNameArray = ContactData.GetName();
2291 for (std::map<int,wxString>::iterator gniter = GeneralNicknamesList.begin();
2292 gniter != GeneralNicknamesList.end(); gniter++){
2294 ucd->ContactNickname = gniter->second;
2299 wxCommandEvent event2(CE_UPDATECONTACTLIST);
2300 event2.SetClientData(ucd);
2301 wxPostEvent(MainPtr, event2);
2305 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
2308 // Save the updated contact data and close the form.
2310 wxCommandEvent NullEvent;
2311 this->SaveContact(NullEvent);