Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added CATEGORIES to the SaveString function of ContactDataObject
[xestiaab/.git] / source / contacteditor / cdo / ContactDataObject-Save.cpp
index 8107ed5..2334177 100644 (file)
@@ -560,6 +560,13 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                &BusinessNoteListType, &BusinessNoteListPref,
                &BusinessNoteListTokens, SaveData, "work");
 
+       // Process CATEGORIES.
+       
+       SaveCategory(&CategoriesList, &CategoriesListLanguage,
+               &CategoriesListAltID, &CategoriesListPID,
+               &CategoriesListType, &CategoriesListPref,
+               &CategoriesListTokens, SaveData);
+
        // Write the end part of the vCard data file.
        
        SaveData->Append("END:VCARD");
@@ -1569,4 +1576,83 @@ void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString
                        
        }
                
+}
+
+void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int, wxString> *CategoryListLanguage,
+       map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
+       map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
+       map<int, wxString> *CategoryListTokens, wxString *SaveData){
+
+       wxString ProcessData = "";
+               
+       for (std::map<int, wxString>::iterator CategoryIter = CategoryList->begin();
+               CategoryIter != CategoryList->end(); CategoryIter++){
+
+               ProcessData.Append("CATEGORIES");
+                       
+               // Check if there is a value for TYPE.
+               
+               if ((*CategoryListType)[CategoryIter->first].size() > 0){
+               
+                       ProcessData.Append(";TYPE=");
+                       ProcessData.Append((*CategoryListType)[CategoryIter->first]);
+                       
+               }
+               
+               // Check if there is a value for ALTID.
+               
+               if ((*CategoryListAltID)[CategoryIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append((*CategoryListAltID)[CategoryIter->first]);
+                       
+               }
+
+               // Check if there is a value for LANGUAGE.
+               
+               if ((*CategoryListLanguage)[CategoryIter->first].size() > 0){
+               
+                       ProcessData.Append(";LANGUAGE=");
+                       ProcessData.Append((*CategoryListLanguage)[CategoryIter->first]);
+                       
+               }
+               
+               // Check if there is a value for PID.
+
+               if ((*CategoryListPID)[CategoryIter->first].size() > 0){
+               
+                       ProcessData.Append(";PID=");
+                       ProcessData.Append((*CategoryListPID)[CategoryIter->first]);
+                       
+               }
+
+               // Check if there is a value for PREF.
+
+               if ((*CategoryListPref)[CategoryIter->first] > 0){
+               
+                       ProcessData.Append(";PREF=");
+                       ProcessData.Append(wxString::Format("%i", (*CategoryListPref)[CategoryIter->first]));
+                       
+               }
+
+               // Check if there is a value for tokens.
+
+               if ((*CategoryListTokens)[CategoryIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append((*CategoryListTokens)[CategoryIter->first]);
+                       
+               }
+                       
+               ProcessData.Append(":");
+               ProcessData.Append(CategoryIter->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