X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2FContactDataObject.cpp;h=55d2a14dbb8c17f3840e72c4741d8646e87b0bc5;hb=1c717d77d60dabd298622aec1f022094bce77c23;hp=54e0bfd1294367f85ff8c683258232f58b759b0b;hpb=02c28b750d6eb441da1053646ca981a4a6473b75;p=xestiaab%2F.git diff --git a/source/contacteditor/ContactDataObject.cpp b/source/contacteditor/ContactDataObject.cpp index 54e0bfd..55d2a14 100644 --- a/source/contacteditor/ContactDataObject.cpp +++ b/source/contacteditor/ContactDataObject.cpp @@ -479,7 +479,113 @@ void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){ NameLanguage = PropertyValue; + } else if (PropertyName == wxT("SORT-AS")){ + + if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") && + PropertyValue.Len() >= 3){ + NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2)); + } + + } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){ + + if (FirstToken == TRUE){ + + PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); + FirstToken = FALSE; + + } else { + + PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); + + } + + } + + } + + // Split the name data. + + int intSplitSeek = 0; + int intSplitsFound = 0; + int intSplitSize = 0; + int intPropertyLen = PropertySeg2.Len(); + + std::map NameValues; + intPrevValue = 0; + + for (int i = 0; i <= intPropertyLen; i++){ + + if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){ + + NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize))); + + intSplitSeek = i; + intSplitSeek++; + + if (intSplitsFound == 4){ + + NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos))); + break; + + } + + intSplitSize = 0; + continue; + } + + intSplitSize++; + + } + + // Split the data into several parts. + + for (std::map::iterator iter = NameValues.begin(); + iter != NameValues.end(); ++iter){ + + if (iter->first == 1){ + + // Deal with family name. + + NameSurname = iter->second; + + } else if (iter->first == 2){ + + // Deal with given names. + + NameForename = iter->second; + + } else if (iter->first == 3){ + + // Deal with additional names. + + NameOtherNames = iter->second; + + } else if (iter->first == 4){ + + // Deal with honorifix prefixes and suffixes. + + NameTitle = iter->second; + + iter++; + + if (iter == NameValues.end()){ + + break; + + } + + NameSuffix = iter->second; + + } + + } + + // Add the name token data. + + if (!PropertyTokens.IsEmpty()){ + + NameTokens = PropertyTokens; }