Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added TEL to the SaveString function of ContactDataObject
[xestiaab/.git] / source / contacteditor / cdo / ContactDataObject-Save.cpp
index 59b67ad..d14240b 100644 (file)
@@ -373,10 +373,24 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                &BusinessIMListPref, &BusinessIMListTokens,
                SaveData, "work");
 
-       // TODO: Process TEL.
-       
-       
+       // Process TEL.
        
+       SaveTelephone(&GeneralTelephoneList, &GeneralTelephoneListAltID, 
+               &GeneralTelephoneListPID, &GeneralTelephoneListType,
+               &GeneralTelephoneListTypeInfo, &GeneralTelephoneListDataType, 
+               &GeneralTelephoneListPref, &GeneralTelephoneListTokens, 
+               SaveData, "");
+       SaveTelephone(&HomeTelephoneList, &HomeTelephoneListAltID, 
+               &HomeTelephoneListPID, &HomeTelephoneListType,
+               &HomeTelephoneListTypeInfo, &HomeTelephoneListDataType, 
+               &HomeTelephoneListPref, &HomeTelephoneListTokens, 
+               SaveData, "home");
+       SaveTelephone(&BusinessTelephoneList, &BusinessTelephoneListAltID, 
+               &BusinessTelephoneListPID, &BusinessTelephoneListType,
+               &BusinessTelephoneListTypeInfo, &BusinessTelephoneListDataType, 
+               &BusinessTelephoneListPref, &BusinessTelephoneListTokens, 
+               SaveData, "work");
+
        // Process LANG.
        
        SaveLanguage(&GeneralLanguageList, &GeneralLanguageListAltID, 
@@ -1399,6 +1413,98 @@ void ContactDataObject::SaveIMPP(map<int, wxString> *IMList, map<int, wxString>
                
 }
 
+void ContactDataObject::SaveTelephone(map<int, wxString> *TelephoneList, map<int, wxString> *TelephoneListAltID, 
+       map<int, wxString> *TelephoneListPID, map<int, wxString> *TelephoneListType,
+       map<int, wxString> *TelephoneListTypeInfo, map<int, wxString> *TelephoneListDataType, 
+       map<int, int> *TelephoneListPref, map<int, wxString> *TelephoneListTokens, 
+       wxString *SaveData, wxString DataType){
+
+       wxString ProcessData = "";
+       
+       for (std::map<int, wxString>::iterator TelephoneIter = TelephoneList->begin();
+               TelephoneIter != TelephoneList->end(); TelephoneIter++){
+
+               ProcessData.Append("TEL");
+                       
+               // Check if there is a value for TYPE.
+
+               if (DataType.size() > 0 || (*TelephoneListAltID)[TelephoneIter->first].size() > 0){
+
+                       ProcessData.Append(";TYPE=\"");
+                       
+                       bool ProcessedType = false;
+                       
+                       if (DataType.size() > 0){
+               
+                               ProcessData.Append(DataType);
+                               ProcessedType = true;
+                       
+                       }
+                       
+                       if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
+                               
+                               if (ProcessedType == true){
+                                       ProcessData.Append(",");
+                               }
+                               ProcessData.Append((*TelephoneListTypeInfo)[TelephoneIter->first]);
+                               
+                       }
+                       
+                       ProcessData.Append("\"");
+               
+               }
+               
+               // Check if there is a value for ALTID.
+               
+               if ((*TelephoneListAltID)[TelephoneIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append((*TelephoneListAltID)[TelephoneIter->first]);
+                       
+               }
+               
+               // Check if there is a value for PID.
+
+               if ((*TelephoneListPID)[TelephoneIter->first].size() > 0){
+               
+                       ProcessData.Append(";PID=");
+                       ProcessData.Append((*TelephoneListPID)[TelephoneIter->first]);
+                       
+               }
+
+               // Check if there is a value for PREF.
+
+               if ((*TelephoneListPref)[TelephoneIter->first] > 0){
+               
+                       ProcessData.Append(";PREF=");
+                       ProcessData.Append(wxString::Format("%i", (*TelephoneListPref)[TelephoneIter->first]));
+                       
+               }
+
+               // Check if there is a value for tokens.
+
+               if ((*TelephoneListTokens)[TelephoneIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append((*TelephoneListTokens)[TelephoneIter->first]);
+                       
+               }
+
+               ProcessData.Append(":");
+               ProcessData.Append((*TelephoneListDataType)[TelephoneIter->first]);
+               ProcessData.Append(":");
+               ProcessData.Append(TelephoneIter->second);
+               ProcessData.Append("\n");
+
+               ProcessData = OutputText(&ProcessData);
+                       
+               SaveData->Append(ProcessData);
+               ProcessData.clear();
+                       
+       }
+               
+}
+
 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID, 
        map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
        map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens, 
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