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("/"));
85 while(wSTDelFilename.HasMoreTokens()){
87 wxDelSplitFilename = wSTDelFilename.GetNextToken();
91 wxSDelDataURL = wxDelSplitFilename;
93 // Delete the contact from the server as it will be useless in certain
94 // address book clients.
96 ActMgrPtr->AddTask(2, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDelDataURL, wxDelSplitFilename, wxSContactFilename, wxT(""));
98 // Clear the filename so the trigger to recreate the UID is done.
100 wxSContactFilename.Clear();
107 if (wxSContactFilename.IsEmpty()){
109 // Generate a random UUID.
111 ContactEditorData.UIDToken = GenerateUUID();
112 ContactEditorData.UIDToken = ContactEditorData.UIDToken.MakeUpper();
114 // Setup the filename.
116 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
118 #if defined(__HAIKU__)
120 #elif defined(__WIN32__)
122 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
123 FilenameFinal.Append(ContactEditorData.UIDToken);
124 FilenameFinal.Append(wxT(".vcf"));
125 wxSContactFilename = FilenameFinal;
129 FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
130 FilenameFinal.Append(ContactEditorData.UIDToken);
131 FilenameFinal.Append(wxT(".vcf"));
132 wxSContactFilename = FilenameFinal;
138 if (ContactEditorData.UIDToken.IsEmpty()){
140 // UID Token is empty. (Shouldn't be).
141 // Generate a new UID Token.
143 ContactEditorData.UIDToken = GenerateUUID();
144 ContactEditorData.UIDToken = ContactEditorData.UIDToken.MakeUpper();
148 FilenameFinal = wxSContactFilename;
152 // Setup the data and write it into the account folder.
154 // Begin preperations to write the contact to a file.
157 std::map<int,int>::iterator intiter;
158 std::map<int,wxString>::iterator striter;
160 // Set some values for saving.
162 ContactEditorData.NameForename = txtForename->GetValue();
163 ContactEditorData.NameSurname = txtSurname->GetValue();
164 ContactEditorData.NameOtherNames = txtOtherNames->GetValue();
165 ContactEditorData.NameTitle = txtTitle->GetValue();
166 ContactEditorData.NameSuffix = txtSuffix->GetValue();
168 ContactEditorData.GenderDetails = txtGenderDescription->GetValue();
170 // Process Birthday: Get Day, Month & Year.
172 wxDateTime BirthdayDate;
173 wxDateTime::Month BirthdayMonth;
176 wxString DataBeforeT;
178 wxString FinalBirthdayString;
179 bool ProcessDataAfterT = FALSE;
181 BirthdayDate = dapBirthday->GetValue();
183 if (!txtBirthday->IsEmpty()){
185 // Birthday value is text so use this.
187 ContactEditorData.Birthday = txtBirthday->GetValue();
189 } else if (BirthdayDate.IsValid()){
191 BirthdayDay = BirthdayDate.GetDay();
192 BirthdayMonth = BirthdayDate.GetMonth();
193 BirthdayYear = BirthdayDate.GetYear();
195 // Look for T and replace data before this.
197 wxStringTokenizer wSTDate(ContactEditorData.Birthday, wxT("T"));
199 while (wSTDate.HasMoreTokens()){
201 if (ProcessDataAfterT == FALSE){
203 DataBeforeT = wSTDate.GetNextToken();
204 ProcessDataAfterT = TRUE;
208 DataAfterT = wSTDate.GetNextToken();
215 // If there is not T then replace altogether.
217 wxString FinalBirthdayDay;
218 wxString FinalBirthdayMonth;
219 wxString FinalBirthdayYear;
221 if (BirthdayDay < 10){
223 FinalBirthdayDay = wxT("0") + wxString::Format(wxT("%i"), BirthdayDay);
227 FinalBirthdayDay = wxString::Format(wxT("%i"), BirthdayDay);
231 if (((int)BirthdayMonth + 1) < 10){
233 FinalBirthdayMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
237 FinalBirthdayMonth = wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
241 if (BirthdayYear == 0){
243 FinalBirthdayYear = wxT("--");
247 FinalBirthdayYear = wxString::Format(wxT("%i"), BirthdayYear);
251 if (!DataAfterT.IsEmpty()){
253 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay + wxT("T") + DataAfterT;
257 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay;
261 if(!FinalBirthdayString.IsEmpty()){
263 ContactEditorData.Birthday = FinalBirthdayString;
269 // Process Anniversary: Get Day, Month & Year.
271 wxDateTime AnniversaryDate;
272 wxDateTime::Month AnniversaryMonth;
277 wxString FinalAnniversaryString;
278 ProcessDataAfterT = FALSE;
280 AnniversaryDate = dapAnniversary->GetValue();
282 if (!txtAnniversary->IsEmpty()){
284 // Birthday value is text so use this.
286 ContactEditorData.Anniversary = txtAnniversary->GetValue();
288 } else if (AnniversaryDate.IsValid()){
290 AnniversaryDay = AnniversaryDate.GetDay();
291 AnniversaryMonth = AnniversaryDate.GetMonth();
292 AnniversaryYear = AnniversaryDate.GetYear();
294 // Look for T and replace data before this.
296 wxStringTokenizer wSTDate(ContactEditorData.Anniversary, wxT("T"));
298 while (wSTDate.HasMoreTokens()){
300 if (ProcessDataAfterT == FALSE){
302 DataBeforeT = wSTDate.GetNextToken();
303 ProcessDataAfterT = TRUE;
307 DataAfterT = wSTDate.GetNextToken();
314 // If there is not T then replace altogether.
316 wxString FinalAnniversaryDay;
317 wxString FinalAnniversaryMonth;
318 wxString FinalAnniversaryYear;
320 if (AnniversaryDay < 10){
322 FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
326 FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
330 if (((int)AnniversaryMonth + 1) < 10){
332 FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
336 FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
340 if (AnniversaryYear == 0){
342 FinalAnniversaryYear = wxT("--");
346 FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
350 if (!DataAfterT.IsEmpty()){
352 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
356 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
360 if(!FinalAnniversaryString.IsEmpty()){
362 ContactEditorData.Birthday = FinalAnniversaryString;
368 // Process full name.
370 if (ContactEditorData.FullNamesList.size() > 0){
372 ContactEditorData.FullNamesList[0] = cmbDisplayAs->GetValue();
376 ContactEditorData.FullNamesList.insert(std::make_pair(0, cmbDisplayAs->GetValue()));
377 ContactEditorData.FullNamesListAltID.insert(std::make_pair(0, wxT("")));
378 ContactEditorData.FullNamesListPID.insert(std::make_pair(0, wxT("")));
379 ContactEditorData.FullNamesListType.insert(std::make_pair(0, wxT("")));
380 ContactEditorData.FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
381 ContactEditorData.FullNamesListPref.insert(std::make_pair(0, 0));
382 ContactEditorData.FullNamesListTokens.insert(std::make_pair(0, wxT("")));
386 /*ContactData.Add(wxT("BEGIN"), wxT("VCARD"), FALSE);
387 ContactData.Add(wxT("VERSION"), wxT("4.0"), FALSE);
389 // Setup the version string.
391 strValue.Append(wxT("-//Xestia//Address Book Version "));
392 strValue.Append(wxT(XSDAB_VERSION));
393 strValue.Append(wxT("//KW"));
395 ContactData.Add(wxT("PRODID"), strValue, FALSE);
397 // Process the REV property.
399 wxDateTime DateTimeSave;
400 DateTimeSave = DateTimeSave.SetToCurrent();
401 wxString DateTimeSaveValue;
403 DateTimeSaveValue += wxString::Format("%04i", DateTimeSave.GetYear());
404 DateTimeSaveValue += wxString::Format("%02i", (DateTimeSave.GetMonth() + 1));
405 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetDay());
406 DateTimeSaveValue += "T";
407 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetHour());
408 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetMinute());
409 DateTimeSaveValue += wxString::Format("%02i", DateTimeSave.GetSecond());
411 if (!ContactEditorData.RevisionTokens.IsEmpty()){
413 ContactData.AddRaw("REV;" + ContactEditorData.RevisionTokens, DateTimeSaveValue);
417 ContactData.AddRaw("REV", DateTimeSaveValue);
421 // Process the XML properties.
423 for (std::map<int,wxString>::iterator iter = ContactEditorData.XMLList.begin();
424 iter != ContactEditorData.XMLList.end(); ++iter){
426 wxString strOrigValue;
428 strOrigValue = ContactEditorData.XMLList.find(iter->first)->second;
430 ResetUnusedString(&strOrigValue);
432 ProcessSaveData(wxT("XML"), &strValue2, &boolValue2, &boolValue,
433 &iter, &strOrigValue, &ContactData,
434 wxT("ALTID"), &ContactEditorData.XMLListAltID );
436 ResetSaveProcessData();
440 // Process the CLIENTPIDMAP properties.
442 for (std::map<int,wxString>::iterator iter = ContactEditorData.ClientPIDList.begin();
443 iter != ContactEditorData.ClientPIDList.end(); ++iter){
445 wxString strOrigValue;
447 strOrigValue = ContactEditorData.ClientPIDList.find(iter->first)->second;
449 ResetUnusedString(&strOrigValue);
451 ProcessSaveData(wxT("CLIENTPIDMAP"), &strValue2, &boolValue2, &boolValue,
452 &iter, &strOrigValue, &ContactData,
453 wxT(""), &ContactEditorData.ClientPIDListTokens );
455 ResetSaveProcessData();
459 // Process the SOURCE properties.
461 for (std::map<int,wxString>::iterator iter = ContactEditorData.SourceList.begin();
462 iter != ContactEditorData.SourceList.end(); ++iter){
464 wxString strOrigValue;
466 strOrigValue = ContactEditorData.SourceList.find(iter->first)->second;
468 ResetUnusedString(&strOrigValue);
470 ProcessSaveData(wxT("SOURCE"), &strValue2, &boolValue2, &boolValue,
471 &iter, &strOrigValue, &ContactData,
472 wxT("ALTID"), &ContactEditorData.SourceListAltID,
473 wxT("PID"), &ContactEditorData.SourceListPID,
474 wxT("TYPE"), &ContactEditorData.SourceListType,
475 wxT("PREF"), &ContactEditorData.SourceListPref,
476 wxT("MEDIATYPE"), &ContactEditorData.SourceListMediatype,
477 wxT(""), &ContactEditorData.SourceListTokens );
479 ResetSaveProcessData();
487 // Setup the name field.
489 strValue = txtSurname->GetValue() + wxT(";") +
490 txtForename->GetValue() + wxT(";") +
491 txtOtherNames->GetValue() + wxT(";") +
492 txtTitle->GetValue() + wxT(";") +
493 txtSuffix->GetValue();
495 strValue2 = ContactData.Convert(cmbDisplayAs->GetValue(), FALSE);
498 if (ContactEditorData.NameTokens.IsEmpty()){
500 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\""), strValue, FALSE);
504 ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\";") + ContactEditorData.NameTokens, strValue, FALSE);
508 if (cmbType->GetCurrentSelection() == 1){
510 ContactData.AddRaw(wxT("KIND"), wxT("individual"));
512 } else if (cmbType->GetCurrentSelection() == 2){
514 ContactData.AddRaw(wxT("KIND"), wxT("group"));
516 // Go through each of the members and write them out.
518 for (std::map<int, wxString>::iterator itemiter = ContactEditorData.GroupsList.begin();
519 itemiter != ContactEditorData.GroupsList.end(); ++itemiter){
521 ContactData.Add(wxT("MEMBER:urn:uuid"), itemiter->second, FALSE);
525 } else if (cmbType->GetCurrentSelection() == 3){
527 ContactData.AddRaw(wxT("KIND"), wxT("org"));
529 } else if (cmbType->GetCurrentSelection() == 4){
531 ContactData.AddRaw(wxT("KIND"), wxT("location"));
536 // Setup the nicknames (General, Home & Business).
549 if (cmbGender->GetCurrentSelection() != 0){
551 switch(cmbGender->GetCurrentSelection()){
582 if (!txtGenderDescription->IsEmpty()){
584 strValue2 = txtGenderDescription->GetValue();
588 if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
590 EscapeString(&strValue2, FALSE);
592 if (!ContactEditorData.GenderTokens.IsEmpty()){
594 if (!strValue2.IsEmpty()){
596 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue + wxT(";") + strValue2);
600 ContactData.AddRaw(wxT("GENDER;") + ContactEditorData.GenderTokens, strValue);
606 if (!strValue2.IsEmpty()){
608 ContactData.AddRaw(wxT("GENDER"), strValue + wxT(";") + strValue2);
612 ContactData.AddRaw(wxT("GENDER"), strValue);
620 ResetSaveProcessData();
622 // Build the values for the BDAY property.
626 if (!ContactEditorData.BirthdayAltID.IsEmpty()){
629 DataValue = ContactEditorData.BirthdayAltID;
631 EscapeString(&DataValue, FALSE);
633 strValue3.Append("ALTID=");
634 strValue3.Append(DataValue);
642 if (!ContactEditorData.BirthdayCalScale.IsEmpty()){
645 DataValue = ContactEditorData.BirthdayCalScale;
647 EscapeString(&DataValue, FALSE);
649 if (boolValue2 == TRUE){
651 strValue3.Append(";");
655 strValue3.Append("CALSCALE=");
656 strValue3.Append(DataValue);
664 if (!ContactEditorData.BirthdayTokens.IsEmpty()){
667 DataValue = ContactEditorData.BirthdayTokens;
669 EscapeString(&DataValue, FALSE);
671 if (boolValue2 == TRUE){
673 strValue3.Append(";");
677 strValue3.Append(DataValue);
681 // Write the BDAY property.
683 if (!txtBirthday->IsEmpty()){
685 if (!txtBirthday->GetValue().IsEmpty()){
687 strValue = txtBirthday->GetValue();
689 if (!strValue3.IsEmpty()){
691 ContactData.AddRaw("BDAY;VALUE=text;" + strValue3, strValue);
695 ContactData.AddRaw("BDAY;VALUE=text", strValue);
705 // Get Day, Month & Year.
707 wxDateTime BirthdayDate;
708 wxDateTime::Month BirthdayMonth;
711 wxString DataBeforeT;
713 wxString FinalBirthdayString;
714 bool ProcessDataAfterT = FALSE;
716 BirthdayDate = dapBirthday->GetValue();
718 if (BirthdayDate.IsValid()){
720 BirthdayDay = BirthdayDate.GetDay();
721 BirthdayMonth = BirthdayDate.GetMonth();
722 BirthdayYear = BirthdayDate.GetYear();
724 // Look for T and replace data before this.
726 wxStringTokenizer wSTDate(ContactEditorData.Birthday, wxT("T"));
728 while (wSTDate.HasMoreTokens()){
730 if (ProcessDataAfterT == FALSE){
732 DataBeforeT = wSTDate.GetNextToken();
733 ProcessDataAfterT = TRUE;
737 DataAfterT = wSTDate.GetNextToken();
744 // If there is not T then replace altogether.
746 wxString FinalBirthdayDay;
747 wxString FinalBirthdayMonth;
748 wxString FinalBirthdayYear;
750 if (BirthdayDay < 10){
752 FinalBirthdayDay = wxT("0") + wxString::Format(wxT("%i"), BirthdayDay);
756 FinalBirthdayDay = wxString::Format(wxT("%i"), BirthdayDay);
760 if (((int)BirthdayMonth + 1) < 10){
762 FinalBirthdayMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
766 FinalBirthdayMonth = wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
770 if (BirthdayYear == 0){
772 FinalBirthdayYear = wxT("--");
776 FinalBirthdayYear = wxString::Format(wxT("%i"), BirthdayYear);
780 if (!DataAfterT.IsEmpty()){
782 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay + wxT("T") + DataAfterT;
786 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay;
790 if (!FinalBirthdayString.IsEmpty() || !strValue3.IsEmpty()){
792 if (!strValue3.IsEmpty()){
794 EscapeString(&strValue2, FALSE);
795 EscapeString(&strValue, FALSE);
797 ContactData.AddRaw(wxT("BDAY;") + strValue3, FinalBirthdayString);
801 EscapeString(&strValue, FALSE);
803 ContactData.AddRaw(wxT("BDAY"), FinalBirthdayString);
813 ResetSaveProcessData();
815 // Build the values for the ANNIVERSARY property.
819 if (!ContactEditorData.AnniversaryAltID.IsEmpty()){
822 DataValue = ContactEditorData.AnniversaryAltID;
824 EscapeString(&DataValue, FALSE);
826 strValue3.Append("ALTID=");
827 strValue3.Append(DataValue);
835 if (!ContactEditorData.AnniversaryCalScale.IsEmpty()){
838 DataValue = ContactEditorData.AnniversaryCalScale;
840 EscapeString(&DataValue, FALSE);
842 if (boolValue2 == TRUE){
844 strValue3.Append(";");
848 strValue3.Append("CALSCALE=");
849 strValue3.Append(DataValue);
857 if (!ContactEditorData.AnniversaryTokens.IsEmpty()){
860 DataValue = ContactEditorData.AnniversaryTokens;
862 EscapeString(&DataValue, FALSE);
864 if (boolValue2 == TRUE){
866 strValue3.Append(";");
870 strValue3.Append(DataValue);
874 // Write the ANNIVERSARY property.
876 if (!txtAnniversary->IsEmpty()){
878 if (!txtAnniversary->GetValue().IsEmpty()){
880 strValue = txtAnniversary->GetValue();
882 if (!strValue3.IsEmpty()){
884 ContactData.AddRaw("ANNIVERSARY;VALUE=text;" + strValue3, strValue);
888 ContactData.AddRaw("ANNIVERSARY;VALUE=text", strValue);
896 // Look for T and replace data before this.
898 // Get Day, Month & Year.
900 wxDateTime AnniversaryDate;
901 wxDateTime::Month AnniversaryMonth;
904 wxString DataBeforeT;
906 wxString FinalAnniversaryString;
907 bool ProcessDataAfterT = FALSE;
909 AnniversaryDate = dapAnniversary->GetValue();
911 if (AnniversaryDate.IsValid()){
913 AnniversaryDay = AnniversaryDate.GetDay();
914 AnniversaryMonth = AnniversaryDate.GetMonth();
915 AnniversaryYear = AnniversaryDate.GetYear();
917 // Look for T and replace data before this.
919 wxStringTokenizer wSTDate(ContactEditorData.Anniversary, wxT("T"));
921 while (wSTDate.HasMoreTokens()){
923 if (ProcessDataAfterT == FALSE){
925 DataBeforeT = wSTDate.GetNextToken();
926 ProcessDataAfterT = TRUE;
930 DataAfterT = wSTDate.GetNextToken();
937 // If there is not T then replace altogether.
939 wxString FinalAnniversaryDay;
940 wxString FinalAnniversaryMonth;
941 wxString FinalAnniversaryYear;
943 if (AnniversaryDay < 10){
945 FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
949 FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
953 if (((int)AnniversaryMonth + 1) < 10){
955 FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
959 FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
963 if (AnniversaryYear == 0){
965 FinalAnniversaryYear = wxT("--");
969 FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
973 if (!DataAfterT.IsEmpty()){
975 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
979 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
983 if (!FinalAnniversaryString.IsEmpty() || !strValue3.IsEmpty()){
985 if (!strValue3.IsEmpty()){
987 EscapeString(&strValue2, FALSE);
988 EscapeString(&strValue, FALSE);
990 ContactData.AddRaw(wxT("ANNIVERSARY;") + strValue3, FinalAnniversaryString);
994 EscapeString(&strValue, FALSE);
996 ContactData.AddRaw(wxT("ANNIVERSARY"), FinalAnniversaryString);
1006 // Setup the addresses (General, Home, Business).
1008 ResetSaveProcessData();
1010 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralAddressList.begin();
1011 iter != ContactEditorData.GeneralAddressList.end(); ++iter){
1013 int intSeekValue = iter->first;
1015 wxString strAddressString;
1016 wxString strAddressFinalValue;
1017 std::map<int, wxString>::iterator iterValue;
1019 strAddressString.Append(wxT(";;"));
1023 iterValue = ContactEditorData.GeneralAddressList.find(intSeekValue);
1024 strAddressFinalValue = iterValue->second;
1025 ProcessCaptureStrings(&strAddressFinalValue);
1026 strAddressString.Append(strAddressFinalValue + wxT(";"));
1027 strAddressFinalValue.Clear();
1031 iterValue = ContactEditorData.GeneralAddressListTown.find(intSeekValue);
1032 strAddressFinalValue = iterValue->second;
1033 ProcessCaptureStrings(&strAddressFinalValue);
1034 strAddressString.Append(strAddressFinalValue + wxT(";"));
1035 strAddressFinalValue.Clear();
1039 iterValue = ContactEditorData.GeneralAddressListCounty.find(intSeekValue);
1040 strAddressFinalValue = iterValue->second;
1041 ProcessCaptureStrings(&strAddressFinalValue);
1042 strAddressString.Append(strAddressFinalValue + wxT(";"));
1043 strAddressFinalValue.Clear();
1047 iterValue = ContactEditorData.GeneralAddressListPostCode.find(intSeekValue);
1048 strAddressFinalValue = iterValue->second;
1049 ProcessCaptureStrings(&strAddressFinalValue);
1050 strAddressString.Append(strAddressFinalValue + wxT(";"));
1051 strAddressFinalValue.Clear();
1055 iterValue = ContactEditorData.GeneralAddressListCountry.find(intSeekValue);
1056 strAddressFinalValue = iterValue->second;
1057 ProcessCaptureStrings(&strAddressFinalValue);
1058 strAddressString.Append(strAddressFinalValue);
1059 strAddressFinalValue.Clear();
1061 ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
1062 &iter, &strAddressString, &ContactData,
1063 wxT("LABEL"), &ContactEditorData.GeneralAddressListLabel,
1064 wxT("LANGUAGE"), &ContactEditorData.GeneralAddressListLang,
1065 wxT("ALTID"), &ContactEditorData.GeneralAddressListAltID,
1066 wxT("PID"), &ContactEditorData.GeneralAddressListPID,
1067 wxT("GEO"), &ContactEditorData.GeneralAddressListGeo,
1068 wxT("TZ"), &ContactEditorData.GeneralAddressListTimezone,
1069 wxT("MEDIATYPE"), &ContactEditorData.GeneralAddressListMediatype,
1070 wxT("PREF"), &ContactEditorData.GeneralAddressListPref,
1071 wxT(""), &ContactEditorData.GeneralAddressListTokens );
1073 ResetSaveProcessData();
1077 ResetSaveProcessData();
1079 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeAddressList.begin();
1080 iter != ContactEditorData.HomeAddressList.end(); ++iter){
1082 int intSeekValue = iter->first;
1084 wxString strAddressString;
1085 wxString strAddressFinalValue;
1086 std::map<int, wxString>::iterator iterValue;
1088 strAddressString.Append(wxT(";;"));
1092 iterValue = ContactEditorData.HomeAddressList.find(intSeekValue);
1093 strAddressFinalValue = iterValue->second;
1094 ProcessCaptureStrings(&strAddressFinalValue);
1095 strAddressString.Append(strAddressFinalValue + wxT(";"));
1099 iterValue = ContactEditorData.HomeAddressListTown.find(intSeekValue);
1100 strAddressFinalValue = iterValue->second;
1101 ProcessCaptureStrings(&strAddressFinalValue);
1102 strAddressString.Append(strAddressFinalValue + wxT(";"));
1106 iterValue = ContactEditorData.HomeAddressListCounty.find(intSeekValue);
1107 strAddressFinalValue = iterValue->second;
1108 ProcessCaptureStrings(&strAddressFinalValue);
1109 strAddressString.Append(strAddressFinalValue + wxT(";"));
1113 iterValue = ContactEditorData.HomeAddressListPostCode.find(intSeekValue);
1114 strAddressFinalValue = iterValue->second;
1115 ProcessCaptureStrings(&strAddressFinalValue);
1116 strAddressString.Append(strAddressFinalValue + wxT(";"));
1120 iterValue = ContactEditorData.HomeAddressListCountry.find(intSeekValue);
1121 strAddressFinalValue = iterValue->second;
1122 ProcessCaptureStrings(&strAddressFinalValue);
1123 strAddressString.Append(strAddressFinalValue);
1125 ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1126 &iter, &strAddressString, &ContactData,
1127 wxT("LABEL"), &ContactEditorData.HomeAddressListLabel,
1128 wxT("LANGUAGE"), &ContactEditorData.HomeAddressListLang,
1129 wxT("ALTID"), &ContactEditorData.HomeAddressListAltID,
1130 wxT("PID"), &ContactEditorData.HomeAddressListPID,
1131 wxT("GEO"), &ContactEditorData.HomeAddressListGeo,
1132 wxT("TZ"), &ContactEditorData.HomeAddressListTimezone,
1133 wxT("MEDIATYPE"), &ContactEditorData.HomeAddressListMediatype,
1134 wxT("PREF"), &ContactEditorData.HomeAddressListPref,
1135 wxT(""), &ContactEditorData.HomeAddressListTokens );
1137 ResetSaveProcessData();
1141 ResetSaveProcessData();
1143 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessAddressList.begin();
1144 iter != ContactEditorData.BusinessAddressList.end(); ++iter){
1146 int intSeekValue = iter->first;
1148 wxString strAddressString;
1149 wxString strAddressFinalValue;
1150 std::map<int, wxString>::iterator iterValue;
1152 strAddressString.Append(wxT(";;"));
1156 iterValue = ContactEditorData.BusinessAddressList.find(intSeekValue);
1157 strAddressFinalValue = iterValue->second;
1158 ProcessCaptureStrings(&strAddressFinalValue);
1160 strAddressString.Append(strAddressFinalValue + wxT(";"));
1164 iterValue = ContactEditorData.BusinessAddressListTown.find(intSeekValue);
1165 strAddressFinalValue = iterValue->second;
1166 ProcessCaptureStrings(&strAddressFinalValue);
1168 strAddressString.Append(strAddressFinalValue + wxT(";"));
1172 iterValue = ContactEditorData.BusinessAddressListCounty.find(intSeekValue);
1173 strAddressFinalValue = iterValue->second;
1174 ProcessCaptureStrings(&strAddressFinalValue);
1176 strAddressString.Append(strAddressFinalValue + wxT(";"));
1180 iterValue = ContactEditorData.BusinessAddressListPostCode.find(intSeekValue);
1181 strAddressFinalValue = iterValue->second;
1182 ProcessCaptureStrings(&strAddressFinalValue);
1184 strAddressString.Append(strAddressFinalValue + wxT(";"));
1188 iterValue = ContactEditorData.BusinessAddressListCountry.find(intSeekValue);
1189 strAddressFinalValue = iterValue->second;
1190 ProcessCaptureStrings(&strAddressFinalValue);
1192 strAddressString.Append(strAddressFinalValue);
1194 ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1195 &iter, &strAddressString, &ContactData,
1196 wxT("LABEL"), &ContactEditorData.BusinessAddressListLabel,
1197 wxT("LANGUAGE"), &ContactEditorData.BusinessAddressListLang,
1198 wxT("ALTID"), &ContactEditorData.BusinessAddressListAltID,
1199 wxT("PID"), &ContactEditorData.BusinessAddressListPID,
1200 wxT("GEO"), &ContactEditorData.BusinessAddressListGeo,
1201 wxT("TZ"), &ContactEditorData.BusinessAddressListTimezone,
1202 wxT("MEDIATYPE"), &ContactEditorData.BusinessAddressListMediatype,
1203 wxT("PREF"), &ContactEditorData.BusinessAddressListPref,
1204 wxT(""), &ContactEditorData.BusinessAddressListTokens );
1206 ResetSaveProcessData();
1210 // Sort out nicknames (if any).
1212 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNicknamesList.begin();
1213 iter != ContactEditorData.GeneralNicknamesList.end(); ++iter){
1215 intValue2 = iter->first;
1217 // Process Alternative ID.
1219 ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
1220 &iter, &ContactEditorData.GeneralNicknamesList, &ContactData,
1221 wxT("LANGUAGE"), &ContactEditorData.GeneralNicknamesListLanguage,
1222 wxT("ALTID"), &ContactEditorData.GeneralNicknamesListAltID,
1223 wxT("PID"), &ContactEditorData.GeneralNicknamesListPID,
1224 wxT("PREF"), &ContactEditorData.GeneralNicknamesListPref,
1225 wxT(""), &ContactEditorData.GeneralNicknamesListTokens );
1227 ResetSaveProcessData();
1231 ResetSaveProcessData();
1233 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNicknamesList.begin();
1234 iter != ContactEditorData.HomeNicknamesList.end(); ++iter){
1236 ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1237 &iter, &ContactEditorData.HomeNicknamesList, &ContactData,
1238 wxT("LANGUAGE"), &ContactEditorData.HomeNicknamesListLanguage,
1239 wxT("ALTID"), &ContactEditorData.HomeNicknamesListAltID,
1240 wxT("PID"), &ContactEditorData.HomeNicknamesListPID,
1241 wxT("PREF"), &ContactEditorData.HomeNicknamesListPref,
1242 wxT(""), &ContactEditorData.HomeNicknamesListTokens );
1244 ResetSaveProcessData();
1248 ResetSaveProcessData();
1250 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNicknamesList.begin();
1251 iter != ContactEditorData.BusinessNicknamesList.end(); ++iter){
1253 ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1254 &iter, &ContactEditorData.BusinessNicknamesList, &ContactData,
1255 wxT("LANGUAGE"), &ContactEditorData.BusinessNicknamesListLanguage,
1256 wxT("ALTID"), &ContactEditorData.BusinessNicknamesListAltID,
1257 wxT("PID"), &ContactEditorData.BusinessNicknamesListPID,
1258 wxT("PREF"), &ContactEditorData.BusinessNicknamesListPref,
1259 wxT(""), &ContactEditorData.BusinessNicknamesListTokens );
1261 ResetSaveProcessData();
1265 ResetSaveProcessData();
1267 // Sort out email (general, home and business).
1269 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralEmailList.begin();
1270 iter != ContactEditorData.GeneralEmailList.end(); ++iter){
1272 wxString strAddressFinalValue;
1273 std::map<int, wxString>::iterator iterValue;
1275 ProcessSaveData(wxT("EMAIL"), &strValue2, &boolValue2, &boolValue,
1276 &iter, &ContactEditorData.GeneralEmailList, &ContactData,
1277 wxT("ALTID"), &ContactEditorData.GeneralEmailListAltID,
1278 wxT("PID"), &ContactEditorData.GeneralEmailListPID,
1279 wxT("PREF"), &ContactEditorData.GeneralEmailListPref,
1280 wxT(""), &ContactEditorData.GeneralEmailListTokens );
1282 ResetSaveProcessData();
1286 ResetSaveProcessData();
1288 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeEmailList.begin();
1289 iter != ContactEditorData.HomeEmailList.end(); ++iter){
1291 ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1292 &iter, &ContactEditorData.HomeEmailList, &ContactData,
1293 wxT("ALTID"), &ContactEditorData.HomeEmailListAltID,
1294 wxT("PID"), &ContactEditorData.HomeEmailListPID,
1295 wxT("PREF"), &ContactEditorData.HomeEmailListPref,
1296 wxT(""), &ContactEditorData.HomeEmailListTokens );
1298 ResetSaveProcessData();
1302 ResetSaveProcessData();
1304 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessEmailList.begin();
1305 iter != ContactEditorData.BusinessEmailList.end(); ++iter){
1307 ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1308 &iter, &ContactEditorData.BusinessEmailList, &ContactData,
1309 wxT("ALTID"), &ContactEditorData.BusinessEmailListAltID,
1310 wxT("PID"), &ContactEditorData.BusinessEmailListPID,
1311 wxT("PREF"), &ContactEditorData.BusinessEmailListPref,
1312 wxT(""), &ContactEditorData.BusinessEmailListTokens );
1314 ResetSaveProcessData();
1318 ResetSaveProcessData();
1320 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralIMList.begin();
1321 iter != ContactEditorData.GeneralIMList.end(); ++iter){
1323 intValue2 = iter->first;
1325 wxString strIMFinalValue = iter->second;
1327 ProcessCaptureStrings(&strIMFinalValue);
1329 if (ContactEditorData.GeneralIMListTypeInfo.find(iter->first) !=
1330 ContactEditorData.GeneralIMListTypeInfo.end()){
1332 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralIMListTypeInfo.find(iter->first);
1334 strIMFinalValue.insert(0, ":");
1335 strIMFinalValue.insert(0, DataTypeIter->second);
1339 strIMFinalValue.insert(0, "none:");
1343 // Process Alternative ID.
1345 ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
1346 &iter, &strIMFinalValue, &ContactData,
1347 wxT("ALTID"), &ContactEditorData.GeneralIMListAltID,
1348 wxT("PID"), &ContactEditorData.GeneralIMListPID,
1349 wxT("MEDIATYPE"), &ContactEditorData.GeneralIMListMediatype,
1350 wxT("PREF"), &ContactEditorData.GeneralIMListPref,
1351 wxT(""), &ContactEditorData.GeneralIMListTokens );
1353 ResetSaveProcessData();
1357 ResetSaveProcessData();
1359 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeIMList.begin();
1360 iter != ContactEditorData.HomeIMList.end(); ++iter){
1362 wxString strIMFinalValue = iter->second;
1364 ProcessCaptureStrings(&strIMFinalValue);
1366 if (ContactEditorData.HomeIMListTypeInfo.find(iter->first) !=
1367 ContactEditorData.HomeIMListTypeInfo.end()){
1369 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeIMListTypeInfo.find(iter->first);
1371 strIMFinalValue.insert(0, ":");
1372 strIMFinalValue.insert(0, DataTypeIter->second);
1376 strIMFinalValue.insert(0, "none:");
1380 ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1381 &iter, &ContactEditorData.HomeIMList, &ContactData,
1382 wxT("ALTID"), &ContactEditorData.HomeIMListAltID,
1383 wxT("PID"), &ContactEditorData.HomeIMListPID,
1384 wxT("MEDIATYPE"), &ContactEditorData.HomeIMListMediatype,
1385 wxT("PREF"), &ContactEditorData.HomeIMListPref,
1386 wxT(""), &ContactEditorData.HomeIMListTokens );
1388 ResetSaveProcessData();
1392 ResetSaveProcessData();
1394 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessIMList.begin();
1395 iter != ContactEditorData.BusinessIMList.end(); ++iter){
1397 wxString strIMFinalValue = iter->second;
1399 ProcessCaptureStrings(&strIMFinalValue);
1401 if (ContactEditorData.BusinessIMListTypeInfo.find(iter->first) !=
1402 ContactEditorData.BusinessIMListTypeInfo.end()){
1404 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessIMListTypeInfo.find(iter->first);
1406 strIMFinalValue.insert(0, ":");
1407 strIMFinalValue.insert(0, DataTypeIter->second);
1411 strIMFinalValue.insert(0, "none:");
1415 ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1416 &iter, &ContactEditorData.BusinessIMList, &ContactData,
1417 wxT("ALTID"), &ContactEditorData.BusinessIMListAltID,
1418 wxT("PID"), &ContactEditorData.BusinessIMListPID,
1419 wxT("MEDIATYPE"), &ContactEditorData.BusinessIMListMediatype,
1420 wxT("PREF"), &ContactEditorData.BusinessIMListPref,
1421 wxT(""), &ContactEditorData.BusinessIMListTokens );
1423 ResetSaveProcessData();
1427 ResetSaveProcessData();
1429 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTelephoneList.begin();
1430 iter != ContactEditorData.GeneralTelephoneList.end(); ++iter){
1432 wxString strAddressFinalValue = iter->second;
1433 int DataID = iter->first;
1435 ProcessCaptureStrings(&strAddressFinalValue);
1437 if (MapDataExists(&DataID, &ContactEditorData.GeneralTelephoneListDataType)){
1439 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralTelephoneListDataType.find(iter->first);
1441 strAddressFinalValue.insert(0, ":");
1442 strAddressFinalValue.insert(0, DataTypeIter->second);
1446 strAddressFinalValue.insert(0, "tel:");
1450 wxString strAddressTypeInfo;
1452 if (MapDataExists(&DataID, &ContactEditorData.GeneralTelephoneListTypeInfo)){
1454 strAddressTypeInfo = ContactEditorData.GeneralTelephoneListTypeInfo.find(iter->first)->second;
1458 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1459 &iter, &strAddressFinalValue, &ContactData,
1460 wxT("ALTID"), &ContactEditorData.GeneralTelephoneListAltID,
1461 wxT("PID"), &ContactEditorData.GeneralTelephoneListPID,
1462 wxT("TYPE"), &ContactEditorData.GeneralTelephoneListTypeInfo,
1463 wxT("PREF"), &ContactEditorData.GeneralTelephoneListPref,
1464 wxT(""), &ContactEditorData.GeneralTelephoneListTokens );
1466 ResetSaveProcessData();
1470 ResetSaveProcessData();
1472 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTelephoneList.begin();
1473 iter != ContactEditorData.HomeTelephoneList.end(); ++iter){
1475 wxString strAddressFinalValue = iter->second;
1477 ProcessCaptureStrings(&strAddressFinalValue);
1479 if (ContactEditorData.HomeTelephoneListDataType.find(iter->first) !=
1480 ContactEditorData.HomeTelephoneListDataType.end()){
1482 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeTelephoneListDataType.find(iter->first);
1484 strAddressFinalValue.insert(0, ":");
1485 strAddressFinalValue.insert(0, DataTypeIter->second);
1489 strAddressFinalValue.insert(0, "tel:");
1493 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1494 &iter, &strAddressFinalValue, &ContactData,
1495 wxT("ALTID"), &ContactEditorData.HomeTelephoneListAltID,
1496 wxT("PID"), &ContactEditorData.HomeTelephoneListPID,
1497 wxT("TYPE"), &ContactEditorData.HomeTelephoneListTypeInfo,
1498 wxT("PREF"), &ContactEditorData.HomeTelephoneListPref,
1499 wxT(""), &ContactEditorData.HomeTelephoneListTokens );
1501 ResetSaveProcessData();
1505 ResetSaveProcessData();
1507 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTelephoneList.begin();
1508 iter != ContactEditorData.BusinessTelephoneList.end(); ++iter){
1510 wxString strAddressFinalValue = iter->second;
1512 ProcessCaptureStrings(&strAddressFinalValue);
1514 if (ContactEditorData.BusinessTelephoneListDataType.find(iter->first) !=
1515 ContactEditorData.BusinessTelephoneListDataType.end()){
1517 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessTelephoneListDataType.find(iter->first);
1519 strAddressFinalValue.insert(0, ":");
1520 strAddressFinalValue.insert(0, DataTypeIter->second);
1524 strAddressFinalValue.insert(0, "tel:");
1528 ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
1529 &iter, &strAddressFinalValue, &ContactData,
1530 wxT("ALTID"), &ContactEditorData.BusinessTelephoneListAltID,
1531 wxT("PID"), &ContactEditorData.BusinessTelephoneListPID,
1532 wxT("TYPE"), &ContactEditorData.BusinessTelephoneListTypeInfo,
1533 wxT("PREF"), &ContactEditorData.BusinessTelephoneListPref,
1534 wxT(""), &ContactEditorData.BusinessTelephoneListTokens );
1536 ResetSaveProcessData();
1540 ResetSaveProcessData();
1542 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralLanguageList.begin();
1543 iter != ContactEditorData.GeneralLanguageList.end(); ++iter){
1545 intValue2 = iter->first;
1547 ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
1548 &iter, &ContactEditorData.GeneralLanguageList, &ContactData,
1549 wxT("ALTID"), &ContactEditorData.GeneralLanguageListAltID,
1550 wxT("PID"), &ContactEditorData.GeneralLanguageListPID,
1551 wxT("PREF"), &ContactEditorData.GeneralLanguageListPref,
1552 wxT(""), &ContactEditorData.GeneralLanguageListTokens );
1554 ResetSaveProcessData();
1558 ResetSaveProcessData();
1560 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeLanguageList.begin();
1561 iter != ContactEditorData.HomeLanguageList.end(); ++iter){
1563 ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1564 &iter, &ContactEditorData.HomeLanguageList, &ContactData,
1565 wxT("ALTID"), &ContactEditorData.HomeLanguageListAltID,
1566 wxT("PID"), &ContactEditorData.HomeLanguageListPID,
1567 wxT("PREF"), &ContactEditorData.HomeLanguageListPref,
1568 wxT(""), &ContactEditorData.HomeLanguageListTokens );
1570 ResetSaveProcessData();
1574 ResetSaveProcessData();
1576 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessLanguageList.begin();
1577 iter != ContactEditorData.BusinessLanguageList.end(); ++iter){
1579 ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1580 &iter, &ContactEditorData.BusinessLanguageList, &ContactData,
1581 wxT("ALTID"), &ContactEditorData.BusinessLanguageListAltID,
1582 wxT("PID"), &ContactEditorData.BusinessLanguageListPID,
1583 wxT("PREF"), &ContactEditorData.BusinessLanguageListPref,
1584 wxT(""), &ContactEditorData.BusinessLanguageListTokens );
1586 ResetSaveProcessData();
1590 ResetSaveProcessData();
1592 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTZList.begin();
1593 iter != ContactEditorData.GeneralTZList.end(); ++iter){
1595 ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
1596 &iter, &ContactEditorData.GeneralTZList, &ContactData,
1597 wxT("ALTID"), &ContactEditorData.GeneralTZListAltID,
1598 wxT("PID"), &ContactEditorData.GeneralTZListPID,
1599 wxT("MEDIATYPE"), &ContactEditorData.GeneralTZListMediatype,
1600 wxT("PREF"), &ContactEditorData.GeneralTZListPref,
1601 wxT(""), &ContactEditorData.GeneralTZListTokens );
1603 ResetSaveProcessData();
1607 ResetSaveProcessData();
1609 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTZList.begin();
1610 iter != ContactEditorData.HomeTZList.end(); ++iter){
1612 ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1613 &iter, &ContactEditorData.HomeTZList, &ContactData,
1614 wxT("ALTID"), &ContactEditorData.HomeTZListAltID,
1615 wxT("PID"), &ContactEditorData.HomeTZListPID,
1616 wxT("MEDIATYPE"), &ContactEditorData.HomeTZListMediatype,
1617 wxT("PREF"), &ContactEditorData.HomeTZListPref,
1618 wxT(""), &ContactEditorData.HomeTZListTokens );
1620 ResetSaveProcessData();
1624 ResetSaveProcessData();
1626 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTZList.begin();
1627 iter != ContactEditorData.BusinessTZList.end(); ++iter){
1629 ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1630 &iter, &ContactEditorData.BusinessTZList, &ContactData,
1631 wxT("ALTID"), &ContactEditorData.BusinessTZListAltID,
1632 wxT("PID"), &ContactEditorData.BusinessTZListPID,
1633 wxT("MEDIATYPE"), &ContactEditorData.BusinessTZListMediatype,
1634 wxT("PREF"), &ContactEditorData.BusinessTZListPref,
1635 wxT(""), &ContactEditorData.BusinessTZListTokens );
1637 ResetSaveProcessData();
1641 ResetSaveProcessData();
1643 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralGeographyList.begin();
1644 iter != ContactEditorData.GeneralGeographyList.end(); ++iter){
1646 wxString strGeoFinalValue = iter->second;
1648 ProcessCaptureStrings(&strGeoFinalValue);
1650 if (ContactEditorData.GeneralGeographyListDataType.find(iter->first) !=
1651 ContactEditorData.GeneralGeographyListDataType.end()){
1653 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.GeneralGeographyListDataType.find(iter->first);
1655 strGeoFinalValue.insert(0, ":");
1656 strGeoFinalValue.insert(0, DataTypeIter->second);
1660 strGeoFinalValue.insert(0, "geo:");
1664 ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
1665 &iter, &strGeoFinalValue, &ContactData,
1666 wxT("ALTID"), &ContactEditorData.GeneralGeographyListAltID,
1667 wxT("PID"), &ContactEditorData.GeneralGeographyListPID,
1668 wxT("MEDIATYPE"), &ContactEditorData.GeneralGeographyListMediatype,
1669 wxT("PREF"), &ContactEditorData.GeneralGeographyListPref,
1670 wxT(""), &ContactEditorData.GeneralGeographyListTokens );
1672 ResetSaveProcessData();
1676 ResetSaveProcessData();
1678 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeGeographyList.begin();
1679 iter != ContactEditorData.HomeGeographyList.end(); ++iter){
1681 wxString strGeoFinalValue = iter->second;
1683 ProcessCaptureStrings(&strGeoFinalValue);
1685 if (ContactEditorData.HomeGeographyListDataType.find(iter->first) !=
1686 ContactEditorData.HomeGeographyListDataType.end()){
1688 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.HomeGeographyListDataType.find(iter->first);
1690 strGeoFinalValue.insert(0, ":");
1691 strGeoFinalValue.insert(0, DataTypeIter->second);
1695 strGeoFinalValue.insert(0, "geo:");
1699 ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1700 &iter, &strGeoFinalValue, &ContactData,
1701 wxT("ALTID"), &ContactEditorData.HomeGeographyListAltID,
1702 wxT("PID"), &ContactEditorData.HomeGeographyListPID,
1703 wxT("MEDIATYPE"), &ContactEditorData.HomeGeographyListMediatype,
1704 wxT("PREF"), &ContactEditorData.HomeGeographyListPref,
1705 wxT(""), &ContactEditorData.HomeGeographyListTokens );
1707 ResetSaveProcessData();
1711 ResetSaveProcessData();
1713 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessGeographyList.begin();
1714 iter != ContactEditorData.BusinessGeographyList.end(); ++iter){
1716 wxString strGeoFinalValue = iter->second;
1718 ProcessCaptureStrings(&strGeoFinalValue);
1720 if (ContactEditorData.BusinessGeographyListDataType.find(iter->first) !=
1721 ContactEditorData.BusinessGeographyListDataType.end()){
1723 std::map<int,wxString>::iterator DataTypeIter = ContactEditorData.BusinessGeographyListDataType.find(iter->first);
1725 strGeoFinalValue.insert(0, ":");
1726 strGeoFinalValue.insert(0, DataTypeIter->second);
1730 strGeoFinalValue.insert(0, "geo:");
1734 ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1735 &iter, &strGeoFinalValue, &ContactData,
1736 wxT("ALTID"), &ContactEditorData.BusinessGeographyListAltID,
1737 wxT("PID"), &ContactEditorData.BusinessGeographyListPID,
1738 wxT("MEDIATYPE"), &ContactEditorData.BusinessGeographyListMediatype,
1739 wxT("PREF"), &ContactEditorData.BusinessGeographyListPref,
1740 wxT(""), &ContactEditorData.BusinessGeographyListTokens );
1742 ResetSaveProcessData();
1746 ResetSaveProcessData();
1748 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRelatedList.begin();
1749 iter != ContactEditorData.GeneralRelatedList.end(); ++iter){
1751 ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
1752 &iter, &ContactEditorData.GeneralRelatedList, &ContactData,
1753 wxT("ALTID"), &ContactEditorData.GeneralRelatedListAltID,
1754 wxT("PID"), &ContactEditorData.GeneralRelatedListPID,
1755 wxT("LANGUAGE"), &ContactEditorData.GeneralRelatedListLanguage,
1756 wxT("TYPE"), &ContactEditorData.GeneralRelatedListRelType,
1757 wxT("PREF"), &ContactEditorData.GeneralRelatedListPref,
1758 wxT(""), &ContactEditorData.GeneralRelatedListTokens );
1760 ResetSaveProcessData();
1764 ResetSaveProcessData();
1766 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralWebsiteList.begin();
1767 iter != ContactEditorData.GeneralWebsiteList.end(); ++iter){
1769 ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
1770 &iter, &ContactEditorData.GeneralWebsiteList, &ContactData,
1771 wxT("ALTID"), &ContactEditorData.GeneralWebsiteListAltID,
1772 wxT("PID"), &ContactEditorData.GeneralWebsiteListPID,
1773 wxT("MEDIATYPE"), &ContactEditorData.GeneralWebsiteListMediatype,
1774 wxT("PREF"), &ContactEditorData.GeneralWebsiteListPref,
1775 wxT(""), &ContactEditorData.GeneralWebsiteListTokens );
1777 ResetSaveProcessData();
1781 ResetSaveProcessData();
1783 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeWebsiteList.begin();
1784 iter != ContactEditorData.HomeWebsiteList.end(); ++iter){
1786 ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1787 &iter, &ContactEditorData.HomeWebsiteList, &ContactData,
1788 wxT("ALTID"), &ContactEditorData.HomeWebsiteListAltID,
1789 wxT("PID"), &ContactEditorData.HomeWebsiteListPID,
1790 wxT("MEDIATYPE"), &ContactEditorData.HomeWebsiteListMediatype,
1791 wxT("PREF"), &ContactEditorData.HomeWebsiteListPref,
1792 wxT(""), &ContactEditorData.HomeWebsiteListTokens );
1794 ResetSaveProcessData();
1798 ResetSaveProcessData();
1800 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessWebsiteList.begin();
1801 iter != ContactEditorData.BusinessWebsiteList.end(); ++iter){
1803 ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1804 &iter, &ContactEditorData.BusinessWebsiteList, &ContactData,
1805 wxT("ALTID"), &ContactEditorData.BusinessWebsiteListAltID,
1806 wxT("PID"), &ContactEditorData.BusinessWebsiteListPID,
1807 wxT("MEDIATYPE"), &ContactEditorData.BusinessWebsiteListMediatype,
1808 wxT("PREF"), &ContactEditorData.BusinessWebsiteListPref,
1809 wxT(""), &ContactEditorData.BusinessWebsiteListTokens );
1811 ResetSaveProcessData();
1815 ResetSaveProcessData();
1817 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralTitleList.begin();
1818 iter != ContactEditorData.GeneralTitleList.end(); ++iter){
1820 ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
1821 &iter, &ContactEditorData.GeneralTitleList, &ContactData,
1822 wxT("ALTID"), &ContactEditorData.GeneralTitleListAltID,
1823 wxT("PID"), &ContactEditorData.GeneralTitleListPID,
1824 wxT("LANGUAGE"), &ContactEditorData.GeneralTitleListLanguage,
1825 wxT("PREF"), &ContactEditorData.GeneralTitleListPref,
1826 wxT(""), &ContactEditorData.GeneralTitleListTokens );
1828 ResetSaveProcessData();
1832 ResetSaveProcessData();
1834 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeTitleList.begin();
1835 iter != ContactEditorData.HomeTitleList.end(); ++iter){
1837 ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1838 &iter, &ContactEditorData.HomeTitleList, &ContactData,
1839 wxT("ALTID"), &ContactEditorData.HomeTitleListAltID,
1840 wxT("PID"), &ContactEditorData.HomeTitleListPID,
1841 wxT("LANGUAGE"), &ContactEditorData.HomeTitleListLanguage,
1842 wxT("PREF"), &ContactEditorData.HomeTitleListPref,
1843 wxT(""), &ContactEditorData.HomeTitleListTokens );
1845 ResetSaveProcessData();
1849 ResetSaveProcessData();
1851 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessTitleList.begin();
1852 iter != ContactEditorData.BusinessTitleList.end(); ++iter){
1854 ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1855 &iter, &ContactEditorData.BusinessTitleList, &ContactData,
1856 wxT("ALTID"), &ContactEditorData.BusinessTitleListAltID,
1857 wxT("PID"), &ContactEditorData.BusinessTitleListPID,
1858 wxT("LANGUAGE"), &ContactEditorData.BusinessTitleListLanguage,
1859 wxT("PREF"), &ContactEditorData.BusinessTitleListPref,
1860 wxT(""), &ContactEditorData.BusinessTitleListTokens );
1862 ResetSaveProcessData();
1866 ResetSaveProcessData();
1868 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralRoleList.begin();
1869 iter != ContactEditorData.GeneralRoleList.end(); ++iter){
1871 ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
1872 &iter, &ContactEditorData.GeneralRoleList, &ContactData,
1873 wxT("ALTID"), &ContactEditorData.GeneralRoleListAltID,
1874 wxT("PID"), &ContactEditorData.GeneralRoleListPID,
1875 wxT("LANGUAGE"), &ContactEditorData.GeneralRoleListLanguage,
1876 wxT("PREF"), &ContactEditorData.GeneralRoleListPref,
1877 wxT(""), &ContactEditorData.GeneralRoleListTokens );
1879 ResetSaveProcessData();
1883 ResetSaveProcessData();
1885 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeRoleList.begin();
1886 iter != ContactEditorData.HomeRoleList.end(); ++iter){
1888 ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1889 &iter, &ContactEditorData.HomeRoleList, &ContactData,
1890 wxT("ALTID"), &ContactEditorData.HomeRoleListAltID,
1891 wxT("PID"), &ContactEditorData.HomeRoleListPID,
1892 wxT("LANGUAGE"), &ContactEditorData.HomeRoleListLanguage,
1893 wxT("PREF"), &ContactEditorData.HomeRoleListPref,
1894 wxT(""), &ContactEditorData.HomeRoleListTokens );
1896 ResetSaveProcessData();
1900 ResetSaveProcessData();
1902 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessRoleList.begin();
1903 iter != ContactEditorData.BusinessRoleList.end(); ++iter){
1905 ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1906 &iter, &ContactEditorData.BusinessRoleList, &ContactData,
1907 wxT("ALTID"), &ContactEditorData.BusinessRoleListAltID,
1908 wxT("PID"), &ContactEditorData.BusinessRoleListPID,
1909 wxT("LANGUAGE"), &ContactEditorData.BusinessRoleListLanguage,
1910 wxT("PREF"), &ContactEditorData.BusinessRoleListPref,
1911 wxT(""), &ContactEditorData.BusinessRoleListTokens );
1913 ResetSaveProcessData();
1917 ResetSaveProcessData();
1919 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralOrganisationsList.begin();
1920 iter != ContactEditorData.GeneralOrganisationsList.end(); ++iter){
1922 ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
1923 &iter, &ContactEditorData.GeneralOrganisationsList, &ContactData,
1924 wxT("ALTID"), &ContactEditorData.GeneralOrganisationsListAltID,
1925 wxT("PID"), &ContactEditorData.GeneralOrganisationsListPID,
1926 wxT("LANGUAGE"), &ContactEditorData.GeneralOrganisationsListLanguage,
1927 wxT("SORT-AS"), &ContactEditorData.GeneralOrganisationsListSortAs,
1928 wxT("PREF"), &ContactEditorData.GeneralOrganisationsListPref,
1929 wxT(""), &ContactEditorData.GeneralOrganisationsListTokens );
1931 ResetSaveProcessData();
1935 ResetSaveProcessData();
1937 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeOrganisationsList.begin();
1938 iter != ContactEditorData.HomeOrganisationsList.end(); ++iter){
1940 ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1941 &iter, &ContactEditorData.HomeOrganisationsList, &ContactData,
1942 wxT("ALTID"), &ContactEditorData.HomeOrganisationsListAltID,
1943 wxT("PID"), &ContactEditorData.HomeOrganisationsListPID,
1944 wxT("LANGUAGE"), &ContactEditorData.HomeOrganisationsListLanguage,
1945 wxT("SORT-AS"), &ContactEditorData.HomeOrganisationsListSortAs,
1946 wxT("PREF"), &ContactEditorData.HomeOrganisationsListPref,
1947 wxT(""), &ContactEditorData.HomeOrganisationsListTokens );
1949 ResetSaveProcessData();
1953 ResetSaveProcessData();
1955 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessOrganisationsList.begin();
1956 iter != ContactEditorData.BusinessOrganisationsList.end(); ++iter){
1958 ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
1959 &iter, &ContactEditorData.BusinessOrganisationsList, &ContactData,
1960 wxT("ALTID"), &ContactEditorData.BusinessOrganisationsListAltID,
1961 wxT("PID"), &ContactEditorData.BusinessOrganisationsListPID,
1962 wxT("LANGUAGE"), &ContactEditorData.BusinessOrganisationsListLanguage,
1963 wxT("SORT-AS"), &ContactEditorData.BusinessOrganisationsListSortAs,
1964 wxT("PREF"), &ContactEditorData.BusinessOrganisationsListPref,
1965 wxT(""), &ContactEditorData.BusinessOrganisationsListTokens );
1967 ResetSaveProcessData();
1971 ResetSaveProcessData();
1973 for (std::map<int,wxString>::iterator iter = ContactEditorData.GeneralNoteList.begin();
1974 iter != ContactEditorData.GeneralNoteList.end(); ++iter){
1976 ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
1977 &iter, &ContactEditorData.GeneralNoteList, &ContactData,
1978 wxT("ALTID"), &ContactEditorData.GeneralNoteListAltID,
1979 wxT("PID"), &ContactEditorData.GeneralNoteListPID,
1980 wxT("LANGUAGE"), &ContactEditorData.GeneralNoteListLanguage,
1981 wxT("PREF"), &ContactEditorData.GeneralNoteListPref,
1982 wxT(""), &ContactEditorData.GeneralNoteListTokens );
1984 ResetSaveProcessData();
1988 ResetSaveProcessData();
1990 for (std::map<int,wxString>::iterator iter = ContactEditorData.HomeNoteList.begin();
1991 iter != ContactEditorData.HomeNoteList.end(); ++iter){
1993 ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
1994 &iter, &ContactEditorData.HomeNoteList, &ContactData,
1995 wxT("ALTID"), &ContactEditorData.HomeNoteListAltID,
1996 wxT("PID"), &ContactEditorData.HomeNoteListPID,
1997 wxT("LANGUAGE"), &ContactEditorData.HomeNoteListLanguage,
1998 wxT("PREF"), &ContactEditorData.HomeNoteListPref,
1999 wxT(""), &ContactEditorData.HomeNoteListTokens );
2001 ResetSaveProcessData();
2005 ResetSaveProcessData();
2007 for (std::map<int,wxString>::iterator iter = ContactEditorData.BusinessNoteList.begin();
2008 iter != ContactEditorData.BusinessNoteList.end(); ++iter){
2010 ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
2011 &iter, &ContactEditorData.BusinessNoteList, &ContactData,
2012 wxT("ALTID"), &ContactEditorData.BusinessNoteListAltID,
2013 wxT("PID"), &ContactEditorData.BusinessNoteListPID,
2014 wxT("LANGUAGE"), &ContactEditorData.BusinessNoteListLanguage,
2015 wxT("PREF"), &ContactEditorData.BusinessNoteListPref,
2016 wxT(""), &ContactEditorData.BusinessNoteListTokens );
2018 ResetSaveProcessData();
2022 ResetSaveProcessData();
2024 for (std::map<int,wxString>::iterator iter = ContactEditorData.CategoriesList.begin();
2025 iter != ContactEditorData.CategoriesList.end(); ++iter){
2027 ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
2028 &iter, &ContactEditorData.CategoriesList, &ContactData,
2029 wxT("ALTID"), &ContactEditorData.CategoriesListAltID,
2030 wxT("PID"), &ContactEditorData.CategoriesListPID,
2031 wxT("TYPE"), &ContactEditorData.CategoriesListType,
2032 wxT("PREF"), &ContactEditorData.CategoriesListPref,
2033 wxT(""), &ContactEditorData.CategoriesListTokens );
2035 ResetSaveProcessData();
2041 for (std::map<int, std::string>::iterator iter = ContactEditorData.PicturesList.begin();
2042 iter != ContactEditorData.PicturesList.end(); ++iter){
2044 int intValueIndex = iter->first;
2046 std::map<int, std::string>::iterator stdstriter;
2047 std::map<int, wxString>::iterator enciter;
2049 striter = ContactEditorData.PicturesListPictureType.find(intValueIndex);
2050 enciter = ContactEditorData.PicturesListPicEncType.find(intValueIndex);
2052 ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
2053 &iter, &ContactEditorData.PicturesList, &striter,
2054 &enciter, &ContactData,
2055 wxT("ALTID"), &ContactEditorData.PicturesListAltID,
2056 wxT("PID"), &ContactEditorData.PicturesListPID,
2057 wxT("TYPE"), &ContactEditorData.PicturesListType,
2058 wxT("PREF"), &ContactEditorData.PicturesListPref,
2059 wxT(""), &ContactEditorData.PicturesListTokens);
2061 ResetSaveProcessData();
2065 ResetSaveProcessData();
2069 for (std::map<int, std::string>::iterator iter = ContactEditorData.LogosList.begin();
2070 iter != ContactEditorData.LogosList.end(); ++iter){
2072 int intValueIndex = iter->first;
2074 std::map<int, std::string>::iterator stdstriter;
2075 std::map<int, wxString>::iterator enciter;
2077 striter = ContactEditorData.LogosListPictureType.find(intValueIndex);
2078 enciter = ContactEditorData.LogosListPicEncType.find(intValueIndex);
2080 ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
2081 &iter, &ContactEditorData.LogosList, &striter,
2082 &enciter, &ContactData,
2083 wxT("ALTID"), &ContactEditorData.LogosListAltID,
2084 wxT("PID"), &ContactEditorData.LogosListPID,
2085 wxT("TYPE"), &ContactEditorData.LogosListType,
2086 wxT("PREF"), &ContactEditorData.LogosListPref,
2087 wxT(""), &ContactEditorData.LogosListTokens );
2089 ResetSaveProcessData();
2093 ResetSaveProcessData();
2097 for (std::map<int, std::string>::iterator iter = ContactEditorData.SoundsList.begin();
2098 iter != ContactEditorData.SoundsList.end(); ++iter){
2100 int intValueIndex = iter->first;
2102 std::map<int, std::string>::iterator stdstriter;
2103 std::map<int, wxString>::iterator enciter;
2105 striter = ContactEditorData.SoundsListAudioType.find(intValueIndex);
2106 enciter = ContactEditorData.SoundsListAudioEncType.find(intValueIndex);
2108 ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
2109 &iter, &ContactEditorData.SoundsList, &striter,
2110 &enciter, &ContactData,
2111 wxT("ALTID"), &ContactEditorData.SoundsListAltID,
2112 wxT("PID"), &ContactEditorData.SoundsListPID,
2113 wxT("TYPE"), &ContactEditorData.SoundsListType,
2114 wxT("PREF"), &ContactEditorData.SoundsListPref,
2115 wxT(""), &ContactEditorData.SoundsListTokens );
2117 ResetSaveProcessData();
2121 ResetSaveProcessData();
2123 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarList.begin();
2124 iter != ContactEditorData.CalendarList.end(); ++iter){
2126 ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
2127 &iter, &ContactEditorData.CalendarList, &ContactData,
2128 wxT("ALTID"), &ContactEditorData.CalendarListAltID,
2129 wxT("PID"), &ContactEditorData.CalendarListPID,
2130 wxT("MEDIATYPE"), &ContactEditorData.CalendarListMediatype,
2131 wxT("TYPE"), &ContactEditorData.CalendarListType,
2132 wxT("PREF"), &ContactEditorData.CalendarListPref,
2133 wxT(""), &ContactEditorData.CalendarListTokens );
2135 ResetSaveProcessData();
2139 ResetSaveProcessData();
2141 for (std::map<int,wxString>::iterator iter = ContactEditorData.CalendarRequestList.begin();
2142 iter != ContactEditorData.CalendarRequestList.end(); ++iter){
2144 ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
2145 &iter, &ContactEditorData.CalendarRequestList, &ContactData,
2146 wxT("ALTID"), &ContactEditorData.CalendarRequestListAltID,
2147 wxT("PID"), &ContactEditorData.CalendarRequestListPID,
2148 wxT("MEDIATYPE"), &ContactEditorData.CalendarRequestListMediatype,
2149 wxT("TYPE"), &ContactEditorData.CalendarRequestListType,
2150 wxT("PREF"), &ContactEditorData.CalendarRequestListPref,
2151 wxT(""), &ContactEditorData.CalendarRequestListTokens );
2153 ResetSaveProcessData();
2157 ResetSaveProcessData();
2159 for (std::map<int,wxString>::iterator iter = ContactEditorData.FreeBusyList.begin();
2160 iter != ContactEditorData.FreeBusyList.end(); ++iter){
2162 ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
2163 &iter, &ContactEditorData.FreeBusyList, &ContactData,
2164 wxT("ALTID"), &ContactEditorData.FreeBusyListAltID,
2165 wxT("PID"), &ContactEditorData.FreeBusyListPID,
2166 wxT("MEDIATYPE"), &ContactEditorData.FreeBusyListMediatype,
2167 wxT("TYPE"), &ContactEditorData.FreeBusyListType,
2168 wxT("PREF"), &ContactEditorData.FreeBusyListPref,
2169 wxT(""), &ContactEditorData.FreeBusyListTokens );
2171 ResetSaveProcessData();
2175 for (std::map<int, wxString>::iterator iter = ContactEditorData.KeyList.begin();
2176 iter != ContactEditorData.KeyList.end(); ++iter){
2178 intValue2 = iter->first;
2180 // Get the key information.
2182 std::map<int, wxString>::iterator enciter;
2184 striter = ContactEditorData.KeyListDataType.find(intValue2);
2186 wxString strValueData;
2188 strValueData = iter->second;
2189 strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));
2191 ProcessSaveData(wxT("KEY"), &strValue2, &boolValue2, &boolValue,
2192 &iter, &strValueData, &ContactData,
2193 wxT("ALTID"), &ContactEditorData.KeyListAltID,
2194 wxT("PID"), &ContactEditorData.KeyListPID,
2195 wxT("TYPE"), &ContactEditorData.KeyListType,
2196 wxT("PREF"), &ContactEditorData.KeyListPref,
2197 wxT(""), &ContactEditorData.KeyListTokens );
2199 ResetSaveProcessData();
2203 // Vendor specific items.
2205 ResetSaveProcessData();
2207 for (std::map<int,wxString>::iterator iter = ContactEditorData.VendorList.begin();
2208 iter != ContactEditorData.VendorList.end(); ++iter){
2210 intValue2 = iter->first;
2212 // Get the IANA PEN number.
2214 striter = ContactEditorData.VendorListPEN.find(intValue2);
2216 if (striter->first == intValue2){
2218 strValue2 = striter->second;
2222 // Get the element name.
2224 striter = ContactEditorData.VendorListElement.find(intValue2);
2226 if (striter->first == intValue2){
2228 strValue3 = striter->second;
2234 striter = ContactEditorData.VendorList.find(intValue2);
2236 if (striter->first == intValue2){
2238 strValue = striter->second;
2242 // Add to the vCard.
2244 if (boolValue == TRUE){
2246 ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
2250 ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
2254 ResetSaveProcessData();
2258 ResetSaveProcessData();
2262 for (std::map<int,wxString>::iterator iter = ContactEditorData.XTokenList.begin();
2263 iter != ContactEditorData.XTokenList.end(); ++iter){
2265 intValue2 = iter->first;
2267 // Get the element name.
2269 striter = ContactEditorData.XTokenListTokens.find(intValue2);
2271 if (striter->first == intValue2){
2273 strValue2 = striter->second;
2279 striter = ContactEditorData.XTokenList.find(intValue2);
2281 if (striter->first == intValue2){
2283 strValue = striter->second;
2287 // Add to the vCard.
2289 if (boolValue == TRUE){
2291 ContactData.AddRaw(wxT("X-") + strValue2, strValue);
2295 ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
2299 ResetSaveProcessData();
2303 ResetSaveProcessData();
2305 if (ContactEditorData.FullNamesList.size() == 0){
2307 wxString FullName = cmbDisplayAs->GetValue();
2308 ContactEditorData.FullNamesList.insert(std::make_pair(0, FullName));
2309 ContactEditorData.FullNamesListAltID.insert(std::make_pair(0, wxT("")));
2310 ContactEditorData.FullNamesListPID.insert(std::make_pair(0, wxT("")));
2311 ContactEditorData.FullNamesListType.insert(std::make_pair(0, wxT("")));
2312 ContactEditorData.FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
2313 ContactEditorData.FullNamesListPref.insert(std::make_pair(0, 0));
2314 ContactEditorData.FullNamesListTokens.insert(std::make_pair(0, wxT("")));
2319 for (std::map<int, wxString>::iterator iter = ContactEditorData.FullNamesList.begin();
2320 iter != ContactEditorData.FullNamesList.end(); ++iter){
2322 if (FNFirst == TRUE){
2324 iter->second = cmbDisplayAs->GetValue();
2329 std::map<int,wxString>::iterator mapS;
2331 mapS = ContactEditorData.FullNamesListTokens.find(iter->first);
2333 ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue,
2334 &iter, &ContactEditorData.FullNamesList, &ContactData,
2335 wxT("ALTID"), &ContactEditorData.FullNamesListAltID,
2336 wxT("PID"), &ContactEditorData.FullNamesListPID,
2337 wxT("TYPE"), &ContactEditorData.FullNamesListType,
2338 wxT("LANGUAGE"), &ContactEditorData.FullNamesListLanguage,
2339 wxT("PREF"), &ContactEditorData.FullNamesListPref,
2340 wxT(""), &ContactEditorData.FullNamesListTokens );
2344 ResetSaveProcessData();
2348 // Insert revision (REV) date.
2350 // Get today's date and time.
2352 wxDateTime DateTimeNow = wxDateTime::Now();
2356 // Set year, month and date.
2358 int intYear = DateTimeNow.GetYear();
2359 int intMonth = DateTimeNow.GetMonth();
2360 int intDay = DateTimeNow.GetDay();
2362 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
2366 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
2370 DateRev.Append(wxString::Format(wxT("%i"), intMonth));
2376 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
2380 DateRev.Append(wxString::Format(wxT("%i"), intDay));
2384 DateRev.Append(wxT("T"));
2386 // Set hour, minute and second.
2388 int intHour = DateTimeNow.GetHour();
2389 int intMinute = DateTimeNow.GetMinute();
2390 int intSecond = DateTimeNow.GetSecond();
2394 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
2398 DateRev.Append(wxString::Format(wxT("%i"), intHour));
2402 if (intMinute < 10){
2404 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
2408 DateRev.Append(wxString::Format(wxT("%i"), intMinute));
2412 if (intSecond < 10){
2414 DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
2418 DateRev.Append(wxString::Format(wxT("%i"), intSecond));
2422 DateRev.Append(wxT("Z"));
2424 ContactData.Add(wxT("UID"), ContactEditorData.UIDToken, FALSE);
2426 // End the vCard File.
2428 ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);*/
2431 ContactEditorData.SaveFile(FilenameFinal);
2432 //ContactData.WriteFile(FilenameFinal);
2434 vCard34Conv ConvFileFun;
2438 ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
2440 wxString AccountDirPrefix;
2441 wxString AccountDir;
2444 #if defined(__HAIKU__)
2446 #elif defined(__APPLE__)
2448 PrefDir = GetUserPrefDir();
2450 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2452 #elif defined(__WIN32__)
2454 PrefDir = GetUserPrefDir();
2456 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
2460 PrefDir = GetUserPrefDir();
2462 wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
2466 XABPreferences PrefData(PrefDir);
2468 wxString AccountType;
2470 for (int i = 0; i < PrefData.accounts.GetCount(); i++){
2472 AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
2474 if (AccountDir == wxSContactAccount){
2476 AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
2477 AccountDirPrefix.Trim();
2478 AccountType = PrefData.accounts.GetAccountType(i);
2485 wxString wxSplitFilename;
2486 wxString wxSDataURL;
2488 while(wSTFilename.HasMoreTokens()){
2490 wxSplitFilename = wSTFilename.GetNextToken();
2494 wxSDataURL = wxSplitFilename;
2496 // Find out if the filename exists in the table.
2498 if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
2500 wxString ETagResult;
2501 wxString ETagOriginal;
2503 ETagDB *ETagDBPtr = NULL;
2505 ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
2507 wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
2508 wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
2510 if (wxSETagOrig.IsEmpty()){
2512 // Generate the ETag.
2514 wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2518 if (wxSETag.IsEmpty()){
2520 // Update empty ETag.
2522 wxSETag = wxSETagOrig;
2523 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
2527 // Don't change original ETag.
2529 wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
2530 ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
2534 if (EditMode == FALSE){
2536 ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2538 FMTimer.SetFilename(FilenameFinal);
2539 FMTimer.UpdateTimestamp();
2540 FMTimer.Start(10000, FALSE);
2542 wxCommandEvent reloadevent(RELOADCONTACTLIST);
2543 reloadevent.SetString(wxSContactAccount);
2544 wxPostEvent(this->GetParent(), reloadevent);
2548 ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
2549 FMTimer.UpdateTimestamp();
2550 FMTimer.Start(10000, FALSE);
2556 // Send a notification to update the main window
2557 // with the new details.
2562 // TODO: Workout nickname settings by priority and
2567 NameData.Forename = txtForename->GetValue();
2568 NameData.Surname = txtSurname->GetValue();
2569 NameData.OtherNames = txtOtherNames->GetValue();
2570 NameData.Title = txtTitle->GetValue();
2571 NameData.Suffix = txtSuffix->GetValue();
2573 ucd->ContactAccount = wxSContactAccount;
2574 ucd->ContactFilename = FilenameFinal;
2575 ucd->ContactName = cmbDisplayAs->GetValue();
2576 ucd->ContactNameArray = NameData;
2578 for (std::map<int,wxString>::iterator gniter = ContactEditorData.GeneralNicknamesList.begin();
2579 gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){
2581 ucd->ContactNickname = gniter->second;
2586 wxCommandEvent event2(CE_UPDATECONTACTLIST);
2587 event2.SetClientData(ucd);
2588 wxPostEvent(MainPtr, event2);
2592 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
2595 // Save the updated contact data and close the form.
2597 wxCommandEvent NullEvent;
2598 this->SaveContact(NullEvent);