Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added property value, ALTID, LANGUAGE source, header and unit tests for the N vCard...
[xestiaab/.git] / source / contacteditor / ContactDataObject.cpp
index 266a5e0..54e0bfd 100644 (file)
@@ -74,6 +74,7 @@ ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){
        bool QuoteMode = FALSE;
        bool PropertyFind = TRUE;
        bool KindProcessed = FALSE;
+       bool NameProcessed = FALSE;
        int ContactLineLen = 0;
        int QuoteBreakPoint = 0;
        int GroupCount = 0;
@@ -190,6 +191,11 @@ ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){
                        ProcessFN(PropertySeg1, PropertySeg2, &FNCount);
                        FNCount++;
                
+               } else if (Property == wxT("N") && NameProcessed == FALSE){
+               
+                       ProcessN(PropertySeg1, PropertySeg2);
+                       NameProcessed = TRUE;
+               
                }
                
        }
@@ -428,6 +434,57 @@ void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2,
 
 }
 
+void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
+
+       std::map<int, int> SplitPoints;
+       std::map<int, int> SplitLength;
+
+       int intPrevValue = 3;
+       int intPref = 0;                        
+       int intType = 0;
+       
+       SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
+       
+       intPrevValue = 2;
+       
+       NameForename = PropertySeg2;
+       
+       wxString PropertyName;
+       wxString PropertyValue;
+       wxString PropertyData;
+       wxString PropertyTokens;
+       std::map<int,int>::iterator SLiter;
+       bool FirstToken = TRUE;
+       
+       for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
+       intiter != SplitPoints.end(); ++intiter){
+       
+               SLiter = SplitLength.find(intiter->first);
+       
+               PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
+               
+               wxStringTokenizer PropertyElement (PropertyData, wxT("="));
+               PropertyName = PropertyElement.GetNextToken();                          
+               PropertyValue = PropertyElement.GetNextToken();
+               
+               intPrevValue = intiter->second;
+               
+               CaptureString(&PropertyValue, FALSE);
+               
+               if (PropertyName == wxT("ALTID")){
+
+                       NameAltID = PropertyValue;
+               
+               } else if (PropertyName == wxT("LANGUAGE")){
+               
+                       NameLanguage = PropertyValue;
+               
+               }
+       
+       }
+
+} 
+
 void SplitValues(wxString *PropertyLine, 
        std::map<int,int> *SplitPoints, 
        std::map<int,int> *SplitLength, 
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