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 strAddressFinalValue = iter->second;
1361 ProcessCaptureStrings(&strAddressFinalValue);
1363 strAddressFinalValue.insert(0, wxT("geo:"));
1365 ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
1366 &iter, &strAddressFinalValue, &ContactData,
1367 wxT("ALTID"), &ContactEditorData.GeneralGeographyListAltID,
1368 wxT("PID"), &ContactEditorData.GeneralGeographyListPID,
1369 wxT("MEDIATYPE"), &ContactEditorData.GeneralGeographyListMediatype,
1370 wxT("PREF"), &ContactEditorData.GeneralGeographyListPref,
1371 wxT(""), &ContactEditorData.GeneralGeographyListTokens );
1373 ResetSaveProcessData();
1377 ResetSaveProcessData();
1379 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeGeographyList.begin();
1380 iter != ContactEditorData.HomeGeographyList.end(); ++iter){
1382 wxString strAddressFinalValue = iter->second;
1384 ProcessCaptureStrings(&strAddressFinalValue);
1386 strAddressFinalValue.insert(0, wxT("geo:"));
1388 ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1389 &iter, &ContactEditorData.HomeGeographyList, &ContactData,
1390 wxT("ALTID"), &ContactEditorData.HomeGeographyListAltID,
1391 wxT("PID"), &ContactEditorData.HomeGeographyListPID,
1392 wxT("MEDIATYPE"), &ContactEditorData.HomeGeographyListMediatype,
1393 wxT("PREF"), &ContactEditorData.HomeGeographyListPref,
1394 wxT(""), &ContactEditorData.HomeGeographyListTokens );
1396 ResetSaveProcessData();
1400 ResetSaveProcessData();
1402 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessGeographyList.begin();
1403 iter != ContactEditorData.BusinessGeographyList.end(); ++iter){
1405 wxString strAddressFinalValue = iter->second;
1407 ProcessCaptureStrings(&strAddressFinalValue);
1409 strAddressFinalValue.insert(0, wxT("geo:"));
1411 ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1412 &iter, &ContactEditorData.BusinessGeographyList, &ContactData,
1413 wxT("ALTID"), &ContactEditorData.BusinessGeographyListAltID,
1414 wxT("PID"), &ContactEditorData.BusinessGeographyListPID,
1415 wxT("MEDIATYPE"), &ContactEditorData.BusinessGeographyListMediatype,
1416 wxT("PREF"), &ContactEditorData.BusinessGeographyListPref,
1417 wxT(""), &ContactEditorData.BusinessGeographyListTokens );
1419 ResetSaveProcessData();
1423 ResetSaveProcessData();
1425 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRelatedList.begin();
1426 iter != ContactEditorData.GeneralRelatedList.end(); ++iter){
1428 ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
1429 &iter, &ContactEditorData.GeneralRelatedList, &ContactData,
1430 wxT("ALTID"), &ContactEditorData.GeneralRelatedListAltID,
1431 wxT("PID"), &ContactEditorData.GeneralRelatedListPID,
1432 wxT("LANGUAGE"), &ContactEditorData.GeneralRelatedListLanguage,
1433 wxT("TYPE"), &ContactEditorData.GeneralRelatedListRelType,
1434 wxT("PREF"), &ContactEditorData.GeneralRelatedListPref,
1435 wxT(""), &ContactEditorData.GeneralRelatedListTokens );
1437 ResetSaveProcessData();
1441 ResetSaveProcessData();
1443 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralWebsiteList.begin();
1444 iter != ContactEditorData.GeneralWebsiteList.end(); ++iter){
1446 ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
1447 &iter, &ContactEditorData.GeneralWebsiteList, &ContactData,
1448 wxT("ALTID"), &ContactEditorData.GeneralWebsiteListAltID,
1449 wxT("PID"), &ContactEditorData.GeneralWebsiteListPID,
1450 wxT("MEDIATYPE"), &ContactEditorData.GeneralWebsiteListMediatype,
1451 wxT("PREF"), &ContactEditorData.GeneralWebsiteListPref,
1452 wxT(""), &ContactEditorData.GeneralWebsiteListTokens );
1454 ResetSaveProcessData();
1458 ResetSaveProcessData();
1460 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeWebsiteList.begin();
1461 iter != ContactEditorData.HomeWebsiteList.end(); ++iter){
1463 ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1464 &iter, &ContactEditorData.HomeWebsiteList, &ContactData,
1465 wxT("ALTID"), &ContactEditorData.HomeWebsiteListAltID,
1466 wxT("PID"), &ContactEditorData.HomeWebsiteListPID,
1467 wxT("MEDIATYPE"), &ContactEditorData.HomeWebsiteListMediatype,
1468 wxT("PREF"), &ContactEditorData.HomeWebsiteListPref,
1469 wxT(""), &ContactEditorData.HomeWebsiteListTokens );
1471 ResetSaveProcessData();
1475 ResetSaveProcessData();
1477 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessWebsiteList.begin();
1478 iter != ContactEditorData.BusinessWebsiteList.end(); ++iter){
1480 ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1481 &iter, &ContactEditorData.BusinessWebsiteList, &ContactData,
1482 wxT("ALTID"), &ContactEditorData.BusinessWebsiteListAltID,
1483 wxT("PID"), &ContactEditorData.BusinessWebsiteListPID,
1484 wxT("MEDIATYPE"), &ContactEditorData.BusinessWebsiteListMediatype,
1485 wxT("PREF"), &ContactEditorData.BusinessWebsiteListPref,
1486 wxT(""), &ContactEditorData.BusinessWebsiteListTokens );
1488 ResetSaveProcessData();
1492 ResetSaveProcessData();
1494 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTitleList.begin();
1495 iter != ContactEditorData.GeneralTitleList.end(); ++iter){
1497 ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
1498 &iter, &ContactEditorData.GeneralTitleList, &ContactData,
1499 wxT("ALTID"), &ContactEditorData.GeneralTitleListAltID,
1500 wxT("PID"), &ContactEditorData.GeneralTitleListPID,
1501 wxT("LANGUAGE"), &ContactEditorData.GeneralTitleListLanguage,
1502 wxT("PREF"), &ContactEditorData.GeneralTitleListPref,
1503 wxT(""), &ContactEditorData.GeneralTitleListTokens );
1505 ResetSaveProcessData();
1509 ResetSaveProcessData();
1511 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTitleList.begin();
1512 iter != ContactEditorData.HomeTitleList.end(); ++iter){
1514 ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1515 &iter, &ContactEditorData.HomeTitleList, &ContactData,
1516 wxT("ALTID"), &ContactEditorData.HomeTitleListAltID,
1517 wxT("PID"), &ContactEditorData.HomeTitleListPID,
1518 wxT("LANGUAGE"), &ContactEditorData.HomeTitleListLanguage,
1519 wxT("PREF"), &ContactEditorData.HomeTitleListPref,
1520 wxT(""), &ContactEditorData.HomeTitleListTokens );
1522 ResetSaveProcessData();
1526 ResetSaveProcessData();
1528 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTitleList.begin();
1529 iter != ContactEditorData.BusinessTitleList.end(); ++iter){
1531 ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1532 &iter, &ContactEditorData.BusinessTitleList, &ContactData,
1533 wxT("ALTID"), &ContactEditorData.BusinessTitleListAltID,
1534 wxT("PID"), &ContactEditorData.BusinessTitleListPID,
1535 wxT("LANGUAGE"), &ContactEditorData.BusinessTitleListLanguage,
1536 wxT("PREF"), &ContactEditorData.BusinessTitleListPref,
1537 wxT(""), &ContactEditorData.BusinessTitleListTokens );
1539 ResetSaveProcessData();
1543 ResetSaveProcessData();
1545 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRoleList.begin();
1546 iter != ContactEditorData.GeneralRoleList.end(); ++iter){
1548 ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
1549 &iter, &ContactEditorData.GeneralRoleList, &ContactData,
1550 wxT("ALTID"), &ContactEditorData.GeneralRoleListAltID,
1551 wxT("PID"), &ContactEditorData.GeneralRoleListPID,
1552 wxT("LANGUAGE"), &ContactEditorData.GeneralRoleListLanguage,
1553 wxT("PREF"), &ContactEditorData.GeneralRoleListPref,
1554 wxT(""), &ContactEditorData.GeneralRoleListTokens );
1556 ResetSaveProcessData();
1560 ResetSaveProcessData();
1562 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeRoleList.begin();
1563 iter != ContactEditorData.HomeRoleList.end(); ++iter){
1565 ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1566 &iter, &ContactEditorData.HomeRoleList, &ContactData,
1567 wxT("ALTID"), &ContactEditorData.HomeRoleListAltID,
1568 wxT("PID"), &ContactEditorData.HomeRoleListPID,
1569 wxT("LANGUAGE"), &ContactEditorData.HomeRoleListLanguage,
1570 wxT("PREF"), &ContactEditorData.HomeRoleListPref,
1571 wxT(""), &ContactEditorData.HomeRoleListTokens );
1573 ResetSaveProcessData();
1577 ResetSaveProcessData();
1579 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessRoleList.begin();
1580 iter != ContactEditorData.BusinessRoleList.end(); ++iter){
1582 ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1583 &iter, &ContactEditorData.BusinessRoleList, &ContactData,
1584 wxT("ALTID"), &ContactEditorData.BusinessRoleListAltID,
1585 wxT("PID"), &ContactEditorData.BusinessRoleListPID,
1586 wxT("LANGUAGE"), &ContactEditorData.BusinessRoleListLanguage,
1587 wxT("PREF"), &ContactEditorData.BusinessRoleListPref,
1588 wxT(""), &ContactEditorData.BusinessRoleListTokens );
1590 ResetSaveProcessData();
1594 ResetSaveProcessData();
1596 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralOrganisationsList.begin();
1597 iter != ContactEditorData.GeneralOrganisationsList.end(); ++iter){
1599 ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
1600 &iter, &ContactEditorData.GeneralOrganisationsList, &ContactData,
1601 wxT("ALTID"), &ContactEditorData.GeneralOrganisationsListAltID,
1602 wxT("PID"), &ContactEditorData.GeneralOrganisationsListPID,
1603 wxT("LANGUAGE"), &ContactEditorData.GeneralOrganisationsListLanguage,
1604 wxT("SORT-AS"), &ContactEditorData.GeneralOrganisationsListSortAs,
1605 wxT("PREF"), &ContactEditorData.GeneralOrganisationsListPref,
1606 wxT(""), &ContactEditorData.GeneralOrganisationsListTokens );
1608 ResetSaveProcessData();
1612 ResetSaveProcessData();
1614 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeOrganisationsList.begin();
1615 iter != ContactEditorData.HomeOrganisationsList.end(); ++iter){
1617 ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1618 &iter, &ContactEditorData.HomeOrganisationsList, &ContactData,
1619 wxT("ALTID"), &ContactEditorData.HomeOrganisationsListAltID,
1620 wxT("PID"), &ContactEditorData.HomeOrganisationsListPID,
1621 wxT("LANGUAGE"), &ContactEditorData.HomeOrganisationsListLanguage,
1622 wxT("SORT-AS"), &ContactEditorData.HomeOrganisationsListSortAs,
1623 wxT("PREF"), &ContactEditorData.HomeOrganisationsListPref,
1624 wxT(""), &ContactEditorData.HomeOrganisationsListTokens );
1626 ResetSaveProcessData();
1630 ResetSaveProcessData();
1632 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessOrganisationsList.begin();
1633 iter != ContactEditorData.BusinessOrganisationsList.end(); ++iter){
1635 ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1636 &iter, &ContactEditorData.BusinessOrganisationsList, &ContactData,
1637 wxT("ALTID"), &ContactEditorData.BusinessOrganisationsListAltID,
1638 wxT("PID"), &ContactEditorData.BusinessOrganisationsListPID,
1639 wxT("LANGUAGE"), &ContactEditorData.BusinessOrganisationsListLanguage,
1640 wxT("SORT-AS"), &ContactEditorData.BusinessOrganisationsListSortAs,
1641 wxT("PREF"), &ContactEditorData.BusinessOrganisationsListPref,
1642 wxT(""), &ContactEditorData.BusinessOrganisationsListTokens );
1644 ResetSaveProcessData();
1648 ResetSaveProcessData();
1650 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNoteList.begin();
1651 iter != ContactEditorData.GeneralNoteList.end(); ++iter){
1653 ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
1654 &iter, &ContactEditorData.GeneralNoteList, &ContactData,
1655 wxT("ALTID"), &ContactEditorData.GeneralNoteListAltID,
1656 wxT("PID"), &ContactEditorData.GeneralNoteListPID,
1657 wxT("LANGUAGE"), &ContactEditorData.GeneralNoteListLanguage,
1658 wxT("PREF"), &ContactEditorData.GeneralNoteListPref,
1659 wxT(""), &ContactEditorData.GeneralNoteListTokens );
1661 ResetSaveProcessData();
1665 ResetSaveProcessData();
1667 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNoteList.begin();
1668 iter != ContactEditorData.HomeNoteList.end(); ++iter){
1670 ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1671 &iter, &ContactEditorData.HomeNoteList, &ContactData,
1672 wxT("ALTID"), &ContactEditorData.HomeNoteListAltID,
1673 wxT("PID"), &ContactEditorData.HomeNoteListPID,
1674 wxT("LANGUAGE"), &ContactEditorData.HomeNoteListLanguage,
1675 wxT("PREF"), &ContactEditorData.HomeNoteListPref,
1676 wxT(""), &ContactEditorData.HomeNoteListTokens );
1678 ResetSaveProcessData();
1682 ResetSaveProcessData();
1684 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNoteList.begin();
1685 iter != ContactEditorData.BusinessNoteList.end(); ++iter){
1687 ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1688 &iter, &ContactEditorData.BusinessNoteList, &ContactData,
1689 wxT("ALTID"), &ContactEditorData.BusinessNoteListAltID,
1690 wxT("PID"), &ContactEditorData.BusinessNoteListPID,
1691 wxT("LANGUAGE"), &ContactEditorData.BusinessNoteListLanguage,
1692 wxT("PREF"), &ContactEditorData.BusinessNoteListPref,
1693 wxT(""), &ContactEditorData.BusinessNoteListTokens );
1695 ResetSaveProcessData();
1699 ResetSaveProcessData();
1701 for (std::map<int,wxString>::iterator iter = ContactEditorData.CategoriesList.begin();
1702 iter != ContactEditorData.CategoriesList.end(); ++iter){
1704 ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
1705 &iter, &ContactEditorData.CategoriesList, &ContactData,
1706 wxT("ALTID"), &ContactEditorData.CategoriesListAltID,
1707 wxT("PID"), &ContactEditorData.CategoriesListPID,
1708 wxT("TYPE"), &ContactEditorData.CategoriesListType,
1709 wxT("PREF"), &ContactEditorData.CategoriesListPref,
1710 wxT(""), &ContactEditorData.CategoriesListTokens );
1712 ResetSaveProcessData();
1718 for (std::map<int, std::string>::iterator iter = ContactEditorData.PicturesList.begin();
1719 iter != ContactEditorData.PicturesList.end(); ++iter){
1721 int intValueIndex = iter->first;
1723 std::map<int, std::string>::iterator stdstriter;
1724 std::map<int, wxString>::iterator enciter;
1726 striter = ContactEditorData.PicturesListPictureType.find(intValueIndex);
1727 enciter = ContactEditorData.PicturesListPicEncType.find(intValueIndex);
1729 ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
1730 &iter, &ContactEditorData.PicturesList, &striter,
1731 &enciter, &ContactData,
1732 wxT("ALTID"), &ContactEditorData.PicturesListAltID,
1733 wxT("PID"), &ContactEditorData.PicturesListPID,
1734 wxT("TYPE"), &ContactEditorData.PicturesListType,
1735 wxT("PREF"), &ContactEditorData.PicturesListPref,
1736 wxT(""), &ContactEditorData.PicturesListTokens);
1738 ResetSaveProcessData();
1742 ResetSaveProcessData();
1746 for (std::map<int, std::string>::iterator iter = ContactEditorData.LogosList.begin();
1747 iter != ContactEditorData.LogosList.end(); ++iter){
1749 int intValueIndex = iter->first;
1751 std::map<int, std::string>::iterator stdstriter;
1752 std::map<int, wxString>::iterator enciter;
1754 striter = ContactEditorData.LogosListPictureType.find(intValueIndex);
1755 enciter = ContactEditorData.LogosListPicEncType.find(intValueIndex);
1757 ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
1758 &iter, &ContactEditorData.LogosList, &striter,
1759 &enciter, &ContactData,
1760 wxT("ALTID"), &ContactEditorData.LogosListAltID,
1761 wxT("PID"), &ContactEditorData.LogosListPID,
1762 wxT("TYPE"), &ContactEditorData.LogosListType,
1763 wxT("PREF"), &ContactEditorData.LogosListPref,
1764 wxT(""), &ContactEditorData.LogosListTokens );
1766 ResetSaveProcessData();
1770 ResetSaveProcessData();
1774 for (std::map<int, std::string>::iterator iter = ContactEditorData.SoundsList.begin();
1775 iter != ContactEditorData.SoundsList.end(); ++iter){
1777 int intValueIndex = iter->first;
1779 std::map<int, std::string>::iterator stdstriter;
1780 std::map<int, wxString>::iterator enciter;
1782 striter = ContactEditorData.SoundsListAudioType.find(intValueIndex);
1783 enciter = ContactEditorData.SoundsListAudioEncType.find(intValueIndex);
1785 ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
1786 &iter, &ContactEditorData.SoundsList, &striter,
1787 &enciter, &ContactData,
1788 wxT("ALTID"), &ContactEditorData.SoundsListAltID,
1789 wxT("PID"), &ContactEditorData.SoundsListPID,
1790 wxT("TYPE"), &ContactEditorData.SoundsListType,
1791 wxT("PREF"), &ContactEditorData.SoundsListPref,
1792 wxT(""), &ContactEditorData.SoundsListTokens );
1794 ResetSaveProcessData();
1798 ResetSaveProcessData();
1800 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarList.begin();
1801 iter != ContactEditorData.CalendarList.end(); ++iter){
1803 ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
1804 &iter, &ContactEditorData.CalendarList, &ContactData,
1805 wxT("ALTID"), &ContactEditorData.CalendarListAltID,
1806 wxT("PID"), &ContactEditorData.CalendarListPID,
1807 wxT("MEDIATYPE"), &ContactEditorData.CalendarListMediatype,
1808 wxT("TYPE"), &ContactEditorData.CalendarListType,
1809 wxT("PREF"), &ContactEditorData.CalendarListPref,
1810 wxT(""), &ContactEditorData.CalendarListTokens );
1812 ResetSaveProcessData();
1816 ResetSaveProcessData();
1818 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarRequestList.begin();
1819 iter != ContactEditorData.CalendarRequestList.end(); ++iter){
1821 ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
1822 &iter, &ContactEditorData.CalendarRequestList, &ContactData,
1823 wxT("ALTID"), &ContactEditorData.CalendarRequestListAltID,
1824 wxT("PID"), &ContactEditorData.CalendarRequestListPID,
1825 wxT("MEDIATYPE"), &ContactEditorData.CalendarRequestListMediatype,
1826 wxT("TYPE"), &ContactEditorData.CalendarRequestListType,
1827 wxT("PREF"), &ContactEditorData.CalendarRequestListPref,
1828 wxT(""), &ContactEditorData.CalendarRequestListTokens );
1830 ResetSaveProcessData();
1834 ResetSaveProcessData();
1836 for (std::map<int,wxString>::iterator iter = ContactEditorData.FreeBusyList.begin();
1837 iter != ContactEditorData.FreeBusyList.end(); ++iter){
1839 ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
1840 &iter, &ContactEditorData.FreeBusyList, &ContactData,
1841 wxT("ALTID"), &ContactEditorData.FreeBusyListAltID,
1842 wxT("PID"), &ContactEditorData.FreeBusyListPID,
1843 wxT("MEDIATYPE"), &ContactEditorData.FreeBusyListMediatype,
1844 wxT("TYPE"), &ContactEditorData.FreeBusyListType,
1845 wxT("PREF"), &ContactEditorData.FreeBusyListPref,
1846 wxT(""), &ContactEditorData.FreeBusyListTokens );
1848 ResetSaveProcessData();
1852 for (std::map<int, wxString>::iterator iter = ContactEditorData.KeyList.begin();
1853 iter != ContactEditorData.KeyList.end(); ++iter){
1855 intValue2 = iter->first;
1857 // Get the key information.
1859 std::map<int, wxString>::iterator enciter;
1861 striter = ContactEditorData.KeyListDataType.find(intValue2);
1862 //enciter = KeyListAudioEncType.find(intValue2);
1864 wxString strValueData;
1866 strValueData = iter->second;
1867 strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));
1869 ProcessSaveData(wxT("KEY"), &strValue2, &boolValue2, &boolValue,
1870 &iter, &strValueData, &ContactData,
1871 wxT("ALTID"), &ContactEditorData.KeyListAltID,
1872 wxT("PID"), &ContactEditorData.KeyListPID,
1873 wxT("TYPE"), &ContactEditorData.KeyListType,
1874 wxT("PREF"), &ContactEditorData.KeyListPref,
1875 wxT(""), &ContactEditorData.KeyListTokens );
1877 ResetSaveProcessData();
1881 // Vendor specific items.
1883 ResetSaveProcessData();
1885 for (std::map<int,wxString>::iterator iter = ContactEditorData.VendorList.begin();
1886 iter != ContactEditorData.VendorList.end(); ++iter){
1888 intValue2 = iter->first;
1890 // Get the IANA PEN number.
1892 striter = ContactEditorData.VendorListPEN.find(intValue2);
1894 if (striter->first == intValue2){
1896 strValue2 = striter->second;
1900 // Get the element name.
1902 striter = ContactEditorData.VendorListElement.find(intValue2);
1904 if (striter->first == intValue2){
1906 strValue3 = striter->second;
1912 striter = ContactEditorData.VendorList.find(intValue2);
1914 if (striter->first == intValue2){
1916 strValue = striter->second;
1920 // Add to the vCard.
1922 if (boolValue == TRUE){
1924 ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
1928 ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
1932 ResetSaveProcessData();
1936 ResetSaveProcessData();
1940 for (std::map<int,wxString>::iterator iter = ContactEditorData.XTokenList.begin();
1941 iter != ContactEditorData.XTokenList.end(); ++iter){
1943 intValue2 = iter->first;
1945 // Get the element name.
1947 striter = ContactEditorData.XTokenListTokens.find(intValue2);
1949 if (striter->first == intValue2){
1951 strValue2 = striter->second;
1957 striter = ContactEditorData.XTokenList.find(intValue2);
1959 if (striter->first == intValue2){
1961 strValue = striter->second;
1965 // Add to the vCard.
1967 if (boolValue == TRUE){
1969 ContactData.AddRaw(wxT("X-") + strValue2, strValue);
1973 ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
1977 ResetSaveProcessData();
1981 ResetSaveProcessData();
1983 if (ContactEditorData.FullNamesList.size() == 0){
1985 wxString FullName = cmbDisplayAs->GetValue();
1986 ContactEditorData.FullNamesList.insert(std::make_pair(0, FullName));
1987 ContactEditorData.FullNamesListAltID.insert(std::make_pair(0, wxT("")));
1988 ContactEditorData.FullNamesListPID.insert(std::make_pair(0, wxT("")));
1989 ContactEditorData.FullNamesListType.insert(std::make_pair(0, wxT("")));
1990 ContactEditorData.FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
1991 ContactEditorData.FullNamesListPref.insert(std::make_pair(0, 0));
1992 ContactEditorData.FullNamesListTokens.insert(std::make_pair(0, wxT("")));
1997 for (std::map<int, wxString>::iterator iter = ContactEditorData.FullNamesList.begin();
1998 iter != ContactEditorData.FullNamesList.end(); ++iter){
2000 if (FNFirst == TRUE){
2002 iter->second = cmbDisplayAs->GetValue();
2007 std::map<int,wxString>::iterator mapS;
2009 mapS = ContactEditorData.FullNamesListTokens.find(iter->first);
2011 ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue,
2012 &iter, &ContactEditorData.FullNamesList, &ContactData,
2013 wxT("ALTID"), &ContactEditorData.FullNamesListAltID,
2014 wxT("PID"), &ContactEditorData.FullNamesListPID,
2015 wxT("TYPE"), &ContactEditorData.FullNamesListType,
2016 wxT("LANGUAGE"), &ContactEditorData.FullNamesListLanguage,
2017 wxT("PREF"), &ContactEditorData.FullNamesListPref,
2018 wxT(""), &ContactEditorData.FullNamesListTokens );
2022 ResetSaveProcessData();
2026 //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
2028 // Insert revision (REV) date.
2030 // Get today's date and time.
2032 wxDateTime DateTimeNow = wxDateTime::Now();
2036 // Set year, month and date.
2038 int intYear = DateTimeNow.GetYear();
2039 int intMonth = DateTimeNow.GetMonth();
2040 int intDay = DateTimeNow.GetDay();
2042 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
2046 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
2050 DateRev.Append(wxString::Format(wxT("%i"), intMonth));
2056 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
2060 DateRev.Append(wxString::Format(wxT("%i"), intDay));
2064 //DateRev.Append(wx);
2065 //DateRev.Append(wx);
2066 //DateRev.Append(wx);
2067 DateRev.Append(wxT("T"));
2069 // Set hour, minute and second.
2071 int intHour = DateTimeNow.GetHour();
2072 int intMinute = DateTimeNow.GetMinute();
2073 int intSecond = DateTimeNow.GetSecond();
2077 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
2081 DateRev.Append(wxString::Format(wxT("%i"), intHour));
2085 if (intMinute < 10){
2087 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
2091 DateRev.Append(wxString::Format(wxT("%i"), intMinute));
2095 if (intSecond < 10){
2097 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
2101 DateRev.Append(wxString::Format(wxT("%i"), intSecond));
2105 // DateRev.Append(wx);
2106 // DateRev.Append(wx);
2107 // DateRev.Append(wxString DateTimeNow->);
2108 DateRev.Append(wxT("Z"));
2110 ContactData.Add(wxT("UID"), ContactEditorData.UIDToken, FALSE);
2112 // End the vCard File.
2114 ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
2117 ContactData.WriteFile(FilenameFinal);
2119 vCard34Conv ConvFileFun;
2123 ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
2125 wxString AccountDirPrefix;
2126 wxString AccountDir;
2129 #if defined(__HAIKU__)
2131 //preffilename = wxT("noo");
2133 #elif defined(__APPLE__)
2135 PrefDir = GetUserPrefDir();
2137 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2139 #elif defined(__WIN32__)
2141 PrefDir = GetUserPrefDir();
2143 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
2147 PrefDir = GetUserPrefDir();
2149 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2153 XABPreferences PrefData(PrefDir);
2155 wxString AccountType;
2157 for (int i = 0; i < PrefData.accounts.GetCount(); i++){
2159 AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
2161 if (AccountDir == wxSContactAccount){
2163 AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
2164 AccountDirPrefix.Trim();
2165 AccountType = PrefData.accounts.GetAccountType(i);
2172 wxString wxSplitFilename;
2173 wxString wxSDataURL;
2175 while(wSTFilename.HasMoreTokens()){
2177 wxSplitFilename = wSTFilename.GetNextToken();
2181 wxSDataURL = wxSplitFilename;
2182 //wxSDataURL.Append(wxSplitFilename);
2184 // Find out if the filename exists in the table.
2186 if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
2188 wxString ETagResult;
2189 wxString ETagOriginal;
2191 ETagDB *ETagDBPtr = NULL;
2193 ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
2195 wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
2196 wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
2198 if (wxSETagOrig.IsEmpty()){
2200 // Generate the ETag.
2202 wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2206 if (wxSETag.IsEmpty()){
2208 // Update empty ETag.
2210 wxSETag = wxSETagOrig;
2211 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
2216 // Don't change original ETag.
2218 wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2219 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
2223 if (EditMode == FALSE){
2225 ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2227 FMTimer.SetFilename(FilenameFinal);
2228 FMTimer.UpdateTimestamp();
2229 FMTimer.Start(10000, FALSE);
2231 wxCommandEvent reloadevent(RELOADCONTACTLIST);
2232 reloadevent.SetString(wxSContactAccount);
2233 wxPostEvent(this->GetParent(), reloadevent);
2238 ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2239 FMTimer.UpdateTimestamp();
2240 FMTimer.Start(10000, FALSE);
2246 // Send a notification to update the main window
2247 // with the new details.
2252 // TODO: Workout nickname settings by priority and
2255 ucd->ContactAccount = wxSContactAccount;
2256 ucd->ContactFilename = FilenameFinal;
2257 ucd->ContactName = cmbDisplayAs->GetValue();
2258 ucd->ContactNameArray = ContactData.GetName();
2260 for (std::map<int,wxString>::iterator gniter = ContactEditorData.GeneralNicknamesList.begin();
2261 gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){
2263 ucd->ContactNickname = gniter->second;
2268 wxCommandEvent event2(CE_UPDATECONTACTLIST);
2269 event2.SetClientData(ucd);
2270 wxPostEvent(MainPtr, event2);
2274 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
2277 // Save the updated contact data and close the form.
2279 wxCommandEvent NullEvent;
2280 this->SaveContact(NullEvent);