X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=blobdiff_plain;f=source%2Fcontacteditor%2FContactDataObject.cpp;h=266a5e0eceda576864815d8774381b50d3e64821;hp=28c29e70bc0ef8672e48278119e38aadf4100535;hb=5ab6af24eb42838438875f9c7af77210ccfa44a8;hpb=d18234d18666d7afdc563abc098eaba75deb00c7 diff --git a/source/contacteditor/ContactDataObject.cpp b/source/contacteditor/ContactDataObject.cpp index 28c29e7..266a5e0 100644 --- a/source/contacteditor/ContactDataObject.cpp +++ b/source/contacteditor/ContactDataObject.cpp @@ -177,15 +177,11 @@ ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){ PropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1)); if (Property == wxT("KIND") && KindProcessed == FALSE){ - - // See frmContactEditor-LoadGroup.cpp - + ProcessKind(PropertySeg2); } else if (Property == wxT("MEMBER")){ - // See frmContactEditor-LoadGroup.cpp - ProcessMember(PropertySeg1, PropertySeg2, &GroupCount); GroupCount++; @@ -240,8 +236,6 @@ void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySe intPrevValue = 7; - // Look for type before continuing. - wxString PropertyName; wxString PropertyValue; wxString PropertyData; @@ -263,8 +257,6 @@ void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySe intPrevValue = intiter->second; CaptureString(&PropertyValue, FALSE); - - //ContactProcess::ContactProcessCaptureStrings(&PropertyValue); if (PropertyName == wxT("ALTID")){ @@ -331,8 +323,109 @@ void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySe void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){ + std::map SplitPoints; + std::map SplitLength; + + int intPrevValue = 4; + int intPref = 0; + int intType = 0; + + SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue); + + intPrevValue = 3; + + wxString PropertyName; + wxString PropertyValue; + wxString PropertyData; + wxString PropertyTokens; + std::map::iterator SLiter; + bool FirstToken = TRUE; + + for (std::map::iterator intiter = SplitPoints.begin(); + intiter != SplitPoints.end(); ++intiter){ + + SLiter = SplitLength.find(intiter->first); + + PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); + + wxStringTokenizer PropertyElement (PropertyData, wxT("=")); + PropertyName = PropertyElement.GetNextToken(); + PropertyValue = PropertyElement.GetNextToken(); + + intPrevValue = intiter->second; + + CaptureString(&PropertyValue, FALSE); + + if (PropertyName == wxT("TYPE")){ + + if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") || + PropertyValue == wxT("work") ){ + + FullNamesListType.erase(*FNCount); + FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue)); + + } + + } else if (PropertyName == wxT("LANGUAGE")){ + + FullNamesListLanguage.erase(*FNCount); + FullNamesListLanguage.insert(std::make_pair(*FNCount, PropertyValue)); + + } else if (PropertyName == wxT("ALTID")){ + + FullNamesListAltID.erase(*FNCount); + FullNamesListAltID.insert(std::make_pair(*FNCount, PropertyValue)); + + } else if (PropertyName == wxT("PID")){ + + FullNamesListPID.erase(*FNCount); + FullNamesListPID.insert(std::make_pair(*FNCount, PropertyValue)); + + } else if (PropertyName == wxT("PREF")){ + + int PriorityNumber = 0; + bool ValidNumber = TRUE; + + try{ + PriorityNumber = std::stoi(PropertyValue.ToStdString()); + } + + catch(std::invalid_argument &e){ + ValidNumber = FALSE; + } + + if (ValidNumber == TRUE){ + + FullNamesListPref.erase(*FNCount); + FullNamesListPref.insert(std::make_pair(*FNCount, PriorityNumber)); + + } + + } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){ + + if (FirstToken == TRUE){ + + PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); + FirstToken = FALSE; + + } else { + + PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); + + } + + } + + } + FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2)); + if (!PropertyTokens.IsEmpty()){ + + FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens)); + + } + } void SplitValues(wxString *PropertyLine,