Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Replaced old KEY processing with ProcessSaveData.
[xestiaab/.git] / source / contacteditor / frmContactEditor-Save.cpp
index 6a0dc1b..d7cac2c 100644 (file)
@@ -1772,157 +1772,7 @@ void frmContactEditor::SaveContact( wxCommandEvent& event )
          iter != ContactEditorData.KeyList.end(); ++iter){
         
         intValue2 = iter->first;
-        
-        // Process Alternative ID.
-        
-        striter = ContactEditorData.KeyListAltID.find(intValue2);
-        
-        if (striter->first == intValue2){
-            
-            strValue3 = striter->second;
-            
-            if (!strValue3.IsEmpty()){
-                
-                strValue3.Trim();
-                strValue3.Trim();
-                
-                if (boolValue2 == TRUE){
-                    
-                    strValue2.Append(wxT(";"));
-                    
-                } else {
-                    
-                    boolValue2 = TRUE;
-                    
-                }
-                
-                strValue2.Append(wxT("ALTID=") + strValue3);
-                
-                boolValue = TRUE;
-                
-            }
-            
-        }
-        
-        // Process PID.
-        
-        striter = ContactEditorData.KeyListPID.find(intValue2);
-        
-        if (striter->first == intValue2){
-            
-            strValue3 = striter->second;
-            
-            if (!strValue3.IsEmpty()){
-                
-                strValue3.Trim();
-                strValue3.Trim();
-                
-                if (boolValue2 == TRUE){
-                    
-                    strValue2.Append(wxT(";"));
-                    
-                } else {
-                    
-                    boolValue2 = TRUE;
-                    
-                }
-                
-                strValue2.Append(wxT("PID=") + strValue3);
-                
-                boolValue = TRUE;
-                
-            }
-            
-        }
-        
-        // Process Type.
-        
-        striter = ContactEditorData.KeyListType.find(intValue2);
-        
-        if (striter->first == intValue2){
-            
-            strValue3 = striter->second;
-            
-            if (!strValue3.IsEmpty()){
-                
-                strValue3.Trim();
-                strValue3.Trim();
-                
-                if (boolValue2 == TRUE){
-                    
-                    strValue2.Append(wxT(";"));
-                    
-                } else {
-                    
-                    boolValue2 = TRUE;
-                    
-                }
-                
-                strValue2.Append(wxT("TYPE=") + strValue3);
-                
-                boolValue = TRUE;
-                
-            }
-            
-        }
-        
-        intiter = ContactEditorData.KeyListPref.find(intValue2);
-        
-        if (intiter->first == intValue2){
-            
-            intValue3 = intiter->second;
-            
-            if (intValue3){
-                
-                if (boolValue2 == TRUE){
-                    
-                    strValue2.Append(wxT(";"));
-                    
-                } else {
-                    
-                    boolValue2 = TRUE;
-                    
-                }
-                
-                strValue2.Append(wxT("PREF=") + wxString::Format(wxT("%i"), intValue3));
-                
-                boolValue = TRUE;
-                
-            }
-            
-        }      
-        
-        // Process Tokens.
-        
-        striter = ContactEditorData.KeyListTokens.find(intValue2);
-        
-        if (striter->first == intValue2){
-            
-            strValue3 = striter->second;
-            
-            if (!strValue3.IsEmpty()){
-                
-                strValue3.Trim();
-                strValue3.Trim();
-                
-                if (boolValue2 == TRUE){
-                    
-                    strValue2.Append(wxT(";"));
-                    
-                } else {
-                    
-                    boolValue2 = TRUE;
-                    
-                }
-                
-                strValue2.Append(strValue3);
-                
-                boolValue = TRUE;
-                
-            }
-            
-        }      
-        
+       
         // Get the key information.
         
         std::map<int, wxString>::iterator enciter;
@@ -1933,23 +1783,17 @@ void frmContactEditor::SaveContact( wxCommandEvent& event )
         wxString strValueData;
         
         strValueData = iter->second;   
-        //strValueData.insert(0, wxT("data:") + striter->second + wxT(";") + enciter->second + wxT(","));
-        strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));      
-        
-        
-        // Add to the vCard.
-        
-        if (boolValue == TRUE){
-            
-            ContactData.AddRaw(wxT("KEY;") + strValue2, strValueData);
-            
-        } else {
-            
-            ContactData.Add(wxT("KEY"), strValueData, TRUE);
-            
-        }
+        strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));
+       
+        ProcessSaveData(wxT("KEY"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &strValueData, &ContactData,
+                        wxT("ALTID"), &ContactEditorData.KeyListAltID,
+                        wxT("PID"), &ContactEditorData.KeyListPID,
+                        wxT("TYPE"), &ContactEditorData.KeyListType,
+                        wxT("PREF"), &ContactEditorData.KeyListPref,
+                        wxT(""), &ContactEditorData.KeyListTokens );
         
-        ResetSaveProcessData();   
+        ResetSaveProcessData();
         
     }
     
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