1 // frmContactEditor-Save.cpp - frmContactEditor save contact subroutines.
3 // (c) 2012-2016 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "frmContactEditor.h"
21 #include "../version.h"
22 #include "../vcard/vcard.h"
23 #include "../vcard/vcard34conv.h"
24 #include "../common/textprocessing.h"
25 #include "../common/preferences.h"
26 #include "../common/uuid.h"
27 #include "../common/dirs.h"
29 void frmContactEditor::SaveContact( wxCommandEvent& event )
32 // Check if Display As combo box has a value in it.
33 // Do not go any further if there is no value.
35 wxString cmbDisplayAsValue = cmbDisplayAs->GetValue();
37 if (cmbDisplayAsValue.IsEmpty()){
39 wxMessageBox(_("Display As value cannot be left blank."), _("Display As value empty"), wxICON_ERROR);
44 // Save the updated contact data.
47 wxString FilenameFinal;
48 bool ReplaceContact = FALSE;
50 if (StartupEditMode == TRUE){
52 if (cmbType->GetCurrentSelection() == 1 ||
53 cmbType->GetCurrentSelection() == 3 ||
54 cmbType->GetCurrentSelection() == 4){
58 // Mark contact for replacing.
60 ReplaceContact = TRUE;
65 } else if (cmbType->GetCurrentSelection() == 2){
67 if (IsGroup == FALSE){
69 // Mark contact for replacing.
71 ReplaceContact = TRUE;
78 if (ReplaceContact == TRUE){
80 wxString wxDelSplitFilename;
81 wxString wxDelFinalFilename;
82 wxString wxSDelDataURL;
83 wxStringTokenizer wSTDelFilename(wxSContactFilename, wxT("/"));
84 while(wSTDelFilename.HasMoreTokens()){
86 wxDelSplitFilename = wSTDelFilename.GetNextToken();
90 wxSDelDataURL = wxDelSplitFilename;
92 // Delete the contact from the server as it will be useless in certain
93 // address book clients.
95 ActMgrPtr->AddTask(2, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDelDataURL, wxDelSplitFilename, wxSContactFilename, wxT(""));
97 // Clear the filename so the trigger to recreate the UID is done.
99 wxSContactFilename.Clear();
106 if (wxSContactFilename.IsEmpty()){
108 // Generate a random UUID.
110 ContactEditorData.UIDToken = GenerateUUID();
111 ContactEditorData.UIDToken = ContactEditorData.UIDToken.MakeUpper();
113 // Setup the filename.
115 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
117 #if defined(__HAIKU__)
119 //preffilename = wxT("noo");
121 #elif defined(__WIN32__)
123 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
124 FilenameFinal.Append(ContactEditorData.UIDToken);
125 FilenameFinal.Append(wxT(".vcf"));
126 wxSContactFilename = FilenameFinal;
130 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
131 FilenameFinal.Append(ContactEditorData.UIDToken);
132 FilenameFinal.Append(wxT(".vcf"));
133 wxSContactFilename = FilenameFinal;
139 if (ContactEditorData.UIDToken.IsEmpty()){
141 // UID Token is empty. (Shouldn't be).
142 // Generate a new UID Token.
144 ContactEditorData.UIDToken = GenerateUUID();
145 ContactEditorData.UIDToken = ContactEditorData.UIDToken.MakeUpper();
149 FilenameFinal = wxSContactFilename;
153 // Setup the data and write it into the account folder.
155 // Begin preperations to write the contact to a file.
158 bool NNGeneralFirst = TRUE;
159 bool NNHomeFirst = TRUE;
160 bool NNWorkFirst = TRUE;
162 std::map<int,int>::iterator intiter;
163 std::map<int,wxString>::iterator striter;
165 ContactData.Add(wxT("BEGIN"), wxT("VCARD"), FALSE);
166 ContactData.Add(wxT("VERSION"), wxT("4.0"), FALSE);
168 // Setup the version string.
170 strValue.Append(wxT("-//Xestia//Address Book Version "));
171 strValue.Append(wxT(XSDAB_VERSION));
172 strValue.Append(wxT("//KW"));
174 ContactData.Add(wxT("PRODID"), strValue, FALSE);
176 // Process the REV property.
178 wxDateTime DateTimeSave;
179 DateTimeSave = DateTimeSave.SetToCurrent();
180 wxString DateTimeSaveValue;
182 DateTimeSaveValue += wxString::Format("%04i", DateTimeSave.GetYear());
183 DateTimeSaveValue += wxString::Format("%02i", (DateTimeSave.GetMonth() + 1));
184 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetDay());
185 DateTimeSaveValue += "T";
186 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetHour());
187 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetMinute());
188 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetSecond());
190 if (!ContactEditorData.RevisionTokens.IsEmpty()){
191 ContactData.AddRaw("REV;" + ContactEditorData.RevisionTokens, DateTimeSaveValue);
193 ContactData.AddRaw("REV", DateTimeSaveValue);
195 // Process the XML properties.
197 for (std::map<int,wxString>::iterator iter = ContactEditorData.XMLList.begin();
198 iter != ContactEditorData.XMLList.end(); ++iter){
200 wxString strOrigValue;
202 strOrigValue = ContactEditorData.XMLList.find(iter->first)->second;
204 ResetUnusedString(&strOrigValue);
206 ProcessSaveData(wxT("XML"), &strValue2, &boolValue2, &boolValue,
207 &iter, &strOrigValue, &ContactData,
208 wxT("ALTID"), &ContactEditorData.XMLListAltID );
210 ResetSaveProcessData();
214 // Process the CLIENTPIDMAP properties.
216 for (std::map<int,wxString>::iterator iter = ContactEditorData.ClientPIDList.begin();
217 iter != ContactEditorData.ClientPIDList.end(); ++iter){
219 wxString strOrigValue;
221 strOrigValue = ContactEditorData.ClientPIDList.find(iter->first)->second;
223 ResetUnusedString(&strOrigValue);
225 ProcessSaveData(wxT("CLIENTPIDMAP"), &strValue2, &boolValue2, &boolValue,
226 &iter, &strOrigValue, &ContactData,
227 wxT(""), &ContactEditorData.ClientPIDListTokens );
229 ResetSaveProcessData();
233 // Process the SOURCE properties.
235 for (std::map<int,wxString>::iterator iter = ContactEditorData.SourceList.begin();
236 iter != ContactEditorData.SourceList.end(); ++iter){
238 wxString strOrigValue;
240 strOrigValue = ContactEditorData.SourceList.find(iter->first)->second;
242 ResetUnusedString(&strOrigValue);
244 ProcessSaveData(wxT("SOURCE"), &strValue2, &boolValue2, &boolValue,
245 &iter, &strOrigValue, &ContactData,
246 wxT("ALTID"), &ContactEditorData.SourceListAltID,
247 wxT("PID"), &ContactEditorData.SourceListPID,
248 wxT("TYPE"), &ContactEditorData.SourceListType,
249 wxT("PREF"), &ContactEditorData.SourceListPref,
250 wxT("MEDIATYPE"), &ContactEditorData.SourceListMediatype,
251 wxT(""), &ContactEditorData.SourceListTokens );
253 ResetSaveProcessData();
261 // Setup the name field.
263 strValue = txtSurname->GetValue() + wxT(";") +
264 txtForename->GetValue() + wxT(";") +
265 txtOtherNames->GetValue() + wxT(";") +
266 txtTitle->GetValue() + wxT(";") +
267 txtSuffix->GetValue();
269 strValue2 = ContactData.Convert(cmbDisplayAs->GetValue(), FALSE);
272 if (ContactEditorData.NameTokens.IsEmpty()){
273 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\""), strValue, FALSE);
275 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\";") + ContactEditorData.NameTokens, strValue, FALSE);
278 if (cmbType->GetCurrentSelection() == 1){
280 ContactData.AddRaw(wxT("KIND"), wxT("individual"));
282 } else if (cmbType->GetCurrentSelection() == 2){
284 ContactData.AddRaw(wxT("KIND"), wxT("group"));
286 // Go through each of the members and write them out.
288 for (std::map<int, wxString>::iterator itemiter = ContactEditorData.GroupsList.begin();
289 itemiter != ContactEditorData.GroupsList.end(); ++itemiter){
291 ContactData.Add(wxT("MEMBER:urn:uuid"), itemiter->second, FALSE);
295 } else if (cmbType->GetCurrentSelection() == 3){
297 ContactData.AddRaw(wxT("KIND"), wxT("org"));
299 } else if (cmbType->GetCurrentSelection() == 4){
301 ContactData.AddRaw(wxT("KIND"), wxT("location"));
306 // Setup the nicknames (General, Home & Business).
319 if (cmbGender->GetCurrentSelection() != 0){
321 switch(cmbGender->GetCurrentSelection()){
352 if (!txtGenderDescription->IsEmpty()){
354 strValue2 = txtGenderDescription->GetValue();
358 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
360 EscapeString(&strValue2, FALSE);
362 if (!ContactEditorData.GenderTokens.IsEmpty()){
364 if (!strValue2.IsEmpty()){
366 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue + wxT(";") + strValue2);
370 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue);
376 if (!strValue2.IsEmpty()){
378 ContactData.AddRaw(wxT("GENDER"), strValue + wxT(";") + strValue2);
382 ContactData.AddRaw(wxT("GENDER"), strValue);
401 strValue3 = ContactEditorData.BirthdayAltID;
403 if (!strValue3.IsEmpty()){
408 strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
414 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
419 strValue3 = ContactEditorData.BirthdayCalScale;
421 if (!strValue3.IsEmpty()){
426 if (boolValue2 == TRUE){
428 strValue2.Append(wxT(";"));
436 strValue2.Append(wxT("CALSCALE=") + strValue3);
444 strValue2 = ContactEditorData.BirthdayTokens;
446 // Get the birthday and write it.
448 ResetSaveProcessData();
450 if (!txtBirthday->IsEmpty()){
452 strValue = txtBirthday->GetValue();
454 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
456 if (!strValue2.IsEmpty()){
458 EscapeString(&strValue2, FALSE);
459 EscapeString(&strValue, FALSE);
461 ContactData.AddRaw(wxT("BDAY;VALUE=text;") + strValue2 + wxT(";"), strValue);
465 EscapeString(&strValue, FALSE);
467 ContactData.AddRaw(wxT("BDAY;VALUE=text"), strValue);
477 // Get Day, Month & Year.
479 wxDateTime BirthdayDate;
480 wxDateTime::Month BirthdayMonth;
483 wxString DataBeforeT;
485 wxString FinalBirthdayString;
486 bool ProcessDataAfterT = FALSE;
488 BirthdayDate = dapBirthday->GetValue();
490 if (BirthdayDate.IsValid()){
492 BirthdayDay = BirthdayDate.GetDay();
493 BirthdayMonth = BirthdayDate.GetMonth();
494 BirthdayYear = BirthdayDate.GetYear();
496 // Look for T and replace data before this.
498 wxStringTokenizer wSTDate(ContactEditorData.Birthday, wxT("T"));
500 while (wSTDate.HasMoreTokens()){
502 if (ProcessDataAfterT == FALSE){
504 DataBeforeT = wSTDate.GetNextToken();
505 ProcessDataAfterT = TRUE;
509 DataAfterT = wSTDate.GetNextToken();
516 // If there is not T then replace altogether.
518 wxString FinalBirthdayDay;
519 wxString FinalBirthdayMonth;
520 wxString FinalBirthdayYear;
522 if (BirthdayDay < 10){
524 FinalBirthdayDay = wxT("0") + wxString::Format(wxT("%i"), BirthdayDay);
528 FinalBirthdayDay = wxString::Format(wxT("%i"), BirthdayDay);
532 if (((int)BirthdayMonth + 1) < 10){
534 FinalBirthdayMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
538 FinalBirthdayMonth = wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
542 if (BirthdayYear == 0){
544 FinalBirthdayYear = wxT("--");
548 FinalBirthdayYear = wxString::Format(wxT("%i"), BirthdayYear);
552 if (!DataAfterT.IsEmpty()){
554 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay + wxT("T") + DataAfterT;
558 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay;
562 if (!FinalBirthdayString.IsEmpty() || !strValue2.IsEmpty()){
564 if (!strValue2.IsEmpty()){
566 EscapeString(&strValue2, FALSE);
567 EscapeString(&strValue, FALSE);
569 ContactData.AddRaw(wxT("BDAY") + strValue2 + wxT(";"), FinalBirthdayString);
573 EscapeString(&strValue, FALSE);
575 ContactData.AddRaw(wxT("BDAY"), FinalBirthdayString);
585 ResetSaveProcessData();
589 strValue3 = ContactEditorData.AnniversaryAltID;
591 if (!strValue3.IsEmpty()){
596 strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
602 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
607 strValue3 = ContactEditorData.AnniversaryCalScale;
609 if (!strValue3.IsEmpty()){
614 if (boolValue2 == TRUE){
616 strValue2.Append(wxT(";"));
624 strValue2.Append(wxT("CALSCALE=") + strValue3);
632 strValue2 = ContactEditorData.AnniversaryTokens;
634 // Deal with ANNIVERSARY.
636 if (!txtAnniversary->IsEmpty()){
638 strValue = txtAnniversary->GetValue();
640 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
642 if (!strValue2.IsEmpty()){
644 EscapeString(&strValue2, FALSE);
645 EscapeString(&strValue, FALSE);
647 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text;") + strValue2 + wxT(";"), strValue);
651 EscapeString(&strValue, FALSE);
653 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text"), strValue);
661 // Look for T and replace data before this.
663 // Get Day, Month & Year.
665 wxDateTime AnniversaryDate;
666 wxDateTime::Month AnniversaryMonth;
669 wxString DataBeforeT;
671 wxString FinalAnniversaryString;
672 bool ProcessDataAfterT = FALSE;
674 AnniversaryDate = dapAnniversary->GetValue();
676 if (AnniversaryDate.IsValid()){
678 AnniversaryDay = AnniversaryDate.GetDay();
679 AnniversaryMonth = AnniversaryDate.GetMonth();
680 AnniversaryYear = AnniversaryDate.GetYear();
682 // Look for T and replace data before this.
684 wxStringTokenizer wSTDate(ContactEditorData.Anniversary, wxT("T"));
686 while (wSTDate.HasMoreTokens()){
688 if (ProcessDataAfterT == FALSE){
690 DataBeforeT = wSTDate.GetNextToken();
691 ProcessDataAfterT = TRUE;
695 DataAfterT = wSTDate.GetNextToken();
702 // If there is not T then replace altogether.
704 wxString FinalAnniversaryDay;
705 wxString FinalAnniversaryMonth;
706 wxString FinalAnniversaryYear;
708 if (AnniversaryDay < 10){
710 FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
714 FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
718 if (((int)AnniversaryMonth + 1) < 10){
720 FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
724 FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
728 if (AnniversaryYear == 0){
730 FinalAnniversaryYear = wxT("--");
734 FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
738 if (!DataAfterT.IsEmpty()){
740 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
744 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
748 if (!FinalAnniversaryString.IsEmpty() || !strValue2.IsEmpty()){
750 if (!strValue2.IsEmpty()){
752 EscapeString(&strValue2, FALSE);
753 EscapeString(&strValue, FALSE);
755 ContactData.AddRaw(wxT("ANNIVERSARY") + strValue2 + wxT(";"), FinalAnniversaryString);
759 EscapeString(&strValue, FALSE);
761 ContactData.AddRaw(wxT("ANNIVERSARY"), FinalAnniversaryString);
771 // Setup the addresses (General, Home, Business).
773 //intValue = GeneralAddressList.size();
774 ResetSaveProcessData();
776 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralAddressList.begin();
777 iter != ContactEditorData.GeneralAddressList.end(); ++iter){
779 int intSeekValue = iter->first;
781 wxString strAddressString;
782 wxString strAddressFinalValue;
783 std::map<int, wxString>::iterator iterValue;
785 strAddressString.Append(wxT(";;"));
789 iterValue = ContactEditorData.GeneralAddressList.find(intSeekValue);
790 strAddressFinalValue = iterValue->second;
791 ProcessCaptureStrings(&strAddressFinalValue);
792 strAddressString.Append(strAddressFinalValue + wxT(";"));
793 strAddressFinalValue.Clear();
797 iterValue = ContactEditorData.GeneralAddressListTown.find(intSeekValue);
798 strAddressFinalValue = iterValue->second;
799 ProcessCaptureStrings(&strAddressFinalValue);
800 strAddressString.Append(strAddressFinalValue + wxT(";"));
801 strAddressFinalValue.Clear();
805 iterValue = ContactEditorData.GeneralAddressListCounty.find(intSeekValue);
806 strAddressFinalValue = iterValue->second;
807 ProcessCaptureStrings(&strAddressFinalValue);
808 strAddressString.Append(strAddressFinalValue + wxT(";"));
809 strAddressFinalValue.Clear();
813 iterValue = ContactEditorData.GeneralAddressListPostCode.find(intSeekValue);
814 strAddressFinalValue = iterValue->second;
815 ProcessCaptureStrings(&strAddressFinalValue);
816 strAddressString.Append(strAddressFinalValue + wxT(";"));
817 strAddressFinalValue.Clear();
821 iterValue = ContactEditorData.GeneralAddressListCountry.find(intSeekValue);
822 strAddressFinalValue = iterValue->second;
823 ProcessCaptureStrings(&strAddressFinalValue);
824 strAddressString.Append(strAddressFinalValue);
825 strAddressFinalValue.Clear();
827 ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
828 &iter, &strAddressString, &ContactData,
829 wxT("LABEL"), &ContactEditorData.GeneralAddressListLabel,
830 wxT("LANGUAGE"), &ContactEditorData.GeneralAddressListLang,
831 wxT("ALTID"), &ContactEditorData.GeneralAddressListAltID,
832 wxT("PID"), &ContactEditorData.GeneralAddressListPID,
833 wxT("GEO"), &ContactEditorData.GeneralAddressListGeo,
834 wxT("TZ"), &ContactEditorData.GeneralAddressListTimezone,
835 wxT("MEDIATYPE"), &ContactEditorData.GeneralAddressListMediatype,
836 wxT("PREF"), &ContactEditorData.GeneralAddressListPref,
837 wxT(""), &ContactEditorData.GeneralAddressListTokens );
839 ResetSaveProcessData();
843 ResetSaveProcessData();
845 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeAddressList.begin();
846 iter != ContactEditorData.HomeAddressList.end(); ++iter){
848 int intSeekValue = iter->first;
850 wxString strAddressString;
851 wxString strAddressFinalValue;
852 std::map<int, wxString>::iterator iterValue;
854 strAddressString.Append(wxT(";;"));
858 iterValue = ContactEditorData.HomeAddressList.find(intSeekValue);
859 strAddressFinalValue = iterValue->second;
860 ProcessCaptureStrings(&strAddressFinalValue);
861 strAddressString.Append(strAddressFinalValue + wxT(";"));
865 iterValue = ContactEditorData.HomeAddressListTown.find(intSeekValue);
866 strAddressFinalValue = iterValue->second;
867 ProcessCaptureStrings(&strAddressFinalValue);
868 strAddressString.Append(strAddressFinalValue + wxT(";"));
872 iterValue = ContactEditorData.HomeAddressListCounty.find(intSeekValue);
873 strAddressFinalValue = iterValue->second;
874 ProcessCaptureStrings(&strAddressFinalValue);
875 strAddressString.Append(strAddressFinalValue + wxT(";"));
879 iterValue = ContactEditorData.HomeAddressListPostCode.find(intSeekValue);
880 strAddressFinalValue = iterValue->second;
881 ProcessCaptureStrings(&strAddressFinalValue);
882 strAddressString.Append(strAddressFinalValue + wxT(";"));
886 iterValue = ContactEditorData.HomeAddressListCountry.find(intSeekValue);
887 strAddressFinalValue = iterValue->second;
888 ProcessCaptureStrings(&strAddressFinalValue);
889 strAddressString.Append(strAddressFinalValue);
891 ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
892 &iter, &strAddressString, &ContactData,
893 wxT("LABEL"), &ContactEditorData.HomeAddressListLabel,
894 wxT("LANGUAGE"), &ContactEditorData.HomeAddressListLang,
895 wxT("ALTID"), &ContactEditorData.HomeAddressListAltID,
896 wxT("PID"), &ContactEditorData.HomeAddressListPID,
897 wxT("GEO"), &ContactEditorData.HomeAddressListGeo,
898 wxT("TZ"), &ContactEditorData.HomeAddressListTimezone,
899 wxT("MEDIATYPE"), &ContactEditorData.HomeAddressListMediatype,
900 wxT("PREF"), &ContactEditorData.HomeAddressListPref,
901 wxT(""), &ContactEditorData.HomeAddressListTokens );
903 ResetSaveProcessData();
907 ResetSaveProcessData();
909 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessAddressList.begin();
910 iter != ContactEditorData.BusinessAddressList.end(); ++iter){
912 int intSeekValue = iter->first;
914 wxString strAddressString;
915 wxString strAddressFinalValue;
916 std::map<int, wxString>::iterator iterValue;
918 strAddressString.Append(wxT(";;"));
922 iterValue = ContactEditorData.BusinessAddressList.find(intSeekValue);
923 strAddressFinalValue = iterValue->second;
924 ProcessCaptureStrings(&strAddressFinalValue);
926 strAddressString.Append(strAddressFinalValue + wxT(";"));
930 iterValue = ContactEditorData.BusinessAddressListTown.find(intSeekValue);
931 strAddressFinalValue = iterValue->second;
932 ProcessCaptureStrings(&strAddressFinalValue);
934 strAddressString.Append(strAddressFinalValue + wxT(";"));
938 iterValue = ContactEditorData.BusinessAddressListCounty.find(intSeekValue);
939 strAddressFinalValue = iterValue->second;
940 ProcessCaptureStrings(&strAddressFinalValue);
942 strAddressString.Append(strAddressFinalValue + wxT(";"));
946 iterValue = ContactEditorData.BusinessAddressListPostCode.find(intSeekValue);
947 strAddressFinalValue = iterValue->second;
948 ProcessCaptureStrings(&strAddressFinalValue);
950 strAddressString.Append(strAddressFinalValue + wxT(";"));
954 iterValue = ContactEditorData.BusinessAddressListCountry.find(intSeekValue);
955 strAddressFinalValue = iterValue->second;
956 ProcessCaptureStrings(&strAddressFinalValue);
958 strAddressString.Append(strAddressFinalValue);
960 ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
961 &iter, &strAddressString, &ContactData,
962 wxT("LABEL"), &ContactEditorData.BusinessAddressListLabel,
963 wxT("LANGUAGE"), &ContactEditorData.BusinessAddressListLang,
964 wxT("ALTID"), &ContactEditorData.BusinessAddressListAltID,
965 wxT("PID"), &ContactEditorData.BusinessAddressListPID,
966 wxT("GEO"), &ContactEditorData.BusinessAddressListGeo,
967 wxT("TZ"), &ContactEditorData.BusinessAddressListTimezone,
968 wxT("MEDIATYPE"), &ContactEditorData.BusinessAddressListMediatype,
969 wxT("PREF"), &ContactEditorData.BusinessAddressListPref,
970 wxT(""), &ContactEditorData.BusinessAddressListTokens );
972 ResetSaveProcessData();
976 // Sort out nicknames (if any).
978 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNicknamesList.begin();
979 iter != ContactEditorData.GeneralNicknamesList.end(); ++iter){
981 intValue2 = iter->first;
983 // Process Alternative ID.
985 ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
986 &iter, &ContactEditorData.GeneralNicknamesList, &ContactData,
987 wxT("LANGUAGE"), &ContactEditorData.GeneralNicknamesListLanguage,
988 wxT("ALTID"), &ContactEditorData.GeneralNicknamesListAltID,
989 wxT("PID"), &ContactEditorData.GeneralNicknamesListPID,
990 wxT("PREF"), &ContactEditorData.GeneralNicknamesListPref,
991 wxT(""), &ContactEditorData.GeneralNicknamesListTokens );
993 ResetSaveProcessData();
997 ResetSaveProcessData();
999 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNicknamesList.begin();
1000 iter != ContactEditorData.HomeNicknamesList.end(); ++iter){
1002 ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1003 &iter, &ContactEditorData.HomeNicknamesList, &ContactData,
1004 wxT("LANGUAGE"), &ContactEditorData.HomeNicknamesListLanguage,
1005 wxT("ALTID"), &ContactEditorData.HomeNicknamesListAltID,
1006 wxT("PID"), &ContactEditorData.HomeNicknamesListPID,
1007 wxT("PREF"), &ContactEditorData.HomeNicknamesListPref,
1008 wxT(""), &ContactEditorData.HomeNicknamesListTokens );
1010 ResetSaveProcessData();
1014 ResetSaveProcessData();
1016 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNicknamesList.begin();
1017 iter != ContactEditorData.BusinessNicknamesList.end(); ++iter){
1019 ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1020 &iter, &ContactEditorData.BusinessNicknamesList, &ContactData,
1021 wxT("LANGUAGE"), &ContactEditorData.BusinessNicknamesListLanguage,
1022 wxT("ALTID"), &ContactEditorData.BusinessNicknamesListAltID,
1023 wxT("PID"), &ContactEditorData.BusinessNicknamesListPID,
1024 wxT("PREF"), &ContactEditorData.BusinessNicknamesListPref,
1025 wxT(""), &ContactEditorData.BusinessNicknamesListTokens );
1027 ResetSaveProcessData();
1031 ResetSaveProcessData();
1033 // Sort out email (general, home and business).
1035 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralEmailList.begin();
1036 iter != ContactEditorData.GeneralEmailList.end(); ++iter){
1038 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1041 wxString strAddressFinalValue;
1042 std::map<int, wxString>::iterator iterValue;
1044 ProcessSaveData(wxT("EMAIL"), &strValue2, &boolValue2, &boolValue,
1045 &iter, &ContactEditorData.GeneralEmailList, &ContactData,
1046 wxT("ALTID"), &ContactEditorData.GeneralEmailListAltID,
1047 wxT("PID"), &ContactEditorData.GeneralEmailListPID,
1048 wxT("PREF"), &ContactEditorData.GeneralEmailListPref,
1049 wxT(""), &ContactEditorData.GeneralEmailListTokens );
1051 ResetSaveProcessData();
1055 ResetSaveProcessData();
1057 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeEmailList.begin();
1058 iter != ContactEditorData.HomeEmailList.end(); ++iter){
1060 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1063 ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1064 &iter, &ContactEditorData.HomeEmailList, &ContactData,
1065 wxT("ALTID"), &ContactEditorData.HomeEmailListAltID,
1066 wxT("PID"), &ContactEditorData.HomeEmailListPID,
1067 wxT("PREF"), &ContactEditorData.HomeEmailListPref,
1068 wxT(""), &ContactEditorData.HomeEmailListTokens );
1070 ResetSaveProcessData();
1074 ResetSaveProcessData();
1076 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessEmailList.begin();
1077 iter != ContactEditorData.BusinessEmailList.end(); ++iter){
1079 //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
1082 ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1083 &iter, &ContactEditorData.BusinessEmailList, &ContactData,
1084 wxT("ALTID"), &ContactEditorData.BusinessEmailListAltID,
1085 wxT("PID"), &ContactEditorData.BusinessEmailListPID,
1086 wxT("PREF"), &ContactEditorData.BusinessEmailListPref,
1087 wxT(""), &ContactEditorData.BusinessEmailListTokens );
1089 ResetSaveProcessData();
1093 ResetSaveProcessData();
1095 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralIMList.begin();
1096 iter != ContactEditorData.GeneralIMList.end(); ++iter){
1098 intValue2 = iter->first;
1100 // Process Alternative ID.
1102 ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
1103 &iter, &ContactEditorData.GeneralIMList, &ContactData,
1104 wxT("ALTID"), &ContactEditorData.GeneralIMListAltID,
1105 wxT("PID"), &ContactEditorData.GeneralIMListPID,
1106 wxT("MEDIATYPE"), &ContactEditorData.GeneralIMListMediatype,
1107 wxT("PREF"), &ContactEditorData.GeneralIMListPref,
1108 wxT(""), &ContactEditorData.GeneralIMListTokens );
1110 ResetSaveProcessData();
1114 ResetSaveProcessData();
1116 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeIMList.begin();
1117 iter != ContactEditorData.HomeIMList.end(); ++iter){
1119 ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1120 &iter, &ContactEditorData.HomeIMList, &ContactData,
1121 wxT("ALTID"), &ContactEditorData.HomeIMListAltID,
1122 wxT("PID"), &ContactEditorData.HomeIMListPID,
1123 wxT("MEDIATYPE"), &ContactEditorData.HomeIMListMediatype,
1124 wxT("PREF"), &ContactEditorData.HomeIMListPref,
1125 wxT(""), &ContactEditorData.HomeIMListTokens );
1127 ResetSaveProcessData();
1131 ResetSaveProcessData();
1133 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessIMList.begin();
1134 iter != ContactEditorData.BusinessIMList.end(); ++iter){
1136 ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1137 &iter, &ContactEditorData.BusinessIMList, &ContactData,
1138 wxT("ALTID"), &ContactEditorData.BusinessIMListAltID,
1139 wxT("PID"), &ContactEditorData.BusinessIMListPID,
1140 wxT("MEDIATYPE"), &ContactEditorData.BusinessIMListMediatype,
1141 wxT("PREF"), &ContactEditorData.BusinessIMListPref,
1142 wxT(""), &ContactEditorData.BusinessIMListTokens );
1144 ResetSaveProcessData();
1148 ResetSaveProcessData();
1150 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTelephoneList.begin();
1151 iter != ContactEditorData.GeneralTelephoneList.end(); ++iter){
1153 wxString strAddressFinalValue = iter->second;
1155 ProcessCaptureStrings(&strAddressFinalValue);
1157 if (ContactEditorData.GeneralTelephoneListDataType.find(iter->first) !=
1158 ContactEditorData.GeneralTelephoneListDataType.end()){
1160 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralTelephoneListDataType.find(iter->first);
1162 strAddressFinalValue.insert(0, ":");
1163 strAddressFinalValue.insert(0, DataTypeIter->second);
1167 strAddressFinalValue.insert(0, "tel:");
1171 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1172 &iter, &strAddressFinalValue, &ContactData,
1173 wxT("ALTID"), &ContactEditorData.GeneralTelephoneListAltID,
1174 wxT("PID"), &ContactEditorData.GeneralTelephoneListPID,
1175 wxT("TYPE"), &ContactEditorData.GeneralTelephoneListType,
1176 wxT("PREF"), &ContactEditorData.GeneralTelephoneListPref,
1177 wxT(""), &ContactEditorData.GeneralTelephoneListTokens );
1179 ResetSaveProcessData();
1183 ResetSaveProcessData();
1185 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTelephoneList.begin();
1186 iter != ContactEditorData.HomeTelephoneList.end(); ++iter){
1188 wxString strAddressFinalValue = iter->second;
1190 ProcessCaptureStrings(&strAddressFinalValue);
1192 if (ContactEditorData.HomeTelephoneListDataType.find(iter->first) !=
1193 ContactEditorData.HomeTelephoneListDataType.end()){
1195 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeTelephoneListDataType.find(iter->first);
1197 strAddressFinalValue.insert(0, ":");
1198 strAddressFinalValue.insert(0, DataTypeIter->second);
1202 strAddressFinalValue.insert(0, "tel:");
1206 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1207 &iter, &strAddressFinalValue, &ContactData,
1208 wxT("ALTID"), &ContactEditorData.HomeTelephoneListAltID,
1209 wxT("PID"), &ContactEditorData.HomeTelephoneListPID,
1210 wxT("TYPE"), &ContactEditorData.HomeTelephoneListType,
1211 wxT("PREF"), &ContactEditorData.HomeTelephoneListPref,
1212 wxT(""), &ContactEditorData.HomeTelephoneListTokens );
1214 ResetSaveProcessData();
1218 ResetSaveProcessData();
1220 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTelephoneList.begin();
1221 iter != ContactEditorData.BusinessTelephoneList.end(); ++iter){
1223 wxString strAddressFinalValue = iter->second;
1225 ProcessCaptureStrings(&strAddressFinalValue);
1227 if (ContactEditorData.BusinessTelephoneListDataType.find(iter->first) !=
1228 ContactEditorData.BusinessTelephoneListDataType.end()){
1230 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessTelephoneListDataType.find(iter->first);
1232 strAddressFinalValue.insert(0, ":");
1233 strAddressFinalValue.insert(0, DataTypeIter->second);
1237 strAddressFinalValue.insert(0, "tel:");
1241 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1242 &iter, &strAddressFinalValue, &ContactData,
1243 wxT("ALTID"), &ContactEditorData.BusinessTelephoneListAltID,
1244 wxT("PID"), &ContactEditorData.BusinessTelephoneListPID,
1245 wxT("TYPE"), &ContactEditorData.BusinessTelephoneListType,
1246 wxT("PREF"), &ContactEditorData.BusinessTelephoneListPref,
1247 wxT(""), &ContactEditorData.BusinessTelephoneListTokens );
1249 ResetSaveProcessData();
1253 ResetSaveProcessData();
1255 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralLanguageList.begin();
1256 iter != ContactEditorData.GeneralLanguageList.end(); ++iter){
1258 intValue2 = iter->first;
1260 ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
1261 &iter, &ContactEditorData.GeneralLanguageList, &ContactData,
1262 wxT("ALTID"), &ContactEditorData.GeneralLanguageListAltID,
1263 wxT("PID"), &ContactEditorData.GeneralLanguageListPID,
1264 wxT("PREF"), &ContactEditorData.GeneralLanguageListPref,
1265 wxT(""), &ContactEditorData.GeneralLanguageListTokens );
1267 ResetSaveProcessData();
1271 ResetSaveProcessData();
1273 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeLanguageList.begin();
1274 iter != ContactEditorData.HomeLanguageList.end(); ++iter){
1276 ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1277 &iter, &ContactEditorData.HomeLanguageList, &ContactData,
1278 wxT("ALTID"), &ContactEditorData.HomeLanguageListAltID,
1279 wxT("PID"), &ContactEditorData.HomeLanguageListPID,
1280 wxT("PREF"), &ContactEditorData.HomeLanguageListPref,
1281 wxT(""), &ContactEditorData.HomeLanguageListTokens );
1283 ResetSaveProcessData();
1287 ResetSaveProcessData();
1289 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessLanguageList.begin();
1290 iter != ContactEditorData.BusinessLanguageList.end(); ++iter){
1292 ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1293 &iter, &ContactEditorData.BusinessLanguageList, &ContactData,
1294 wxT("ALTID"), &ContactEditorData.BusinessLanguageListAltID,
1295 wxT("PID"), &ContactEditorData.BusinessLanguageListPID,
1296 wxT("PREF"), &ContactEditorData.BusinessLanguageListPref,
1297 wxT(""), &ContactEditorData.BusinessLanguageListTokens );
1299 ResetSaveProcessData();
1303 ResetSaveProcessData();
1305 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTZList.begin();
1306 iter != ContactEditorData.GeneralTZList.end(); ++iter){
1308 ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
1309 &iter, &ContactEditorData.GeneralTZList, &ContactData,
1310 wxT("ALTID"), &ContactEditorData.GeneralTZListAltID,
1311 wxT("PID"), &ContactEditorData.GeneralTZListPID,
1312 wxT("MEDIATYPE"), &ContactEditorData.GeneralTZListMediatype,
1313 wxT("PREF"), &ContactEditorData.GeneralTZListPref,
1314 wxT(""), &ContactEditorData.GeneralTZListTokens );
1316 ResetSaveProcessData();
1320 ResetSaveProcessData();
1322 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTZList.begin();
1323 iter != ContactEditorData.HomeTZList.end(); ++iter){
1325 ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1326 &iter, &ContactEditorData.HomeTZList, &ContactData,
1327 wxT("ALTID"), &ContactEditorData.HomeTZListAltID,
1328 wxT("PID"), &ContactEditorData.HomeTZListPID,
1329 wxT("MEDIATYPE"), &ContactEditorData.HomeTZListMediatype,
1330 wxT("PREF"), &ContactEditorData.HomeTZListPref,
1331 wxT(""), &ContactEditorData.HomeTZListTokens );
1333 ResetSaveProcessData();
1337 ResetSaveProcessData();
1339 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTZList.begin();
1340 iter != ContactEditorData.BusinessTZList.end(); ++iter){
1342 ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1343 &iter, &ContactEditorData.BusinessTZList, &ContactData,
1344 wxT("ALTID"), &ContactEditorData.BusinessTZListAltID,
1345 wxT("PID"), &ContactEditorData.BusinessTZListPID,
1346 wxT("MEDIATYPE"), &ContactEditorData.BusinessTZListMediatype,
1347 wxT("PREF"), &ContactEditorData.BusinessTZListPref,
1348 wxT(""), &ContactEditorData.BusinessTZListTokens );
1350 ResetSaveProcessData();
1354 ResetSaveProcessData();
1356 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralGeographyList.begin();
1357 iter != ContactEditorData.GeneralGeographyList.end(); ++iter){
1359 wxString strGeoFinalValue = iter->second;
1361 ProcessCaptureStrings(&strGeoFinalValue);
1363 if (ContactEditorData.GeneralGeographyListDataType.find(iter->first) !=
1364 ContactEditorData.GeneralGeographyListDataType.end()){
1366 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralGeographyListDataType.find(iter->first);
1368 strGeoFinalValue.insert(0, ":");
1369 strGeoFinalValue.insert(0, DataTypeIter->second);
1373 strGeoFinalValue.insert(0, "geo:");
1377 ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
1378 &iter, &strGeoFinalValue, &ContactData,
1379 wxT("ALTID"), &ContactEditorData.GeneralGeographyListAltID,
1380 wxT("PID"), &ContactEditorData.GeneralGeographyListPID,
1381 wxT("MEDIATYPE"), &ContactEditorData.GeneralGeographyListMediatype,
1382 wxT("PREF"), &ContactEditorData.GeneralGeographyListPref,
1383 wxT(""), &ContactEditorData.GeneralGeographyListTokens );
1385 ResetSaveProcessData();
1389 ResetSaveProcessData();
1391 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeGeographyList.begin();
1392 iter != ContactEditorData.HomeGeographyList.end(); ++iter){
1394 wxString strGeoFinalValue = iter->second;
1396 ProcessCaptureStrings(&strGeoFinalValue);
1398 if (ContactEditorData.HomeGeographyListDataType.find(iter->first) !=
1399 ContactEditorData.HomeGeographyListDataType.end()){
1401 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeGeographyListDataType.find(iter->first);
1403 strGeoFinalValue.insert(0, ":");
1404 strGeoFinalValue.insert(0, DataTypeIter->second);
1408 strGeoFinalValue.insert(0, "geo:");
1412 ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1413 &iter, &strGeoFinalValue, &ContactData,
1414 wxT("ALTID"), &ContactEditorData.HomeGeographyListAltID,
1415 wxT("PID"), &ContactEditorData.HomeGeographyListPID,
1416 wxT("MEDIATYPE"), &ContactEditorData.HomeGeographyListMediatype,
1417 wxT("PREF"), &ContactEditorData.HomeGeographyListPref,
1418 wxT(""), &ContactEditorData.HomeGeographyListTokens );
1420 ResetSaveProcessData();
1424 ResetSaveProcessData();
1426 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessGeographyList.begin();
1427 iter != ContactEditorData.BusinessGeographyList.end(); ++iter){
1429 wxString strGeoFinalValue = iter->second;
1431 ProcessCaptureStrings(&strGeoFinalValue);
1433 if (ContactEditorData.BusinessGeographyListDataType.find(iter->first) !=
1434 ContactEditorData.BusinessGeographyListDataType.end()){
1436 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessGeographyListDataType.find(iter->first);
1438 strGeoFinalValue.insert(0, ":");
1439 strGeoFinalValue.insert(0, DataTypeIter->second);
1443 strGeoFinalValue.insert(0, "geo:");
1447 ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1448 &iter, &strGeoFinalValue, &ContactData,
1449 wxT("ALTID"), &ContactEditorData.BusinessGeographyListAltID,
1450 wxT("PID"), &ContactEditorData.BusinessGeographyListPID,
1451 wxT("MEDIATYPE"), &ContactEditorData.BusinessGeographyListMediatype,
1452 wxT("PREF"), &ContactEditorData.BusinessGeographyListPref,
1453 wxT(""), &ContactEditorData.BusinessGeographyListTokens );
1455 ResetSaveProcessData();
1459 ResetSaveProcessData();
1461 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRelatedList.begin();
1462 iter != ContactEditorData.GeneralRelatedList.end(); ++iter){
1464 ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
1465 &iter, &ContactEditorData.GeneralRelatedList, &ContactData,
1466 wxT("ALTID"), &ContactEditorData.GeneralRelatedListAltID,
1467 wxT("PID"), &ContactEditorData.GeneralRelatedListPID,
1468 wxT("LANGUAGE"), &ContactEditorData.GeneralRelatedListLanguage,
1469 wxT("TYPE"), &ContactEditorData.GeneralRelatedListRelType,
1470 wxT("PREF"), &ContactEditorData.GeneralRelatedListPref,
1471 wxT(""), &ContactEditorData.GeneralRelatedListTokens );
1473 ResetSaveProcessData();
1477 ResetSaveProcessData();
1479 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralWebsiteList.begin();
1480 iter != ContactEditorData.GeneralWebsiteList.end(); ++iter){
1482 ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
1483 &iter, &ContactEditorData.GeneralWebsiteList, &ContactData,
1484 wxT("ALTID"), &ContactEditorData.GeneralWebsiteListAltID,
1485 wxT("PID"), &ContactEditorData.GeneralWebsiteListPID,
1486 wxT("MEDIATYPE"), &ContactEditorData.GeneralWebsiteListMediatype,
1487 wxT("PREF"), &ContactEditorData.GeneralWebsiteListPref,
1488 wxT(""), &ContactEditorData.GeneralWebsiteListTokens );
1490 ResetSaveProcessData();
1494 ResetSaveProcessData();
1496 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeWebsiteList.begin();
1497 iter != ContactEditorData.HomeWebsiteList.end(); ++iter){
1499 ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1500 &iter, &ContactEditorData.HomeWebsiteList, &ContactData,
1501 wxT("ALTID"), &ContactEditorData.HomeWebsiteListAltID,
1502 wxT("PID"), &ContactEditorData.HomeWebsiteListPID,
1503 wxT("MEDIATYPE"), &ContactEditorData.HomeWebsiteListMediatype,
1504 wxT("PREF"), &ContactEditorData.HomeWebsiteListPref,
1505 wxT(""), &ContactEditorData.HomeWebsiteListTokens );
1507 ResetSaveProcessData();
1511 ResetSaveProcessData();
1513 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessWebsiteList.begin();
1514 iter != ContactEditorData.BusinessWebsiteList.end(); ++iter){
1516 ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1517 &iter, &ContactEditorData.BusinessWebsiteList, &ContactData,
1518 wxT("ALTID"), &ContactEditorData.BusinessWebsiteListAltID,
1519 wxT("PID"), &ContactEditorData.BusinessWebsiteListPID,
1520 wxT("MEDIATYPE"), &ContactEditorData.BusinessWebsiteListMediatype,
1521 wxT("PREF"), &ContactEditorData.BusinessWebsiteListPref,
1522 wxT(""), &ContactEditorData.BusinessWebsiteListTokens );
1524 ResetSaveProcessData();
1528 ResetSaveProcessData();
1530 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTitleList.begin();
1531 iter != ContactEditorData.GeneralTitleList.end(); ++iter){
1533 ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
1534 &iter, &ContactEditorData.GeneralTitleList, &ContactData,
1535 wxT("ALTID"), &ContactEditorData.GeneralTitleListAltID,
1536 wxT("PID"), &ContactEditorData.GeneralTitleListPID,
1537 wxT("LANGUAGE"), &ContactEditorData.GeneralTitleListLanguage,
1538 wxT("PREF"), &ContactEditorData.GeneralTitleListPref,
1539 wxT(""), &ContactEditorData.GeneralTitleListTokens );
1541 ResetSaveProcessData();
1545 ResetSaveProcessData();
1547 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTitleList.begin();
1548 iter != ContactEditorData.HomeTitleList.end(); ++iter){
1550 ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1551 &iter, &ContactEditorData.HomeTitleList, &ContactData,
1552 wxT("ALTID"), &ContactEditorData.HomeTitleListAltID,
1553 wxT("PID"), &ContactEditorData.HomeTitleListPID,
1554 wxT("LANGUAGE"), &ContactEditorData.HomeTitleListLanguage,
1555 wxT("PREF"), &ContactEditorData.HomeTitleListPref,
1556 wxT(""), &ContactEditorData.HomeTitleListTokens );
1558 ResetSaveProcessData();
1562 ResetSaveProcessData();
1564 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTitleList.begin();
1565 iter != ContactEditorData.BusinessTitleList.end(); ++iter){
1567 ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1568 &iter, &ContactEditorData.BusinessTitleList, &ContactData,
1569 wxT("ALTID"), &ContactEditorData.BusinessTitleListAltID,
1570 wxT("PID"), &ContactEditorData.BusinessTitleListPID,
1571 wxT("LANGUAGE"), &ContactEditorData.BusinessTitleListLanguage,
1572 wxT("PREF"), &ContactEditorData.BusinessTitleListPref,
1573 wxT(""), &ContactEditorData.BusinessTitleListTokens );
1575 ResetSaveProcessData();
1579 ResetSaveProcessData();
1581 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRoleList.begin();
1582 iter != ContactEditorData.GeneralRoleList.end(); ++iter){
1584 ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
1585 &iter, &ContactEditorData.GeneralRoleList, &ContactData,
1586 wxT("ALTID"), &ContactEditorData.GeneralRoleListAltID,
1587 wxT("PID"), &ContactEditorData.GeneralRoleListPID,
1588 wxT("LANGUAGE"), &ContactEditorData.GeneralRoleListLanguage,
1589 wxT("PREF"), &ContactEditorData.GeneralRoleListPref,
1590 wxT(""), &ContactEditorData.GeneralRoleListTokens );
1592 ResetSaveProcessData();
1596 ResetSaveProcessData();
1598 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeRoleList.begin();
1599 iter != ContactEditorData.HomeRoleList.end(); ++iter){
1601 ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1602 &iter, &ContactEditorData.HomeRoleList, &ContactData,
1603 wxT("ALTID"), &ContactEditorData.HomeRoleListAltID,
1604 wxT("PID"), &ContactEditorData.HomeRoleListPID,
1605 wxT("LANGUAGE"), &ContactEditorData.HomeRoleListLanguage,
1606 wxT("PREF"), &ContactEditorData.HomeRoleListPref,
1607 wxT(""), &ContactEditorData.HomeRoleListTokens );
1609 ResetSaveProcessData();
1613 ResetSaveProcessData();
1615 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessRoleList.begin();
1616 iter != ContactEditorData.BusinessRoleList.end(); ++iter){
1618 ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1619 &iter, &ContactEditorData.BusinessRoleList, &ContactData,
1620 wxT("ALTID"), &ContactEditorData.BusinessRoleListAltID,
1621 wxT("PID"), &ContactEditorData.BusinessRoleListPID,
1622 wxT("LANGUAGE"), &ContactEditorData.BusinessRoleListLanguage,
1623 wxT("PREF"), &ContactEditorData.BusinessRoleListPref,
1624 wxT(""), &ContactEditorData.BusinessRoleListTokens );
1626 ResetSaveProcessData();
1630 ResetSaveProcessData();
1632 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralOrganisationsList.begin();
1633 iter != ContactEditorData.GeneralOrganisationsList.end(); ++iter){
1635 ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
1636 &iter, &ContactEditorData.GeneralOrganisationsList, &ContactData,
1637 wxT("ALTID"), &ContactEditorData.GeneralOrganisationsListAltID,
1638 wxT("PID"), &ContactEditorData.GeneralOrganisationsListPID,
1639 wxT("LANGUAGE"), &ContactEditorData.GeneralOrganisationsListLanguage,
1640 wxT("SORT-AS"), &ContactEditorData.GeneralOrganisationsListSortAs,
1641 wxT("PREF"), &ContactEditorData.GeneralOrganisationsListPref,
1642 wxT(""), &ContactEditorData.GeneralOrganisationsListTokens );
1644 ResetSaveProcessData();
1648 ResetSaveProcessData();
1650 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeOrganisationsList.begin();
1651 iter != ContactEditorData.HomeOrganisationsList.end(); ++iter){
1653 ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1654 &iter, &ContactEditorData.HomeOrganisationsList, &ContactData,
1655 wxT("ALTID"), &ContactEditorData.HomeOrganisationsListAltID,
1656 wxT("PID"), &ContactEditorData.HomeOrganisationsListPID,
1657 wxT("LANGUAGE"), &ContactEditorData.HomeOrganisationsListLanguage,
1658 wxT("SORT-AS"), &ContactEditorData.HomeOrganisationsListSortAs,
1659 wxT("PREF"), &ContactEditorData.HomeOrganisationsListPref,
1660 wxT(""), &ContactEditorData.HomeOrganisationsListTokens );
1662 ResetSaveProcessData();
1666 ResetSaveProcessData();
1668 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessOrganisationsList.begin();
1669 iter != ContactEditorData.BusinessOrganisationsList.end(); ++iter){
1671 ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1672 &iter, &ContactEditorData.BusinessOrganisationsList, &ContactData,
1673 wxT("ALTID"), &ContactEditorData.BusinessOrganisationsListAltID,
1674 wxT("PID"), &ContactEditorData.BusinessOrganisationsListPID,
1675 wxT("LANGUAGE"), &ContactEditorData.BusinessOrganisationsListLanguage,
1676 wxT("SORT-AS"), &ContactEditorData.BusinessOrganisationsListSortAs,
1677 wxT("PREF"), &ContactEditorData.BusinessOrganisationsListPref,
1678 wxT(""), &ContactEditorData.BusinessOrganisationsListTokens );
1680 ResetSaveProcessData();
1684 ResetSaveProcessData();
1686 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNoteList.begin();
1687 iter != ContactEditorData.GeneralNoteList.end(); ++iter){
1689 ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
1690 &iter, &ContactEditorData.GeneralNoteList, &ContactData,
1691 wxT("ALTID"), &ContactEditorData.GeneralNoteListAltID,
1692 wxT("PID"), &ContactEditorData.GeneralNoteListPID,
1693 wxT("LANGUAGE"), &ContactEditorData.GeneralNoteListLanguage,
1694 wxT("PREF"), &ContactEditorData.GeneralNoteListPref,
1695 wxT(""), &ContactEditorData.GeneralNoteListTokens );
1697 ResetSaveProcessData();
1701 ResetSaveProcessData();
1703 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNoteList.begin();
1704 iter != ContactEditorData.HomeNoteList.end(); ++iter){
1706 ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1707 &iter, &ContactEditorData.HomeNoteList, &ContactData,
1708 wxT("ALTID"), &ContactEditorData.HomeNoteListAltID,
1709 wxT("PID"), &ContactEditorData.HomeNoteListPID,
1710 wxT("LANGUAGE"), &ContactEditorData.HomeNoteListLanguage,
1711 wxT("PREF"), &ContactEditorData.HomeNoteListPref,
1712 wxT(""), &ContactEditorData.HomeNoteListTokens );
1714 ResetSaveProcessData();
1718 ResetSaveProcessData();
1720 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNoteList.begin();
1721 iter != ContactEditorData.BusinessNoteList.end(); ++iter){
1723 ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1724 &iter, &ContactEditorData.BusinessNoteList, &ContactData,
1725 wxT("ALTID"), &ContactEditorData.BusinessNoteListAltID,
1726 wxT("PID"), &ContactEditorData.BusinessNoteListPID,
1727 wxT("LANGUAGE"), &ContactEditorData.BusinessNoteListLanguage,
1728 wxT("PREF"), &ContactEditorData.BusinessNoteListPref,
1729 wxT(""), &ContactEditorData.BusinessNoteListTokens );
1731 ResetSaveProcessData();
1735 ResetSaveProcessData();
1737 for (std::map<int,wxString>::iterator iter = ContactEditorData.CategoriesList.begin();
1738 iter != ContactEditorData.CategoriesList.end(); ++iter){
1740 ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
1741 &iter, &ContactEditorData.CategoriesList, &ContactData,
1742 wxT("ALTID"), &ContactEditorData.CategoriesListAltID,
1743 wxT("PID"), &ContactEditorData.CategoriesListPID,
1744 wxT("TYPE"), &ContactEditorData.CategoriesListType,
1745 wxT("PREF"), &ContactEditorData.CategoriesListPref,
1746 wxT(""), &ContactEditorData.CategoriesListTokens );
1748 ResetSaveProcessData();
1754 for (std::map<int, std::string>::iterator iter = ContactEditorData.PicturesList.begin();
1755 iter != ContactEditorData.PicturesList.end(); ++iter){
1757 int intValueIndex = iter->first;
1759 std::map<int, std::string>::iterator stdstriter;
1760 std::map<int, wxString>::iterator enciter;
1762 striter = ContactEditorData.PicturesListPictureType.find(intValueIndex);
1763 enciter = ContactEditorData.PicturesListPicEncType.find(intValueIndex);
1765 ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
1766 &iter, &ContactEditorData.PicturesList, &striter,
1767 &enciter, &ContactData,
1768 wxT("ALTID"), &ContactEditorData.PicturesListAltID,
1769 wxT("PID"), &ContactEditorData.PicturesListPID,
1770 wxT("TYPE"), &ContactEditorData.PicturesListType,
1771 wxT("PREF"), &ContactEditorData.PicturesListPref,
1772 wxT(""), &ContactEditorData.PicturesListTokens);
1774 ResetSaveProcessData();
1778 ResetSaveProcessData();
1782 for (std::map<int, std::string>::iterator iter = ContactEditorData.LogosList.begin();
1783 iter != ContactEditorData.LogosList.end(); ++iter){
1785 int intValueIndex = iter->first;
1787 std::map<int, std::string>::iterator stdstriter;
1788 std::map<int, wxString>::iterator enciter;
1790 striter = ContactEditorData.LogosListPictureType.find(intValueIndex);
1791 enciter = ContactEditorData.LogosListPicEncType.find(intValueIndex);
1793 ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
1794 &iter, &ContactEditorData.LogosList, &striter,
1795 &enciter, &ContactData,
1796 wxT("ALTID"), &ContactEditorData.LogosListAltID,
1797 wxT("PID"), &ContactEditorData.LogosListPID,
1798 wxT("TYPE"), &ContactEditorData.LogosListType,
1799 wxT("PREF"), &ContactEditorData.LogosListPref,
1800 wxT(""), &ContactEditorData.LogosListTokens );
1802 ResetSaveProcessData();
1806 ResetSaveProcessData();
1810 for (std::map<int, std::string>::iterator iter = ContactEditorData.SoundsList.begin();
1811 iter != ContactEditorData.SoundsList.end(); ++iter){
1813 int intValueIndex = iter->first;
1815 std::map<int, std::string>::iterator stdstriter;
1816 std::map<int, wxString>::iterator enciter;
1818 striter = ContactEditorData.SoundsListAudioType.find(intValueIndex);
1819 enciter = ContactEditorData.SoundsListAudioEncType.find(intValueIndex);
1821 ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
1822 &iter, &ContactEditorData.SoundsList, &striter,
1823 &enciter, &ContactData,
1824 wxT("ALTID"), &ContactEditorData.SoundsListAltID,
1825 wxT("PID"), &ContactEditorData.SoundsListPID,
1826 wxT("TYPE"), &ContactEditorData.SoundsListType,
1827 wxT("PREF"), &ContactEditorData.SoundsListPref,
1828 wxT(""), &ContactEditorData.SoundsListTokens );
1830 ResetSaveProcessData();
1834 ResetSaveProcessData();
1836 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarList.begin();
1837 iter != ContactEditorData.CalendarList.end(); ++iter){
1839 ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
1840 &iter, &ContactEditorData.CalendarList, &ContactData,
1841 wxT("ALTID"), &ContactEditorData.CalendarListAltID,
1842 wxT("PID"), &ContactEditorData.CalendarListPID,
1843 wxT("MEDIATYPE"), &ContactEditorData.CalendarListMediatype,
1844 wxT("TYPE"), &ContactEditorData.CalendarListType,
1845 wxT("PREF"), &ContactEditorData.CalendarListPref,
1846 wxT(""), &ContactEditorData.CalendarListTokens );
1848 ResetSaveProcessData();
1852 ResetSaveProcessData();
1854 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarRequestList.begin();
1855 iter != ContactEditorData.CalendarRequestList.end(); ++iter){
1857 ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
1858 &iter, &ContactEditorData.CalendarRequestList, &ContactData,
1859 wxT("ALTID"), &ContactEditorData.CalendarRequestListAltID,
1860 wxT("PID"), &ContactEditorData.CalendarRequestListPID,
1861 wxT("MEDIATYPE"), &ContactEditorData.CalendarRequestListMediatype,
1862 wxT("TYPE"), &ContactEditorData.CalendarRequestListType,
1863 wxT("PREF"), &ContactEditorData.CalendarRequestListPref,
1864 wxT(""), &ContactEditorData.CalendarRequestListTokens );
1866 ResetSaveProcessData();
1870 ResetSaveProcessData();
1872 for (std::map<int,wxString>::iterator iter = ContactEditorData.FreeBusyList.begin();
1873 iter != ContactEditorData.FreeBusyList.end(); ++iter){
1875 ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
1876 &iter, &ContactEditorData.FreeBusyList, &ContactData,
1877 wxT("ALTID"), &ContactEditorData.FreeBusyListAltID,
1878 wxT("PID"), &ContactEditorData.FreeBusyListPID,
1879 wxT("MEDIATYPE"), &ContactEditorData.FreeBusyListMediatype,
1880 wxT("TYPE"), &ContactEditorData.FreeBusyListType,
1881 wxT("PREF"), &ContactEditorData.FreeBusyListPref,
1882 wxT(""), &ContactEditorData.FreeBusyListTokens );
1884 ResetSaveProcessData();
1888 for (std::map<int, wxString>::iterator iter = ContactEditorData.KeyList.begin();
1889 iter != ContactEditorData.KeyList.end(); ++iter){
1891 intValue2 = iter->first;
1893 // Get the key information.
1895 std::map<int, wxString>::iterator enciter;
1897 striter = ContactEditorData.KeyListDataType.find(intValue2);
1898 //enciter = KeyListAudioEncType.find(intValue2);
1900 wxString strValueData;
1902 strValueData = iter->second;
1903 strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));
1905 ProcessSaveData(wxT("KEY"), &strValue2, &boolValue2, &boolValue,
1906 &iter, &strValueData, &ContactData,
1907 wxT("ALTID"), &ContactEditorData.KeyListAltID,
1908 wxT("PID"), &ContactEditorData.KeyListPID,
1909 wxT("TYPE"), &ContactEditorData.KeyListType,
1910 wxT("PREF"), &ContactEditorData.KeyListPref,
1911 wxT(""), &ContactEditorData.KeyListTokens );
1913 ResetSaveProcessData();
1917 // Vendor specific items.
1919 ResetSaveProcessData();
1921 for (std::map<int,wxString>::iterator iter = ContactEditorData.VendorList.begin();
1922 iter != ContactEditorData.VendorList.end(); ++iter){
1924 intValue2 = iter->first;
1926 // Get the IANA PEN number.
1928 striter = ContactEditorData.VendorListPEN.find(intValue2);
1930 if (striter->first == intValue2){
1932 strValue2 = striter->second;
1936 // Get the element name.
1938 striter = ContactEditorData.VendorListElement.find(intValue2);
1940 if (striter->first == intValue2){
1942 strValue3 = striter->second;
1948 striter = ContactEditorData.VendorList.find(intValue2);
1950 if (striter->first == intValue2){
1952 strValue = striter->second;
1956 // Add to the vCard.
1958 if (boolValue == TRUE){
1960 ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
1964 ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
1968 ResetSaveProcessData();
1972 ResetSaveProcessData();
1976 for (std::map<int,wxString>::iterator iter = ContactEditorData.XTokenList.begin();
1977 iter != ContactEditorData.XTokenList.end(); ++iter){
1979 intValue2 = iter->first;
1981 // Get the element name.
1983 striter = ContactEditorData.XTokenListTokens.find(intValue2);
1985 if (striter->first == intValue2){
1987 strValue2 = striter->second;
1993 striter = ContactEditorData.XTokenList.find(intValue2);
1995 if (striter->first == intValue2){
1997 strValue = striter->second;
2001 // Add to the vCard.
2003 if (boolValue == TRUE){
2005 ContactData.AddRaw(wxT("X-") + strValue2, strValue);
2009 ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
2013 ResetSaveProcessData();
2017 ResetSaveProcessData();
2019 if (ContactEditorData.FullNamesList.size() == 0){
2021 wxString FullName = cmbDisplayAs->GetValue();
2022 ContactEditorData.FullNamesList.insert(std::make_pair(0, FullName));
2023 ContactEditorData.FullNamesListAltID.insert(std::make_pair(0, wxT("")));
2024 ContactEditorData.FullNamesListPID.insert(std::make_pair(0, wxT("")));
2025 ContactEditorData.FullNamesListType.insert(std::make_pair(0, wxT("")));
2026 ContactEditorData.FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
2027 ContactEditorData.FullNamesListPref.insert(std::make_pair(0, 0));
2028 ContactEditorData.FullNamesListTokens.insert(std::make_pair(0, wxT("")));
2033 for (std::map<int, wxString>::iterator iter = ContactEditorData.FullNamesList.begin();
2034 iter != ContactEditorData.FullNamesList.end(); ++iter){
2036 if (FNFirst == TRUE){
2038 iter->second = cmbDisplayAs->GetValue();
2043 std::map<int,wxString>::iterator mapS;
2045 mapS = ContactEditorData.FullNamesListTokens.find(iter->first);
2047 ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue,
2048 &iter, &ContactEditorData.FullNamesList, &ContactData,
2049 wxT("ALTID"), &ContactEditorData.FullNamesListAltID,
2050 wxT("PID"), &ContactEditorData.FullNamesListPID,
2051 wxT("TYPE"), &ContactEditorData.FullNamesListType,
2052 wxT("LANGUAGE"), &ContactEditorData.FullNamesListLanguage,
2053 wxT("PREF"), &ContactEditorData.FullNamesListPref,
2054 wxT(""), &ContactEditorData.FullNamesListTokens );
2058 ResetSaveProcessData();
2062 //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
2064 // Insert revision (REV) date.
2066 // Get today's date and time.
2068 wxDateTime DateTimeNow = wxDateTime::Now();
2072 // Set year, month and date.
2074 int intYear = DateTimeNow.GetYear();
2075 int intMonth = DateTimeNow.GetMonth();
2076 int intDay = DateTimeNow.GetDay();
2078 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
2082 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
2086 DateRev.Append(wxString::Format(wxT("%i"), intMonth));
2092 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
2096 DateRev.Append(wxString::Format(wxT("%i"), intDay));
2100 //DateRev.Append(wx);
2101 //DateRev.Append(wx);
2102 //DateRev.Append(wx);
2103 DateRev.Append(wxT("T"));
2105 // Set hour, minute and second.
2107 int intHour = DateTimeNow.GetHour();
2108 int intMinute = DateTimeNow.GetMinute();
2109 int intSecond = DateTimeNow.GetSecond();
2113 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
2117 DateRev.Append(wxString::Format(wxT("%i"), intHour));
2121 if (intMinute < 10){
2123 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
2127 DateRev.Append(wxString::Format(wxT("%i"), intMinute));
2131 if (intSecond < 10){
2133 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
2137 DateRev.Append(wxString::Format(wxT("%i"), intSecond));
2141 // DateRev.Append(wx);
2142 // DateRev.Append(wx);
2143 // DateRev.Append(wxString DateTimeNow->);
2144 DateRev.Append(wxT("Z"));
2146 ContactData.Add(wxT("UID"), ContactEditorData.UIDToken, FALSE);
2148 // End the vCard File.
2150 ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
2153 ContactData.WriteFile(FilenameFinal);
2155 vCard34Conv ConvFileFun;
2159 ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
2161 wxString AccountDirPrefix;
2162 wxString AccountDir;
2165 #if defined(__HAIKU__)
2167 //preffilename = wxT("noo");
2169 #elif defined(__APPLE__)
2171 PrefDir = GetUserPrefDir();
2173 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2175 #elif defined(__WIN32__)
2177 PrefDir = GetUserPrefDir();
2179 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
2183 PrefDir = GetUserPrefDir();
2185 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2189 XABPreferences PrefData(PrefDir);
2191 wxString AccountType;
2193 for (int i = 0; i < PrefData.accounts.GetCount(); i++){
2195 AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
2197 if (AccountDir == wxSContactAccount){
2199 AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
2200 AccountDirPrefix.Trim();
2201 AccountType = PrefData.accounts.GetAccountType(i);
2208 wxString wxSplitFilename;
2209 wxString wxSDataURL;
2211 while(wSTFilename.HasMoreTokens()){
2213 wxSplitFilename = wSTFilename.GetNextToken();
2217 wxSDataURL = wxSplitFilename;
2218 //wxSDataURL.Append(wxSplitFilename);
2220 // Find out if the filename exists in the table.
2222 if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
2224 wxString ETagResult;
2225 wxString ETagOriginal;
2227 ETagDB *ETagDBPtr = NULL;
2229 ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
2231 wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
2232 wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
2234 if (wxSETagOrig.IsEmpty()){
2236 // Generate the ETag.
2238 wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2242 if (wxSETag.IsEmpty()){
2244 // Update empty ETag.
2246 wxSETag = wxSETagOrig;
2247 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
2252 // Don't change original ETag.
2254 wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2255 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
2259 if (EditMode == FALSE){
2261 ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2263 FMTimer.SetFilename(FilenameFinal);
2264 FMTimer.UpdateTimestamp();
2265 FMTimer.Start(10000, FALSE);
2267 wxCommandEvent reloadevent(RELOADCONTACTLIST);
2268 reloadevent.SetString(wxSContactAccount);
2269 wxPostEvent(this->GetParent(), reloadevent);
2274 ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2275 FMTimer.UpdateTimestamp();
2276 FMTimer.Start(10000, FALSE);
2282 // Send a notification to update the main window
2283 // with the new details.
2288 // TODO: Workout nickname settings by priority and
2291 ucd->ContactAccount = wxSContactAccount;
2292 ucd->ContactFilename = FilenameFinal;
2293 ucd->ContactName = cmbDisplayAs->GetValue();
2294 ucd->ContactNameArray = ContactData.GetName();
2296 for (std::map<int,wxString>::iterator gniter = ContactEditorData.GeneralNicknamesList.begin();
2297 gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){
2299 ucd->ContactNickname = gniter->second;
2304 wxCommandEvent event2(CE_UPDATECONTACTLIST);
2305 event2.SetClientData(ucd);
2306 wxPostEvent(MainPtr, event2);
2310 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
2313 // Save the updated contact data and close the form.
2315 wxCommandEvent NullEvent;
2316 this->SaveContact(NullEvent);