X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2FContactDataObject.cpp;h=ec9a03d03a7d8780d4f4712b9fd31412ee999240;hb=4a40989643e36ab0e1cd71cffcb6410704e1ee6d;hp=ac80f158f61e9de931355466f4f2099fc107b2b3;hpb=761f457eb9757276b88bc324e9ee7d964d628734;p=xestiaab%2F.git diff --git a/source/contacteditor/ContactDataObject.cpp b/source/contacteditor/ContactDataObject.cpp index ac80f15..ec9a03d 100644 --- a/source/contacteditor/ContactDataObject.cpp +++ b/source/contacteditor/ContactDataObject.cpp @@ -2180,6 +2180,7 @@ void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; + bool PropertyMatched = FALSE; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ @@ -2196,41 +2197,30 @@ void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, CaptureString(&PropertyValue, FALSE); + ProcessStringValue(&PropertyName, "ALTID", IMListAltID, &PropertyValue, IMCount, &PropertyMatched); + ProcessStringValue(&PropertyName, "PID", IMListPID, &PropertyValue, IMCount, &PropertyMatched); + ProcessStringValue(&PropertyName, "MEDIATYPE", IMListMediatype, &PropertyValue, IMCount, &PropertyMatched); + ProcessIntegerValue(&PropertyName, "PREF", IMListPref, &PropertyValue, IMCount, &PropertyMatched); + // Process properties. - if (PropertyName == wxT("ALTID")){ - - IMListAltID->erase(*IMCount); - IMListAltID->insert(std::make_pair(*IMCount, PropertyValue)); + if (PropertyMatched == TRUE){ + + PropertyMatched = FALSE; + continue; - } else if (PropertyName == wxT("PID")){ - - IMListPID->erase(*IMCount); - IMListPID->insert(std::make_pair(*IMCount, PropertyValue)); + } - } else if (PropertyName == wxT("MEDIATYPE")){ - - IMListMediatype->erase(*IMCount); - IMListMediatype->insert(std::make_pair(*IMCount, PropertyValue)); + if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){ - } else if (PropertyName == wxT("PREF")){ + if (FirstToken == TRUE){ - ProcessIntegerValue(IMListPref, &PropertyValue, IMCount); - - } else { - - if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){ + PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); + FirstToken = FALSE; - if (FirstToken == TRUE){ - - PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); - FirstToken = FALSE; - - } else { - - PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); - - } + } else { + + PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); } @@ -2480,6 +2470,8 @@ void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString Propert intPrevValue = 4; + bool PropertyMatched = FALSE; + for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ @@ -2497,34 +2489,27 @@ void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString Propert // Process properties. - if (PropertyName == wxT("ALTID")){ - - TelephoneListAltID->erase(*TelephoneCount); - TelephoneListAltID->insert(std::make_pair(*TelephoneCount, PropertyValue)); + ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched); + ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched); + ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched); - } else if (PropertyName == wxT("PID")){ - - TelephoneListPID->erase(*TelephoneCount); - TelephoneListPID->insert(std::make_pair(*TelephoneCount, PropertyValue)); + if (PropertyMatched == TRUE){ - } else if (PropertyName == wxT("PREF")){ - - ProcessIntegerValue(TelephoneListPref, &PropertyValue, TelephoneCount); + PropertyMatched = FALSE; + continue; - } else { + } + + if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){ - if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){ + if (FirstToken == TRUE){ - if (FirstToken == TRUE){ - - PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); - FirstToken = FALSE; - - } else { - - PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); - - } + PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); + FirstToken = FALSE; + + } else { + + PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); } @@ -2605,6 +2590,7 @@ void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString Property wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; + bool PropertyMatched = FALSE; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ @@ -2623,34 +2609,27 @@ void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString Property // Process properties. - if (PropertyName == wxT("ALTID")){ + ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched); + ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched); + ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched); - LanguageListAltID->erase(*LanguageCount); - LanguageListAltID->insert(std::make_pair(*LanguageCount, PropertyValue)); + if (PropertyMatched == TRUE){ - } else if (PropertyName == wxT("PID")){ - - LanguageListPID->erase(*LanguageCount); - LanguageListPID->insert(std::make_pair(*LanguageCount, PropertyValue)); + PropertyMatched = FALSE; + continue; - } else if (PropertyName == wxT("PREF")){ - - ProcessIntegerValue(LanguageListPref, &PropertyValue, LanguageCount); + } - } else { + if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){ - if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){ + if (FirstToken == TRUE){ - if (FirstToken == TRUE){ - - PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); - FirstToken = FALSE; - - } else { - - PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); - - } + PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); + FirstToken = FALSE; + + } else { + + PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); } @@ -2734,6 +2713,7 @@ void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString Proper wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; + bool PropertyMatched = FALSE; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ @@ -2752,39 +2732,28 @@ void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString Proper // Process properties. - if (PropertyName == wxT("ALTID")){ - - GeopositionListAltID->erase(*GeographicCount); - GeopositionListAltID->insert(std::make_pair(*GeographicCount, PropertyValue)); + ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched); + ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched); + ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched); + ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched); - } else if (PropertyName == wxT("PID")){ - - GeopositionListPID->erase(*GeographicCount); - GeopositionListPID->insert(std::make_pair(*GeographicCount, PropertyValue)); + if (PropertyMatched == TRUE){ - } else if (PropertyName == wxT("MEDIATYPE")){ - - GeopositionListMediatype->erase(*GeographicCount); - GeopositionListMediatype->insert(std::make_pair(*GeographicCount, PropertyValue)); + PropertyMatched = FALSE; + continue; - } else if (PropertyName == wxT("PREF")){ - - ProcessIntegerValue(GeopositionListPref, &PropertyValue, GeographicCount); + } - } else { + if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){ - if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){ + if (FirstToken == TRUE){ - if (FirstToken == TRUE){ - - PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); - FirstToken = FALSE; - - } else { - - PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); - - } + PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); + FirstToken = FALSE; + + } else { + + PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); } @@ -2941,6 +2910,8 @@ void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertyS intPrevValue = 8; + bool PropertyMatched = FALSE; + for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ @@ -2973,60 +2944,31 @@ void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertyS CaptureString(&PropertyValue, FALSE); - if (PropertyName == wxT("ALTID")){ - - GeneralRelatedListAltID.erase(*RelatedCount); - GeneralRelatedListAltID.insert(std::make_pair(*RelatedCount, PropertyValue)); - - } else if (PropertyName == wxT("PID")){ + ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched); + ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched); + ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched); + ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched); - GeneralRelatedListPID.erase(*RelatedCount); - GeneralRelatedListPID.insert(std::make_pair(*RelatedCount, PropertyValue)); + if (PropertyMatched == TRUE){ - } 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){ - - GeneralRelatedListPref.erase(*RelatedCount); - GeneralRelatedListPref.insert(std::make_pair(*RelatedCount, PriorityNumber)); - - } + PropertyMatched = FALSE; + continue; - } else if (PropertyName == wxT("LANGUAGE")){ + } - ProcessIntegerValue(&GeneralRelatedListPref, &PropertyValue, RelatedCount); - - } else if (PropertyName != wxT("TYPE")) { + if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){ + + if (FirstToken == TRUE){ - // Something else we don't know about so append - // to the tokens variable. + PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); + FirstToken = FALSE; - if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){ + } else { - if (FirstToken == TRUE){ - - PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); - FirstToken = FALSE; - - } else { - - PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); - - } + PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); } - + } }