Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added PHOTO to the SaveString function of ContactDataObject
[xestiaab/.git] / source / contacteditor / cdo / ContactDataObject-Save.cpp
index 08135bf..82b0c11 100644 (file)
@@ -545,6 +545,40 @@ 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");
+
+       // Process CATEGORIES.
+       
+       SaveCategory(&CategoriesList, &CategoriesListLanguage,
+               &CategoriesListAltID, &CategoriesListPID,
+               &CategoriesListType, &CategoriesListPref,
+               &CategoriesListTokens, SaveData);
+
+       // Process PHOTO.
+       
+       SavePhoto(&PicturesList, &PicturesListAltID, 
+               &PicturesListPID, &PicturesListType,
+               &PicturesListPicEncType, &PicturesListPictureType,
+               &PicturesListMediatype, &PicturesListPref,
+               &PicturesListTokens, SaveData);
+       
+       // Process LOGO.
+       
+       // Process SOUND.
+
        // Write the end part of the vCard data file.
        
        SaveData->Append("END:VCARD");
@@ -1474,4 +1508,247 @@ 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();
+                       
+       }
+               
+}
+
+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();
+                       
+       }
+               
+}
+
+void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxString> *PicturesListAltID, 
+               map<int, wxString> *PicturesListPID, map<int, wxString> *PicturesListType,
+               map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
+               map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
+               map<int, wxString> *PicturesListTokens, wxString *SaveData){
+
+       wxString ProcessData = "";
+               
+       for (std::map<int, string>::iterator PicturesIter = PicturesList->begin();
+               PicturesIter != PicturesList->end(); PicturesIter++){
+
+               ProcessData.Append("PHOTO");
+                       
+               // Check if there is a value for TYPE.
+               
+               if ((*PicturesListType)[PicturesIter->first].size() > 0){
+               
+                       ProcessData.Append(";TYPE=");
+                       ProcessData.Append((*PicturesListType)[PicturesIter->first]);
+                       
+               }
+               
+               // Check if there is a value for ALTID.
+               
+               if ((*PicturesListAltID)[PicturesIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append((*PicturesListAltID)[PicturesIter->first]);
+                       
+               }
+
+               // Check if there is a value for MEDIATYPE..
+               
+               if ((*PicturesListMediatype)[PicturesIter->first].size() > 0){
+               
+                       ProcessData.Append(";MEDIATYPE=");
+                       ProcessData.Append((*PicturesListMediatype)[PicturesIter->first]);
+                       
+               }
+               
+               // Check if there is a value for PID.
+
+               if ((*PicturesListPID)[PicturesIter->first].size() > 0){
+               
+                       ProcessData.Append(";PID=");
+                       ProcessData.Append((*PicturesListPID)[PicturesIter->first]);
+                       
+               }
+
+               // Check if there is a value for PREF.
+
+               if ((*PicturesListPref)[PicturesIter->first] > 0){
+               
+                       ProcessData.Append(";PREF=");
+                       ProcessData.Append(wxString::Format("%i", (*PicturesListPref)[PicturesIter->first]));
+                       
+               }
+
+               // Check if there is a value for tokens.
+
+               if ((*PicturesListTokens)[PicturesIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append((*PicturesListTokens)[PicturesIter->first]);
+                       
+               }
+               
+               ProcessData.Append(":data:");
+               ProcessData.Append((*PicturesListPictureType)[PicturesIter->first]);
+               ProcessData.Append(";");
+               ProcessData.Append((*PicturesListPicEncType)[PicturesIter->first]);
+               ProcessData.Append(",");
+               ProcessData.Append(PicturesIter->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