4 #include <wx/tokenzr.h>
5 #include <wx/datetime.h>
8 #include "frmContactEditor.h"
11 #include "../version.h"
12 #include "../vcard/vcard.h"
13 #include "../common/textprocessing.h"
14 #include "../common/dirs.h"
16 bool frmContactEditor::LoadContact(wxString Filename){
18 // Load the contact into the contact editor.
21 wxString wxSContactString;
24 XABViewMode XVMData = MainPtr->GetViewMode();
26 wxSContactFilename = Filename;
28 // Check if we are using wxWidgets version 2.8 or less and
29 // execute the required command accordingly.
31 #if wxABI_VERSION < 20900
32 ContactFile.Open(Filename.c_str(), wxT("r"));
34 ContactFile.Open(Filename, wxT("r"));
37 if (ContactFile.IsOpened() == FALSE){
43 ContactFile.ReadAll(&wxSContactString, wxConvAuto());
47 std::map<int, wxString> ContactFileLines;
48 std::map<int, wxString>::iterator striter;
50 wxStringTokenizer wSTContactFileLines(wxSContactString, wxT("\r\n"));
52 int ContactLineSeek = 0;
54 while (wSTContactFileLines.HasMoreTokens() == TRUE){
56 ContactLine = wSTContactFileLines.GetNextToken();
57 ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine));
64 bool QuoteMode = FALSE;
65 bool PropertyFind = TRUE;
66 bool HasExtraNicknames = FALSE;
67 bool IgnoreGender = FALSE;
68 bool ExtraLineSeek = TRUE;
69 bool BirthdayProcessed = FALSE;
70 bool AnniversaryProcessed = FALSE;
71 bool FNProcessed = FALSE;
72 bool GenderProcessed = FALSE;
73 bool NameProcessed = FALSE;
74 bool UIDProcessed = FALSE;
75 bool KindProcessed = FALSE;
76 bool ETagFound = FALSE;
77 bool ETagOrigFound = FALSE;
78 int intExtraNickname = 0;
80 wxString wxSPropertySeg1;
81 wxString wxSPropertySeg2;
82 wxString wxSPropertyNextLine;
83 size_t ContactLineLen = 0;
84 int QuoteBreakPoint = 0;
87 int NicknameCount = 0;
101 int CategoryCount = 0;
107 int CalReqAdrCount = 0;
108 int FreeBusyCount = 0;
112 //int intValueSeek = 1;
114 for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
115 iter != ContactFileLines.end(); ++iter){
117 // Find the colon which splits the start bit from the data part.
119 ContactLine = iter->second;
121 while (ExtraLineSeek == TRUE){
123 // Check if there is extra data on the next line
124 // (indicated by space or tab at the start) and add data.
128 if (iter == ContactFileLines.end()){
135 wxSPropertyNextLine = iter->second;
138 if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
140 wxSPropertyNextLine.Remove(0, 1);
141 //wxSPropertyNextLine.Trim(FALSE);
142 //ContactLine.Trim();
143 ContactLine.Append(wxSPropertyNextLine);
148 ExtraLineSeek = FALSE;
154 ContactLineLen = ContactLine.Len();
156 // Make sure we are not in quotation mode.
157 // Make sure colon does not have \ or \\ before it.
159 for (int i = 0; i <= ContactLineLen; i++){
161 if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
163 PropertyFind = FALSE;
165 } else if (PropertyFind == TRUE){
167 wxSProperty.Append(ContactLine.Mid(i, 1));
171 if (ContactLine.Mid(i, 1) == wxT("\"")){
173 if (QuoteMode == TRUE){
185 if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
194 // Split that line at the point into two variables (ignore the colon).
196 wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
197 wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
199 // Add the data into the contact editor depending on what it is.
201 if (wxSProperty == wxT("KIND") && KindProcessed == FALSE){
203 std::map<int, int> SplitPoints;
204 std::map<int, int> SplitLength;
205 std::map<int, int>::iterator SLiter;
206 wxString PropertyData;
207 wxString PropertyName;
208 wxString PropertyValue;
209 wxString PropertyTokens;
211 if (wxSPropertySeg2 == wxT("individual")){
213 cmbType->SetSelection(1);
215 } else if (wxSPropertySeg2 == wxT("group")){
217 cmbType->SetSelection(2);
220 } else if (wxSPropertySeg2 == wxT("org")){
222 cmbType->SetSelection(3);
224 } else if (wxSPropertySeg2 == wxT("location")){
226 cmbType->SetSelection(4);
230 cmbType->SetSelection(0);
234 wxCommandEvent nullevent;
236 UpdateMembersTab(nullevent);
238 } else if (wxSProperty == wxT("MEMBER")){
240 std::map<int, int> SplitPoints;
241 std::map<int, int> SplitLength;
242 std::map<int, int>::iterator SLiter;
243 wxString PropertyData;
244 wxString PropertyName;
245 wxString PropertyValue;
246 wxString PropertyTokens;
248 // Go through the list of contacts for the account and find the matching UID.
249 // If contact with UID doesn't match then say (unknown contact).
251 wxString AccountDirFinal = GetAccountDir(wxSContactAccount, FALSE);
253 //wxString vcardfilenamewxs;
254 wxString vCardFilename;
255 wxString vCardFilenameFull;
256 wxString vCardDataString;
257 //wxStringTokenizer vcardfileline;
259 wxString setname, setvalue;
260 //vCardNames = new std::map<wxString, wxString, std::greater<wxString>>;
261 std::multimap<wxString, wxString, std::greater<wxString>> vCardNamesAsc;
262 std::multimap<wxString, wxString, std::less<wxString>> vCardNamesDsc;
264 wxDir vcardaccdir(AccountDirFinal);
266 bool ProcFiles = vcardaccdir.GetFirst(&vCardFilename, wxEmptyString, wxDIR_FILES);
269 if (vCardFilename.Right(4) == wxT(".vcf") ||
270 vCardFilename.Right(4) == wxT(".VCF") ||
271 vCardFilename.Right(5) == wxT(".vcard") ||
272 vCardFilename.Right(5) == wxT(".VCARD")){
276 vCardFilenameFull.Append(AccountDirFinal);
277 vCardFilenameFull.Append(wxT("/"));
278 vCardFilenameFull.Append(vCardFilename);
280 Person.LoadFile(vCardFilenameFull);
282 if (wxSPropertySeg2.Left(9) == wxT("urn:uuid:")){
284 wxString NewPropValue;
285 NewPropValue = wxSPropertySeg2.Mid(9, wxString::npos);
286 wxSPropertySeg2 = NewPropValue;
290 if (Person.MeetBaseSpecification()){
292 wxString KindStatus = Person.Get(wxT("KIND"));
294 if (KindStatus == wxT("group")){
296 vCardFilename.Clear();
297 vCardFilenameFull.Clear();
298 vCardDataString.Clear();
299 ProcFiles = vcardaccdir.GetNext(&vCardFilename);
304 wxString PersonName = Person.Get(wxT("N"));
305 wxString PersonUID = Person.Get(wxT("UID"));
306 wxString PersonFilename = vCardFilenameFull;
308 if (PersonUID != wxSPropertySeg2){
310 vCardFilename.Clear();
311 vCardFilenameFull.Clear();
312 vCardDataString.Clear();
313 ProcFiles = vcardaccdir.GetNext(&vCardFilename);
318 //ContactsNames.insert(std::make_pair(PersonName, ContactIndex));
319 //ContactsUIDs.insert(std::make_pair(ContactIndex, PersonUID));
321 if (XVMData.SortMode == 1){
323 // Split the name into sections.
325 vCardDataString = Person.Get(wxT("N"));
327 vCardName NameData = Person.GetName();
329 vCardDataString = NameData.Forename + wxT(" ") + NameData.Surname;
331 } else if (XVMData.SortMode == 2){
333 // Split the name into sections.
335 vCardName NameData = Person.GetName();
337 vCardDataString = NameData.Surname + wxT(", ") + NameData.Forename;
339 } else if (XVMData.SortMode == 3){
341 // Check and make sure that the top most nickname is used.
343 vCardDataString = Person.Get(wxT("NICKNAME"));
345 if (vCardDataString.IsEmpty()){
347 vCardDataString = wxT("(no nickname)");
351 } else if (XVMData.SortMode == 4){
353 vCardDataString = Person.Get(wxT("FN"));
357 if (XVMData.AscendingMode == TRUE){
358 vCardNamesAsc.insert(std::make_pair(vCardDataString, PersonUID));
360 vCardNamesDsc.insert(std::make_pair(vCardDataString, PersonUID));
371 vCardFilename.Clear();
372 vCardFilenameFull.Clear();
373 vCardDataString.Clear();
374 ProcFiles = vcardaccdir.GetNext(&vCardFilename);
378 if (XVMData.AscendingMode == TRUE){
380 for (std::map<wxString,wxString>::iterator iter = vCardNamesAsc.begin();
381 iter != vCardNamesAsc.end(); ++iter){
386 ItemData.SetText(iter->first);
388 lboGroups->InsertItem(ItemData);
390 GroupsList.insert(std::make_pair(intValueSeek, iter->second));
397 for (std::map<wxString,wxString>::iterator iter = vCardNamesDsc.begin();
398 iter != vCardNamesDsc.end(); ++iter){
403 ItemData.SetText(iter->first);
405 lboGroups->InsertItem(ItemData);
407 GroupsList.insert(std::make_pair(intValueSeek, iter->second));
416 } else if (wxSProperty == wxT("FN")){
420 NameDisplayAs = wxSPropertySeg2;
421 cmbDisplayAs->SetValue(ContactData.Convert(wxSPropertySeg2, TRUE));
425 size_t intPropertyLen = wxSPropertySeg1.Len();
426 std::map<int, int> SplitPoints;
427 std::map<int, int> SplitLength;
428 std::map<int, int>::iterator SLiter;
429 wxString PropertyData;
430 wxString PropertyName;
431 wxString PropertyValue;
432 wxString PropertyTokens;
433 bool FirstToken = TRUE;
434 int intSplitsFound = 0;
435 int intSplitSize = 0;
436 int intPrevValue = 4;
440 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
444 // Look for type before continuing.
446 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
447 intiter != SplitPoints.end(); ++intiter){
449 SLiter = SplitLength.find(intiter->first);
451 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
453 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
454 PropertyName = PropertyElement.GetNextToken();
455 PropertyValue = PropertyElement.GetNextToken();
457 intPrevValue = intiter->second;
459 if (PropertyName == wxT("TYPE")){
461 if (PropertyValue == wxT("work")){
465 } else if (PropertyValue == wxT("home")){
479 // Setup blank lines for later on.
481 FullNamesList.insert(std::make_pair(intValueSeek, wxT("")));
482 FullNamesListAltID.insert(std::make_pair(intValueSeek, wxT("")));
483 FullNamesListPID.insert(std::make_pair(intValueSeek, wxT("")));
484 FullNamesListPref.insert(std::make_pair(intValueSeek, 0));
485 FullNamesListType.insert(std::make_pair(intValueSeek, wxT("")));
486 FullNamesListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
487 FullNamesListTokens.insert(std::make_pair(intValueSeek, wxT("")));
491 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
492 intiter != SplitPoints.end(); ++intiter){
494 SLiter = SplitLength.find(intiter->first);
496 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
498 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
499 PropertyName = PropertyElement.GetNextToken();
500 PropertyValue = PropertyElement.GetNextToken();
502 ProcessCaptureStrings(&PropertyValue);
504 intPrevValue = intiter->second;
506 // Process properties.
508 if (PropertyName == wxT("ALTID")){
510 FullNamesListAltID.erase(intValueSeek); FullNamesListAltID.insert(std::make_pair(intValueSeek, PropertyValue));
512 } else if (PropertyName == wxT("PID")){
514 FullNamesListPID.erase(intValueSeek); FullNamesListPID.insert(std::make_pair(intValueSeek, PropertyValue));
516 } else if (PropertyName == wxT("PREF")){
518 intPref = wxAtoi(PropertyValue);
520 if (intPref > 0 && intPref < 101){
522 FullNamesListPref.erase(intValueSeek); FullNamesListPref.insert(std::make_pair(intValueSeek, intPref));
526 } else if (PropertyName == wxT("LANG")){
528 FullNamesListLanguage.erase(intValueSeek); FullNamesListLanguage.insert(std::make_pair(intValueSeek, PropertyValue));
532 // Something else we don't know about so append
533 // to the tokens variable.
535 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
537 if (FirstToken == TRUE){
539 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
544 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
554 // Split the address.
556 //std::map<int, int>::iterator SLiter;
557 intPropertyLen = wxSPropertySeg2.Len();
564 for (int i = 0; i <= intPropertyLen; i++){
568 if (wxSPropertySeg2.Mid(i, 1) == wxT(":") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
571 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
573 if (intSplitsFound == 1){
575 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
586 // Add the data to the General/Home/Work address variables.
592 coldata.SetId(intValueSeek);
593 coldata.SetData(intValueSeek);
594 coldata.SetText(IMPPType);
598 //ProcessCaptureStrings(wxsPropertySeg2);
600 ProcessCaptureStrings(&wxSPropertySeg2);
602 FullNamesList.erase(intValueSeek);
603 FullNamesListType.erase(intValueSeek);
604 FullNamesListTokens.erase(intValueSeek);
605 FullNamesList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
606 FullNamesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
610 FullNamesListType.insert(std::make_pair(intValueSeek, wxT("")));
612 } else if (intType == 1){
614 FullNamesListType.insert(std::make_pair(intValueSeek, wxT("home")));
616 } else if (intType == 2){
618 FullNamesListType.insert(std::make_pair(intValueSeek, wxT("work")));
622 if (FNProcessed == FALSE){
624 NameDisplayAs = wxSPropertySeg2;
625 cmbDisplayAs->SetValue(ContactData.Convert(wxSPropertySeg2, TRUE));
632 ListCtrlIndex = lboIM->InsertItem(coldata);
634 lboIM->SetItem(ListCtrlIndex, 1, IMPPAddress);
636 if (intPref > 0 && intPref < 101){
638 lboIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
642 GeneralIMList.erase(intValueSeek);
643 GeneralIMListType.erase(intValueSeek);
644 GeneralIMListTokens.erase(intValueSeek);
645 GeneralIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
646 GeneralIMListType.insert(std::make_pair(intValueSeek, wxT("")));
647 GeneralIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
649 } else if (intType == 1){
651 ListCtrlIndex = lboHomeIM->InsertItem(coldata);
653 lboHomeIM->SetItem(ListCtrlIndex, 1, IMPPAddress);
655 if (intPref > 0 && intPref < 101){
657 lboHomeIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
661 HomeIMList.erase(intValueSeek);
662 HomeIMListType.erase(intValueSeek);
663 HomeIMListTokens.erase(intValueSeek);
664 HomeIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
665 HomeIMListType.insert(std::make_pair(intValueSeek, wxT("home")));
666 HomeIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
668 } else if (intType == 2){
670 ListCtrlIndex = lboBusinessIM->InsertItem(coldata);
672 lboBusinessIM->SetItem(ListCtrlIndex, 1, IMPPAddress);
674 if (intPref > 0 && intPref < 101){
676 lboBusinessIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
680 BusinessIMList.erase(intValueSeek);
681 BusinessIMListType.erase(intValueSeek);
682 BusinessIMListTokens.erase(intValueSeek);
683 BusinessIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
684 BusinessIMListType.insert(std::make_pair(intValueSeek, wxT("work")));
685 BusinessIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
692 } else if (wxSProperty == wxT("N") && NameProcessed == FALSE){
694 size_t intPropertyLen = wxSPropertySeg1.Len();
695 std::map<int, int> SplitPoints;
696 std::map<int, int> SplitLength;
697 std::map<int, int>::iterator SLiter;
698 wxString PropertyData;
699 wxString PropertyName;
700 wxString PropertyValue;
701 wxString PropertyTokens;
702 bool FirstToken = TRUE;
703 int intSplitsFound = 0;
704 int intSplitSize = 0;
705 int intPrevValue = 3;
706 int intSplitSeek = 0;
708 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
710 // Look for type before continuing.
714 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
715 intiter != SplitPoints.end(); ++intiter){
717 SLiter = SplitLength.find(intiter->first);
719 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
721 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
722 PropertyName = PropertyElement.GetNextToken();
723 PropertyValue = PropertyElement.GetNextToken();
725 intPrevValue = intiter->second;
731 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
732 intiter != SplitPoints.end(); ++intiter){
734 SLiter = SplitLength.find(intiter->first);
736 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
738 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
739 PropertyName = PropertyElement.GetNextToken();
740 PropertyValue = PropertyElement.GetNextToken();
742 ProcessCaptureStrings(&PropertyValue);
744 intPrevValue = intiter->second;
746 // Process properties.
748 if (PropertyName == wxT("ALTID")){
750 NameAltID = PropertyValue;
752 } else if (PropertyName == wxT("LANG")){
754 NameLanguage = PropertyValue;
756 } else if (PropertyName == wxT("SORT-AS")){
758 NameDisplayAs = PropertyValue;
762 // Something else we don't know about so append
763 // to the tokens variable.
765 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
767 if (FirstToken == TRUE){
769 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
774 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
784 intPropertyLen = wxSPropertySeg2.Len();
792 for (int i = 0; i <= intPropertyLen; i++){
796 if (wxSPropertySeg2.Mid(i, 1) == wxT(";") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
799 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
801 if (intSplitsFound == 4){
803 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
808 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
818 // Split the data into several parts.
820 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
821 intiter != SplitPoints.end(); ++intiter){
823 if (intiter->first == 1){
825 // Deal with family name.
827 SLiter = SplitLength.find(1);
829 txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
831 intPrevValue = intiter->second;
832 NameSurname = wxSPropertySeg2.Mid(0, SLiter->second);
834 } else if (intiter->first == 2){
836 // Deal with given names.
838 SLiter = SplitLength.find(2);
840 txtForename->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
841 intPrevValue = intiter->second;
842 NameForename = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
844 } else if (intiter->first == 3){
846 // Deal with additional names.
848 SLiter = SplitLength.find(3);
850 txtOtherNames->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
851 intPrevValue = intiter->second;
852 NameOtherNames = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
854 } else if (intiter->first == 4){
856 // Deal with honorifix prefixes and suffixes.
858 SLiter = SplitLength.find(4);
860 txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
861 intPrevValue = intiter->second;
862 NameTitle = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
864 txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
865 NameSuffix = wxSPropertySeg2.Mid(intPrevValue);
871 NameTokens = PropertyTokens;
872 NameProcessed = TRUE;
874 } else if (wxSProperty == wxT("NICKNAME")){
876 std::map<int, int> SplitPoints;
877 std::map<int, int> SplitLength;
878 std::map<int, int>::iterator SLiter;
879 wxString PropertyData;
880 wxString PropertyName;
881 wxString PropertyValue;
882 wxString PropertyTokens;
883 bool FirstToken = TRUE;
884 int intPrevValue = 10;
889 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
893 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
894 intiter != SplitPoints.end(); ++intiter){
896 SLiter = SplitLength.find(intiter->first);
898 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
900 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
901 PropertyName = PropertyElement.GetNextToken();
902 PropertyValue = PropertyElement.GetNextToken();
904 intPrevValue = intiter->second;
906 if (PropertyName == wxT("TYPE")){
908 if (PropertyValue == wxT("work")){
912 } else if (PropertyValue == wxT("home")){
926 // Setup blank lines for later on.
930 GeneralNicknamesList.insert(std::make_pair(intValueSeek, wxT("")));
931 GeneralNicknamesListAltID.insert(std::make_pair(intValueSeek, wxT("")));
932 GeneralNicknamesListPID.insert(std::make_pair(intValueSeek, wxT("")));
933 GeneralNicknamesListPref.insert(std::make_pair(intValueSeek, 0));
934 GeneralNicknamesListTokens.insert(std::make_pair(intValueSeek, wxT("")));
935 GeneralNicknamesListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
937 } else if (intType == 1){
939 HomeNicknamesList.insert(std::make_pair(intValueSeek, wxT("")));
940 HomeNicknamesListAltID.insert(std::make_pair(intValueSeek, wxT("")));
941 HomeNicknamesListPID.insert(std::make_pair(intValueSeek, wxT("")));
942 HomeNicknamesListPref.insert(std::make_pair(intValueSeek, 0));
943 HomeNicknamesListTokens.insert(std::make_pair(intValueSeek, wxT("")));
944 HomeNicknamesListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
946 } else if (intType == 2){
948 BusinessNicknamesList.insert(std::make_pair(intValueSeek, wxT("")));
949 BusinessNicknamesListAltID.insert(std::make_pair(intValueSeek, wxT("")));
950 BusinessNicknamesListPID.insert(std::make_pair(intValueSeek, wxT("")));
951 BusinessNicknamesListPref.insert(std::make_pair(intValueSeek, 0));
952 BusinessNicknamesListTokens.insert(std::make_pair(intValueSeek, wxT("")));
953 BusinessNicknamesListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
959 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
960 intiter != SplitPoints.end(); ++intiter){
962 SLiter = SplitLength.find(intiter->first);
964 PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
966 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
967 PropertyName = PropertyElement.GetNextToken();
968 PropertyValue = PropertyElement.GetNextToken();
970 intPrevValue = intiter->second;
972 ProcessCaptureStrings(&PropertyValue);
974 // Process properties.
976 size_t intPropertyValueLen = PropertyValue.Len();
978 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
980 PropertyValue.Trim();
981 PropertyValue.RemoveLast();
985 if (PropertyValue.Mid(0, 1) == wxT("\"")){
987 PropertyValue.Remove(0, 1);
991 if (PropertyName == wxT("ALTID")){
993 if (intType == 0){ GeneralNicknamesListAltID.erase(intValueSeek); GeneralNicknamesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
994 else if (intType == 1){ HomeNicknamesListAltID.erase(intValueSeek); HomeNicknamesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
995 else if (intType == 2){ BusinessNicknamesListAltID.erase(intValueSeek); BusinessNicknamesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
997 } else if (PropertyName == wxT("PID")){
999 if (intType == 0){ GeneralNicknamesListPID.erase(intValueSeek); GeneralNicknamesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
1000 else if (intType == 1){ HomeNicknamesListPID.erase(intValueSeek); HomeNicknamesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
1001 else if (intType == 2){ BusinessNicknamesListPID.erase(intValueSeek); BusinessNicknamesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
1003 } else if (PropertyName == wxT("PREF")){
1005 intPref = wxAtoi(PropertyValue);
1007 if (intType == 0){ GeneralNicknamesListPref.erase(intValueSeek); GeneralNicknamesListPref.insert(std::make_pair(intValueSeek, intPref)); }
1008 else if (intType == 1){ HomeNicknamesListPref.erase(intValueSeek); HomeNicknamesListPref.insert(std::make_pair(intValueSeek, intPref)); }
1009 else if (intType == 2){ BusinessNicknamesListPref.erase(intValueSeek); BusinessNicknamesListPref.insert(std::make_pair(intValueSeek, intPref)); }
1011 } else if (PropertyName == wxT("LANGUAGE")){
1013 if (intType == 0){ GeneralNicknamesListLanguage.erase(intValueSeek); GeneralNicknamesListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
1014 else if (intType == 1){ HomeNicknamesListLanguage.erase(intValueSeek); HomeNicknamesListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
1015 else if (intType == 2){ BusinessNicknamesListLanguage.erase(intValueSeek); BusinessNicknamesListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
1019 // Something else we don't know about so append
1020 // to the tokens variable.
1022 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1024 if (FirstToken == TRUE){
1026 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1031 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1041 // Add the data to the General/Home/Work address variables.
1043 ProcessCaptureStrings(&wxSPropertySeg2);
1047 coldata.SetId(intValueSeek);
1048 coldata.SetData(intValueSeek);
1049 coldata.SetText(wxSPropertySeg2);
1053 ListCtrlIndex = lboNicknames->InsertItem(coldata);
1055 if (intPref > 0 && intPref < 101){
1057 lboNicknames->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
1061 GeneralNicknamesList.erase(intValueSeek);
1062 GeneralNicknamesListType.erase(intValueSeek);
1063 GeneralNicknamesListTokens.erase(intValueSeek);
1064 GeneralNicknamesList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
1065 GeneralNicknamesListType.insert(std::make_pair(intValueSeek, wxT("")));
1066 GeneralNicknamesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
1068 } else if (intType == 1){
1070 ListCtrlIndex = lboHomeNicknames->InsertItem(coldata);
1072 if (intPref > 0 && intPref < 101){
1074 lboHomeNicknames->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
1078 HomeNicknamesList.erase(intValueSeek);
1079 HomeNicknamesListType.erase(intValueSeek);
1080 HomeNicknamesListTokens.erase(intValueSeek);
1081 HomeNicknamesList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
1082 HomeNicknamesListType.insert(std::make_pair(intValueSeek, wxT("home")));
1083 HomeNicknamesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
1085 } else if (intType == 2){
1087 ListCtrlIndex = lboBusinessNicknames->InsertItem(coldata);
1089 if (intPref > 0 && intPref < 101){
1091 lboBusinessNicknames->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
1095 BusinessNicknamesList.erase(intValueSeek);
1096 BusinessNicknamesListType.erase(intValueSeek);
1097 BusinessNicknamesListTokens.erase(intValueSeek);
1098 BusinessNicknamesList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
1099 BusinessNicknamesListType.insert(std::make_pair(intValueSeek, wxT("work")));
1100 BusinessNicknamesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
1107 } else if (wxSProperty == wxT("GENDER") && GenderProcessed == FALSE){
1109 std::map<int, int> SplitPoints;
1110 std::map<int, int> SplitLength;
1111 std::map<int, int>::iterator SLiter;
1112 wxString PropertyData;
1113 wxString PropertyName;
1114 wxString PropertyValue;
1115 wxString PropertyTokens;
1116 bool FirstToken = TRUE;;
1117 int intPrevValue = 8;
1119 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1123 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1124 intiter != SplitPoints.end(); ++intiter){
1126 SLiter = SplitLength.find(intiter->first);
1128 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
1130 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1131 PropertyName = PropertyElement.GetNextToken();
1132 PropertyValue = PropertyElement.GetNextToken();
1134 intPrevValue = intiter->second;
1136 // Process properties.
1138 size_t intPropertyValueLen = PropertyValue.Len();
1140 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1142 PropertyValue.Trim();
1143 PropertyValue.RemoveLast();
1147 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1149 PropertyValue.Remove(0, 1);
1153 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1155 if (FirstToken == TRUE){
1157 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1162 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1170 wxStringTokenizer GenderDetails (wxSPropertySeg2, wxT(";"));
1172 wxString GenderComponent;
1173 wxString GenderIdentity;
1175 if (GenderDetails.CountTokens() >= 2){
1177 GenderComponent = GenderDetails.GetNextToken();
1178 GenderIdentity = GenderDetails.GetString();
1180 ProcessCaptureStrings(&GenderIdentity);
1182 txtGenderDescription->SetValue(ContactData.Convert(GenderIdentity, TRUE));
1186 GenderComponent = GenderDetails.GetNextToken();
1190 if (GenderComponent == wxT("M")){
1194 cmbGender->SetSelection(1);
1196 } else if (GenderComponent == wxT("F")){
1198 // Gender is Female.
1200 cmbGender->SetSelection(2);
1202 } else if (GenderComponent == wxT("O")){
1206 cmbGender->SetSelection(3);
1208 } else if (GenderComponent == wxT("N")){
1210 // Gender is None/Not Applicable.
1212 cmbGender->SetSelection(4);
1214 } else if (GenderComponent == wxT("U")){
1216 // Gender is Unknown.
1218 cmbGender->SetSelection(5);
1222 GenderTokens = PropertyTokens;
1223 GenderProcessed = TRUE;
1225 } else if (wxSProperty == wxT("BDAY") && BirthdayProcessed == FALSE){
1227 // Process date. Preserve the remainder in the string.
1229 std::map<int, int> SplitPoints;
1230 std::map<int, int> SplitLength;
1231 std::map<int, int>::iterator SLiter;
1232 wxString PropertyData;
1233 wxString PropertyName;
1234 wxString PropertyValue;
1235 wxString PropertyTokens;
1236 bool BirthdayText = FALSE;
1237 int intPrevValue = 6;
1239 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1243 // Look for type before continuing.
1245 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1246 intiter != SplitPoints.end(); ++intiter){
1248 SLiter = SplitLength.find(intiter->first);
1250 PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
1252 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1253 PropertyName = PropertyElement.GetNextToken();
1254 PropertyValue = PropertyElement.GetNextToken();
1256 intPrevValue = intiter->second;
1258 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1260 ProcessCaptureStrings(&wxSPropertySeg2);
1261 txtBirthday->SetValue(wxSPropertySeg2);
1262 Birthday = wxSPropertySeg2;
1263 BirthdayText = TRUE;
1269 // Setup blank lines for later on.
1273 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1274 intiter != SplitPoints.end(); ++intiter){
1276 SLiter = SplitLength.find(intiter->first);
1278 PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
1280 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1281 PropertyName = PropertyElement.GetNextToken();
1282 PropertyValue = PropertyElement.GetNextToken();
1284 intPrevValue = intiter->second;
1286 // Process properties.
1288 ProcessCaptureStrings(&PropertyValue);
1290 size_t intPropertyValueLen = PropertyValue.Len();
1292 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1294 PropertyValue.Trim();
1295 PropertyValue.RemoveLast();
1299 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1301 PropertyValue.Remove(0, 1);
1305 if (PropertyName == wxT("ALTID")){
1307 BirthdayAltID = PropertyValue;
1309 } else if (PropertyName == wxT("CALSCALE")){
1311 BirthdayCalScale = PropertyValue;
1313 } else if (PropertyName != wxT("VALUE")) {
1315 // Something else we don't know about so append
1316 // to the tokens variable.
1318 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1320 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1328 // Add the data to the variables and form.
1330 if (BirthdayText == FALSE){
1332 Birthday = wxSPropertySeg2;
1334 wxDateTime::Month DateMonth;
1335 unsigned int DateDay;
1339 if (Birthday.Mid(0, 2) == wxT("--")){
1345 DateYear = wxAtoi(Birthday.Mid(0,4));
1349 DateMonth = (wxDateTime::Month)(wxAtoi(Birthday.Mid(4,2)) - 1);
1350 DateDay = wxAtoi(Birthday.Mid(6,2));
1352 wxDateTime BDayDate(DateDay,DateMonth,DateYear);
1354 /*BDayDate.SetDay(DateDay);
1355 BDayDate.SetMonth(wxDateTime::Month::Jan);
1356 BDayDate.SetYear(DateYear);*/
1358 dapBirthday->SetValue(BDayDate);
1362 BirthdayTokens = PropertyTokens;
1364 BirthdayProcessed = TRUE;
1366 } else if (wxSProperty == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
1368 // Process date. Preserve the remainder in the string.
1370 std::map<int, int> SplitPoints;
1371 std::map<int, int> SplitLength;
1372 std::map<int, int>::iterator SLiter;
1373 wxString PropertyData;
1374 wxString PropertyName;
1375 wxString PropertyValue;
1376 wxString PropertyTokens;
1377 bool AnniversaryText = FALSE;
1378 int intPrevValue = 13;
1380 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1384 // Look for type before continuing.
1386 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1387 intiter != SplitPoints.end(); ++intiter){
1389 SLiter = SplitLength.find(intiter->first);
1391 PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
1393 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1394 PropertyName = PropertyElement.GetNextToken();
1395 PropertyValue = PropertyElement.GetNextToken();
1397 intPrevValue = intiter->second;
1399 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1401 ProcessCaptureStrings(&wxSPropertySeg2);
1402 txtAnniversary->SetValue(wxSPropertySeg2);
1403 Anniversary = wxSPropertySeg2;
1404 AnniversaryText = TRUE;
1410 // Setup blank lines for later on.
1414 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1415 intiter != SplitPoints.end(); ++intiter){
1417 SLiter = SplitLength.find(intiter->first);
1419 PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
1421 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1422 PropertyName = PropertyElement.GetNextToken();
1423 PropertyValue = PropertyElement.GetNextToken();
1425 intPrevValue = intiter->second;
1427 // Process properties.
1429 size_t intPropertyValueLen = PropertyValue.Len();
1431 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1433 PropertyValue.Trim();
1434 PropertyValue.RemoveLast();
1438 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1440 PropertyValue.Remove(0, 1);
1444 ProcessCaptureStrings(&PropertyValue);
1446 if (PropertyName == wxT("ALTID")){
1448 AnniversaryAltID = PropertyValue;
1450 } else if (PropertyName == wxT("CALSCALE")){
1452 AnniversaryCalScale = PropertyValue;
1454 } else if (PropertyName != wxT("VALUE")) {
1456 // Something else we don't know about so append
1457 // to the tokens variable.
1459 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1461 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1469 // Add the data to the variables and form.
1471 if (AnniversaryText == FALSE){
1473 Anniversary = wxSPropertySeg2;
1475 wxDateTime::Month DateMonth;
1480 if (Anniversary.Mid(0, 2) == wxT("--")){
1486 DateYear = wxAtoi(Anniversary.Mid(0,4));
1490 DateMonth = (wxDateTime::Month)(wxAtoi(Anniversary.Mid(4,2)) - 1);
1491 DateDay = wxAtoi(Anniversary.Mid(6,2));
1493 wxDateTime ADayDate(DateDay,DateMonth,DateYear);
1495 dapAnniversary->SetValue(ADayDate);
1499 AnniversaryTokens = PropertyTokens;
1501 AnniversaryProcessed = TRUE;
1503 } else if (wxSProperty == wxT("TZ")){
1505 size_t intPropertyLen = wxSPropertySeg1.Len();
1506 std::map<int, int> SplitPoints;
1507 std::map<int, int> SplitLength;
1508 std::map<int, int>::iterator SLiter;
1509 wxString PropertyData;
1510 wxString PropertyName;
1511 wxString PropertyValue;
1512 wxString PropertyTokens;
1513 bool FirstToken = TRUE;
1514 int intSplitsFound = 0;
1515 int intSplitSize = 0;
1516 int intPrevValue = 4;
1521 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1525 // Look for type before continuing.
1527 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1528 intiter != SplitPoints.end(); ++intiter){
1530 SLiter = SplitLength.find(intiter->first);
1532 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
1534 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1535 PropertyName = PropertyElement.GetNextToken();
1536 PropertyValue = PropertyElement.GetNextToken();
1538 intPrevValue = intiter->second;
1540 if (PropertyName == wxT("TYPE")){
1542 if (PropertyValue == wxT("work")){
1546 } else if (PropertyValue == wxT("home")){
1560 // Setup blank lines for later on.
1564 GeneralTZList.insert(std::make_pair(intValueSeek, wxT("")));
1565 GeneralTZListAltID.insert(std::make_pair(intValueSeek, wxT("")));
1566 GeneralTZListPID.insert(std::make_pair(intValueSeek, wxT("")));
1567 GeneralTZListPref.insert(std::make_pair(intValueSeek, 0));
1568 GeneralTZListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
1569 GeneralTZListTokens.insert(std::make_pair(intValueSeek, wxT("")));
1571 } else if (intType == 1){
1573 HomeTZList.insert(std::make_pair(intValueSeek, wxT("")));
1574 HomeTZListAltID.insert(std::make_pair(intValueSeek, wxT("")));
1575 HomeTZListPID.insert(std::make_pair(intValueSeek, wxT("")));
1576 HomeTZListPref.insert(std::make_pair(intValueSeek, 0));
1577 HomeTZListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
1578 HomeTZListTokens.insert(std::make_pair(intValueSeek, wxT("")));
1580 } else if (intType == 2){
1582 BusinessTZList.insert(std::make_pair(intValueSeek, wxT("")));
1583 BusinessTZListAltID.insert(std::make_pair(intValueSeek, wxT("")));
1584 BusinessTZListPID.insert(std::make_pair(intValueSeek, wxT("")));
1585 BusinessTZListPref.insert(std::make_pair(intValueSeek, 0));
1586 BusinessTZListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
1587 BusinessTZListTokens.insert(std::make_pair(intValueSeek, wxT("")));
1593 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1594 intiter != SplitPoints.end(); ++intiter){
1596 SLiter = SplitLength.find(intiter->first);
1598 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
1600 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1601 PropertyName = PropertyElement.GetNextToken();
1602 PropertyValue = PropertyElement.GetNextToken();
1604 intPrevValue = intiter->second;
1606 size_t intPropertyValueLen = PropertyValue.Len();
1608 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1610 PropertyValue.Trim();
1611 PropertyValue.RemoveLast();
1615 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1617 PropertyValue.Remove(0, 1);
1621 ProcessCaptureStrings(&PropertyValue);
1623 // Process properties.
1625 if (PropertyName == wxT("ALTID")){
1627 if (intType == 0){ GeneralTZListAltID.erase(intValueSeek); GeneralTZListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
1628 else if (intType == 1){ HomeTZListAltID.erase(intValueSeek); HomeTZListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
1629 else if (intType == 2){ BusinessTZListAltID.erase(intValueSeek); BusinessTZListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
1631 } else if (PropertyName == wxT("PID")){
1633 if (intType == 0){ GeneralTZListPID.erase(intValueSeek); GeneralTZListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
1634 else if (intType == 1){ HomeTZListPID.erase(intValueSeek); HomeTZListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
1635 else if (intType == 2){ BusinessTZListPID.erase(intValueSeek); BusinessTZListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
1637 } else if (PropertyName == wxT("MEDIATYPE")){
1639 if (intType == 0){ GeneralTZListMediatype.erase(intValueSeek); GeneralTZListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
1640 else if (intType == 1){ HomeTZListMediatype.erase(intValueSeek); HomeTZListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
1641 else if (intType == 2){ BusinessTZListMediatype.erase(intValueSeek); BusinessTZListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
1643 } else if (PropertyName == wxT("PREF")){
1645 intPref = wxAtoi(PropertyValue);
1647 if (intPref > 0 && intPref < 101){
1649 if (intType == 0){ GeneralTZListPref.erase(intValueSeek); GeneralTZListPref.insert(std::make_pair(intValueSeek, intPref)); }
1650 else if (intType == 1){ HomeTZListPref.erase(intValueSeek); HomeTZListPref.insert(std::make_pair(intValueSeek, intPref)); }
1651 else if (intType == 2){ BusinessTZListPref.erase(intValueSeek); BusinessTZListPref.insert(std::make_pair(intValueSeek, intPref)); }
1657 // Something else we don't know about so append
1658 // to the tokens variable.
1660 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1662 if (FirstToken == TRUE){
1664 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1669 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1679 // Split the address.
1681 //std::map<int, int>::iterator SLiter;
1682 intPropertyLen = wxSPropertySeg2.Len();
1683 SplitPoints.clear();
1684 SplitLength.clear();
1689 for (int i = 0; i <= intPropertyLen; i++){
1693 if (wxSPropertySeg2.Mid(i, 1) == wxT(";") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1696 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1698 if (intSplitsFound == 6){
1700 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1705 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1715 // Add the data to the General/Home/Work address variables.
1717 ProcessCaptureStrings(&wxSPropertySeg2);
1721 coldata.SetId(intValueSeek);
1722 coldata.SetData(intValueSeek);
1723 coldata.SetText(wxSPropertySeg2);
1727 ListCtrlIndex = lboTimezones->InsertItem(coldata);
1729 if (intPref > 0 && intPref < 101){
1731 lboTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
1735 GeneralTZList.erase(intValueSeek);
1736 GeneralTZListType.erase(intValueSeek);
1737 GeneralTZListTokens.erase(intValueSeek);
1738 GeneralTZList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
1739 GeneralTZListType.insert(std::make_pair(intValueSeek, wxT("")));
1740 GeneralTZListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
1742 } else if (intType == 1){
1744 ListCtrlIndex = lboHomeTimezones->InsertItem(coldata);
1746 if (intPref > 0 && intPref < 101){
1748 lboHomeTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
1752 HomeTZList.erase(intValueSeek);
1753 HomeTZListType.erase(intValueSeek);
1754 HomeTZListTokens.erase(intValueSeek);
1755 HomeTZList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
1756 HomeTZListType.insert(std::make_pair(intValueSeek, wxT("home")));
1757 HomeTZListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
1759 } else if (intType == 2){
1761 ListCtrlIndex = lboBusinessTimezones->InsertItem(coldata);
1763 if (intPref > 0 && intPref < 101){
1765 lboBusinessTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
1769 BusinessTZList.erase(intValueSeek);
1770 BusinessTZListType.erase(intValueSeek);
1771 BusinessTZListTokens.erase(intValueSeek);
1772 BusinessTZList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
1773 BusinessTZListType.insert(std::make_pair(intValueSeek, wxT("work")));
1774 BusinessTZListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
1781 } else if (wxSProperty == wxT("ADR")){
1783 size_t intPropertyLen = wxSPropertySeg1.Len();
1784 std::map<int, int> SplitPoints;
1785 std::map<int, int> SplitLength;
1786 std::map<int, int>::iterator SLiter;
1787 wxString PropertyData;
1788 wxString PropertyName;
1789 wxString PropertyValue;
1790 wxString PropertyTokens;
1791 wxString AddressLabel;
1792 wxString AddressLang;
1793 wxString AddressAltID;
1794 wxString AddressPID;
1795 wxString AddressTokens;
1796 wxString AddressGeo;
1797 wxString AddressTimezone;
1798 wxString AddressType;
1799 wxString AddressMediatype;
1800 wxString AddressPOBox;
1801 wxString AddressExtended;
1802 wxString AddressStreet;
1803 wxString AddressLocality;
1804 wxString AddressCity;
1805 wxString AddressRegion;
1806 wxString AddressPostalCode;
1807 wxString AddressCountry;
1808 bool FirstToken = TRUE;
1809 int intSplitsFound = 0;
1810 int intSplitSize = 0;
1811 int intPrevValue = 5;
1816 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1820 // Look for type before continuing.
1822 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1823 intiter != SplitPoints.end(); ++intiter){
1825 SLiter = SplitLength.find(intiter->first);
1827 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
1829 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1830 PropertyName = PropertyElement.GetNextToken();
1831 PropertyValue = PropertyElement.GetNextToken();
1833 intPrevValue = intiter->second;
1835 if (PropertyName == wxT("TYPE")){
1837 if (PropertyValue == wxT("work")){
1841 } else if (PropertyValue == wxT("home")){
1855 // Setup blank lines for later on.
1859 GeneralAddressList.insert(std::make_pair(intValueSeek, wxT("")));
1860 GeneralAddressListTown.insert(std::make_pair(intValueSeek, wxT("")));
1861 GeneralAddressListCounty.insert(std::make_pair(intValueSeek, wxT("")));
1862 GeneralAddressListPostCode.insert(std::make_pair(intValueSeek, wxT("")));
1863 GeneralAddressListCountry.insert(std::make_pair(intValueSeek, wxT("")));
1864 GeneralAddressListLabel.insert(std::make_pair(intValueSeek, wxT("")));
1865 GeneralAddressListLang.insert(std::make_pair(intValueSeek, wxT("")));
1866 GeneralAddressListAltID.insert(std::make_pair(intValueSeek, wxT("")));
1867 GeneralAddressListPID.insert(std::make_pair(intValueSeek, wxT("")));
1868 GeneralAddressListGeo.insert(std::make_pair(intValueSeek, wxT("")));
1869 GeneralAddressListTimezone.insert(std::make_pair(intValueSeek, wxT("")));
1870 GeneralAddressListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
1871 GeneralAddressListPref.insert(std::make_pair(intValueSeek, 0));
1872 GeneralAddressListTokens.insert(std::make_pair(intValueSeek, wxT("")));
1874 } else if (intType == 1){
1876 HomeAddressList.insert(std::make_pair(intValueSeek, wxT("")));
1877 HomeAddressListTown.insert(std::make_pair(intValueSeek, wxT("")));
1878 HomeAddressListCounty.insert(std::make_pair(intValueSeek, wxT("")));
1879 HomeAddressListPostCode.insert(std::make_pair(intValueSeek, wxT("")));
1880 HomeAddressListCountry.insert(std::make_pair(intValueSeek, wxT("")));
1881 HomeAddressListLabel.insert(std::make_pair(intValueSeek, wxT("")));
1882 HomeAddressListLang.insert(std::make_pair(intValueSeek, wxT("")));
1883 HomeAddressListAltID.insert(std::make_pair(intValueSeek, wxT("")));
1884 HomeAddressListPID.insert(std::make_pair(intValueSeek, wxT("")));
1885 HomeAddressListGeo.insert(std::make_pair(intValueSeek, wxT("")));
1886 HomeAddressListTimezone.insert(std::make_pair(intValueSeek, wxT("")));
1887 HomeAddressListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
1888 HomeAddressListPref.insert(std::make_pair(intValueSeek, 0));
1889 HomeAddressListTokens.insert(std::make_pair(intValueSeek, wxT("")));
1891 } else if (intType == 2){
1893 BusinessAddressList.insert(std::make_pair(intValueSeek, wxT("")));
1894 BusinessAddressListTown.insert(std::make_pair(intValueSeek, wxT("")));
1895 BusinessAddressListCounty.insert(std::make_pair(intValueSeek, wxT("")));
1896 BusinessAddressListPostCode.insert(std::make_pair(intValueSeek, wxT("")));
1897 BusinessAddressListCountry.insert(std::make_pair(intValueSeek, wxT("")));
1898 BusinessAddressListLabel.insert(std::make_pair(intValueSeek, wxT("")));
1899 BusinessAddressListLang.insert(std::make_pair(intValueSeek, wxT("")));
1900 BusinessAddressListAltID.insert(std::make_pair(intValueSeek, wxT("")));
1901 BusinessAddressListPID.insert(std::make_pair(intValueSeek, wxT("")));
1902 BusinessAddressListGeo.insert(std::make_pair(intValueSeek, wxT("")));
1903 BusinessAddressListTimezone.insert(std::make_pair(intValueSeek, wxT("")));
1904 BusinessAddressListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
1905 BusinessAddressListPref.insert(std::make_pair(intValueSeek, 0));
1906 BusinessAddressListTokens.insert(std::make_pair(intValueSeek, wxT("")));
1912 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1913 intiter != SplitPoints.end(); ++intiter){
1915 SLiter = SplitLength.find(intiter->first);
1917 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
1919 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1920 PropertyName = PropertyElement.GetNextToken();
1921 PropertyValue = PropertyElement.GetNextToken();
1923 intPrevValue = intiter->second;
1925 ProcessCaptureStrings(&PropertyValue);
1927 // Process properties.
1929 if (PropertyName == wxT("LABEL")){
1931 if (intType == 0){ GeneralAddressListLabel.erase(intValueSeek); GeneralAddressListLabel.insert(std::make_pair(intValueSeek, PropertyValue)); }
1932 else if (intType == 1){ HomeAddressListLabel.erase(intValueSeek); HomeAddressListLabel.insert(std::make_pair(intValueSeek, PropertyValue)); }
1933 else if (intType == 2){ BusinessAddressListLabel.erase(intValueSeek); BusinessAddressListLabel.insert(std::make_pair(intValueSeek, PropertyValue));}
1935 } else if (PropertyName == wxT("LANGUAGE")){
1937 if (intType == 0){ GeneralAddressListLang.erase(intValueSeek); GeneralAddressListLang.insert(std::make_pair(intValueSeek, PropertyValue)); }
1938 else if (intType == 1){ HomeAddressListLang.erase(intValueSeek); HomeAddressListLang.insert(std::make_pair(intValueSeek, PropertyValue)); }
1939 else if (intType == 2){ BusinessAddressListLang.erase(intValueSeek); BusinessAddressListLang.insert(std::make_pair(intValueSeek, PropertyValue)); }
1941 } else if (PropertyName == wxT("ALTID")){
1943 if (intType == 0){ GeneralAddressListAltID.erase(intValueSeek); GeneralAddressListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
1944 else if (intType == 1){ HomeAddressListAltID.erase(intValueSeek); HomeAddressListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
1945 else if (intType == 2){ BusinessAddressListAltID.erase(intValueSeek); BusinessAddressListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
1947 } else if (PropertyName == wxT("PID")){
1949 if (intType == 0){ GeneralAddressListPID.erase(intValueSeek); GeneralAddressListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
1950 else if (intType == 1){ HomeAddressListPID.erase(intValueSeek); HomeAddressListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
1951 else if (intType == 2){ BusinessAddressListPID.erase(intValueSeek); BusinessAddressListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
1953 } else if (PropertyName == wxT("GEO")){
1955 if (intType == 0){ GeneralAddressListGeo.erase(intValueSeek); GeneralAddressListGeo.insert(std::make_pair(intValueSeek, PropertyValue)); }
1956 else if (intType == 1){ HomeAddressListGeo.erase(intValueSeek); HomeAddressListGeo.insert(std::make_pair(intValueSeek, PropertyValue)); }
1957 else if (intType == 2){ BusinessAddressListGeo.erase(intValueSeek); BusinessAddressListGeo.insert(std::make_pair(intValueSeek, PropertyValue)); }
1959 } else if (PropertyName == wxT("TZ")){
1961 if (intType == 0){ GeneralAddressListTimezone.erase(intValueSeek); GeneralAddressListTimezone.insert(std::make_pair(intValueSeek, PropertyValue)); }
1962 else if (intType == 1){ HomeAddressListTimezone.erase(intValueSeek); HomeAddressListTimezone.insert(std::make_pair(intValueSeek, PropertyValue)); }
1963 else if (intType == 2){ BusinessAddressListTimezone.erase(intValueSeek); BusinessAddressListTimezone.insert(std::make_pair(intValueSeek, PropertyValue)); }
1965 } else if (PropertyName == wxT("MEDIATYPE")){
1967 if (intType == 0){ GeneralAddressListMediatype.erase(intValueSeek); GeneralAddressListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
1968 else if (intType == 1){ HomeAddressListMediatype.erase(intValueSeek); HomeAddressListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
1969 else if (intType == 2){ BusinessAddressListMediatype.erase(intValueSeek); BusinessAddressListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
1971 } else if (PropertyName == wxT("PREF")){
1973 intPref = wxAtoi(PropertyValue);
1975 if (intPref > 0 && intPref < 101){
1977 if (intType == 0){ GeneralAddressListPref.erase(intValueSeek); GeneralAddressListPref.insert(std::make_pair(intValueSeek, intPref)); }
1978 else if (intType == 1){ HomeAddressListPref.erase(intValueSeek); HomeAddressListPref.insert(std::make_pair(intValueSeek, intPref)); }
1979 else if (intType == 2){ BusinessAddressListPref.erase(intValueSeek); BusinessAddressListPref.insert(std::make_pair(intValueSeek, intPref)); }
1985 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1987 if (FirstToken == TRUE){
1989 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1994 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2004 // Split the address.
2006 //std::map<int, int>::iterator SLiter;
2007 intPropertyLen = wxSPropertySeg2.Len();
2008 SplitPoints.clear();
2009 SplitLength.clear();
2014 for (int i = 0; i <= intPropertyLen; i++){
2018 if (wxSPropertySeg2.Mid(i, 1) == wxT(";") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
2021 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
2023 if (intSplitsFound == 6){
2025 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2030 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2040 // Split the data into several parts.
2042 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2043 intiter != SplitPoints.end(); ++intiter){
2045 if (intiter->first == 1){
2047 // Deal with PO Box.
2049 SLiter = SplitLength.find(1);
2051 //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
2052 AddressPOBox = wxSPropertySeg2.Mid(0, SLiter->second);
2053 intPrevValue = intiter->second;
2055 } else if (intiter->first == 2){
2057 // Deal with extended address.
2059 SLiter = SplitLength.find(2);
2061 AddressExtended = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
2062 //txtForename->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
2063 intPrevValue = intiter->second;
2065 } else if (intiter->first == 3){
2067 // Deal with street address.
2069 SLiter = SplitLength.find(3);
2071 AddressStreet = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
2072 //txtOtherNames->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
2073 intPrevValue = intiter->second;
2075 } else if (intiter->first == 4){
2077 // Deal with locality
2079 SLiter = SplitLength.find(4);
2081 AddressLocality = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
2082 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
2083 intPrevValue = intiter->second;
2085 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
2087 } else if (intiter->first == 5){
2089 // Deal with region.
2091 SLiter = SplitLength.find(5);
2093 AddressRegion = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
2094 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
2095 intPrevValue = intiter->second;
2097 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
2099 } else if (intiter->first == 6){
2101 // Deal with post code.
2103 SLiter = SplitLength.find(6);
2105 AddressPostalCode = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
2106 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
2107 intPrevValue = intiter->second;
2109 // Deal with country.
2111 AddressCountry = wxSPropertySeg2.Mid(intPrevValue);
2112 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
2118 // Add the data to the General/Home/Work address variables.
2120 ProcessCaptureStrings(&AddressStreet, &AddressLocality, &AddressRegion, &AddressPostalCode, &AddressCountry);
2124 coldata.SetId(intValueSeek);
2125 coldata.SetData(intValueSeek);
2126 coldata.SetText(AddressStreet);
2130 ListCtrlIndex = lboAddresses->InsertItem(coldata);
2131 lboAddresses->SetItem(ListCtrlIndex, 1, AddressLocality);
2132 lboAddresses->SetItem(ListCtrlIndex, 2, AddressRegion);
2133 lboAddresses->SetItem(ListCtrlIndex, 3, AddressPostalCode);
2135 if (intPref > 0 && intPref < 101){
2137 lboAddresses->SetItem(ListCtrlIndex, 4, wxString::Format(wxT("%i"), intPref));
2141 GeneralAddressList.erase(intValueSeek);
2142 GeneralAddressListTown.erase(intValueSeek);
2143 GeneralAddressListCounty.erase(intValueSeek);
2144 GeneralAddressListPostCode.erase(intValueSeek);
2145 GeneralAddressListCountry.erase(intValueSeek);
2146 GeneralAddressListType.erase(intValueSeek);
2147 GeneralAddressListTokens.erase(intValueSeek);
2148 GeneralAddressList.insert(std::make_pair(intValueSeek, AddressStreet));
2149 GeneralAddressListTown.insert(std::make_pair(intValueSeek, AddressLocality));
2150 GeneralAddressListCounty.insert(std::make_pair(intValueSeek, AddressRegion));
2151 GeneralAddressListPostCode.insert(std::make_pair(intValueSeek, AddressPostalCode));
2152 GeneralAddressListCountry.insert(std::make_pair(intValueSeek, AddressCountry));
2153 GeneralAddressListType.insert(std::make_pair(intValueSeek, wxT("")));
2154 GeneralAddressListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
2156 } else if (intType == 1){
2158 ListCtrlIndex = lboHomeAddresses->InsertItem(coldata);
2159 lboHomeAddresses->SetItem(ListCtrlIndex, 1, AddressLocality);
2160 lboHomeAddresses->SetItem(ListCtrlIndex, 2, AddressRegion);
2161 lboHomeAddresses->SetItem(ListCtrlIndex, 3, AddressPostalCode);
2163 if (intPref > 0 && intPref < 101){
2165 lboHomeAddresses->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
2169 HomeAddressList.erase(intValueSeek);
2170 HomeAddressListTown.erase(intValueSeek);
2171 HomeAddressListCounty.erase(intValueSeek);
2172 HomeAddressListPostCode.erase(intValueSeek);
2173 HomeAddressListCountry.erase(intValueSeek);
2174 HomeAddressListType.erase(intValueSeek);
2175 HomeAddressListTokens.erase(intValueSeek);
2176 HomeAddressList.insert(std::make_pair(intValueSeek, AddressStreet));
2177 HomeAddressListTown.insert(std::make_pair(intValueSeek, AddressLocality));
2178 HomeAddressListCounty.insert(std::make_pair(intValueSeek, AddressRegion));
2179 HomeAddressListPostCode.insert(std::make_pair(intValueSeek, AddressPostalCode));
2180 HomeAddressListCountry.insert(std::make_pair(intValueSeek, AddressCountry));
2181 HomeAddressListType.insert(std::make_pair(intValueSeek, wxT("home")));
2182 HomeAddressListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
2184 } else if (intType == 2){
2186 ListCtrlIndex = lboBusinessAddresses->InsertItem(coldata);
2187 lboBusinessAddresses->SetItem(ListCtrlIndex, 1, AddressLocality);
2188 lboBusinessAddresses->SetItem(ListCtrlIndex, 2, AddressRegion);
2189 lboBusinessAddresses->SetItem(ListCtrlIndex, 3, AddressPostalCode);
2191 if (intPref > 0 && intPref < 101){
2193 lboBusinessAddresses->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
2197 BusinessAddressList.erase(intValueSeek);
2198 BusinessAddressListTown.erase(intValueSeek);
2199 BusinessAddressListCounty.erase(intValueSeek);
2200 BusinessAddressListPostCode.erase(intValueSeek);
2201 BusinessAddressListCountry.erase(intValueSeek);
2202 BusinessAddressListType.erase(intValueSeek);
2203 BusinessAddressListTokens.erase(intValueSeek);
2204 BusinessAddressList.insert(std::make_pair(intValueSeek, AddressStreet));
2205 BusinessAddressListTown.insert(std::make_pair(intValueSeek, AddressLocality));
2206 BusinessAddressListCounty.insert(std::make_pair(intValueSeek, AddressRegion));
2207 BusinessAddressListPostCode.insert(std::make_pair(intValueSeek, AddressPostalCode));
2208 BusinessAddressListCountry.insert(std::make_pair(intValueSeek, AddressCountry));
2209 BusinessAddressListType.insert(std::make_pair(intValueSeek, wxT("work")));
2210 BusinessAddressListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
2217 } else if (wxSProperty == wxT("EMAIL")){
2219 size_t intPropertyLen = wxSPropertySeg1.Len();
2220 std::map<int, int> SplitPoints;
2221 std::map<int, int> SplitLength;
2222 std::map<int, int>::iterator SLiter;
2223 std::map<int, int>::iterator SPoint;
2224 wxString PropertyData;
2225 wxString PropertyName;
2226 wxString PropertyValue;
2227 wxString PropertyTokens;
2228 wxString AddressLabel;
2229 wxString AddressLang;
2230 wxString AddressAltID;
2231 wxString AddressPID;
2232 wxString AddressTokens;
2233 wxString AddressGeo;
2234 wxString AddressTimezone;
2235 wxString AddressType;
2236 wxString AddressMediatype;
2237 wxString AddressPOBox;
2238 wxString AddressExtended;
2239 wxString AddressStreet;
2240 wxString AddressLocality;
2241 wxString AddressCity;
2242 wxString AddressRegion;
2243 wxString AddressPostalCode;
2244 wxString AddressCountry;
2245 bool FirstToken = TRUE;
2246 int intSplitsFound = 0;
2247 int intSplitSize = 0;
2248 int intPrevValue = 7;
2253 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2257 // Look for type before continuing.
2259 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2260 intiter != SplitPoints.end(); ++intiter){
2262 SLiter = SplitLength.find(intiter->first);
2264 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
2266 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2267 PropertyName = PropertyElement.GetNextToken();
2268 PropertyValue = PropertyElement.GetNextToken();
2270 intPrevValue = intiter->second;
2272 if (PropertyName == wxT("TYPE")){
2274 if (PropertyValue == wxT("work")){
2278 } else if (PropertyValue == wxT("home")){
2292 // Setup blank lines for later on.
2296 GeneralEmailList.insert(std::make_pair(intValueSeek, wxT("")));
2297 GeneralEmailListAltID.insert(std::make_pair(intValueSeek, wxT("")));
2298 GeneralEmailListPID.insert(std::make_pair(intValueSeek, wxT("")));
2299 GeneralEmailListPref.insert(std::make_pair(intValueSeek, 0));
2300 GeneralEmailListTokens.insert(std::make_pair(intValueSeek, wxT("")));
2302 } else if (intType == 1){
2304 HomeEmailList.insert(std::make_pair(intValueSeek, wxT("")));
2305 HomeEmailListAltID.insert(std::make_pair(intValueSeek, wxT("")));
2306 HomeEmailListPID.insert(std::make_pair(intValueSeek, wxT("")));
2307 HomeEmailListPref.insert(std::make_pair(intValueSeek, 0));
2308 HomeEmailListTokens.insert(std::make_pair(intValueSeek, wxT("")));
2310 } else if (intType == 2){
2312 BusinessEmailList.insert(std::make_pair(intValueSeek, wxT("")));
2313 BusinessEmailListAltID.insert(std::make_pair(intValueSeek, wxT("")));
2314 BusinessEmailListPID.insert(std::make_pair(intValueSeek, wxT("")));
2315 BusinessEmailListPref.insert(std::make_pair(intValueSeek, 0));
2316 BusinessEmailListTokens.insert(std::make_pair(intValueSeek, wxT("")));
2322 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2323 intiter != SplitPoints.end(); ++intiter){
2325 SLiter = SplitLength.find(intiter->first);
2327 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
2329 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2330 PropertyName = PropertyElement.GetNextToken();
2331 PropertyValue = PropertyElement.GetNextToken();
2333 intPrevValue = intiter->second;
2335 ProcessCaptureStrings(&PropertyValue);
2337 // Process properties.
2339 if (PropertyName == wxT("ALTID")){
2341 if (intType == 0){ GeneralEmailListAltID.erase(intValueSeek); GeneralEmailListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
2342 else if (intType == 1){ HomeEmailListAltID.erase(intValueSeek); HomeEmailListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
2343 else if (intType == 2){ BusinessEmailListAltID.erase(intValueSeek); BusinessEmailListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
2345 } else if (PropertyName == wxT("PID")){
2347 if (intType == 0){ GeneralEmailListPID.erase(intValueSeek); GeneralEmailListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
2348 else if (intType == 1){ HomeEmailListPID.erase(intValueSeek); HomeEmailListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
2349 else if (intType == 2){ BusinessEmailListPID.erase(intValueSeek); BusinessEmailListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
2351 } else if (PropertyName == wxT("PREF")){
2353 intPref = wxAtoi(PropertyValue);
2355 if (intPref > 0 && intPref < 101){
2357 if (intType == 0){ GeneralEmailListPref.erase(intValueSeek); GeneralEmailListPref.insert(std::make_pair(intValueSeek, intPref)); }
2358 else if (intType == 1){ HomeEmailListPref.erase(intValueSeek); HomeEmailListPref.insert(std::make_pair(intValueSeek, intPref)); }
2359 else if (intType == 2){ BusinessEmailListPref.erase(intValueSeek); BusinessEmailListPref.insert(std::make_pair(intValueSeek, intPref)); }
2365 // Something else we don't know about so append
2366 // to the tokens variable.
2368 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2370 if (FirstToken == TRUE){
2372 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2377 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2387 //std::map<int, int>::iterator SLiter;
2388 intPropertyLen = wxSPropertySeg2.Len();
2389 SplitPoints.clear();
2390 SplitLength.clear();
2395 // Add the data to the General/Home/Work email variables.
2397 ProcessCaptureStrings(&wxSPropertySeg2);
2401 coldata.SetId(intValueSeek);
2402 coldata.SetData(intValueSeek);
2403 coldata.SetText(wxSPropertySeg2);
2409 ListCtrlIndex = lboEmails->InsertItem(coldata);
2411 if (intPref > 0 && intPref < 101){
2413 lboEmails->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
2417 GeneralEmailList.erase(intValueSeek);
2418 GeneralEmailListType.erase(intValueSeek);
2419 GeneralEmailListTokens.erase(intValueSeek);
2420 GeneralEmailList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
2421 GeneralEmailListType.insert(std::make_pair(intValueSeek, wxT("")));
2422 GeneralEmailListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
2424 } else if (intType == 1){
2426 ListCtrlIndex = lboHomeEmails->InsertItem(coldata);
2428 if (intPref > 0 && intPref < 101){
2430 lboHomeEmails->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
2434 HomeEmailList.erase(intValueSeek);
2435 HomeEmailListType.erase(intValueSeek);
2436 HomeEmailListTokens.erase(intValueSeek);
2437 HomeEmailList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
2438 HomeEmailListType.insert(std::make_pair(intValueSeek, wxT("home")));
2439 HomeEmailListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
2441 } else if (intType == 2){
2443 ListCtrlIndex = lboBusinessEmail->InsertItem(coldata);
2445 if (intPref > 0 && intPref < 101){
2447 lboBusinessEmail->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
2451 BusinessEmailList.erase(intValueSeek);
2452 BusinessEmailListType.erase(intValueSeek);
2453 BusinessEmailListTokens.erase(intValueSeek);
2454 BusinessEmailList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
2455 BusinessEmailListType.insert(std::make_pair(intValueSeek, wxT("work")));
2456 BusinessEmailListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
2463 } else if (wxSProperty == wxT("IMPP")){
2465 size_t intPropertyLen = wxSPropertySeg1.Len();
2466 std::map<int, int> SplitPoints;
2467 std::map<int, int> SplitLength;
2468 std::map<int, int>::iterator SLiter;
2469 std::map<int, int>::iterator SPoint;
2470 wxString PropertyData;
2471 wxString PropertyName;
2472 wxString PropertyValue;
2473 wxString PropertyTokens;
2475 wxString IMPPAddress;
2476 bool FirstToken = TRUE;
2477 int intSplitsFound = 0;
2478 int intSplitSize = 0;
2479 int intPrevValue = 6;
2484 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2488 // Look for type before continuing.
2490 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2491 intiter != SplitPoints.end(); ++intiter){
2493 SLiter = SplitLength.find(intiter->first);
2495 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
2497 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2498 PropertyName = PropertyElement.GetNextToken();
2499 PropertyValue = PropertyElement.GetNextToken();
2501 intPrevValue = intiter->second;
2503 if (PropertyName == wxT("TYPE")){
2505 if (PropertyValue == wxT("work")){
2509 } else if (PropertyValue == wxT("home")){
2523 // Setup blank lines for later on.
2527 GeneralIMList.insert(std::make_pair(intValueSeek, wxT("")));
2528 GeneralIMListAltID.insert(std::make_pair(intValueSeek, wxT("")));
2529 GeneralIMListPID.insert(std::make_pair(intValueSeek, wxT("")));
2530 GeneralIMListPref.insert(std::make_pair(intValueSeek, 0));
2531 GeneralIMListTokens.insert(std::make_pair(intValueSeek, wxT("")));
2532 GeneralIMListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
2534 } else if (intType == 1){
2536 HomeIMList.insert(std::make_pair(intValueSeek, wxT("")));
2537 HomeIMListAltID.insert(std::make_pair(intValueSeek, wxT("")));
2538 HomeIMListPID.insert(std::make_pair(intValueSeek, wxT("")));
2539 HomeIMListPref.insert(std::make_pair(intValueSeek, 0));
2540 HomeIMListTokens.insert(std::make_pair(intValueSeek, wxT("")));
2541 HomeIMListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
2543 } else if (intType == 2){
2545 BusinessIMList.insert(std::make_pair(intValueSeek, wxT("")));
2546 BusinessIMListAltID.insert(std::make_pair(intValueSeek, wxT("")));
2547 BusinessIMListPID.insert(std::make_pair(intValueSeek, wxT("")));
2548 BusinessIMListPref.insert(std::make_pair(intValueSeek, 0));
2549 BusinessIMListTokens.insert(std::make_pair(intValueSeek, wxT("")));
2550 BusinessIMListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
2556 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2557 intiter != SplitPoints.end(); ++intiter){
2559 SLiter = SplitLength.find(intiter->first);
2561 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
2563 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2564 PropertyName = PropertyElement.GetNextToken();
2565 PropertyValue = PropertyElement.GetNextToken();
2567 ProcessCaptureStrings(&PropertyValue);
2569 intPrevValue = intiter->second;
2571 // Process properties.
2573 if (PropertyName == wxT("ALTID")){
2575 if (intType == 0){ GeneralIMListAltID.erase(intValueSeek); GeneralIMListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
2576 else if (intType == 1){ HomeIMListAltID.erase(intValueSeek); HomeIMListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
2577 else if (intType == 2){ BusinessIMListAltID.erase(intValueSeek); BusinessIMListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
2579 } else if (PropertyName == wxT("PID")){
2581 if (intType == 0){ GeneralIMListPID.erase(intValueSeek); GeneralIMListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
2582 else if (intType == 1){ HomeIMListPID.erase(intValueSeek); HomeIMListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
2583 else if (intType == 2){ BusinessIMListPID.erase(intValueSeek); BusinessIMListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
2585 } else if (PropertyName == wxT("PREF")){
2587 intPref = wxAtoi(PropertyValue);
2589 if (intPref > 0 && intPref < 101){
2591 if (intType == 0){ GeneralIMListPref.erase(intValueSeek); GeneralIMListPref.insert(std::make_pair(intValueSeek, intPref)); }
2592 else if (intType == 1){ HomeIMListPref.erase(intValueSeek); HomeIMListPref.insert(std::make_pair(intValueSeek, intPref)); }
2593 else if (intType == 2){ BusinessIMListPref.erase(intValueSeek); BusinessIMListPref.insert(std::make_pair(intValueSeek, intPref)); }
2597 } else if (PropertyName == wxT("MEDIATYPE")){
2599 if (intType == 0){ GeneralIMListMediatype.erase(intValueSeek); GeneralIMListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
2600 else if (intType == 1){ HomeIMListMediatype.erase(intValueSeek); HomeIMListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
2601 else if (intType == 2){ BusinessIMListMediatype.erase(intValueSeek); BusinessIMListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
2605 // Something else we don't know about so append
2606 // to the tokens variable.
2608 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2610 if (FirstToken == TRUE){
2612 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2617 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2627 // Split the address.
2629 //std::map<int, int>::iterator SLiter;
2630 intPropertyLen = wxSPropertySeg2.Len();
2631 SplitPoints.clear();
2632 SplitLength.clear();
2637 for (int i = 0; i <= intPropertyLen; i++){
2641 if (wxSPropertySeg2.Mid(i, 1) == wxT(":") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
2644 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
2646 if (intSplitsFound == 1){
2648 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2659 // Split the data into several parts.
2661 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2662 intiter != SplitPoints.end(); ++intiter){
2664 if (intiter->first == 1){
2666 // Deal with PO Box.
2668 SLiter = SplitLength.find(1);
2670 //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
2671 IMPPType = wxSPropertySeg2.Mid(0, SLiter->second);
2672 intPrevValue = intiter->second;
2674 IMPPAddress = wxSPropertySeg2.Mid(intPrevValue);
2680 // Check what IM type it is.
2682 if (IMPPType == wxT("aim")){
2684 IMPPType = wxT("AIM");
2686 } else if (IMPPType == wxT("gg")){
2688 IMPPType = wxT("Gadu-Gadu");
2690 } else if (IMPPType == wxT("icq")){
2692 IMPPType = wxT("ICQ");
2694 } else if (IMPPType == wxT("skype")){
2696 IMPPType = wxT("Skype");
2698 } else if (IMPPType == wxT("xmpp")){
2700 IMPPType = wxT("XMPP");
2702 } else if (IMPPType == wxT("yahoo")){
2704 IMPPType = wxT("Yahoo");
2712 // Add the data to the General/Home/Work address variables.
2714 ProcessCaptureStrings(&wxSPropertySeg2);
2718 coldata.SetId(intValueSeek);
2719 coldata.SetData(intValueSeek);
2720 coldata.SetText(IMPPType);
2724 ListCtrlIndex = lboIM->InsertItem(coldata);
2726 lboIM->SetItem(ListCtrlIndex, 1, IMPPAddress);
2728 if (intPref > 0 && intPref < 101){
2730 lboIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
2734 GeneralIMList.erase(intValueSeek);
2735 GeneralIMListType.erase(intValueSeek);
2736 GeneralIMListTokens.erase(intValueSeek);
2737 GeneralIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
2738 GeneralIMListType.insert(std::make_pair(intValueSeek, wxT("")));
2739 GeneralIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
2741 } else if (intType == 1){
2743 ListCtrlIndex = lboHomeIM->InsertItem(coldata);
2745 lboHomeIM->SetItem(ListCtrlIndex, 1, IMPPAddress);
2747 if (intPref > 0 && intPref < 101){
2749 lboHomeIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
2753 HomeIMList.erase(intValueSeek);
2754 HomeIMListType.erase(intValueSeek);
2755 HomeIMListTokens.erase(intValueSeek);
2756 HomeIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
2757 HomeIMListType.insert(std::make_pair(intValueSeek, wxT("home")));
2758 HomeIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
2760 } else if (intType == 2){
2762 ListCtrlIndex = lboBusinessIM->InsertItem(coldata);
2764 lboBusinessIM->SetItem(ListCtrlIndex, 1, IMPPAddress);
2766 if (intPref > 0 && intPref < 101){
2768 lboBusinessIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
2772 BusinessIMList.erase(intValueSeek);
2773 BusinessIMListType.erase(intValueSeek);
2774 BusinessIMListTokens.erase(intValueSeek);
2775 BusinessIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
2776 BusinessIMListType.insert(std::make_pair(intValueSeek, wxT("work")));
2777 BusinessIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
2784 } else if (wxSProperty == wxT("TEL")){
2786 // Check TEL and make sure it is functioning properly.
2788 size_t intPropertyLen = wxSPropertySeg1.Len();
2789 std::map<int, int> SplitPoints;
2790 std::map<int, int> SplitLength;
2791 std::map<int, int> TypeSplitPoints;
2792 std::map<int, int> TypeSplitLength;
2793 std::map<int, int>::iterator SLiter;
2794 std::map<int, int>::iterator SPoint;
2795 std::map<int, int>::iterator TSLiter;
2796 std::map<int, int>::iterator TSPoint;
2797 wxString PropertyData;
2798 wxString PropertyName;
2799 wxString PropertyValue;
2800 wxString PropertyTokens;
2804 wxString TelTypeDetail;
2805 bool FirstToken = TRUE;
2806 int intSplitsFound = 0;
2807 int intSplitSize = 0;
2808 int intPrevValue = 5;
2811 int intSplitPoint = 0;
2814 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2818 // Look for type before continuing.
2820 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2821 intiter != SplitPoints.end(); ++intiter){
2823 SLiter = SplitLength.find(intiter->first);
2825 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
2827 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2828 PropertyName = PropertyElement.GetNextToken();
2829 PropertyValue = PropertyElement.GetNextToken();
2831 intPrevValue = intiter->second;
2833 if (PropertyName == wxT("TYPE")){
2835 // Process each value in type and translate each
2838 // Strip out the quotes if they are there.
2840 size_t intPropertyValueLen = PropertyValue.Len();
2842 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2844 PropertyValue.Trim();
2845 PropertyValue.RemoveLast();
2849 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2851 PropertyValue.Remove(0, 1);
2855 TelTypeDetail = PropertyValue;
2861 for (int i = 0; i <= intPropertyValueLen; i++){
2865 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2867 if (intSplitsFound == 0){
2869 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2870 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2874 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2875 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2888 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2889 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2891 int intTypeSeek = 0;
2893 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2894 typeiter != TypeSplitPoints.end(); ++typeiter){
2896 wxString TypePropertyName;
2898 TSLiter = TypeSplitLength.find(typeiter->first);
2900 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2902 if (intTypeSeek == 0){
2907 TelTypeUI.Append(wxT(","));
2911 if (TypePropertyName == wxT("home")){
2915 } else if (TypePropertyName == wxT("work")){
2922 if (TypePropertyName == wxT("text")){
2924 TelTypeUI.Append(_("text"));
2927 } else if (TypePropertyName == wxT("voice")){
2929 TelTypeUI.Append(_("voice"));
2932 } else if (TypePropertyName == wxT("fax")){
2934 TelTypeUI.Append(_("fax"));
2937 } else if (TypePropertyName == wxT("cell")){
2939 TelTypeUI.Append(_("mobile"));
2942 } else if (TypePropertyName == wxT("video")){
2944 TelTypeUI.Append(_("video"));
2947 } else if (TypePropertyName == wxT("pager")){
2949 TelTypeUI.Append(_("pager"));
2952 } else if (TypePropertyName == wxT("textphone")){
2954 TelTypeUI.Append(_("textphone"));
2967 // Setup blank lines for later on.
2971 GeneralTelephoneList.insert(std::make_pair(intValueSeek, wxT("")));
2972 GeneralTelephoneListAltID.insert(std::make_pair(intValueSeek, wxT("")));
2973 GeneralTelephoneListPID.insert(std::make_pair(intValueSeek, wxT("")));
2974 GeneralTelephoneListPref.insert(std::make_pair(intValueSeek, 0));
2975 GeneralTelephoneListTokens.insert(std::make_pair(intValueSeek, wxT("")));
2977 } else if (intType == 1){
2979 HomeTelephoneList.insert(std::make_pair(intValueSeek, wxT("")));
2980 HomeTelephoneListAltID.insert(std::make_pair(intValueSeek, wxT("")));
2981 HomeTelephoneListPID.insert(std::make_pair(intValueSeek, wxT("")));
2982 HomeTelephoneListPref.insert(std::make_pair(intValueSeek, 0));
2983 HomeTelephoneListTokens.insert(std::make_pair(intValueSeek, wxT("")));
2985 } else if (intType == 2){
2987 BusinessTelephoneList.insert(std::make_pair(intValueSeek, wxT("")));
2988 BusinessTelephoneListAltID.insert(std::make_pair(intValueSeek, wxT("")));
2989 BusinessTelephoneListPID.insert(std::make_pair(intValueSeek, wxT("")));
2990 BusinessTelephoneListPref.insert(std::make_pair(intValueSeek, 0));
2991 BusinessTelephoneListTokens.insert(std::make_pair(intValueSeek, wxT("")));
2997 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2998 intiter != SplitPoints.end(); ++intiter){
3000 SLiter = SplitLength.find(intiter->first);
3002 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
3004 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3005 PropertyName = PropertyElement.GetNextToken();
3006 PropertyValue = PropertyElement.GetNextToken();
3008 intPrevValue = intiter->second;
3010 size_t intPropertyValueLen = PropertyValue.Len();
3012 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3014 PropertyValue.Trim();
3015 PropertyValue.RemoveLast();
3019 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3021 PropertyValue.Remove(0, 1);
3025 ProcessCaptureStrings(&PropertyValue);
3027 // Process properties.
3029 if (PropertyName == wxT("ALTID")){
3031 if (intType == 0){ GeneralTelephoneListAltID.erase(intValueSeek); GeneralTelephoneListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3032 else if (intType == 1){ HomeTelephoneListAltID.erase(intValueSeek); HomeTelephoneListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3033 else if (intType == 2){ BusinessTelephoneListAltID.erase(intValueSeek); BusinessTelephoneListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3035 } else if (PropertyName == wxT("PID")){
3037 if (intType == 0){ GeneralTelephoneListPID.erase(intValueSeek); GeneralTelephoneListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3038 else if (intType == 1){ HomeTelephoneListPID.erase(intValueSeek); HomeTelephoneListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3039 else if (intType == 2){ BusinessTelephoneListPID.erase(intValueSeek); BusinessTelephoneListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3041 } else if (PropertyName == wxT("PREF")){
3043 intPref = wxAtoi(PropertyValue);
3045 if (intPref > 0 && intPref < 101){
3047 if (intType == 0){ GeneralTelephoneListPref.erase(intValueSeek); GeneralTelephoneListPref.insert(std::make_pair(intValueSeek, intPref)); }
3048 else if (intType == 1){ HomeTelephoneListPref.erase(intValueSeek); HomeTelephoneListPref.insert(std::make_pair(intValueSeek, intPref)); }
3049 else if (intType == 2){ BusinessTelephoneListPref.erase(intValueSeek); BusinessTelephoneListPref.insert(std::make_pair(intValueSeek, intPref)); }
3055 // Something else we don't know about so append
3056 // to the tokens variable.
3058 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3060 if (FirstToken == TRUE){
3062 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3067 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3077 // Split the address.
3079 //std::map<int, int>::iterator SLiter;
3080 intPropertyLen = wxSPropertySeg2.Len();
3081 SplitPoints.clear();
3082 SplitLength.clear();
3087 for (int i = 0; i <= intPropertyLen; i++){
3091 if (wxSPropertySeg2.Mid(i, 1) == wxT(":") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3094 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3096 if (intSplitsFound == 1){
3098 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3109 // Split the data into several parts.
3111 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3112 intiter != SplitPoints.end(); ++intiter){
3114 if (intiter->first == 1){
3116 // Deal with PO Box.
3118 SLiter = SplitLength.find(1);
3120 //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
3121 TelType = wxSPropertySeg2.Mid(0, SLiter->second);
3122 intPrevValue = intiter->second;
3124 TelNumber = wxSPropertySeg2.Mid(intPrevValue);
3130 // Add the data to the General/Home/Work address variables.
3132 ProcessCaptureStrings(&PropertyValue);
3135 coldata.SetId(intValueSeek);
3136 coldata.SetData(intValueSeek);
3137 coldata.SetText(TelNumber);
3141 ListCtrlIndex = lboTelephone->InsertItem(coldata);
3143 lboTelephone->SetItem(ListCtrlIndex, 1, TelTypeUI);
3145 if (intPref > 0 && intPref < 101){
3147 lboTelephone->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
3151 GeneralTelephoneList.erase(intValueSeek);
3152 GeneralTelephoneListType.erase(intValueSeek);
3153 GeneralTelephoneListTokens.erase(intValueSeek);
3154 GeneralTelephoneList.insert(std::make_pair(intValueSeek, TelNumber));
3155 GeneralTelephoneListType.insert(std::make_pair(intValueSeek, TelTypeDetail));
3156 GeneralTelephoneListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
3158 } else if (intType == 1){
3160 ListCtrlIndex = lboHomeTelephone->InsertItem(coldata);
3162 lboHomeTelephone->SetItem(ListCtrlIndex, 1, TelTypeUI);
3164 if (intPref > 0 && intPref < 101){
3166 lboHomeTelephone->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
3170 HomeTelephoneList.erase(intValueSeek);
3171 HomeTelephoneListType.erase(intValueSeek);
3172 HomeTelephoneListTokens.erase(intValueSeek);
3173 HomeTelephoneList.insert(std::make_pair(intValueSeek, TelNumber));
3174 HomeTelephoneListType.insert(std::make_pair(intValueSeek, TelTypeDetail));
3175 HomeTelephoneListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
3177 } else if (intType == 2){
3179 ListCtrlIndex = lboBusinessTelephone->InsertItem(coldata);
3181 lboBusinessTelephone->SetItem(ListCtrlIndex, 1, TelTypeUI);
3183 if (intPref > 0 && intPref < 101){
3185 lboBusinessTelephone->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
3189 BusinessTelephoneList.erase(intValueSeek);
3190 BusinessTelephoneListType.erase(intValueSeek);
3191 BusinessTelephoneListTokens.erase(intValueSeek);
3192 BusinessTelephoneList.insert(std::make_pair(intValueSeek, TelNumber));
3193 BusinessTelephoneListType.insert(std::make_pair(intValueSeek, TelTypeDetail));
3194 BusinessTelephoneListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
3201 } else if (wxSProperty == wxT("LANG")){
3203 std::map<int, int> SplitPoints;
3204 std::map<int, int> SplitLength;
3205 std::map<int, int>::iterator SLiter;
3206 wxString PropertyData;
3207 wxString PropertyName;
3208 wxString PropertyValue;
3209 wxString PropertyTokens;
3210 bool FirstToken = TRUE;
3211 int intPrevValue = 6;
3216 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3220 // Look for type before continuing.
3222 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3223 intiter != SplitPoints.end(); ++intiter){
3225 SLiter = SplitLength.find(intiter->first);
3227 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
3229 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3230 PropertyName = PropertyElement.GetNextToken();
3231 PropertyValue = PropertyElement.GetNextToken();
3233 intPrevValue = intiter->second;
3235 if (PropertyName == wxT("TYPE")){
3237 if (PropertyValue == wxT("work")){
3241 } else if (PropertyValue == wxT("home")){
3255 // Setup blank lines for later on.
3259 GeneralLanguageList.insert(std::make_pair(intValueSeek, wxT("")));
3260 GeneralLanguageListAltID.insert(std::make_pair(intValueSeek, wxT("")));
3261 GeneralLanguageListPID.insert(std::make_pair(intValueSeek, wxT("")));
3262 GeneralLanguageListPref.insert(std::make_pair(intValueSeek, 0));
3263 GeneralLanguageListTokens.insert(std::make_pair(intValueSeek, wxT("")));
3265 } else if (intType == 1){
3267 HomeLanguageList.insert(std::make_pair(intValueSeek, wxT("")));
3268 HomeLanguageListAltID.insert(std::make_pair(intValueSeek, wxT("")));
3269 HomeLanguageListPID.insert(std::make_pair(intValueSeek, wxT("")));
3270 HomeLanguageListPref.insert(std::make_pair(intValueSeek, 0));
3271 HomeLanguageListTokens.insert(std::make_pair(intValueSeek, wxT("")));
3273 } else if (intType == 2){
3275 BusinessLanguageList.insert(std::make_pair(intValueSeek, wxT("")));
3276 BusinessLanguageListAltID.insert(std::make_pair(intValueSeek, wxT("")));
3277 BusinessLanguageListPID.insert(std::make_pair(intValueSeek, wxT("")));
3278 BusinessLanguageListPref.insert(std::make_pair(intValueSeek, 0));
3279 BusinessLanguageListTokens.insert(std::make_pair(intValueSeek, wxT("")));
3285 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3286 intiter != SplitPoints.end(); ++intiter){
3288 SLiter = SplitLength.find(intiter->first);
3290 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
3292 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3293 PropertyName = PropertyElement.GetNextToken();
3294 PropertyValue = PropertyElement.GetNextToken();
3296 intPrevValue = intiter->second;
3298 // Process properties.
3300 size_t intPropertyValueLen = PropertyValue.Len();
3302 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3304 PropertyValue.Trim();
3305 PropertyValue.RemoveLast();
3309 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3311 PropertyValue.Remove(0, 1);
3315 ProcessCaptureStrings(&PropertyValue);
3317 if (PropertyName == wxT("ALTID")){
3319 if (intType == 0){ GeneralLanguageListAltID.erase(intValueSeek); GeneralLanguageListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3320 else if (intType == 1){ HomeLanguageListAltID.erase(intValueSeek); HomeLanguageListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3321 else if (intType == 2){ BusinessLanguageListAltID.erase(intValueSeek); BusinessLanguageListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3323 } else if (PropertyName == wxT("PID")){
3325 if (intType == 0){ GeneralLanguageListPID.erase(intValueSeek); GeneralLanguageListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3326 else if (intType == 1){ HomeLanguageListPID.erase(intValueSeek); HomeLanguageListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3327 else if (intType == 2){ BusinessLanguageListPID.erase(intValueSeek); BusinessLanguageListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3329 } else if (PropertyName == wxT("PREF")){
3331 intPref = wxAtoi(PropertyValue);
3333 if (intType == 0){ GeneralLanguageListPref.erase(intValueSeek); GeneralLanguageListPref.insert(std::make_pair(intValueSeek, intPref)); }
3334 else if (intType == 1){ HomeLanguageListPref.erase(intValueSeek); HomeLanguageListPref.insert(std::make_pair(intValueSeek, intPref)); }
3335 else if (intType == 2){ BusinessLanguageListPref.erase(intValueSeek); BusinessLanguageListPref.insert(std::make_pair(intValueSeek, intPref)); }
3339 // Something else we don't know about so append
3340 // to the tokens variable.
3342 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3344 if (FirstToken == TRUE){
3346 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3351 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3361 // Add the data to the General/Home/Work address variables.
3363 ProcessCaptureStrings(&wxSPropertySeg2);
3367 coldata.SetId(intValueSeek);
3368 coldata.SetData(intValueSeek);
3369 coldata.SetText(wxSPropertySeg2);
3373 ListCtrlIndex = lboLanguages->InsertItem(coldata);
3375 if (intPref > 0 && intPref < 101){
3377 lboLanguages->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
3381 GeneralLanguageList.erase(intValueSeek);
3382 GeneralLanguageListType.erase(intValueSeek);
3383 GeneralLanguageListTokens.erase(intValueSeek);
3384 GeneralLanguageList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
3385 GeneralLanguageListType.insert(std::make_pair(intValueSeek, wxT("")));
3386 GeneralLanguageListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
3388 } else if (intType == 1){
3390 ListCtrlIndex = lboHomeLanguages->InsertItem(coldata);
3392 if (intPref > 0 && intPref < 101){
3394 lboHomeLanguages->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
3398 HomeLanguageList.erase(intValueSeek);
3399 HomeLanguageListType.erase(intValueSeek);
3400 HomeLanguageListTokens.erase(intValueSeek);
3401 HomeLanguageList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
3402 HomeLanguageListType.insert(std::make_pair(intValueSeek, wxT("home")));
3403 HomeLanguageListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
3405 } else if (intType == 2){
3407 ListCtrlIndex = lboBusinessLanguages->InsertItem(coldata);
3409 if (intPref > 0 && intPref < 101){
3411 lboBusinessLanguages->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
3415 BusinessLanguageList.erase(intValueSeek);
3416 BusinessLanguageListType.erase(intValueSeek);
3417 BusinessLanguageListTokens.erase(intValueSeek);
3418 BusinessLanguageList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
3419 BusinessLanguageListType.insert(std::make_pair(intValueSeek, wxT("work")));
3420 BusinessLanguageListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
3427 } else if (wxSProperty == wxT("GEO")){
3429 size_t intPropertyLen = wxSPropertySeg1.Len();
3430 std::map<int, int> SplitPoints;
3431 std::map<int, int> SplitLength;
3432 std::map<int, int>::iterator SLiter;
3433 wxString PropertyData;
3434 wxString PropertyName;
3435 wxString PropertyValue;
3436 wxString PropertyTokens;
3439 bool FirstToken = TRUE;
3440 int intSplitsFound = 0;
3441 int intSplitSize = 0;
3442 int intPrevValue = 5;
3447 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3451 // Look for type before continuing.
3453 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3454 intiter != SplitPoints.end(); ++intiter){
3456 SLiter = SplitLength.find(intiter->first);
3458 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
3460 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3461 PropertyName = PropertyElement.GetNextToken();
3462 PropertyValue = PropertyElement.GetNextToken();
3464 intPrevValue = intiter->second;
3466 if (PropertyName == wxT("TYPE")){
3468 if (PropertyValue == wxT("work")){
3472 } else if (PropertyValue == wxT("home")){
3486 // Setup blank lines for later on.
3490 GeneralGeographyList.insert(std::make_pair(intValueSeek, wxT("")));
3491 GeneralGeographyListAltID.insert(std::make_pair(intValueSeek, wxT("")));
3492 GeneralGeographyListPID.insert(std::make_pair(intValueSeek, wxT("")));
3493 GeneralGeographyListPref.insert(std::make_pair(intValueSeek, 0));
3494 GeneralGeographyListTokens.insert(std::make_pair(intValueSeek, wxT("")));
3496 } else if (intType == 1){
3498 HomeGeographyList.insert(std::make_pair(intValueSeek, wxT("")));
3499 HomeGeographyListAltID.insert(std::make_pair(intValueSeek, wxT("")));
3500 HomeGeographyListPID.insert(std::make_pair(intValueSeek, wxT("")));
3501 HomeGeographyListPref.insert(std::make_pair(intValueSeek, 0));
3502 HomeGeographyListTokens.insert(std::make_pair(intValueSeek, wxT("")));
3504 } else if (intType == 2){
3506 BusinessGeographyList.insert(std::make_pair(intValueSeek, wxT("")));
3507 BusinessGeographyListAltID.insert(std::make_pair(intValueSeek, wxT("")));
3508 BusinessGeographyListPID.insert(std::make_pair(intValueSeek, wxT("")));
3509 BusinessGeographyListPref.insert(std::make_pair(intValueSeek, 0));
3510 BusinessGeographyListTokens.insert(std::make_pair(intValueSeek, wxT("")));
3516 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3517 intiter != SplitPoints.end(); ++intiter){
3519 SLiter = SplitLength.find(intiter->first);
3521 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
3523 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3524 PropertyName = PropertyElement.GetNextToken();
3525 PropertyValue = PropertyElement.GetNextToken();
3527 intPrevValue = intiter->second;
3529 // Process properties.
3531 size_t intPropertyValueLen = PropertyValue.Len();
3533 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3535 PropertyValue.Trim();
3536 PropertyValue.RemoveLast();
3540 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3542 PropertyValue.Remove(0, 1);
3546 ProcessCaptureStrings(&PropertyValue);
3548 if (PropertyName == wxT("ALTID")){
3550 if (intType == 0){ GeneralGeographyListAltID.erase(intValueSeek); GeneralGeographyListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3551 else if (intType == 1){ HomeGeographyListAltID.erase(intValueSeek); HomeGeographyListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3552 else if (intType == 2){ BusinessGeographyListAltID.erase(intValueSeek); BusinessGeographyListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3554 } else if (PropertyName == wxT("PID")){
3556 if (intType == 0){ GeneralGeographyListPID.erase(intValueSeek); GeneralGeographyListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3557 else if (intType == 1){ HomeGeographyListPID.erase(intValueSeek); HomeGeographyListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3558 else if (intType == 2){ BusinessGeographyListPID.erase(intValueSeek); BusinessGeographyListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
3560 } else if (PropertyName == wxT("MEDIATYPE")){
3562 if (intType == 0){ GeneralGeographyListMediatype.erase(intValueSeek); GeneralGeographyListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
3563 else if (intType == 1){ HomeGeographyListMediatype.erase(intValueSeek); HomeGeographyListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
3564 else if (intType == 2){ BusinessGeographyListMediatype.erase(intValueSeek); BusinessGeographyListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
3566 } else if (PropertyName == wxT("PREF")){
3568 intPref = wxAtoi(PropertyValue);
3570 if (intPref > 0 && intPref < 101){
3572 if (intType == 0){ GeneralGeographyListPref.erase(intValueSeek); GeneralGeographyListPref.insert(std::make_pair(intValueSeek, intPref)); }
3573 else if (intType == 1){ HomeGeographyListPref.erase(intValueSeek); HomeGeographyListPref.insert(std::make_pair(intValueSeek, intPref)); }
3574 else if (intType == 2){ BusinessGeographyListPref.erase(intValueSeek); BusinessGeographyListPref.insert(std::make_pair(intValueSeek, intPref)); }
3580 // Something else we don't know about so append
3581 // to the tokens variable.
3583 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3585 if (FirstToken == TRUE){
3587 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3592 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3602 // Split the address.
3604 //std::map<int, int>::iterator SLiter;
3605 intPropertyLen = wxSPropertySeg2.Len();
3606 SplitPoints.clear();
3607 SplitLength.clear();
3612 for (int i = 0; i <= intPropertyLen; i++){
3616 if (wxSPropertySeg2.Mid(i, 1) == wxT(":") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3619 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3621 if (intSplitsFound == 1){
3623 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3634 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3635 intiter != SplitPoints.end(); ++intiter){
3637 if (intiter->first == 1){
3639 // Deal with PO Box.
3641 SLiter = SplitLength.find(1);
3643 //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
3644 GeoType = wxSPropertySeg2.Mid(0, SLiter->second);
3645 intPrevValue = intiter->second;
3647 GeoData = wxSPropertySeg2.Mid(intPrevValue);
3653 ProcessCaptureStrings(&wxSPropertySeg2);
3657 coldata.SetId(intValueSeek);
3658 coldata.SetData(intValueSeek);
3665 ListCtrlIndex = lboTimezones->InsertItem(coldata);
3667 if (intPref > 0 && intPref < 101){
3669 lboTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
3675 txtGeopositioning->SetValue(GeoData);
3678 GeneralGeographyList.erase(intValueSeek);
3679 GeneralGeographyListType.erase(intValueSeek);
3680 GeneralGeographyListTokens.erase(intValueSeek);
3681 GeneralGeographyList.insert(std::make_pair(intValueSeek, GeoData));
3682 GeneralGeographyListType.insert(std::make_pair(intValueSeek, wxT("")));
3683 GeneralGeographyListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
3685 CaptureString(&GeoData, FALSE);
3686 coldata.SetText(GeoData);
3687 ListCtrlIndex = lboGeoposition->InsertItem(coldata);
3689 if (intPref > 0 && intPref < 101){
3691 lboGeoposition->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
3695 } else if (intType == 1){
3699 ListCtrlIndex = lboHomeTimezones->InsertItem(coldata);
3701 if (intPref > 0 && intPref < 101){
3703 lboHomeTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
3710 txtHomeGeopositioning->SetValue(GeoData);
3713 HomeGeographyList.erase(intValueSeek);
3714 HomeGeographyListType.erase(intValueSeek);
3715 HomeGeographyListTokens.erase(intValueSeek);
3716 HomeGeographyList.insert(std::make_pair(intValueSeek, GeoData));
3717 HomeGeographyListType.insert(std::make_pair(intValueSeek, wxT("home")));
3718 HomeGeographyListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
3720 CaptureString(&GeoData, FALSE);
3721 coldata.SetText(GeoData);
3722 ListCtrlIndex = lboHomeGeoposition->InsertItem(coldata);
3724 if (intPref > 0 && intPref < 101){
3726 lboHomeGeoposition->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
3730 } else if (intType == 2){
3732 ListCtrlIndex = lboBusinessGeoposition->InsertItem(coldata);
3736 ListCtrlIndex = lboBusinessTimezones->InsertItem(coldata);
3738 if (intPref > 0 && intPref < 101){
3740 lboBusinessTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
3747 txtBusinessGeopositioning->SetValue(GeoData);
3750 BusinessGeographyList.erase(intValueSeek);
3751 BusinessGeographyListType.erase(intValueSeek);
3752 BusinessGeographyListTokens.erase(intValueSeek);
3753 BusinessGeographyList.insert(std::make_pair(intValueSeek, GeoData));
3754 BusinessGeographyListType.insert(std::make_pair(intValueSeek, wxT("work")));
3755 BusinessGeographyListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
3757 CaptureString(&GeoData, FALSE);
3758 coldata.SetText(GeoData);
3759 ListCtrlIndex = lboBusinessGeoposition->InsertItem(coldata);
3761 if (intPref > 0 && intPref < 101){
3763 lboBusinessGeoposition->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
3772 } else if (wxSProperty == wxT("RELATED")){
3774 size_t intPropertyLen = wxSPropertySeg1.Len();
3775 std::map<int, int> SplitPoints;
3776 std::map<int, int> SplitLength;
3777 std::map<int, int>::iterator SLiter;
3778 wxString PropertyData;
3779 wxString PropertyName;
3780 wxString PropertyValue;
3781 wxString PropertyTokens;
3782 wxString RelatedType;
3783 wxString RelatedTypeOriginal;
3784 wxString RelatedName;
3785 bool FirstToken = TRUE;
3786 int intSplitsFound = 0;
3787 int intSplitSize = 0;
3788 int intPrevValue = 9;
3792 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3796 // Look for type before continuing.
3798 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3799 intiter != SplitPoints.end(); ++intiter){
3801 SLiter = SplitLength.find(intiter->first);
3803 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
3805 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3806 PropertyName = PropertyElement.GetNextToken();
3807 PropertyValue = PropertyElement.GetNextToken();
3809 intPrevValue = intiter->second;
3813 RelatedTypeOriginal = PropertyValue;
3815 if (PropertyName == wxT("TYPE")){
3817 if (PropertyValue == wxT("contact")){
3819 RelatedType = _("Contact");
3821 } else if (PropertyValue == wxT("acquaintance")){
3823 RelatedType = _("Acquaintance");
3825 } else if (PropertyValue == wxT("friend")){
3827 RelatedType = _("Friend");
3829 } else if (PropertyValue == wxT("met")){
3831 RelatedType = _("Met");
3833 } else if (PropertyValue == wxT("co-worker")){
3835 RelatedType = _("Co-worker");
3837 } else if (PropertyValue == wxT("colleague")){
3839 RelatedType = _("Colleague");
3841 } else if (PropertyValue == wxT("co-resident")){
3843 RelatedType = _("Co-resident");
3845 } else if (PropertyValue == wxT("neighbor")){
3847 RelatedType = _("Neighbour");
3849 } else if (PropertyValue == wxT("child")){
3851 RelatedType = _("Child");
3853 } else if (PropertyValue == wxT("parent")){
3855 RelatedType = _("Parent");
3857 } else if (PropertyValue == wxT("sibling")){
3859 RelatedType = _("Sibling");
3861 } else if (PropertyValue == wxT("spouse")){
3863 RelatedType = _("Spouse");
3865 } else if (PropertyValue == wxT("kin")){
3867 RelatedType = _("Kin");
3869 } else if (PropertyValue == wxT("muse")){
3871 RelatedType = _("Muse");
3873 } else if (PropertyValue == wxT("crush")){
3875 RelatedType = _("Crush");
3877 } else if (PropertyValue == wxT("date")){
3879 RelatedType = _("Date");
3881 } else if (PropertyValue == wxT("sweetheart")){
3883 RelatedType = _("Sweetheart");
3885 } else if (PropertyValue == wxT("me")){
3887 RelatedType = _("Me");
3889 } else if (PropertyValue == wxT("agent")){
3891 RelatedType = _("Agent");
3893 } else if (PropertyValue == wxT("emergency")){
3895 RelatedType = _("Emergency");
3899 RelatedType = PropertyValue;
3909 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3910 intiter != SplitPoints.end(); ++intiter){
3912 SLiter = SplitLength.find(intiter->first);
3914 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
3916 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3917 PropertyName = PropertyElement.GetNextToken();
3918 PropertyValue = PropertyElement.GetNextToken();
3920 intPrevValue = intiter->second;
3922 // Process properties.
3924 size_t intPropertyValueLen = PropertyValue.Len();
3926 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3928 PropertyValue.Trim();
3929 PropertyValue.RemoveLast();
3933 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3935 PropertyValue.Remove(0, 1);
3939 ProcessCaptureStrings(&PropertyValue);
3941 if (PropertyName == wxT("ALTID")){
3943 GeneralRelatedListAltID.erase(intValueSeek);
3944 GeneralRelatedListAltID.insert(std::make_pair(intValueSeek, PropertyValue));
3946 } else if (PropertyName == wxT("PID")){
3948 GeneralRelatedListPID.erase(intValueSeek);
3949 GeneralRelatedListPID.insert(std::make_pair(intValueSeek, PropertyValue));
3951 } else if (PropertyName == wxT("PREF")){
3953 intPref = wxAtoi(PropertyValue);
3955 if (intPref > 0 && intPref < 101){
3957 GeneralRelatedListPref.erase(intValueSeek);
3958 GeneralRelatedListPref.insert(std::make_pair(intValueSeek, intPref));
3963 } else if (PropertyName == wxT("LANGUAGE")){
3965 GeneralRelatedListLanguage.erase(intValueSeek);
3966 GeneralRelatedListLanguage.insert(std::make_pair(intValueSeek, PropertyValue));
3970 // Something else we don't know about so append
3971 // to the tokens variable.
3973 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3975 if (FirstToken == TRUE){
3977 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3982 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3992 // Split the address.
3994 //std::map<int, int>::iterator SLiter;
3995 intPropertyLen = wxSPropertySeg2.Len();
3996 SplitPoints.clear();
3997 SplitLength.clear();
4002 // Add the data to the General/Home/Work address variables.
4006 coldata.SetId(intValueSeek);
4007 coldata.SetData(intValueSeek);
4008 coldata.SetText(RelatedType);
4010 ProcessCaptureStrings(&wxSPropertySeg2);
4012 ListCtrlIndex = lboRelated->InsertItem(coldata);
4014 lboRelated->SetItem(ListCtrlIndex, 1, wxSPropertySeg2);
4016 if (intPref > 0 && intPref < 101){
4018 lboRelated->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
4022 GeneralRelatedList.erase(intValueSeek);
4023 GeneralRelatedListRelType.erase(intValueSeek);
4024 GeneralRelatedListType.erase(intValueSeek);
4025 GeneralRelatedListTokens.erase(intValueSeek);
4026 GeneralRelatedList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
4027 GeneralRelatedListRelType.insert(std::make_pair(intValueSeek, RelatedTypeOriginal));
4028 GeneralRelatedListType.insert(std::make_pair(intValueSeek, RelatedTypeOriginal));
4029 GeneralRelatedListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
4034 } else if (wxSProperty == wxT("URL")){
4036 std::map<int, int> SplitPoints;
4037 std::map<int, int> SplitLength;
4038 std::map<int, int>::iterator SLiter;
4039 wxString PropertyData;
4040 wxString PropertyName;
4041 wxString PropertyValue;
4042 wxString PropertyTokens;
4043 bool FirstToken = TRUE;
4044 int intPrevValue = 5;
4049 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4053 // Look for type before continuing.
4055 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4056 intiter != SplitPoints.end(); ++intiter){
4058 SLiter = SplitLength.find(intiter->first);
4060 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
4062 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4063 PropertyName = PropertyElement.GetNextToken();
4064 PropertyValue = PropertyElement.GetNextToken();
4066 intPrevValue = intiter->second;
4068 if (PropertyName == wxT("TYPE")){
4070 if (PropertyValue == wxT("work")){
4074 } else if (PropertyValue == wxT("home")){
4088 // Setup blank lines for later on.
4092 GeneralWebsiteList.insert(std::make_pair(intValueSeek, wxT("")));
4093 GeneralWebsiteListAltID.insert(std::make_pair(intValueSeek, wxT("")));
4094 GeneralWebsiteListPID.insert(std::make_pair(intValueSeek, wxT("")));
4095 GeneralWebsiteListPref.insert(std::make_pair(intValueSeek, 0));
4096 GeneralWebsiteListTokens.insert(std::make_pair(intValueSeek, wxT("")));
4098 } else if (intType == 1){
4100 HomeWebsiteList.insert(std::make_pair(intValueSeek, wxT("")));
4101 HomeWebsiteListAltID.insert(std::make_pair(intValueSeek, wxT("")));
4102 HomeWebsiteListPID.insert(std::make_pair(intValueSeek, wxT("")));
4103 HomeWebsiteListPref.insert(std::make_pair(intValueSeek, 0));
4104 HomeWebsiteListTokens.insert(std::make_pair(intValueSeek, wxT("")));
4106 } else if (intType == 2){
4108 BusinessWebsiteList.insert(std::make_pair(intValueSeek, wxT("")));
4109 BusinessWebsiteListAltID.insert(std::make_pair(intValueSeek, wxT("")));
4110 BusinessWebsiteListPID.insert(std::make_pair(intValueSeek, wxT("")));
4111 BusinessWebsiteListPref.insert(std::make_pair(intValueSeek, 0));
4112 BusinessWebsiteListTokens.insert(std::make_pair(intValueSeek, wxT("")));
4118 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4119 intiter != SplitPoints.end(); ++intiter){
4121 SLiter = SplitLength.find(intiter->first);
4123 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
4125 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4126 PropertyName = PropertyElement.GetNextToken();
4127 PropertyValue = PropertyElement.GetNextToken();
4129 intPrevValue = intiter->second;
4131 // Process properties.
4133 size_t intPropertyValueLen = PropertyValue.Len();
4135 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4137 PropertyValue.Trim();
4138 PropertyValue.RemoveLast();
4142 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4144 PropertyValue.Remove(0, 1);
4148 ProcessCaptureStrings(&PropertyValue);
4150 if (PropertyName == wxT("ALTID")){
4152 if (intType == 0){ GeneralWebsiteListAltID.erase(intValueSeek); GeneralWebsiteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4153 else if (intType == 1){ HomeWebsiteListAltID.erase(intValueSeek); HomeWebsiteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4154 else if (intType == 2){ BusinessWebsiteListAltID.erase(intValueSeek); BusinessWebsiteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4156 } else if (PropertyName == wxT("PID")){
4158 if (intType == 0){ GeneralWebsiteListPID.erase(intValueSeek); GeneralWebsiteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4159 else if (intType == 1){ HomeWebsiteListPID.erase(intValueSeek); HomeWebsiteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4160 else if (intType == 2){ BusinessWebsiteListPID.erase(intValueSeek); BusinessWebsiteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4162 } else if (PropertyName == wxT("PREF")){
4164 intPref = wxAtoi(PropertyValue);
4166 if (intType == 0){ GeneralWebsiteListPref.erase(intValueSeek); GeneralWebsiteListPref.insert(std::make_pair(intValueSeek, intPref)); }
4167 else if (intType == 1){ HomeWebsiteListPref.erase(intValueSeek); HomeWebsiteListPref.insert(std::make_pair(intValueSeek, intPref)); }
4168 else if (intType == 2){ BusinessWebsiteListPref.erase(intValueSeek); BusinessWebsiteListPref.insert(std::make_pair(intValueSeek, intPref)); }
4170 } else if (PropertyName == wxT("MEDIATYPE")){
4172 if (intType == 0){ GeneralWebsiteListMediatype.erase(intValueSeek); GeneralWebsiteListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
4173 else if (intType == 1){ HomeWebsiteListMediatype.erase(intValueSeek); HomeWebsiteListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
4174 else if (intType == 2){ BusinessWebsiteListMediatype.erase(intValueSeek); BusinessWebsiteListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
4178 // Something else we don't know about so append
4179 // to the tokens variable.
4181 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4183 if (FirstToken == TRUE){
4185 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4190 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4200 // Add the data to the General/Home/Work address variables.
4202 ProcessCaptureStrings(&wxSPropertySeg2);
4206 coldata.SetId(intValueSeek);
4207 coldata.SetData(intValueSeek);
4208 coldata.SetText(wxSPropertySeg2);
4212 ListCtrlIndex = lboWebsites->InsertItem(coldata);
4214 if (intPref > 0 && intPref < 101){
4216 lboWebsites->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
4220 GeneralWebsiteList.erase(intValueSeek);
4221 GeneralWebsiteListType.erase(intValueSeek);
4222 GeneralWebsiteListTokens.erase(intValueSeek);
4223 GeneralWebsiteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
4224 GeneralWebsiteListType.insert(std::make_pair(intValueSeek, wxT("")));
4225 GeneralWebsiteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
4227 } else if (intType == 1){
4229 ListCtrlIndex = lboHomeWebsites->InsertItem(coldata);
4231 if (intPref > 0 && intPref < 101){
4233 lboHomeWebsites->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
4237 HomeWebsiteList.erase(intValueSeek);
4238 HomeWebsiteListType.erase(intValueSeek);
4239 HomeWebsiteListTokens.erase(intValueSeek);
4240 HomeWebsiteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
4241 HomeWebsiteListType.insert(std::make_pair(intValueSeek, wxT("home")));
4242 HomeWebsiteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
4244 } else if (intType == 2){
4246 ListCtrlIndex = lboBusinessWebsites->InsertItem(coldata);
4248 if (intPref > 0 && intPref < 101){
4250 lboBusinessWebsites->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
4254 BusinessWebsiteList.erase(intValueSeek);
4255 BusinessWebsiteListType.erase(intValueSeek);
4256 BusinessWebsiteListTokens.erase(intValueSeek);
4257 BusinessWebsiteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
4258 BusinessWebsiteListType.insert(std::make_pair(intValueSeek, wxT("work")));
4259 BusinessWebsiteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
4266 } else if (wxSProperty == wxT("TITLE")) {
4268 std::map<int, int> SplitPoints;
4269 std::map<int, int> SplitLength;
4270 std::map<int, int>::iterator SLiter;
4271 wxString PropertyData;
4272 wxString PropertyName;
4273 wxString PropertyValue;
4274 wxString PropertyTokens;
4275 bool FirstToken = TRUE;
4276 int intPrevValue = 7;
4281 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4285 // Look for type before continuing.
4287 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4288 intiter != SplitPoints.end(); ++intiter){
4290 SLiter = SplitLength.find(intiter->first);
4292 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
4294 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4295 PropertyName = PropertyElement.GetNextToken();
4296 PropertyValue = PropertyElement.GetNextToken();
4298 intPrevValue = intiter->second;
4300 if (PropertyName == wxT("TYPE")){
4302 if (PropertyValue == wxT("work")){
4306 } else if (PropertyValue == wxT("home")){
4320 // Setup blank lines for later on.
4324 GeneralTitleList.insert(std::make_pair(intValueSeek, wxT("")));
4325 GeneralTitleListAltID.insert(std::make_pair(intValueSeek, wxT("")));
4326 GeneralTitleListPID.insert(std::make_pair(intValueSeek, wxT("")));
4327 GeneralTitleListPref.insert(std::make_pair(intValueSeek, 0));
4328 GeneralTitleListTokens.insert(std::make_pair(intValueSeek, wxT("")));
4329 GeneralTitleListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
4331 } else if (intType == 1){
4333 HomeTitleList.insert(std::make_pair(intValueSeek, wxT("")));
4334 HomeTitleListAltID.insert(std::make_pair(intValueSeek, wxT("")));
4335 HomeTitleListPID.insert(std::make_pair(intValueSeek, wxT("")));
4336 HomeTitleListPref.insert(std::make_pair(intValueSeek, 0));
4337 HomeTitleListTokens.insert(std::make_pair(intValueSeek, wxT("")));
4338 HomeTitleListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
4340 } else if (intType == 2){
4342 BusinessTitleList.insert(std::make_pair(intValueSeek, wxT("")));
4343 BusinessTitleListAltID.insert(std::make_pair(intValueSeek, wxT("")));
4344 BusinessTitleListPID.insert(std::make_pair(intValueSeek, wxT("")));
4345 BusinessTitleListPref.insert(std::make_pair(intValueSeek, 0));
4346 BusinessTitleListTokens.insert(std::make_pair(intValueSeek, wxT("")));
4347 BusinessTitleListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
4353 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4354 intiter != SplitPoints.end(); ++intiter){
4356 SLiter = SplitLength.find(intiter->first);
4358 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
4360 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4361 PropertyName = PropertyElement.GetNextToken();
4362 PropertyValue = PropertyElement.GetNextToken();
4364 intPrevValue = intiter->second;
4366 // Process properties.
4368 size_t intPropertyValueLen = PropertyValue.Len();
4370 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4372 PropertyValue.Trim();
4373 PropertyValue.RemoveLast();
4377 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4379 PropertyValue.Remove(0, 1);
4383 ProcessCaptureStrings(&PropertyValue);
4385 if (PropertyName == wxT("ALTID")){
4387 if (intType == 0){ GeneralTitleListAltID.erase(intValueSeek); GeneralTitleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4388 else if (intType == 1){ HomeTitleListAltID.erase(intValueSeek); HomeTitleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4389 else if (intType == 2){ BusinessTitleListAltID.erase(intValueSeek); BusinessTitleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4391 } else if (PropertyName == wxT("PID")){
4393 if (intType == 0){ GeneralTitleListPID.erase(intValueSeek); GeneralTitleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4394 else if (intType == 1){ HomeTitleListPID.erase(intValueSeek); HomeTitleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4395 else if (intType == 2){ BusinessTitleListPID.erase(intValueSeek); BusinessTitleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4397 } else if (PropertyName == wxT("PREF")){
4399 intPref = wxAtoi(PropertyValue);
4401 if (intType == 0){ GeneralTitleListPref.erase(intValueSeek); GeneralTitleListPref.insert(std::make_pair(intValueSeek, intPref)); }
4402 else if (intType == 1){ HomeTitleListPref.erase(intValueSeek); HomeTitleListPref.insert(std::make_pair(intValueSeek, intPref)); }
4403 else if (intType == 2){ BusinessTitleListPref.erase(intValueSeek); BusinessTitleListPref.insert(std::make_pair(intValueSeek, intPref)); }
4405 } else if (PropertyName == wxT("LANGUAGE")){
4407 if (intType == 0){ GeneralTitleListLanguage.erase(intValueSeek); GeneralTitleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
4408 else if (intType == 1){ HomeTitleListLanguage.erase(intValueSeek); HomeTitleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
4409 else if (intType == 2){ BusinessTitleListLanguage.erase(intValueSeek); BusinessTitleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
4413 // Something else we don't know about so append
4414 // to the tokens variable.
4416 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4418 if (FirstToken == TRUE){
4420 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4425 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4435 // Add the data to the General/Home/Work address variables.
4437 ProcessCaptureStrings(&wxSPropertySeg2);
4441 coldata.SetId(intValueSeek);
4442 coldata.SetData(intValueSeek);
4443 coldata.SetText(wxSPropertySeg2);
4447 ListCtrlIndex = lboTitles->InsertItem(coldata);
4449 if (intPref > 0 && intPref < 101){
4451 lboTitles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
4455 GeneralTitleList.erase(intValueSeek);
4456 GeneralTitleListType.erase(intValueSeek);
4457 GeneralTitleListTokens.erase(intValueSeek);
4458 GeneralTitleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
4459 GeneralTitleListType.insert(std::make_pair(intValueSeek, wxT("")));
4460 GeneralTitleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
4462 } else if (intType == 1){
4464 ListCtrlIndex = lboHomeTitles->InsertItem(coldata);
4466 if (intPref > 0 && intPref < 101){
4468 lboHomeTitles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
4472 HomeTitleList.erase(intValueSeek);
4473 HomeTitleListType.erase(intValueSeek);
4474 HomeTitleListTokens.erase(intValueSeek);
4475 HomeTitleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
4476 HomeTitleListType.insert(std::make_pair(intValueSeek, wxT("home")));
4477 HomeTitleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
4479 } else if (intType == 2){
4481 ListCtrlIndex = lboBusinessTitles->InsertItem(coldata);
4483 if (intPref > 0 && intPref < 101){
4485 lboBusinessTitles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
4489 BusinessTitleList.erase(intValueSeek);
4490 BusinessTitleListType.erase(intValueSeek);
4491 BusinessTitleListTokens.erase(intValueSeek);
4492 BusinessTitleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
4493 BusinessTitleListType.insert(std::make_pair(intValueSeek, wxT("work")));
4494 BusinessTitleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
4501 } else if (wxSProperty == wxT("ROLE")) {
4503 std::map<int, int> SplitPoints;
4504 std::map<int, int> SplitLength;
4505 std::map<int, int>::iterator SLiter;
4506 wxString PropertyData;
4507 wxString PropertyName;
4508 wxString PropertyValue;
4509 wxString PropertyTokens;
4510 bool FirstToken = TRUE;
4511 int intPrevValue = 6;
4516 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4520 // Look for type before continuing.
4522 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4523 intiter != SplitPoints.end(); ++intiter){
4525 SLiter = SplitLength.find(intiter->first);
4527 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
4529 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4530 PropertyName = PropertyElement.GetNextToken();
4531 PropertyValue = PropertyElement.GetNextToken();
4533 intPrevValue = intiter->second;
4535 if (PropertyName == wxT("TYPE")){
4537 if (PropertyValue == wxT("work")){
4541 } else if (PropertyValue == wxT("home")){
4555 // Setup blank lines for later on.
4559 GeneralRoleList.insert(std::make_pair(intValueSeek, wxT("")));
4560 GeneralRoleListAltID.insert(std::make_pair(intValueSeek, wxT("")));
4561 GeneralRoleListPID.insert(std::make_pair(intValueSeek, wxT("")));
4562 GeneralRoleListPref.insert(std::make_pair(intValueSeek, 0));
4563 GeneralRoleListTokens.insert(std::make_pair(intValueSeek, wxT("")));
4564 GeneralRoleListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
4566 } else if (intType == 1){
4568 HomeRoleList.insert(std::make_pair(intValueSeek, wxT("")));
4569 HomeRoleListAltID.insert(std::make_pair(intValueSeek, wxT("")));
4570 HomeRoleListPID.insert(std::make_pair(intValueSeek, wxT("")));
4571 HomeRoleListPref.insert(std::make_pair(intValueSeek, 0));
4572 HomeRoleListTokens.insert(std::make_pair(intValueSeek, wxT("")));
4573 HomeRoleListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
4575 } else if (intType == 2){
4577 BusinessRoleList.insert(std::make_pair(intValueSeek, wxT("")));
4578 BusinessRoleListAltID.insert(std::make_pair(intValueSeek, wxT("")));
4579 BusinessRoleListPID.insert(std::make_pair(intValueSeek, wxT("")));
4580 BusinessRoleListPref.insert(std::make_pair(intValueSeek, 0));
4581 BusinessRoleListTokens.insert(std::make_pair(intValueSeek, wxT("")));
4582 BusinessRoleListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
4588 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4589 intiter != SplitPoints.end(); ++intiter){
4591 SLiter = SplitLength.find(intiter->first);
4593 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
4595 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4596 PropertyName = PropertyElement.GetNextToken();
4597 PropertyValue = PropertyElement.GetNextToken();
4599 intPrevValue = intiter->second;
4601 // Process properties.
4603 size_t intPropertyValueLen = PropertyValue.Len();
4605 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4607 PropertyValue.Trim();
4608 PropertyValue.RemoveLast();
4612 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4614 PropertyValue.Remove(0, 1);
4618 ProcessCaptureStrings(&PropertyValue);
4620 if (PropertyName == wxT("ALTID")){
4622 if (intType == 0){ GeneralRoleListAltID.erase(intValueSeek); GeneralRoleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4623 else if (intType == 1){ HomeRoleListAltID.erase(intValueSeek); HomeRoleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4624 else if (intType == 2){ BusinessRoleListAltID.erase(intValueSeek); BusinessRoleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4626 } else if (PropertyName == wxT("PID")){
4628 if (intType == 0){ GeneralRoleListPID.erase(intValueSeek); GeneralRoleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4629 else if (intType == 1){ HomeRoleListPID.erase(intValueSeek); HomeRoleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4630 else if (intType == 2){ BusinessRoleListPID.erase(intValueSeek); BusinessRoleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4632 } else if (PropertyName == wxT("PREF")){
4634 intPref = wxAtoi(PropertyValue);
4636 if (intType == 0){ GeneralRoleListPref.erase(intValueSeek); GeneralRoleListPref.insert(std::make_pair(intValueSeek, intPref)); }
4637 else if (intType == 1){ HomeRoleListPref.erase(intValueSeek); HomeRoleListPref.insert(std::make_pair(intValueSeek, intPref)); }
4638 else if (intType == 2){ BusinessRoleListPref.erase(intValueSeek); BusinessRoleListPref.insert(std::make_pair(intValueSeek, intPref)); }
4640 } else if (PropertyName == wxT("LANGUAGE")){
4642 if (intType == 0){ GeneralRoleListLanguage.erase(intValueSeek); GeneralRoleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
4643 else if (intType == 1){ HomeRoleListLanguage.erase(intValueSeek); HomeRoleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
4644 else if (intType == 2){ BusinessRoleListLanguage.erase(intValueSeek); BusinessRoleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
4648 // Something else we don't know about so append
4649 // to the tokens variable.
4651 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4653 if (FirstToken == TRUE){
4655 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4660 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4670 // Add the data to the General/Home/Work address variables.
4672 ProcessCaptureStrings(&wxSPropertySeg2);
4676 coldata.SetId(intValueSeek);
4677 coldata.SetData(intValueSeek);
4678 coldata.SetText(wxSPropertySeg2);
4682 ListCtrlIndex = lboRoles->InsertItem(coldata);
4684 if (intPref > 0 && intPref < 101){
4686 lboRoles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
4690 GeneralRoleList.erase(intValueSeek);
4691 GeneralRoleListType.erase(intValueSeek);
4692 GeneralRoleListTokens.erase(intValueSeek);
4693 GeneralRoleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
4694 GeneralRoleListType.insert(std::make_pair(intValueSeek, wxT("")));
4695 GeneralRoleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
4697 } else if (intType == 1){
4699 ListCtrlIndex = lboHomeRoles->InsertItem(coldata);
4701 if (intPref > 0 && intPref < 101){
4703 lboHomeRoles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
4707 HomeRoleList.erase(intValueSeek);
4708 HomeRoleListType.erase(intValueSeek);
4709 HomeRoleListTokens.erase(intValueSeek);
4710 HomeRoleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
4711 HomeRoleListType.insert(std::make_pair(intValueSeek, wxT("home")));
4712 HomeRoleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
4714 } else if (intType == 2){
4716 ListCtrlIndex = lboBusinessRoles->InsertItem(coldata);
4718 if (intPref > 0 && intPref < 101){
4720 lboBusinessRoles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
4724 BusinessRoleList.erase(intValueSeek);
4725 BusinessRoleListType.erase(intValueSeek);
4726 BusinessRoleListTokens.erase(intValueSeek);
4727 BusinessRoleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
4728 BusinessRoleListType.insert(std::make_pair(intValueSeek, wxT("work")));
4729 BusinessRoleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
4736 } else if (wxSProperty == wxT("ORG")) {
4738 std::map<int, int> SplitPoints;
4739 std::map<int, int> SplitLength;
4740 std::map<int, int>::iterator SLiter;
4741 wxString PropertyData;
4742 wxString PropertyName;
4743 wxString PropertyValue;
4744 wxString PropertyTokens;
4745 bool FirstToken = TRUE;
4746 int intPrevValue = 5;
4751 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4755 // Look for type before continuing.
4757 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4758 intiter != SplitPoints.end(); ++intiter){
4760 SLiter = SplitLength.find(intiter->first);
4762 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
4764 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4765 PropertyName = PropertyElement.GetNextToken();
4766 PropertyValue = PropertyElement.GetNextToken();
4768 intPrevValue = intiter->second;
4770 if (PropertyName == wxT("TYPE")){
4772 if (PropertyValue == wxT("work")){
4776 } else if (PropertyValue == wxT("home")){
4790 // Setup blank lines for later on.
4794 GeneralOrganisationsList.insert(std::make_pair(intValueSeek, wxT("")));
4795 GeneralOrganisationsListAltID.insert(std::make_pair(intValueSeek, wxT("")));
4796 GeneralOrganisationsListPID.insert(std::make_pair(intValueSeek, wxT("")));
4797 GeneralOrganisationsListPref.insert(std::make_pair(intValueSeek, 0));
4798 GeneralOrganisationsListTokens.insert(std::make_pair(intValueSeek, wxT("")));
4799 GeneralOrganisationsListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
4800 GeneralOrganisationsListSortAs.insert(std::make_pair(intValueSeek, wxT("")));
4802 } else if (intType == 1){
4804 HomeOrganisationsList.insert(std::make_pair(intValueSeek, wxT("")));
4805 HomeOrganisationsListAltID.insert(std::make_pair(intValueSeek, wxT("")));
4806 HomeOrganisationsListPID.insert(std::make_pair(intValueSeek, wxT("")));
4807 HomeOrganisationsListPref.insert(std::make_pair(intValueSeek, 0));
4808 HomeOrganisationsListTokens.insert(std::make_pair(intValueSeek, wxT("")));
4809 HomeOrganisationsListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
4810 HomeOrganisationsListSortAs.insert(std::make_pair(intValueSeek, wxT("")));
4812 } else if (intType == 2){
4814 BusinessOrganisationsList.insert(std::make_pair(intValueSeek, wxT("")));
4815 BusinessOrganisationsListAltID.insert(std::make_pair(intValueSeek, wxT("")));
4816 BusinessOrganisationsListPID.insert(std::make_pair(intValueSeek, wxT("")));
4817 BusinessOrganisationsListPref.insert(std::make_pair(intValueSeek, 0));
4818 BusinessOrganisationsListTokens.insert(std::make_pair(intValueSeek, wxT("")));
4819 BusinessOrganisationsListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
4820 BusinessOrganisationsListSortAs.insert(std::make_pair(intValueSeek, wxT("")));
4826 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4827 intiter != SplitPoints.end(); ++intiter){
4829 SLiter = SplitLength.find(intiter->first);
4831 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
4833 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4834 PropertyName = PropertyElement.GetNextToken();
4835 PropertyValue = PropertyElement.GetNextToken();
4837 intPrevValue = intiter->second;
4839 // Process properties.
4841 size_t intPropertyValueLen = PropertyValue.Len();
4843 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4845 PropertyValue.Trim();
4846 PropertyValue.RemoveLast();
4850 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4852 PropertyValue.Remove(0, 1);
4856 ProcessCaptureStrings(&PropertyValue);
4858 if (PropertyName == wxT("ALTID")){
4860 if (intType == 0){ GeneralOrganisationsListAltID.erase(intValueSeek); GeneralOrganisationsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4861 else if (intType == 1){ HomeOrganisationsListAltID.erase(intValueSeek); HomeOrganisationsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4862 else if (intType == 2){ BusinessOrganisationsListAltID.erase(intValueSeek); BusinessOrganisationsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4864 } else if (PropertyName == wxT("PID")){
4866 if (intType == 0){ GeneralOrganisationsListPID.erase(intValueSeek); GeneralOrganisationsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4867 else if (intType == 1){ HomeOrganisationsListPID.erase(intValueSeek); HomeOrganisationsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4868 else if (intType == 2){ BusinessOrganisationsListPID.erase(intValueSeek); BusinessOrganisationsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
4870 } else if (PropertyName == wxT("PREF")){
4872 intPref = wxAtoi(PropertyValue);
4874 if (intType == 0){ GeneralOrganisationsListPref.erase(intValueSeek); GeneralOrganisationsListPref.insert(std::make_pair(intValueSeek, intPref)); }
4875 else if (intType == 1){ HomeOrganisationsListPref.erase(intValueSeek); HomeOrganisationsListPref.insert(std::make_pair(intValueSeek, intPref)); }
4876 else if (intType == 2){ BusinessOrganisationsListPref.erase(intValueSeek); BusinessOrganisationsListPref.insert(std::make_pair(intValueSeek, intPref)); }
4878 } else if (PropertyName == wxT("LANGUAGE")){
4880 if (intType == 0){ GeneralOrganisationsListLanguage.erase(intValueSeek); GeneralOrganisationsListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
4881 else if (intType == 1){ HomeOrganisationsListLanguage.erase(intValueSeek); HomeOrganisationsListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
4882 else if (intType == 2){ BusinessOrganisationsListLanguage.erase(intValueSeek); BusinessOrganisationsListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
4884 } else if (PropertyName == wxT("SORT-AS")){
4886 if (intType == 0){ GeneralOrganisationsListSortAs.erase(intValueSeek); GeneralOrganisationsListSortAs.insert(std::make_pair(intValueSeek, PropertyValue)); }
4887 else if (intType == 1){ HomeOrganisationsListSortAs.erase(intValueSeek); HomeOrganisationsListSortAs.insert(std::make_pair(intValueSeek, PropertyValue)); }
4888 else if (intType == 2){ BusinessOrganisationsListSortAs.erase(intValueSeek); BusinessOrganisationsListSortAs.insert(std::make_pair(intValueSeek, PropertyValue)); }
4892 // Something else we don't know about so append
4893 // to the tokens variable.
4895 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4897 if (FirstToken == TRUE){
4899 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4904 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4914 // Add the data to the General/Home/Work address variables.
4918 ProcessCaptureStrings(&wxSPropertySeg2);
4920 coldata.SetId(intValueSeek);
4921 coldata.SetData(intValueSeek);
4922 coldata.SetText(wxSPropertySeg2);
4926 ListCtrlIndex = lboOrganisations->InsertItem(coldata);
4928 if (intPref > 0 && intPref < 101){
4930 lboOrganisations->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
4934 GeneralOrganisationsList.erase(intValueSeek);
4935 GeneralOrganisationsListType.erase(intValueSeek);
4936 GeneralOrganisationsListTokens.erase(intValueSeek);
4937 GeneralOrganisationsList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
4938 GeneralOrganisationsListType.insert(std::make_pair(intValueSeek, wxT("")));
4939 GeneralOrganisationsListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
4941 } else if (intType == 1){
4943 ListCtrlIndex = lboHomeOrganisations->InsertItem(coldata);
4945 if (intPref > 0 && intPref < 101){
4947 lboHomeOrganisations->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
4951 HomeOrganisationsList.erase(intValueSeek);
4952 HomeOrganisationsListType.erase(intValueSeek);
4953 HomeOrganisationsListTokens.erase(intValueSeek);
4954 HomeOrganisationsList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
4955 HomeOrganisationsListType.insert(std::make_pair(intValueSeek, wxT("home")));
4956 HomeOrganisationsListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
4958 } else if (intType == 2){
4960 ListCtrlIndex = lboBusinessOrganisations->InsertItem(coldata);
4962 if (intPref > 0 && intPref < 101){
4964 lboBusinessOrganisations->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
4968 BusinessOrganisationsList.erase(intValueSeek);
4969 BusinessOrganisationsListType.erase(intValueSeek);
4970 BusinessOrganisationsListTokens.erase(intValueSeek);
4971 BusinessOrganisationsList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
4972 BusinessOrganisationsListType.insert(std::make_pair(intValueSeek, wxT("work")));
4973 BusinessOrganisationsListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
4980 } else if (wxSProperty == wxT("NOTE")) {
4982 std::map<int, int> SplitPoints;
4983 std::map<int, int> SplitLength;
4984 std::map<int, int>::iterator SLiter;
4985 wxString PropertyData;
4986 wxString PropertyName;
4987 wxString PropertyValue;
4988 wxString PropertyTokens;
4989 bool FirstToken = TRUE;
4990 int intPrevValue = 6;
4995 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4999 // Look for type before continuing.
5001 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5002 intiter != SplitPoints.end(); ++intiter){
5004 SLiter = SplitLength.find(intiter->first);
5006 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
5008 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5009 PropertyName = PropertyElement.GetNextToken();
5010 PropertyValue = PropertyElement.GetNextToken();
5012 intPrevValue = intiter->second;
5014 if (PropertyName == wxT("TYPE")){
5016 if (PropertyValue == wxT("work")){
5020 } else if (PropertyValue == wxT("home")){
5034 // Setup blank lines for later on.
5038 GeneralNoteList.insert(std::make_pair(intValueSeek, wxT("")));
5039 GeneralNoteListAltID.insert(std::make_pair(intValueSeek, wxT("")));
5040 GeneralNoteListPID.insert(std::make_pair(intValueSeek, wxT("")));
5041 GeneralNoteListPref.insert(std::make_pair(intValueSeek, 0));
5042 GeneralNoteListTokens.insert(std::make_pair(intValueSeek, wxT("")));
5043 GeneralNoteListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
5045 } else if (intType == 1){
5047 HomeNoteList.insert(std::make_pair(intValueSeek, wxT("")));
5048 HomeNoteListAltID.insert(std::make_pair(intValueSeek, wxT("")));
5049 HomeNoteListPID.insert(std::make_pair(intValueSeek, wxT("")));
5050 HomeNoteListPref.insert(std::make_pair(intValueSeek, 0));
5051 HomeNoteListTokens.insert(std::make_pair(intValueSeek, wxT("")));
5052 HomeNoteListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
5054 } else if (intType == 2){
5056 BusinessNoteList.insert(std::make_pair(intValueSeek, wxT("")));
5057 BusinessNoteListAltID.insert(std::make_pair(intValueSeek, wxT("")));
5058 BusinessNoteListPID.insert(std::make_pair(intValueSeek, wxT("")));
5059 BusinessNoteListPref.insert(std::make_pair(intValueSeek, 0));
5060 BusinessNoteListTokens.insert(std::make_pair(intValueSeek, wxT("")));
5061 BusinessNoteListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
5067 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5068 intiter != SplitPoints.end(); ++intiter){
5070 SLiter = SplitLength.find(intiter->first);
5072 PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
5074 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5075 PropertyName = PropertyElement.GetNextToken();
5076 PropertyValue = PropertyElement.GetNextToken();
5078 intPrevValue = intiter->second;
5080 // Process properties.
5082 size_t intPropertyValueLen = PropertyValue.Len();
5084 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5086 PropertyValue.Trim();
5087 PropertyValue.RemoveLast();
5091 if (PropertyValue.Mid(0, 1) == wxT("\"")){
5093 PropertyValue.Remove(0, 1);
5097 ProcessCaptureStrings(&PropertyValue);
5099 if (PropertyName == wxT("ALTID")){
5101 if (intType == 0){ GeneralNoteListAltID.erase(intValueSeek); GeneralNoteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5102 else if (intType == 1){ HomeNoteListAltID.erase(intValueSeek); HomeNoteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5103 else if (intType == 2){ BusinessNoteListAltID.erase(intValueSeek); BusinessNoteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5105 } else if (PropertyName == wxT("PID")){
5107 if (intType == 0){ GeneralNoteListPID.erase(intValueSeek); GeneralNoteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5108 else if (intType == 1){ HomeNoteListPID.erase(intValueSeek); HomeNoteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5109 else if (intType == 2){ BusinessNoteListPID.erase(intValueSeek); BusinessNoteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5111 } else if (PropertyName == wxT("PREF")){
5113 intPref = wxAtoi(PropertyValue);
5115 if (intType == 0){ GeneralNoteListPref.erase(intValueSeek); GeneralNoteListPref.insert(std::make_pair(intValueSeek, intPref)); }
5116 else if (intType == 1){ HomeNoteListPref.erase(intValueSeek); HomeNoteListPref.insert(std::make_pair(intValueSeek, intPref)); }
5117 else if (intType == 2){ BusinessNoteListPref.erase(intValueSeek); BusinessNoteListPref.insert(std::make_pair(intValueSeek, intPref)); }
5119 } else if (PropertyName == wxT("LANGUAGE")){
5121 if (intType == 0){ GeneralNoteListLanguage.erase(intValueSeek); GeneralNoteListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
5122 else if (intType == 1){ HomeNoteListLanguage.erase(intValueSeek); HomeNoteListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
5123 else if (intType == 2){ BusinessNoteListLanguage.erase(intValueSeek); BusinessNoteListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
5127 // Something else we don't know about so append
5128 // to the tokens variable.
5130 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5132 if (FirstToken == TRUE){
5134 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5139 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5149 // Add the data to the General/Home/Work address variables.
5151 ProcessCaptureStrings(&wxSPropertySeg2);
5155 coldata.SetId(intValueSeek);
5156 coldata.SetData(intValueSeek);
5160 GeneralNoteList.erase(intValueSeek);
5161 GeneralNoteListType.erase(intValueSeek);
5162 GeneralNoteListTokens.erase(intValueSeek);
5163 GeneralNoteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
5164 GeneralNoteListType.insert(std::make_pair(intValueSeek, wxT("")));
5165 GeneralNoteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
5167 //CaptureString(&wxSPropertySeg2, FALSE);
5169 coldata.SetText(wxSPropertySeg2);
5171 ListCtrlIndex = lboNotes->InsertItem(coldata);
5173 if (intPref > 0 && intPref < 101){
5175 lboNotes->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
5179 } else if (intType == 1){
5181 HomeNoteList.erase(intValueSeek);
5182 HomeNoteListType.erase(intValueSeek);
5183 HomeNoteListTokens.erase(intValueSeek);
5184 HomeNoteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
5185 HomeNoteListType.insert(std::make_pair(intValueSeek, wxT("home")));
5186 HomeNoteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
5188 CaptureString(&wxSPropertySeg2, FALSE);
5190 coldata.SetText(wxSPropertySeg2);
5192 ListCtrlIndex = lboHomeNotes->InsertItem(coldata);
5194 if (intPref > 0 && intPref < 101){
5196 lboHomeNotes->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
5200 } else if (intType == 2){
5202 BusinessNoteList.erase(intValueSeek);
5203 BusinessNoteListType.erase(intValueSeek);
5204 BusinessNoteListTokens.erase(intValueSeek);
5205 BusinessNoteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
5206 BusinessNoteListType.insert(std::make_pair(intValueSeek, wxT("work")));
5207 BusinessNoteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
5209 CaptureString(&wxSPropertySeg2, FALSE);
5211 coldata.SetText(wxSPropertySeg2);
5213 ListCtrlIndex = lboBusinessNotes->InsertItem(coldata);
5215 if (intPref > 0 && intPref < 101){
5217 lboBusinessNotes->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
5226 } else if (wxSProperty == wxT("CATEGORIES")) {
5228 size_t intPropertyLen = wxSPropertySeg1.Len();
5229 std::map<int, int> SplitPoints;
5230 std::map<int, int> SplitLength;
5231 std::map<int, int>::iterator SLiter;
5232 wxString PropertyData;
5233 wxString PropertyName;
5234 wxString PropertyValue;
5235 wxString PropertyTokens;
5236 wxString PropertyType;
5237 bool AfterFirstToken = FALSE;
5238 bool FirstToken = TRUE;
5239 int intSplitsFound = 0;
5240 int intSplitSize = 0;
5241 int intPrevValue = 12;
5244 int intSplitSeek = 0;
5247 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
5251 // Look for type before continuing.
5253 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5254 intiter != SplitPoints.end(); ++intiter){
5256 SLiter = SplitLength.find(intiter->first);
5258 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
5260 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5261 PropertyName = PropertyElement.GetNextToken();
5262 PropertyValue = PropertyElement.GetNextToken();
5264 intPrevValue = intiter->second;
5266 if (PropertyName == wxT("TYPE")){
5268 if (PropertyValue == wxT("work")){
5271 PropertyType = wxT("work");
5273 } else if (PropertyValue == wxT("home")){
5276 PropertyType = wxT("home");
5288 // Setup blank lines for later on.
5290 CategoriesList.insert(std::make_pair(intValueSeek, wxT("")));
5291 CategoriesListAltID.insert(std::make_pair(intValueSeek, wxT("")));
5292 CategoriesListPID.insert(std::make_pair(intValueSeek, wxT("")));
5293 CategoriesListPref.insert(std::make_pair(intValueSeek, 0));
5294 CategoriesListTokens.insert(std::make_pair(intValueSeek, wxT("")));
5298 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5299 intiter != SplitPoints.end(); ++intiter){
5301 SLiter = SplitLength.find(intiter->first);
5303 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
5305 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5306 PropertyName = PropertyElement.GetNextToken();
5307 PropertyValue = PropertyElement.GetNextToken();
5309 intPrevValue = intiter->second;
5311 // Process properties.
5313 size_t intPropertyValueLen = PropertyValue.Len();
5315 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5317 PropertyValue.Trim();
5318 PropertyValue.RemoveLast();
5322 if (PropertyValue.Mid(0, 1) == wxT("\"")){
5324 PropertyValue.Remove(0, 1);
5328 ProcessCaptureStrings(&PropertyValue);
5330 if (PropertyName == wxT("ALTID")){
5332 if (intType == 0){ CategoriesListAltID.erase(intValueSeek); CategoriesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5333 else if (intType == 1){ CategoriesListAltID.erase(intValueSeek); CategoriesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5334 else if (intType == 2){ CategoriesListAltID.erase(intValueSeek); CategoriesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5336 } else if (PropertyName == wxT("PID")){
5338 if (intType == 0){ CategoriesListPID.erase(intValueSeek); CategoriesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5339 else if (intType == 1){ CategoriesListPID.erase(intValueSeek); CategoriesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5340 else if (intType == 2){ CategoriesListPID.erase(intValueSeek); CategoriesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5342 } else if (PropertyName == wxT("PREF")){
5344 intPref = wxAtoi(PropertyValue);
5346 if (intType == 0){ CategoriesListPref.erase(intValueSeek); CategoriesListPref.insert(std::make_pair(intValueSeek, intPref)); }
5347 else if (intType == 1){ CategoriesListPref.erase(intValueSeek); CategoriesListPref.insert(std::make_pair(intValueSeek, intPref)); }
5348 else if (intType == 2){ CategoriesListPref.erase(intValueSeek); CategoriesListPref.insert(std::make_pair(intValueSeek, intPref)); }
5352 // Something else we don't know about so append
5353 // to the tokens variable.
5355 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5357 if (FirstToken == TRUE){
5359 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5364 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5374 // Deal with multiple categories.
5376 SplitPoints.clear();
5377 SplitLength.clear();
5382 intPropertyLen = wxSPropertySeg2.Len();
5384 for (int i = 0; i <= intPropertyLen; i++){
5386 if (intSplitSize == 0 && wxSPropertySeg2.Mid(i, 1) == wxT(" ")){
5394 if (wxSPropertySeg2.Mid(i, 1) == wxT(",") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
5396 if (AfterFirstToken == TRUE){
5398 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
5399 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
5403 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
5404 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5405 AfterFirstToken = TRUE;
5417 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5418 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
5422 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5423 intiter != SplitPoints.end(); ++intiter){
5425 SLiter = SplitLength.find(intiter->first);
5427 PropertyData = wxSPropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
5429 intPrevValue = intiter->second;
5431 // Process properties.
5435 int intPropertyValueLen = PropertyValue.Len();
5437 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5439 PropertyValue.Trim();
5440 PropertyValue.RemoveLast();
5446 // Add the data to the General/Home/Work address variables.
5448 // Trim any whitespace from the start and end.
5450 PropertyData = PropertyData.Trim(FALSE);
5451 PropertyData = PropertyData.Trim(TRUE);
5453 ProcessCaptureStrings(&PropertyData);
5457 coldata.SetId(intValueSeek);
5458 coldata.SetData(intValueSeek);
5459 coldata.SetText(PropertyData);
5461 ListCtrlIndex = lboCategories->InsertItem(coldata);
5463 if (intPref > 0 && intPref < 101){
5465 lboCategories->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
5469 CategoriesList.erase(intValueSeek);
5470 CategoriesListType.erase(intValueSeek);
5471 CategoriesListTokens.erase(intValueSeek);
5472 CategoriesList.insert(std::make_pair(intValueSeek, PropertyData));
5473 CategoriesListType.insert(std::make_pair(intValueSeek, PropertyType));
5474 CategoriesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
5481 } else if (wxSProperty == wxT("PHOTO")) {
5483 size_t intPropertyLen = wxSPropertySeg1.Len();
5484 std::map<int, int> SplitPoints;
5485 std::map<int, int> SplitLength;
5486 std::map<int, int>::iterator SLiter;
5487 wxString PropertyData;
5488 wxString PropertyName;
5489 wxString PropertyValue;
5490 wxString PropertyTokens;
5491 bool FirstToken = TRUE;
5492 int intSplitsFound = 0;
5493 int intSplitSize = 0;
5494 int intPrevValue = 7;
5499 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
5503 // Look for type before continuing.
5505 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5506 intiter != SplitPoints.end(); ++intiter){
5508 SLiter = SplitLength.find(intiter->first);
5510 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
5512 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5513 PropertyName = PropertyElement.GetNextToken();
5514 PropertyValue = PropertyElement.GetNextToken();
5516 intPrevValue = intiter->second;
5518 if (PropertyName == wxT("TYPE")){
5520 if (PropertyValue == wxT("work")){
5524 } else if (PropertyValue == wxT("home")){
5538 // Setup blank lines for later on.
5540 PicturesList.insert(std::make_pair(intValueSeek, ""));
5541 PicturesListType.insert(std::make_pair(intValueSeek, wxT("")));
5542 PicturesListAltID.insert(std::make_pair(intValueSeek, wxT("")));
5543 PicturesListPID.insert(std::make_pair(intValueSeek, wxT("")));
5544 PicturesListPref.insert(std::make_pair(intValueSeek, 0));
5545 PicturesListPicEncType.insert(std::make_pair(intValueSeek, wxT("")));
5546 PicturesListPictureType.insert(std::make_pair(intValueSeek, wxT("")));
5547 PicturesListTokens.insert(std::make_pair(intValueSeek, wxT("")));
5548 PicturesListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
5552 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5553 intiter != SplitPoints.end(); ++intiter){
5555 SLiter = SplitLength.find(intiter->first);
5557 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
5559 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5560 PropertyName = PropertyElement.GetNextToken();
5561 PropertyValue = PropertyElement.GetNextToken();
5563 intPrevValue = intiter->second;
5565 // Process properties.
5567 size_t intPropertyValueLen = PropertyValue.Len();
5569 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5571 PropertyValue.Trim();
5572 PropertyValue.RemoveLast();
5576 if (PropertyValue.Mid(0, 1) == wxT("\"")){
5578 PropertyValue.Remove(0, 1);
5582 ProcessCaptureStrings(&PropertyValue);
5584 if (PropertyName == wxT("ALTID")){
5586 if (intType == 0){ PicturesListAltID.erase(intValueSeek); PicturesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5587 else if (intType == 1){ PicturesListAltID.erase(intValueSeek); PicturesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5588 else if (intType == 2){ PicturesListAltID.erase(intValueSeek); PicturesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5590 } else if (PropertyName == wxT("PID")){
5592 if (intType == 0){ PicturesListPID.erase(intValueSeek); PicturesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5593 else if (intType == 1){ PicturesListPID.erase(intValueSeek); PicturesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5594 else if (intType == 2){ PicturesListPID.erase(intValueSeek); PicturesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5596 } else if (PropertyName == wxT("PREF")){
5598 intPref = wxAtoi(PropertyValue);
5600 if (intType == 0){ PicturesListPref.erase(intValueSeek); PicturesListPref.insert(std::make_pair(intValueSeek, intPref)); }
5601 else if (intType == 1){ PicturesListPref.erase(intValueSeek); PicturesListPref.insert(std::make_pair(intValueSeek, intPref)); }
5602 else if (intType == 2){ PicturesListPref.erase(intValueSeek); PicturesListPref.insert(std::make_pair(intValueSeek, intPref)); }
5604 } else if (PropertyName == wxT("MEDIATYPE")){
5606 if (intType == 0){ PicturesListMediatype.erase(intValueSeek); PicturesListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
5607 else if (intType == 1){ PicturesListMediatype.erase(intValueSeek); PicturesListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
5608 else if (intType == 2){ PicturesListMediatype.erase(intValueSeek); PicturesListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
5612 // Something else we don't know about so append
5613 // to the tokens variable.
5615 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5617 if (FirstToken == TRUE){
5619 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5624 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5634 intPropertyLen = wxSPropertySeg2.Len();
5635 SplitPoints.clear();
5636 SplitLength.clear();
5641 ProcessCaptureStrings(&wxSPropertySeg2);
5643 for (int i = 0; i <= intPropertyLen; i++){
5647 if (wxSPropertySeg2.Mid(i, 1) == wxT(";")){
5650 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
5652 if (intSplitsFound == 6){
5654 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5659 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5669 wxString wxSPhotoURI;
5670 wxString wxSPhotoMIME;
5671 wxString wxSPhotoEncoding;
5672 wxString wxSPhotoData;
5673 std::string base64enc;
5675 if (intSplitsFound == 0){
5679 std::map<int, int>::iterator striter;
5681 striter = SplitLength.find(1);
5683 wxStringTokenizer wSTDataType(wxSPropertySeg2.Mid(0, striter->second), wxT(":"));
5685 while (wSTDataType.HasMoreTokens() == TRUE){
5687 wxSPhotoURI = wSTDataType.GetNextToken();
5688 wxSPhotoMIME = wSTDataType.GetNextToken();
5693 wxStringTokenizer wSTDataInfo(wxSPropertySeg2.Mid((striter->second + 1)), wxT(","));
5695 while (wSTDataInfo.HasMoreTokens() == TRUE){
5697 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
5698 wxSPhotoData = wSTDataInfo.GetNextToken();
5699 base64enc = wxSPhotoData.mb_str();
5706 // Add the data to the General/Home/Work address variables.
5710 coldata.SetId(intValueSeek);
5711 coldata.SetData(intValueSeek);
5712 coldata.SetText(_("Picture"));
5714 ListCtrlIndex = lboPictures->InsertItem(coldata);
5716 if (intPref > 0 && intPref < 101){
5718 lboPictures->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
5722 PicturesList.erase(intValueSeek);
5723 PicturesListType.erase(intValueSeek);
5724 PicturesListTokens.erase(intValueSeek);
5725 PicturesListPictureType.erase(intValueSeek);
5726 PicturesListPicEncType.erase(intValueSeek);
5727 PicturesList.insert(std::make_pair(intValueSeek, base64enc));
5728 PicturesListPictureType.insert(std::make_pair(intValueSeek, wxSPhotoMIME));
5729 PicturesListPicEncType.insert(std::make_pair(intValueSeek, wxSPhotoEncoding));
5733 PicturesListType.insert(std::make_pair(intValueSeek, wxT("")));
5735 } else if (intType == 1){
5737 PicturesListType.insert(std::make_pair(intValueSeek, wxT("home")));
5738 lboLogos->SetItem(ListCtrlIndex, 1, _("Home"));
5740 } else if (intType == 2){
5742 PicturesListType.insert(std::make_pair(intValueSeek, wxT("work")));
5743 lboLogos->SetItem(ListCtrlIndex, 1, _("Work"));
5747 PicturesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
5752 } else if (wxSProperty == wxT("LOGO")) {
5754 size_t intPropertyLen = wxSPropertySeg1.Len();
5755 std::map<int, int> SplitPoints;
5756 std::map<int, int> SplitLength;
5757 std::map<int, int>::iterator SLiter;
5758 wxString PropertyData;
5759 wxString PropertyName;
5760 wxString PropertyValue;
5761 wxString PropertyTokens;
5762 bool FirstToken = TRUE;
5763 int intSplitsFound = 0;
5764 int intSplitSize = 0;
5765 int intPrevValue = 6;
5770 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
5774 // Look for type before continuing.
5776 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5777 intiter != SplitPoints.end(); ++intiter){
5779 SLiter = SplitLength.find(intiter->first);
5781 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
5783 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5784 PropertyName = PropertyElement.GetNextToken();
5785 PropertyValue = PropertyElement.GetNextToken();
5787 intPrevValue = intiter->second;
5789 if (PropertyName == wxT("TYPE")){
5791 if (PropertyValue == wxT("work")){
5795 } else if (PropertyValue == wxT("home")){
5809 // Setup blank lines for later on.
5811 LogosList.insert(std::make_pair(intValueSeek, ""));
5812 LogosListType.insert(std::make_pair(intValueSeek, wxT("")));
5813 LogosListAltID.insert(std::make_pair(intValueSeek, wxT("")));
5814 LogosListPID.insert(std::make_pair(intValueSeek, wxT("")));
5815 LogosListPref.insert(std::make_pair(intValueSeek, 0));
5816 LogosListPicEncType.insert(std::make_pair(intValueSeek, wxT("")));
5817 LogosListPictureType.insert(std::make_pair(intValueSeek, wxT("")));
5818 LogosListTokens.insert(std::make_pair(intValueSeek, wxT("")));
5819 LogosListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
5823 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5824 intiter != SplitPoints.end(); ++intiter){
5826 SLiter = SplitLength.find(intiter->first);
5828 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
5830 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5831 PropertyName = PropertyElement.GetNextToken();
5832 PropertyValue = PropertyElement.GetNextToken();
5834 intPrevValue = intiter->second;
5836 // Process properties.
5838 size_t intPropertyValueLen = PropertyValue.Len();
5840 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5842 PropertyValue.Trim();
5843 PropertyValue.RemoveLast();
5847 if (PropertyValue.Mid(0, 1) == wxT("\"")){
5849 PropertyValue.Remove(0, 1);
5853 ProcessCaptureStrings(&PropertyValue);
5855 if (PropertyName == wxT("ALTID")){
5857 if (intType == 0){ LogosListAltID.erase(intValueSeek); LogosListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5858 else if (intType == 1){ LogosListAltID.erase(intValueSeek); LogosListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5859 else if (intType == 2){ LogosListAltID.erase(intValueSeek); LogosListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5861 } else if (PropertyName == wxT("PID")){
5863 if (intType == 0){ LogosListPID.erase(intValueSeek); LogosListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5864 else if (intType == 1){ LogosListPID.erase(intValueSeek); LogosListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5865 else if (intType == 2){ LogosListPID.erase(intValueSeek); LogosListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
5867 } else if (PropertyName == wxT("PREF")){
5869 intPref = wxAtoi(PropertyValue);
5871 if (intType == 0){ LogosListPref.erase(intValueSeek); LogosListPref.insert(std::make_pair(intValueSeek, intPref)); }
5872 else if (intType == 1){ LogosListPref.erase(intValueSeek); LogosListPref.insert(std::make_pair(intValueSeek, intPref)); }
5873 else if (intType == 2){ LogosListPref.erase(intValueSeek); LogosListPref.insert(std::make_pair(intValueSeek, intPref)); }
5875 } else if (PropertyName == wxT("MEDIATYPE")){
5877 if (intType == 0){ LogosListMediatype.erase(intValueSeek); LogosListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
5878 else if (intType == 1){ LogosListMediatype.erase(intValueSeek); LogosListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
5879 else if (intType == 2){ LogosListMediatype.erase(intValueSeek); LogosListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
5883 // Something else we don't know about so append
5884 // to the tokens variable.
5886 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5888 if (FirstToken == TRUE){
5890 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5895 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5905 intPropertyLen = wxSPropertySeg2.Len();
5906 SplitPoints.clear();
5907 SplitLength.clear();
5912 wxString wxSPhotoURI;
5913 wxString wxSPhotoMIME;
5914 wxString wxSPhotoEncoding;
5915 wxString wxSPhotoData;
5916 std::string base64enc;
5918 ProcessCaptureStrings(&wxSPropertySeg2);
5920 if (intSplitsFound == 0){
5924 std::map<int, int>::iterator striter;
5926 striter = SplitLength.find(1);
5928 wxStringTokenizer wSTDataType(wxSPropertySeg2.Mid(0, striter->second), wxT(":"));
5930 while (wSTDataType.HasMoreTokens() == TRUE){
5932 wxSPhotoURI = wSTDataType.GetNextToken();
5933 wxSPhotoMIME = wSTDataType.GetNextToken();
5938 wxStringTokenizer wSTDataInfo(wxSPropertySeg2.Mid((striter->second + 1)), wxT(","));
5940 while (wSTDataInfo.HasMoreTokens() == TRUE){
5942 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
5943 wxSPhotoData = wSTDataInfo.GetNextToken();
5944 base64enc = wxSPhotoData.mb_str();
5951 // Add the data to the General/Home/Work address variables.
5955 coldata.SetId(intValueSeek);
5956 coldata.SetData(intValueSeek);
5957 coldata.SetText(_("Picture"));
5959 ListCtrlIndex = lboLogos->InsertItem(coldata);
5961 if (intPref > 0 && intPref < 101){
5963 lboLogos->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
5967 LogosList.erase(intValueSeek);
5968 LogosListType.erase(intValueSeek);
5969 LogosListTokens.erase(intValueSeek);
5970 LogosListPictureType.erase(intValueSeek);
5971 LogosListPicEncType.erase(intValueSeek);
5972 LogosList.insert(std::make_pair(intValueSeek, base64enc));
5973 LogosListPictureType.insert(std::make_pair(intValueSeek, wxSPhotoMIME));
5974 LogosListPicEncType.insert(std::make_pair(intValueSeek, wxSPhotoEncoding));
5978 LogosListType.insert(std::make_pair(intValueSeek, wxT("")));
5980 } else if (intType == 1){
5982 LogosListType.insert(std::make_pair(intValueSeek, wxT("home")));
5983 lboLogos->SetItem(ListCtrlIndex, 1, _("Home"));
5985 } else if (intType == 2){
5987 LogosListType.insert(std::make_pair(intValueSeek, wxT("work")));
5988 lboLogos->SetItem(ListCtrlIndex, 1, _("Work"));
5992 LogosListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
5997 } else if (wxSProperty == wxT("SOUND")) {
5999 size_t intPropertyLen = wxSPropertySeg1.Len();
6000 std::map<int, int> SplitPoints;
6001 std::map<int, int> SplitLength;
6002 std::map<int, int>::iterator SLiter;
6003 wxString PropertyData;
6004 wxString PropertyName;
6005 wxString PropertyValue;
6006 wxString PropertyTokens;
6007 bool FirstToken = TRUE;
6008 int intSplitsFound = 0;
6009 int intSplitSize = 0;
6010 int intPrevValue = 7;
6015 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
6019 // Look for type before continuing.
6021 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
6022 intiter != SplitPoints.end(); ++intiter){
6024 SLiter = SplitLength.find(intiter->first);
6026 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
6028 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
6029 PropertyName = PropertyElement.GetNextToken();
6030 PropertyValue = PropertyElement.GetNextToken();
6032 intPrevValue = intiter->second;
6034 if (PropertyName == wxT("TYPE")){
6036 if (PropertyValue == wxT("work")){
6040 } else if (PropertyValue == wxT("home")){
6054 // Setup blank lines for later on.
6056 SoundsList.insert(std::make_pair(intValueSeek, ""));
6057 SoundsListType.insert(std::make_pair(intValueSeek, wxT("")));
6058 SoundsListAltID.insert(std::make_pair(intValueSeek, wxT("")));
6059 SoundsListPID.insert(std::make_pair(intValueSeek, wxT("")));
6060 SoundsListPref.insert(std::make_pair(intValueSeek, 0));
6061 SoundsListAudioEncType.insert(std::make_pair(intValueSeek, wxT("")));
6062 SoundsListAudioType.insert(std::make_pair(intValueSeek, wxT("")));
6063 SoundsListTokens.insert(std::make_pair(intValueSeek, wxT("")));
6064 SoundsListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
6068 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
6069 intiter != SplitPoints.end(); ++intiter){
6071 SLiter = SplitLength.find(intiter->first);
6073 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
6075 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
6076 PropertyName = PropertyElement.GetNextToken();
6077 PropertyValue = PropertyElement.GetNextToken();
6079 intPrevValue = intiter->second;
6081 // Process properties.
6083 size_t intPropertyValueLen = PropertyValue.Len();
6085 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
6087 PropertyValue.Trim();
6088 PropertyValue.RemoveLast();
6092 if (PropertyValue.Mid(0, 1) == wxT("\"")){
6094 PropertyValue.Remove(0, 1);
6098 ProcessCaptureStrings(&PropertyValue);
6100 if (PropertyName == wxT("ALTID")){
6102 if (intType == 0){ SoundsListAltID.erase(intValueSeek); SoundsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
6103 else if (intType == 1){ SoundsListAltID.erase(intValueSeek); SoundsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
6104 else if (intType == 2){ SoundsListAltID.erase(intValueSeek); SoundsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
6106 } else if (PropertyName == wxT("PID")){
6108 if (intType == 0){ SoundsListPID.erase(intValueSeek); SoundsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
6109 else if (intType == 1){ SoundsListPID.erase(intValueSeek); SoundsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
6110 else if (intType == 2){ SoundsListPID.erase(intValueSeek); SoundsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
6112 } else if (PropertyName == wxT("PREF")){
6114 intPref = wxAtoi(PropertyValue);
6116 if (intType == 0){ SoundsListPref.erase(intValueSeek); SoundsListPref.insert(std::make_pair(intValueSeek, intPref)); }
6117 else if (intType == 1){ SoundsListPref.erase(intValueSeek); SoundsListPref.insert(std::make_pair(intValueSeek, intPref)); }
6118 else if (intType == 2){ SoundsListPref.erase(intValueSeek); SoundsListPref.insert(std::make_pair(intValueSeek, intPref)); }
6120 } else if (PropertyName == wxT("MEDIATYPE")){
6122 if (intType == 0){ SoundsListMediatype.erase(intValueSeek); SoundsListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
6123 else if (intType == 1){ SoundsListMediatype.erase(intValueSeek); SoundsListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
6124 else if (intType == 2){ SoundsListMediatype.erase(intValueSeek); SoundsListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
6128 // Something else we don't know about so append
6129 // to the tokens variable.
6131 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
6133 if (FirstToken == TRUE){
6135 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
6140 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
6150 intPropertyLen = wxSPropertySeg2.Len();
6151 SplitPoints.clear();
6152 SplitLength.clear();
6157 ProcessCaptureStrings(&wxSPropertySeg2);
6159 for (int i = 0; i <= intPropertyLen; i++){
6163 if (wxSPropertySeg2.Mid(i, 1) == wxT(";")){
6166 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
6168 if (intSplitsFound == 6){
6170 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
6175 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
6185 wxString wxSSoundURI;
6186 wxString wxSSoundMIME;
6187 wxString wxSSoundEncoding;
6188 wxString wxSSoundData;
6189 std::string base64enc;
6191 if (intSplitsFound == 0){
6195 std::map<int, int>::iterator striter;
6197 striter = SplitLength.find(1);
6199 wxStringTokenizer wSTDataType(wxSPropertySeg2.Mid(0, striter->second), wxT(":"));
6201 while (wSTDataType.HasMoreTokens() == TRUE){
6203 wxSSoundURI = wSTDataType.GetNextToken();
6204 wxSSoundMIME = wSTDataType.GetNextToken();
6209 wxStringTokenizer wSTDataInfo(wxSPropertySeg2.Mid((striter->second + 1)), wxT(","));
6211 while (wSTDataInfo.HasMoreTokens() == TRUE){
6213 wxSSoundEncoding = wSTDataInfo.GetNextToken();
6214 wxSSoundData = wSTDataInfo.GetNextToken();
6215 base64enc = wxSSoundData.mb_str();
6222 // Add the data to the General/Home/Work address variables.
6226 coldata.SetId(intValueSeek);
6227 coldata.SetData(intValueSeek);
6228 coldata.SetText(_("Sound"));
6230 ListCtrlIndex = lboSounds->InsertItem(coldata);
6232 if (intPref > 0 && intPref < 101){
6234 lboSounds->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
6238 SoundsList.erase(intValueSeek);
6239 SoundsListType.erase(intValueSeek);
6240 SoundsListTokens.erase(intValueSeek);
6241 SoundsListAudioType.erase(intValueSeek);
6242 SoundsListAudioEncType.erase(intValueSeek);
6243 SoundsList.insert(std::make_pair(intValueSeek, base64enc));
6244 SoundsListAudioType.insert(std::make_pair(intValueSeek, wxSSoundMIME));
6245 SoundsListAudioEncType.insert(std::make_pair(intValueSeek, wxSSoundEncoding));
6249 SoundsListType.insert(std::make_pair(intValueSeek, wxT("")));
6251 } else if (intType == 1){
6253 SoundsListType.insert(std::make_pair(intValueSeek, wxT("home")));
6254 lboLogos->SetItem(ListCtrlIndex, 1, _("Home"));
6256 } else if (intType == 2){
6258 SoundsListType.insert(std::make_pair(intValueSeek, wxT("work")));
6259 lboLogos->SetItem(ListCtrlIndex, 1, _("Work"));
6263 SoundsListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
6268 } else if (wxSProperty == wxT("CALURI")){
6270 std::map<int, int> SplitPoints;
6271 std::map<int, int> SplitLength;
6272 std::map<int, int>::iterator SLiter;
6273 wxString PropertyData;
6274 wxString PropertyName;
6275 wxString PropertyValue;
6276 wxString PropertyTokens;
6277 bool FirstToken = TRUE;
6278 int intPrevValue = 8;
6283 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
6287 // Look for type before continuing.
6289 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
6290 intiter != SplitPoints.end(); ++intiter){
6292 SLiter = SplitLength.find(intiter->first);
6294 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
6296 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
6297 PropertyName = PropertyElement.GetNextToken();
6298 PropertyValue = PropertyElement.GetNextToken();
6300 intPrevValue = intiter->second;
6302 if (PropertyName == wxT("TYPE")){
6304 if (PropertyValue == wxT("work")){
6308 } else if (PropertyValue == wxT("home")){
6322 // Setup blank lines for later on.
6324 CalendarList.insert(std::make_pair(intValueSeek, wxT("")));
6325 CalendarListAltID.insert(std::make_pair(intValueSeek, wxT("")));
6326 CalendarListPID.insert(std::make_pair(intValueSeek, wxT("")));
6327 CalendarListPref.insert(std::make_pair(intValueSeek, 0));
6328 CalendarListTokens.insert(std::make_pair(intValueSeek, wxT("")));
6332 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
6333 intiter != SplitPoints.end(); ++intiter){
6335 SLiter = SplitLength.find(intiter->first);
6337 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
6339 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
6340 PropertyName = PropertyElement.GetNextToken();
6341 PropertyValue = PropertyElement.GetNextToken();
6343 intPrevValue = intiter->second;
6345 // Process properties.
6347 size_t intPropertyValueLen = PropertyValue.Len();
6349 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
6351 PropertyValue.Trim();
6352 PropertyValue.RemoveLast();
6356 if (PropertyValue.Mid(0, 1) == wxT("\"")){
6358 PropertyValue.Remove(0, 1);
6362 if (PropertyName == wxT("ALTID")){
6364 CalendarListAltID.erase(intValueSeek); CalendarListAltID.insert(std::make_pair(intValueSeek, PropertyValue));
6366 } else if (PropertyName == wxT("PID")){
6368 CalendarListPID.erase(intValueSeek); CalendarListPID.insert(std::make_pair(intValueSeek, PropertyValue));
6370 } else if (PropertyName == wxT("PREF")){
6372 intPref = wxAtoi(PropertyValue);
6374 CalendarListPref.erase(intValueSeek); CalendarListPref.insert(std::make_pair(intValueSeek, intPref));
6376 } else if (PropertyName == wxT("MEDIATYPE")){
6378 CalendarListMediatype.erase(intValueSeek); CalendarListMediatype.insert(std::make_pair(intValueSeek, PropertyValue));
6382 // Something else we don't know about so append
6383 // to the tokens variable.
6385 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
6387 if (FirstToken == TRUE){
6389 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
6394 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
6404 // Add the data to the General/Home/Work address variables.
6408 coldata.SetId(intValueSeek);
6409 coldata.SetData(intValueSeek);
6410 coldata.SetText(wxSPropertySeg2);
6412 ListCtrlIndex = lboCalendarAddresses->InsertItem(coldata);
6414 if (intPref > 0 && intPref < 101){
6416 lboCalendarAddresses->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
6420 CaptureString(&wxSPropertySeg2, FALSE);
6422 CalendarList.erase(intValueSeek);
6423 CalendarListType.erase(intValueSeek);
6424 CalendarListTokens.erase(intValueSeek);
6425 CalendarList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
6429 CalendarListType.insert(std::make_pair(intValueSeek, wxT("")));
6431 } else if (intType == 1){
6433 CalendarListType.insert(std::make_pair(intValueSeek, wxT("home")));
6434 lboCalendarAddresses->SetItem(ListCtrlIndex, 1, _("Home"), intPref);
6436 } else if (intType == 2){
6438 CalendarListType.insert(std::make_pair(intValueSeek, wxT("work")));
6439 lboCalendarAddresses->SetItem(ListCtrlIndex, 1, _("Work"), intPref);
6443 CalendarListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
6448 } else if (wxSProperty == wxT("CALADRURI")){
6450 std::map<int, int> SplitPoints;
6451 std::map<int, int> SplitLength;
6452 std::map<int, int>::iterator SLiter;
6453 wxString PropertyData;
6454 wxString PropertyName;
6455 wxString PropertyValue;
6456 wxString PropertyTokens;
6457 bool FirstToken = TRUE;
6458 int intPrevValue = 11;
6463 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
6467 // Look for type before continuing.
6471 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
6472 intiter != SplitPoints.end(); ++intiter){
6474 SLiter = SplitLength.find(intiter->first);
6476 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
6478 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
6479 PropertyName = PropertyElement.GetNextToken();
6480 PropertyValue = PropertyElement.GetNextToken();
6482 intPrevValue = intiter->second;
6484 if (PropertyName == wxT("TYPE")){
6486 if (PropertyValue == wxT("work")){
6490 } else if (PropertyValue == wxT("home")){
6504 // Setup blank lines for later on.
6506 CalendarRequestList.insert(std::make_pair(intValueSeek, wxT("")));
6507 CalendarRequestListAltID.insert(std::make_pair(intValueSeek, wxT("")));
6508 CalendarRequestListPID.insert(std::make_pair(intValueSeek, wxT("")));
6509 CalendarRequestListPref.insert(std::make_pair(intValueSeek, 0));
6510 CalendarRequestListTokens.insert(std::make_pair(intValueSeek, wxT("")));
6514 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
6515 intiter != SplitPoints.end(); ++intiter){
6517 SLiter = SplitLength.find(intiter->first);
6519 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
6521 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
6522 PropertyName = PropertyElement.GetNextToken();
6523 PropertyValue = PropertyElement.GetNextToken();
6525 intPrevValue = intiter->second;
6527 // Process properties.
6529 size_t intPropertyValueLen = PropertyValue.Len();
6531 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
6533 PropertyValue.Trim();
6534 PropertyValue.RemoveLast();
6538 if (PropertyValue.Mid(0, 1) == wxT("\"")){
6540 PropertyValue.Remove(0, 1);
6544 if (PropertyName == wxT("ALTID")){
6546 CalendarRequestListAltID.erase(intValueSeek); CalendarRequestListAltID.insert(std::make_pair(intValueSeek, PropertyValue));
6548 } else if (PropertyName == wxT("PID")){
6550 CalendarRequestListPID.erase(intValueSeek); CalendarRequestListPID.insert(std::make_pair(intValueSeek, PropertyValue));
6552 } else if (PropertyName == wxT("PREF")){
6554 intPref = wxAtoi(PropertyValue);
6556 CalendarRequestListPref.erase(intValueSeek); CalendarRequestListPref.insert(std::make_pair(intValueSeek, intPref));
6558 } else if (PropertyName == wxT("MEDIATYPE")){
6560 CalendarRequestListMediatype.erase(intValueSeek); CalendarRequestListMediatype.insert(std::make_pair(intValueSeek, PropertyValue));
6564 // Something else we don't know about so append
6565 // to the tokens variable.
6567 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
6569 if (FirstToken == TRUE){
6571 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
6576 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
6586 // Add the data to the General/Home/Work address variables.
6590 coldata.SetId(intValueSeek);
6591 coldata.SetData(intValueSeek);
6592 coldata.SetText(wxSPropertySeg2);
6594 ListCtrlIndex = lboCalendarRequestAddress->InsertItem(coldata);
6596 if (intPref > 0 && intPref < 101){
6598 lboCalendarRequestAddress->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
6602 CaptureString(&wxSPropertySeg2, FALSE);
6604 CalendarRequestList.erase(intValueSeek);
6605 CalendarRequestListType.erase(intValueSeek);
6606 CalendarRequestListTokens.erase(intValueSeek);
6607 CalendarRequestList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
6611 CalendarRequestListType.insert(std::make_pair(intValueSeek, wxT("")));
6613 } else if (intType == 1){
6615 CalendarRequestListType.insert(std::make_pair(intValueSeek, wxT("home")));
6616 lboCalendarRequestAddress->SetItem(ListCtrlIndex, 1, _("Home"), intPref);
6618 } else if (intType == 2){
6620 CalendarRequestListType.insert(std::make_pair(intValueSeek, wxT("work")));
6621 lboCalendarRequestAddress->SetItem(ListCtrlIndex, 1, _("Work"), intPref);
6625 CalendarRequestListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
6630 } else if (wxSProperty == wxT("FBURL")){
6632 std::map<int, int> SplitPoints;
6633 std::map<int, int> SplitLength;
6634 std::map<int, int>::iterator SLiter;
6635 wxString PropertyData;
6636 wxString PropertyName;
6637 wxString PropertyValue;
6638 wxString PropertyTokens;
6639 bool FirstToken = TRUE;
6640 int intPrevValue = 7;
6645 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
6649 // Look for type before continuing.
6651 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
6652 intiter != SplitPoints.end(); ++intiter){
6654 SLiter = SplitLength.find(intiter->first);
6656 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
6658 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
6659 PropertyName = PropertyElement.GetNextToken();
6660 PropertyValue = PropertyElement.GetNextToken();
6662 intPrevValue = intiter->second;
6664 if (PropertyName == wxT("TYPE")){
6666 if (PropertyValue == wxT("work")){
6670 } else if (PropertyValue == wxT("home")){
6684 // Setup blank lines for later on.
6686 FreeBusyList.insert(std::make_pair(intValueSeek, wxT("")));
6687 FreeBusyListAltID.insert(std::make_pair(intValueSeek, wxT("")));
6688 FreeBusyListPID.insert(std::make_pair(intValueSeek, wxT("")));
6689 FreeBusyListPref.insert(std::make_pair(intValueSeek, 0));
6690 FreeBusyListTokens.insert(std::make_pair(intValueSeek, wxT("")));
6694 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
6695 intiter != SplitPoints.end(); ++intiter){
6697 SLiter = SplitLength.find(intiter->first);
6699 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
6701 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
6702 PropertyName = PropertyElement.GetNextToken();
6703 PropertyValue = PropertyElement.GetNextToken();
6705 intPrevValue = intiter->second;
6707 // Process properties.
6709 size_t intPropertyValueLen = PropertyValue.Len();
6711 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
6713 PropertyValue.Trim();
6714 PropertyValue.RemoveLast();
6718 if (PropertyValue.Mid(0, 1) == wxT("\"")){
6720 PropertyValue.Remove(0, 1);
6724 if (PropertyName == wxT("ALTID")){
6726 FreeBusyListAltID.erase(intValueSeek); FreeBusyListAltID.insert(std::make_pair(intValueSeek, PropertyValue));
6728 } else if (PropertyName == wxT("PID")){
6730 FreeBusyListPID.erase(intValueSeek); FreeBusyListPID.insert(std::make_pair(intValueSeek, PropertyValue));
6732 } else if (PropertyName == wxT("PREF")){
6734 intPref = wxAtoi(PropertyValue);
6736 FreeBusyListPref.erase(intValueSeek); FreeBusyListPref.insert(std::make_pair(intValueSeek, intPref));
6738 } else if (PropertyName == wxT("MEDIATYPE")){
6740 FreeBusyListMediatype.erase(intValueSeek); FreeBusyListMediatype.insert(std::make_pair(intValueSeek, PropertyValue));
6744 // Something else we don't know about so append
6745 // to the tokens variable.
6747 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
6749 if (FirstToken == TRUE){
6751 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
6756 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
6766 // Add the data to the General/Home/Work address variables.
6770 coldata.SetId(intValueSeek);
6771 coldata.SetData(intValueSeek);
6772 coldata.SetText(wxSPropertySeg2);
6774 ListCtrlIndex = lboFreeBusyAddresses->InsertItem(coldata);
6776 if (intPref > 0 && intPref < 101){
6778 lboFreeBusyAddresses->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
6782 CaptureString(&wxSPropertySeg2, FALSE);
6784 FreeBusyList.erase(intValueSeek);
6785 FreeBusyListType.erase(intValueSeek);
6786 FreeBusyListTokens.erase(intValueSeek);
6787 FreeBusyList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
6791 FreeBusyListType.insert(std::make_pair(intValueSeek, wxT("")));
6793 } else if (intType == 1){
6795 FreeBusyListType.insert(std::make_pair(intValueSeek, wxT("home")));
6796 lboFreeBusyAddresses->SetItem(ListCtrlIndex, 1, _("Home"), intPref);
6798 } else if (intType == 2){
6800 FreeBusyListType.insert(std::make_pair(intValueSeek, wxT("work")));
6801 lboFreeBusyAddresses->SetItem(ListCtrlIndex, 1, _("Work"), intPref);
6805 FreeBusyListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
6809 } else if (wxSProperty == wxT("KEY")){
6811 size_t intPropertyLen = wxSPropertySeg1.Len();
6812 std::map<int, int> SplitPoints;
6813 std::map<int, int> SplitLength;
6814 std::map<int, int>::iterator SLiter;
6815 wxString PropertyData;
6816 wxString PropertyName;
6817 wxString PropertyValue;
6818 wxString PropertyTokens;
6819 bool FirstToken = TRUE;
6820 int intSplitsFound = 0;
6821 int intSplitSize = 0;
6822 int intPrevValue = 5;
6827 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
6831 // Look for type before continuing.
6833 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
6834 intiter != SplitPoints.end(); ++intiter){
6836 SLiter = SplitLength.find(intiter->first);
6838 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
6840 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
6841 PropertyName = PropertyElement.GetNextToken();
6842 PropertyValue = PropertyElement.GetNextToken();
6844 intPrevValue = intiter->second;
6846 if (PropertyName == wxT("TYPE")){
6848 if (PropertyValue == wxT("work")){
6852 } else if (PropertyValue == wxT("home")){
6866 // Setup blank lines for later on.
6868 KeyList.insert(std::make_pair(intValueSeek, wxT("")));
6869 KeyListAltID.insert(std::make_pair(intValueSeek, wxT("")));
6870 KeyListPID.insert(std::make_pair(intValueSeek, wxT("")));
6871 KeyListPref.insert(std::make_pair(intValueSeek, 0));
6872 KeyListKeyType.insert(std::make_pair(intValueSeek, FALSE));
6873 KeyListDataType.insert(std::make_pair(intValueSeek, wxT("")));
6874 KeyListDataEncType.insert(std::make_pair(intValueSeek, wxT("")));
6875 KeyListTokens.insert(std::make_pair(intValueSeek, wxT("")));
6879 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
6880 intiter != SplitPoints.end(); ++intiter){
6882 SLiter = SplitLength.find(intiter->first);
6884 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
6886 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
6887 PropertyName = PropertyElement.GetNextToken();
6888 PropertyValue = PropertyElement.GetNextToken();
6890 intPrevValue = intiter->second;
6892 // Process properties.
6894 size_t intPropertyValueLen = PropertyValue.Len();
6896 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
6898 PropertyValue.Trim();
6899 PropertyValue.RemoveLast();
6903 if (PropertyValue.Mid(0, 1) == wxT("\"")){
6905 PropertyValue.Remove(0, 1);
6909 if (PropertyName == wxT("ALTID")){
6911 KeyListAltID.erase(intValueSeek); KeyListAltID.insert(std::make_pair(intValueSeek, PropertyValue));
6913 } else if (PropertyName == wxT("PID")){
6915 KeyListPID.erase(intValueSeek); KeyListPID.insert(std::make_pair(intValueSeek, PropertyValue));
6917 } else if (PropertyName == wxT("PREF")){
6919 intPref = wxAtoi(PropertyValue);
6921 KeyListPref.erase(intValueSeek); KeyListPref.insert(std::make_pair(intValueSeek, intPref));
6925 // Something else we don't know about so append
6926 // to the tokens variable.
6928 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
6930 if (FirstToken == TRUE){
6932 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
6937 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
6947 intPropertyLen = wxSPropertySeg2.Len();
6948 SplitPoints.clear();
6949 SplitLength.clear();
6954 for (int i = 0; i <= intPropertyLen; i++){
6958 if (wxSPropertySeg2.Mid(i, 1) == wxT(";") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
6961 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
6963 if (intSplitsFound == 6){
6965 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
6970 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
6981 wxString wxSKeyMIME;
6982 wxString wxSKeyEncoding;
6983 wxString wxSKeyData;
6984 std::string base64enc;
6986 if (intSplitsFound == 0){
6990 std::map<int, int>::iterator striter;
6992 striter = SplitLength.find(1);
6994 wxStringTokenizer wSTDataType(wxSPropertySeg2.Mid(0, striter->second), wxT(":"));
6996 while (wSTDataType.HasMoreTokens() == TRUE){
6998 wxSKeyURI = wSTDataType.GetNextToken();
6999 wxSKeyMIME = wSTDataType.GetNextToken();
7004 if (wxSKeyURI == wxT("data")){
7006 wxStringTokenizer wSTDataInfo(wxSPropertySeg2.Mid((striter->second + 2)), wxT(","));
7008 while (wSTDataInfo.HasMoreTokens() == TRUE){
7010 wxSKeyEncoding = wSTDataInfo.GetNextToken();
7011 wxSKeyData = wSTDataInfo.GetNextToken();
7020 // Add the data to the General/Home/Work address variables.
7024 coldata.SetId(intValueSeek);
7025 coldata.SetData(intValueSeek);
7027 if (wxSKeyURI == wxT("data")){
7029 if (wxSKeyMIME == wxT("application/pgp-keys")){
7031 coldata.SetText(_("PGP Key"));
7035 coldata.SetText(_("Key"));
7039 KeyListDataEncType.erase(intValueSeek);
7040 KeyListKeyType.erase(intValueSeek);
7041 KeyListDataEncType.insert(std::make_pair(intValueSeek, wxSKeyEncoding));
7042 KeyListKeyType.insert(std::make_pair(intValueSeek, TRUE));
7044 KeyList.erase(intValueSeek);
7045 KeyList.insert(std::make_pair(intValueSeek, wxSKeyData));
7049 coldata.SetText(wxSPropertySeg2);
7051 KeyList.erase(intValueSeek);
7052 KeyList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
7056 ListCtrlIndex = lboKeys->InsertItem(coldata);
7058 if (intPref > 0 && intPref < 101){
7060 lboKeys->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
7065 KeyListType.erase(intValueSeek);
7066 KeyListTokens.erase(intValueSeek);
7067 KeyListDataType.erase(intValueSeek);
7069 KeyListDataType.insert(std::make_pair(intValueSeek, wxSKeyMIME));
7072 case 0: KeyListType.insert(std::make_pair(intValueSeek, wxT("")));
7073 case 1: KeyListType.insert(std::make_pair(intValueSeek, wxT("home")));
7074 case 2: KeyListType.insert(std::make_pair(intValueSeek, wxT("work")));
7077 KeyListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
7082 } else if (wxSProperty == wxT("UID") && UIDProcessed == FALSE){
7084 UIDToken = wxSPropertySeg2;
7085 UIDProcessed = TRUE;
7087 } else if (wxSProperty.Mid(0, 3) == wxT("VND")){
7089 // Split the Vendor three ways.
7091 wxStringTokenizer wSTVendorDetails(wxSPropertySeg1, wxT("-"));
7094 wxString wxSVNDPropName;
7097 while (wSTVendorDetails.HasMoreTokens() == TRUE){
7099 wSTVendorDetails.GetNextToken();
7100 wxSVNDID = wSTVendorDetails.GetNextToken();
7101 wxSVNDPropName = wSTVendorDetails.GetNextToken();
7106 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
7108 // Setup the values for later processing.
7110 VendorList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
7111 VendorListPEN.insert(std::make_pair(intValueSeek, wxSVNDID));
7112 VendorListElement.insert(std::make_pair(intValueSeek, wxSVNDPropName));
7114 // Add the data to the vendor variables.
7118 coldata.SetId(intValueSeek);
7119 coldata.SetData(intValueSeek);
7120 coldata.SetText(wxSVNDID + wxT("-") + wxSVNDPropName);
7122 ListCtrlIndex = lboVendorNamespace->InsertItem(coldata);
7124 VendorList.erase(intValueSeek);
7125 VendorListPEN.erase(intValueSeek);
7126 VendorListElement.erase(intValueSeek);
7128 VendorList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
7129 VendorListPEN.insert(std::make_pair(intValueSeek, wxSVNDID));
7130 VendorListElement.insert(std::make_pair(intValueSeek, wxSVNDPropName));
7137 } else if (wxSProperty.Mid(0, 2) == wxT("X-")){
7141 XTokenList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
7142 XTokenListTokens.insert(std::make_pair(intValueSeek, wxSPropertySeg1.Mid(2)));
7148 coldata.SetId(intValueSeek);
7149 coldata.SetData(intValueSeek);
7150 coldata.SetText(wxSPropertySeg1.Mid(2));
7152 ListCtrlIndex = lboXToken->InsertItem(coldata);
7160 // Reset the variables.
7163 PropertyFind = TRUE;
7164 ExtraLineSeek = TRUE;
7166 QuoteBreakPoint = 0;
7167 ContactLine.Clear();
7168 wxSProperty.Clear();
7172 FMTimer.SetFilename(Filename);
7173 FMTimer.Start(10000, FALSE);
7180 void frmContactEditor::SplitValues(wxString *PropertyLine,
7181 std::map<int,int> *SplitPoints,
7182 std::map<int,int> *SplitLength,
7185 size_t intPropertyLen = PropertyLine->Len();
7186 int intSplitsFound = 0;
7187 int intSplitSize = 0;
7188 int intSplitSeek = 0;
7190 for (int i = intSize; i <= intPropertyLen; i++){
7194 if (PropertyLine->Mid(i, 1) == wxT(";") &&
7195 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
7197 if (intSplitsFound == 0){
7199 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
7203 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
7207 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
7217 if (intSplitsFound == 0){
7219 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
7220 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
7224 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
7225 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));