Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added PHOTO to the SaveString function of ContactDataObject
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 2 Jul 2016 16:13:38 +0000 (17:13 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 2 Jul 2016 16:13:38 +0000 (17:13 +0100)
source/contacteditor/cdo/ContactDataObject-Save.cpp
source/contacteditor/cdo/ContactDataObject.h
source/tests/xestiaab_contactsave.h

index 2334177..82b0c11 100644 (file)
@@ -567,6 +567,18 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                &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");
@@ -1655,4 +1667,88 @@ void ContactDataObject::SaveCategory(map<int, wxString> *CategoryList, map<int,
                        
        }
                
+}
+
+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
index a7f4939..a0cf5d5 100644 (file)
@@ -156,6 +156,11 @@ class ContactDataObject{
                map<int, wxString> *CategoryListAltID, map<int, wxString> *CategoryListPID,
                map<int, wxString> *CategoryListType, map<int, int> *CategoryListPref,
                map<int, wxString> *CategoryListTokens, wxString *SaveData);
+       void 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);
 
        public:
 
index d07aabf..0547eb2 100644 (file)
@@ -151,6 +151,15 @@ TEST(ContactSave, ContactSaveTests){
        "CATEGORIES;TYPE=work;ALTID=84;LANGUAGE=kw;PID=86;PREF=88;AAA=BBB:Category Fiv\n"
        " e\n"
        "CATEGORIES;TYPE=work;ALTID=84;LANGUAGE=kw;PID=86;PREF=88;AAA=BBB:Category Six\n"
+       "PHOTO;ALTID=70;MEDIATYPE=image/png;PID=71;PREF=72;MEEP=MOO:data:image/png;bas\n"
+       " e64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAKCAIAAADdHiL1AAAAJUlEQVQoz2NkwAb+//8PYTAy\n"
+       " MmLKMjGQDuilhxHudBrbM8zCDQCxHQkPeaUvawAAAABJRU5ErkJggg==\n"
+       "PHOTO;TYPE=home;ALTID=20;MEDIATYPE=image/png;PID=21;PREF=22;BEEP=BOOP:data:im\n"
+       " age/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAKCAIAAADdHiL1AAAAHklEQVQoz2NkY\n"
+       " PjPgAr+owkwMqIpYGIgHYzqGdx6AAKNAxMN5P6+AAAAAElFTkSuQmCC\n"
+       "PHOTO;TYPE=work;ALTID=90;MEDIATYPE=image/png;PID=91;PREF=92;PHOTO=YUP:data:im\n"
+       " age/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAKCAIAAADdHiL1AAAAIElEQVQoz2MUm\n"
+       " 53EgApepsxF4XfaoylgYiAdjOoZ3HoAeuQD2WdxRzcAAAAASUVORK5CYII=\n"
        "END:VCARD";
 
        ASSERT_EQ(CONTACTLOAD_OK, TestFile3.LoadFile("LoadCheck-Load4.vcf"));
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