Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Replaced the PREF code in TITLE with ProcessIntegerValue.
[xestiaab/.git] / source / contacteditor / ContactDataObject.cpp
index 607f28c..6247596 100644 (file)
@@ -2318,23 +2318,7 @@ void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2,
                
                } 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){
-
-                               IMListPref->erase(*IMCount);
-                               IMListPref->insert(std::make_pair(*IMCount, PriorityNumber));
-
-                       }
+                       ProcessIntegerValue(this, IMListPref, &PropertyValue, IMCount);
                
                } else {
                
@@ -2627,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 {
                
@@ -2770,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 {
                
@@ -2919,24 +2871,8 @@ void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString Proper
                        GeopositionListMediatype->insert(std::make_pair(*GeographicCount, 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){
-
-                               GeopositionListPref->erase(*GeographicCount);
-                               GeopositionListPref->insert(std::make_pair(*GeographicCount, PriorityNumber));
 
-                       }
+                       ProcessIntegerValue(this, GeopositionListPref, &PropertyValue, GeographicCount);
                
                } else {
                
@@ -3171,9 +3107,8 @@ void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertyS
                        }
                
                } else if (PropertyName == wxT("LANGUAGE")){
-               
-                       GeneralRelatedListLanguage.erase(*RelatedCount);
-                       GeneralRelatedListLanguage.insert(std::make_pair(*RelatedCount, PropertyValue));
+
+                       ProcessIntegerValue(this, &GeneralRelatedListPref, &PropertyValue, RelatedCount);
                
                } else if (PropertyName != wxT("TYPE")) {
                
@@ -3324,25 +3259,9 @@ void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2,
                        WebsiteListPID->insert(std::make_pair(*URLCount, 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){
 
-                               WebsiteListPref->erase(*URLCount);
-                               WebsiteListPref->insert(std::make_pair(*URLCount, PriorityNumber));
-
-                       }
-                                       
+                       ProcessIntegerValue(this, WebsiteListPref, &PropertyValue, URLCount);
+                                                       
                } else if (PropertyName == wxT("MEDIATYPE")){
                
                        WebsiteListMediatype->erase(*URLCount);
@@ -3498,25 +3417,9 @@ void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg
                        TitleListPID->insert(std::make_pair(*TitleCount, 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){
-
-                               TitleListPref->erase(*TitleCount);
-                               TitleListPref->insert(std::make_pair(*TitleCount, PriorityNumber));
-
-                       }
-                                       
+                       ProcessIntegerValue(this, TitleListPref, &PropertyValue, TitleCount);
+                       
                } else if (PropertyName == wxT("LANGUAGE")){
                
                        TitleListLanguage->erase(*TitleCount);
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy