Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added SORT-AS and extra tokens code and unit tests for the N vCard parameter in Conta...
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 12 Dec 2015 21:41:38 +0000 (21:41 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 12 Dec 2015 21:41:38 +0000 (21:41 +0000)
source/contacteditor/ContactDataObject.cpp
source/tests/LoadCheck-Load4.vcf
source/tests/xestiaab_contactload.h

index 54e0bfd..5f9ca27 100644 (file)
@@ -479,9 +479,39 @@ void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
                
                        NameLanguage = PropertyValue;
                
+               } else if (PropertyName == wxT("SORT-AS")){
+               
+                       if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
+                               PropertyValue.Len() >= 3){
+                               NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
+                       }
+               
+               } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
+                       
+                       if (FirstToken == TRUE){
+                               
+                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
+                               FirstToken = FALSE;
+                               
+                       } else {
+                       
+                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
+                               
+                       }
+                       
                }
        
        }
+       
+       // Split the name data.
+       
+       // Add the name token data.
+       
+       if (!PropertyTokens.IsEmpty()){
+       
+               NameTokens = PropertyTokens;
+       
+       }
 
 } 
 
index 866e808..9b3cdcd 100644 (file)
@@ -4,5 +4,5 @@ KIND:individual
 MEMBER;ALTID=35;PID=40;PREF=45;MEDIATYPE=text/plain;EXAMPLE=Meep:7a2af44d-64
  31-4797-a55f-d86d56304fda
 FN;TYPE=work;LANGUAGE=kw;ALTID=500;PID=40;PREF=45;EXAMPLE=Baaa:Test Contact
-N;ALTID=3;LANGUAGE=kw:Test
+N;ALTID=3;LANGUAGE=kw;SORT-AS="Contact,Test";TEST=Yes:Test
 END:VCARD
index 4585abc..c573175 100644 (file)
@@ -133,10 +133,23 @@ TEST(ContactLoad, ContactLoadTests){
        
        // Check that the name has been read (N).
        
-       ASSERT_EQ("Test", TestFile.NameForename); 
-       ASSERT_EQ("3", TestFile.NameAltID); 
-       ASSERT_EQ("kw", TestFile.NameLanguage); 
+       ASSERT_EQ("Test", TestFile.NameForename);
+       
+       // Check the ALTID parameter.
+       
+       ASSERT_EQ("3", TestFile.NameAltID);
+       
+       // Check the LANGUAGE parameter. 
+       
+       ASSERT_EQ("kw", TestFile.NameLanguage);
+       
+       // Check the SORT-AS parameter.
+        
+       ASSERT_EQ("Contact,Test", TestFile.NameDisplayAs);
 
+       // Check the extra tokens parameter.
+       
+       ASSERT_EQ("TEST=Yes", TestFile.NameTokens);
        
 }
 
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