Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added ROLE to the SaveString function of ContactDataObject
[xestiaab/.git] / source / contacteditor / cdo / ContactDataObject-Save.cpp
index 426f3f2..3ee868c 100644 (file)
@@ -511,6 +511,21 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                &BusinessWebsiteListPID, &BusinessWebsiteListType,
                &BusinessWebsiteListMediatype, &BusinessWebsiteListPref, 
                &BusinessWebsiteListTokens, SaveData, "work");
+
+       // Process ROLE.
+       
+       SaveRole(&GeneralRoleList, &GeneralRoleListLanguage,
+               &GeneralRoleListAltID, &GeneralRoleListPID,
+               &GeneralRoleListType, &GeneralRoleListPref,
+               &GeneralRoleListTokens, SaveData, "");
+       SaveRole(&HomeRoleList, &HomeRoleListLanguage,
+               &HomeRoleListAltID, &HomeRoleListPID,
+               &HomeRoleListType, &HomeRoleListPref,
+               &HomeRoleListTokens, SaveData, "home");
+       SaveRole(&BusinessRoleList, &BusinessRoleListLanguage,
+               &BusinessRoleListAltID, &BusinessRoleListPID,
+               &BusinessRoleListType, &BusinessRoleListPref,
+               &BusinessRoleListTokens, SaveData, "work");
        
        // Write the end part of the vCard data file.
        
@@ -1272,4 +1287,83 @@ void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxStri
                        
        }
                        
+}
+
+void ContactDataObject::SaveRole(map<int, wxString> *RoleList, map<int, wxString> *RoleListLanguage,
+       map<int, wxString> *RoleListAltID, map<int, wxString> *RoleListPID,
+       map<int, wxString> *RoleListType, map<int, int> *RoleListPref,
+       map<int, wxString> *RoleListTokens, wxString *SaveData, wxString DataType){
+
+       wxString ProcessData = "";
+               
+       for (std::map<int, wxString>::iterator RoleIter = RoleList->begin();
+               RoleIter != RoleList->end(); RoleIter++){
+
+               ProcessData.Append("ROLE");
+                       
+               // Check if there is a value for TYPE.
+               
+               if (DataType.size() > 0){
+               
+                       ProcessData.Append(";TYPE=");
+                       ProcessData.Append(DataType);
+                       
+               }
+               
+               // Check if there is a value for ALTID.
+               
+               if ((*RoleListAltID)[RoleIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append((*RoleListAltID)[RoleIter->first]);
+                       
+               }
+
+               // Check if there is a value for LANGUAGE.
+               
+               if ((*RoleListLanguage)[RoleIter->first].size() > 0){
+               
+                       ProcessData.Append(";LANGUAGE=");
+                       ProcessData.Append((*RoleListLanguage)[RoleIter->first]);
+                       
+               }
+               
+               // Check if there is a value for PID.
+
+               if ((*RoleListPID)[RoleIter->first].size() > 0){
+               
+                       ProcessData.Append(";PID=");
+                       ProcessData.Append((*RoleListPID)[RoleIter->first]);
+                       
+               }
+
+               // Check if there is a value for PREF.
+
+               if ((*RoleListPref)[RoleIter->first] > 0){
+               
+                       ProcessData.Append(";PREF=");
+                       ProcessData.Append(wxString::Format("%i", (*RoleListPref)[RoleIter->first]));
+                       
+               }
+
+               // Check if there is a value for tokens.
+
+               if ((*RoleListTokens)[RoleIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append((*RoleListTokens)[RoleIter->first]);
+                       
+               }
+                       
+               ProcessData.Append(":");
+               ProcessData.Append(RoleIter->second);
+               ProcessData.Append("\n");
+
+               ProcessData = OutputText(&ProcessData);
+               
+               SaveData->Append(ProcessData);
+               ProcessData.clear();
+                       
+       }
+               
 }
\ No newline at end of file
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