Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added NOTE to the SaveString function of ContactDataObject
[xestiaab/.git] / source / contacteditor / cdo / ContactDataObject-Save.cpp
index 08135bf..8107ed5 100644 (file)
@@ -545,6 +545,21 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                &BusinessOrganisationsListPref, &BusinessOrganisationsListTokens, 
                SaveData, "work");
 
+       // Process NOTE.
+       
+       SaveNote(&GeneralNoteList, &GeneralNoteListLanguage,
+               &GeneralNoteListAltID, &GeneralNoteListPID,
+               &GeneralNoteListType, &GeneralNoteListPref,
+               &GeneralNoteListTokens, SaveData, "");
+       SaveNote(&HomeNoteList, &HomeNoteListLanguage,
+               &HomeNoteListAltID, &HomeNoteListPID,
+               &HomeNoteListType, &HomeNoteListPref,
+               &HomeNoteListTokens, SaveData, "home");
+       SaveNote(&BusinessNoteList, &BusinessNoteListLanguage,
+               &BusinessNoteListAltID, &BusinessNoteListPID,
+               &BusinessNoteListType, &BusinessNoteListPref,
+               &BusinessNoteListTokens, SaveData, "work");
+
        // Write the end part of the vCard data file.
        
        SaveData->Append("END:VCARD");
@@ -1474,4 +1489,84 @@ void ContactDataObject::SaveOrganisation(map<int, wxString> *OrganisationList, m
                        
        }
                
+}
+
+void ContactDataObject::SaveNote(map<int, wxString> *NoteList, map<int, wxString> *NoteListLanguage,
+       map<int, wxString> *NoteListAltID, map<int, wxString> *NoteListPID,
+       map<int, wxString> *NoteListType, map<int, int> *NoteListPref,
+       map<int, wxString> *NoteListTokens, wxString *SaveData, wxString DataType){
+
+       wxString ProcessData = "";
+               
+       for (std::map<int, wxString>::iterator NoteIter = NoteList->begin();
+               NoteIter != NoteList->end(); NoteIter++){
+
+               ProcessData.Append("NOTE");
+                       
+               // 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 ((*NoteListAltID)[NoteIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append((*NoteListAltID)[NoteIter->first]);
+                       
+               }
+
+               // Check if there is a value for LANGUAGE.
+               
+               if ((*NoteListLanguage)[NoteIter->first].size() > 0){
+               
+                       ProcessData.Append(";LANGUAGE=");
+                       ProcessData.Append((*NoteListLanguage)[NoteIter->first]);
+                       
+               }
+               
+               // Check if there is a value for PID.
+
+               if ((*NoteListPID)[NoteIter->first].size() > 0){
+               
+                       ProcessData.Append(";PID=");
+                       ProcessData.Append((*NoteListPID)[NoteIter->first]);
+                       
+               }
+
+               // Check if there is a value for PREF.
+
+               if ((*NoteListPref)[NoteIter->first] > 0){
+               
+                       ProcessData.Append(";PREF=");
+                       ProcessData.Append(wxString::Format("%i", (*NoteListPref)[NoteIter->first]));
+                       
+               }
+
+               // Check if there is a value for tokens.
+
+               if ((*NoteListTokens)[NoteIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append((*NoteListTokens)[NoteIter->first]);
+                       
+               }
+                       
+               ProcessData.Append(":");
+               ProcessData.Append(NoteIter->second);
+               ProcessData.Replace("\n", "\\n", true);
+               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