Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added URL to the SaveString function of ContactDataObject
[xestiaab/.git] / source / contacteditor / cdo / ContactDataObject-Save.cpp
index 6276454..426f3f2 100644 (file)
@@ -496,7 +496,22 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                ProcessData.clear();
                        
        }
-
+       
+       // Process URL.
+       
+       SaveURL(&GeneralWebsiteList, &GeneralWebsiteListAltID, 
+               &GeneralWebsiteListPID, &GeneralWebsiteListType,
+               &GeneralWebsiteListMediatype, &GeneralWebsiteListPref, 
+               &GeneralWebsiteListTokens, SaveData, "");
+       SaveURL(&HomeWebsiteList, &HomeWebsiteListAltID, 
+               &HomeWebsiteListPID, &HomeWebsiteListType,
+               &HomeWebsiteListMediatype, &HomeWebsiteListPref, 
+               &HomeWebsiteListTokens, SaveData, "home");
+       SaveURL(&BusinessWebsiteList, &BusinessWebsiteListAltID, 
+               &BusinessWebsiteListPID, &BusinessWebsiteListType,
+               &BusinessWebsiteListMediatype, &BusinessWebsiteListPref, 
+               &BusinessWebsiteListTokens, SaveData, "work");
+       
        // Write the end part of the vCard data file.
        
        SaveData->Append("END:VCARD");
@@ -1178,4 +1193,83 @@ void ContactDataObject::SaveGeoposition(map<int, wxString> *GeographyList, map<i
                        
        }
                
+}
+
+void ContactDataObject::SaveURL(map<int, wxString> *WebsiteList, map<int, wxString> *WebsiteListAltID, 
+               map<int, wxString> *WebsiteListPID, map<int, wxString> *WebsiteListType,
+               map<int, wxString> *WebsiteListMediatype, map<int, int> *WebsiteListPref, 
+               map<int, wxString> *WebsiteListTokens, wxString *SaveData, wxString DataType){
+
+       wxString ProcessData = "";
+       
+       for (std::map<int, wxString>::iterator WebsiteIter = WebsiteList->begin();
+               WebsiteIter != WebsiteList->end(); WebsiteIter++){
+
+               ProcessData.Append("URL");
+                       
+               // 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 ((*WebsiteListAltID)[WebsiteIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append((*WebsiteListAltID)[WebsiteIter->first]);
+                       
+               }
+               
+               // Check if there is a value for MEDIATYPE.
+               
+               if ((*WebsiteListMediatype)[WebsiteIter->first].size() > 0){
+               
+                       ProcessData.Append(";MEDIATYPE=");
+                       ProcessData.Append((*WebsiteListMediatype)[WebsiteIter->first]);
+                       
+               }
+               
+               // Check if there is a value for PID.
+
+               if ((*WebsiteListPID)[WebsiteIter->first].size() > 0){
+               
+                       ProcessData.Append(";PID=");
+                       ProcessData.Append((*WebsiteListPID)[WebsiteIter->first]);
+                       
+               }
+
+               // Check if there is a value for PREF.
+
+               if ((*WebsiteListPref)[WebsiteIter->first] > 0){
+               
+                       ProcessData.Append(";PREF=");
+                       ProcessData.Append(wxString::Format("%i", (*WebsiteListPref)[WebsiteIter->first]));
+                       
+               }
+
+               // Check if there is a value for tokens.
+
+               if ((*WebsiteListTokens)[WebsiteIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append((*WebsiteListTokens)[WebsiteIter->first]);
+                       
+               }
+                       
+               ProcessData.Append(":");
+               ProcessData.Append(WebsiteIter->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