Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Replaced PREF code in IMPP for ProcessIntegerValue.
[xestiaab/.git] / source / contacteditor / ContactDataObject.cpp
index 3d408c9..23c53f3 100644 (file)
@@ -1701,23 +1701,7 @@ void ContactDataObject::ProcessTimeZone(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){
-
-                               TZListPref->erase(*TimeZoneCount);
-                               TZListPref->insert(std::make_pair(*TimeZoneCount, PriorityNumber));
-
-                       }
+                       ProcessIntegerValue(this, TZListPref, &PropertyValue, TimeZoneCount);
                
                } else if (PropertyName == wxT("MEDIATYPE")){
 
@@ -1933,24 +1917,8 @@ void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertyS
                        AddressListMediatype->insert(std::make_pair(*AddressCount, 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){
-
-                               AddressListPref->erase(*AddressCount);
-                               AddressListPref->insert(std::make_pair(*AddressCount, PriorityNumber));
-
-                       }
+                       ProcessIntegerValue(this, AddressListPref, &PropertyValue, AddressCount);
                
                } else {
                
@@ -2215,23 +2183,7 @@ void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg
                
                } 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){
-
-                               EmailListPref->erase(*EmailCount);
-                               EmailListPref->insert(std::make_pair(*EmailCount, PriorityNumber));
-
-                       }
+                       ProcessIntegerValue(this, EmailListPref, &PropertyValue, EmailCount);
                
                } else {
                
@@ -2366,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 {
                
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