Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Reimplemented ANNIVERSARY. Simplified implementation.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 10 Jan 2016 21:03:40 +0000 (21:03 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 10 Jan 2016 21:03:40 +0000 (21:03 +0000)
source/contacteditor/frmContactEditor-Save.cpp

index e23bbd9..693c14b 100644 (file)
@@ -577,85 +577,92 @@ void frmContactEditor::SaveContact( wxCommandEvent& event )
             }
             
         }
-        
+    
     }
     
     ResetSaveProcessData();
     
-    // Process Label.
+    // Build the values for the ANNIVERSARY property.
+
+    // ALTID
+
+    if (!ContactEditorData.AnniversaryAltID.IsEmpty()){
     
-    strValue3 = ContactEditorData.AnniversaryAltID;
+       wxString DataValue;
+       DataValue = ContactEditorData.AnniversaryAltID;
+    
+       EscapeString(&DataValue, FALSE);
+    
+       strValue3.Append("ALTID=");
+       strValue3.Append(DataValue);
+    
+       boolValue2 = TRUE;
     
-    if (!strValue3.IsEmpty()){
-        
-        strValue3.Trim();
-        strValue3.Trim();
-        boolValue2 = TRUE;
-        strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
-        
-        boolValue = TRUE;
-        
     }
     
-    //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
-    //strValue2 =
+    // CALSCALE.
     
-    // Process Language.
+    if (!ContactEditorData.AnniversaryCalScale.IsEmpty()){
     
-    strValue3 = ContactEditorData.AnniversaryCalScale;
+       wxString DataValue;
+       DataValue = ContactEditorData.AnniversaryCalScale;
+    
+       EscapeString(&DataValue, FALSE);
+    
+       if (boolValue2 == TRUE){
+       
+               strValue3.Append(";");
+       
+       }
+       
+       strValue3.Append("CALSCALE=");
+       strValue3.Append(DataValue);
+       
+       boolValue2 = TRUE;
     
-    if (!strValue3.IsEmpty()){
-        
-        strValue3.Trim();
-        strValue3.Trim();
-        
-        if (boolValue2 == TRUE){
-            
-            strValue2.Append(wxT(";"));
-            
-        } else {
-            
-            boolValue2 = TRUE;
-            
-        }
-        
-        strValue2.Append(wxT("CALSCALE=") + strValue3);
-        
-        boolValue = TRUE;
-        
     }
     
-    // Process Tokens.
+    // Extra tokens.
+    
+    if (!ContactEditorData.AnniversaryTokens.IsEmpty()){
     
-    strValue2 = ContactEditorData.AnniversaryTokens;
+       wxString DataValue;
+       DataValue = ContactEditorData.AnniversaryTokens;
+       
+       EscapeString(&DataValue, FALSE);
+       
+       if (boolValue2 == TRUE){
+       
+               strValue3.Append(";");
+       
+       }
+       
+       strValue3.Append(DataValue);
     
-    // Deal with ANNIVERSARY.
+    }
+    
+    // Write the ANNIVERSARY property. 
     
     if (!txtAnniversary->IsEmpty()){
-        
-        strValue = txtAnniversary->GetValue();
-        
-        if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
-            
-            if (!strValue2.IsEmpty()){
-                
-                EscapeString(&strValue2, FALSE);
-                EscapeString(&strValue, FALSE);
-                
-                ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text;") + strValue2 + wxT(";"), strValue);
-                
-            } else {
-                
-                EscapeString(&strValue, FALSE);
-                
-                ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text"), strValue);
-                
-            }
-            
-        }
-        
+    
+       if (!txtAnniversary->GetValue().IsEmpty()){
+       
+           strValue = txtAnniversary->GetValue();
+           
+           if (!strValue3.IsEmpty()){
+           
+               ContactData.AddRaw("ANNIVERSARY;VALUE=text;" + strValue3, strValue);
+           
+           } else {
+
+               ContactData.AddRaw("ANNIVERSARY;VALUE=text", strValue);
+           
+           }
+           
+       }
+    
     } else {
-        
+    
         // Look for T and replace data before this.
         
         // Get Day, Month & Year.
@@ -743,14 +750,14 @@ void frmContactEditor::SaveContact( wxCommandEvent& event )
                 
             }
             
-            if (!FinalAnniversaryString.IsEmpty() || !strValue2.IsEmpty()){
+            if (!FinalAnniversaryString.IsEmpty() || !strValue3.IsEmpty()){
                 
-                if (!strValue2.IsEmpty()){
+                if (!strValue3.IsEmpty()){
                     
                     EscapeString(&strValue2, FALSE);
                     EscapeString(&strValue, FALSE);
                     
-                    ContactData.AddRaw(wxT("ANNIVERSARY") + strValue2 + wxT(";"), FinalAnniversaryString);
+                    ContactData.AddRaw(wxT("ANNIVERSARY;") + strValue3, FinalAnniversaryString);
                     
                 } 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