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

index 245341b..c697fc8 100644 (file)
@@ -3493,6 +3493,7 @@ void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString Prop
        }
 
        intPrevValue = 4;
+       bool PropertyMatched = FALSE;
                
        for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
        intiter != SplitPoints.end(); ++intiter){
@@ -3526,52 +3527,34 @@ void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString Prop
                
                CaptureString(&PropertyValue, FALSE);
                
-               if (PropertyName == wxT("ALTID")){
-               
-                       OrganisationsListAltID->erase(*OrganisationCount);
-                       OrganisationsListAltID->insert(std::make_pair(*OrganisationCount, PropertyValue));
-               
-               } else if (PropertyName == wxT("PID")){
-
-                       OrganisationsListPID->erase(*OrganisationCount);
-                       OrganisationsListPID->insert(std::make_pair(*OrganisationCount, PropertyValue));
+               ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
+               ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
+               ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
+               ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
+               ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
                
-               } else if (PropertyName == wxT("SORT-AS")){
-
-                       OrganisationsListSortAs->erase(*OrganisationCount);
-                       OrganisationsListSortAs->insert(std::make_pair(*OrganisationCount, PropertyValue));
+               if (PropertyMatched == TRUE){
                
-               } else if (PropertyName == wxT("PREF")){
-
-                       ProcessIntegerValue(OrganisationsListPref, &PropertyValue, OrganisationCount);
-                       
-               } else if (PropertyName == wxT("LANGUAGE")){
+                       PropertyMatched = FALSE;
+                       continue;
                
-                       OrganisationsListLanguage->erase(*OrganisationCount);
-                       OrganisationsListLanguage->insert(std::make_pair(*OrganisationCount, PropertyValue));
+               }
                
-               } else {
+               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);
                
                        }
-               
-               }
        
+               }
+
        }
        
        // Add the data to the General/Home/Work address variables.
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