Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Replaced string processing in RELATED with ProcessStringValue.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 28 Dec 2015 04:35:36 +0000 (04:35 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 28 Dec 2015 04:35:36 +0000 (04:35 +0000)
source/contacteditor/ContactDataObject.cpp

index e78af70..ec9a03d 100644 (file)
@@ -2910,6 +2910,8 @@ void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertyS
        
        intPrevValue = 8;                       
        
+       bool PropertyMatched = FALSE;
+       
        for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
        intiter != SplitPoints.end(); ++intiter){
        
@@ -2942,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);
                
                        }
-               
+       
                }
        
        }                                       
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