From c556f865d9d5e104b8f60dd16828da22ea79b087 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 28 Dec 2015 02:10:22 +0000 Subject: [PATCH] Replaced code in PREF for TEL and LANGUAGE with ProcessIntegerValue. --- source/contacteditor/ContactDataObject.cpp | 36 ++-------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/source/contacteditor/ContactDataObject.cpp b/source/contacteditor/ContactDataObject.cpp index 23c53f3..e9784dc 100644 --- a/source/contacteditor/ContactDataObject.cpp +++ b/source/contacteditor/ContactDataObject.cpp @@ -2611,24 +2611,8 @@ void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString Propert TelephoneListPID->insert(std::make_pair(*TelephoneCount, 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){ - - TelephoneListPref->erase(*TelephoneCount); - TelephoneListPref->insert(std::make_pair(*TelephoneCount, PriorityNumber)); - - } + ProcessIntegerValue(this, TelephoneListPref, &PropertyValue, TelephoneCount); } else { @@ -2754,23 +2738,7 @@ void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString Property } 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){ - - LanguageListPref->erase(*LanguageCount); - LanguageListPref->insert(std::make_pair(*LanguageCount, PriorityNumber)); - - } + ProcessIntegerValue(this, LanguageListPref, &PropertyValue, LanguageCount); } else { -- 2.39.5