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

index 82b0c11..7fdb87c 100644 (file)
@@ -577,6 +577,12 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
        
        // Process LOGO.
        
+       SaveLogo(&LogosList, &LogosListAltID, 
+               &LogosListPID, &LogosListType,
+               &LogosListPicEncType, &LogosListPictureType,
+               &LogosListMediatype, &LogosListPref,
+               &LogosListTokens, SaveData);
+       
        // Process SOUND.
 
        // Write the end part of the vCard data file.
@@ -1751,4 +1757,88 @@ void ContactDataObject::SavePhoto(map<int, string> *PicturesList, map<int, wxStr
                        
        }
                        
+}
+
+void ContactDataObject::SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID, 
+       map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
+       map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
+       map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
+       map<int, wxString> *LogosListTokens, wxString *SaveData){
+
+       wxString ProcessData = "";
+               
+       for (std::map<int, string>::iterator LogosIter = LogosList->begin();
+               LogosIter != LogosList->end(); LogosIter++){
+
+               ProcessData.Append("LOGO");
+                       
+               // Check if there is a value for TYPE.
+               
+               if ((*LogosListType)[LogosIter->first].size() > 0){
+               
+                       ProcessData.Append(";TYPE=");
+                       ProcessData.Append((*LogosListType)[LogosIter->first]);
+                       
+               }
+               
+               // Check if there is a value for ALTID.
+               
+               if ((*LogosListAltID)[LogosIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append((*LogosListAltID)[LogosIter->first]);
+                       
+               }
+
+               // Check if there is a value for MEDIATYPE..
+               
+               if ((*LogosListMediatype)[LogosIter->first].size() > 0){
+               
+                       ProcessData.Append(";MEDIATYPE=");
+                       ProcessData.Append((*LogosListMediatype)[LogosIter->first]);
+                       
+               }
+               
+               // Check if there is a value for PID.
+
+               if ((*LogosListPID)[LogosIter->first].size() > 0){
+               
+                       ProcessData.Append(";PID=");
+                       ProcessData.Append((*LogosListPID)[LogosIter->first]);
+                       
+               }
+
+               // Check if there is a value for PREF.
+
+               if ((*LogosListPref)[LogosIter->first] > 0){
+               
+                       ProcessData.Append(";PREF=");
+                       ProcessData.Append(wxString::Format("%i", (*LogosListPref)[LogosIter->first]));
+                       
+               }
+
+               // Check if there is a value for tokens.
+
+               if ((*LogosListTokens)[LogosIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append((*LogosListTokens)[LogosIter->first]);
+                       
+               }
+               
+               ProcessData.Append(":data:");
+               ProcessData.Append((*LogosListPictureType)[LogosIter->first]);
+               ProcessData.Append(";");
+               ProcessData.Append((*LogosListPicEncType)[LogosIter->first]);
+               ProcessData.Append(",");
+               ProcessData.Append(LogosIter->second);
+               ProcessData.Append("\n");
+
+               ProcessData = OutputText(&ProcessData);
+               
+               SaveData->Append(ProcessData);
+               ProcessData.clear();
+                       
+       }
+               
 }
\ No newline at end of file
index a0cf5d5..66d7976 100644 (file)
@@ -161,6 +161,11 @@ class ContactDataObject{
                map<int, wxString> *PicturesListPicEncType, map<int, wxString> *PicturesListPictureType,
                map<int, wxString> *PicturesListMediatype, map<int, int> *PicturesListPref,
                map<int, wxString> *PicturesListTokens, wxString *SaveData);
+       void SaveLogo(map<int, string> *LogosList, map<int, wxString> *LogosListAltID, 
+               map<int, wxString> *LogosListPID, map<int, wxString> *LogosListType,
+               map<int, wxString> *LogosListPicEncType, map<int, wxString> *LogosListPictureType,
+               map<int, wxString> *LogosListMediatype, map<int, int> *LogosListPref,
+               map<int, wxString> *LogosListTokens, wxString *SaveData);
 
        public:
 
index 0547eb2..7a3fb37 100644 (file)
@@ -160,6 +160,15 @@ TEST(ContactSave, ContactSaveTests){
        "PHOTO;TYPE=work;ALTID=90;MEDIATYPE=image/png;PID=91;PREF=92;PHOTO=YUP:data:im\n"
        " age/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAKCAIAAADdHiL1AAAAIElEQVQoz2MUm\n"
        " 53EgApepsxF4XfaoylgYiAdjOoZ3HoAeuQD2WdxRzcAAAAASUVORK5CYII=\n"
+       "LOGO;ALTID=70;MEDIATYPE=image/png;PID=71;PREF=72;MEEP=MOO:data:image/png;base\n"
+       " 64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAKCAIAAADdHiL1AAAAJUlEQVQoz2NkwAb+//8PYTAyM\n"
+       " mLKMjGQDuilhxHudBrbM8zCDQCxHQkPeaUvawAAAABJRU5ErkJggg==\n"
+       "LOGO;TYPE=home;ALTID=20;MEDIATYPE=image/png;PID=21;PREF=22;BEEP=BOOP:data:ima\n"
+       " ge/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAKCAIAAADdHiL1AAAAHklEQVQoz2NkYP\n"
+       " jPgAr+owkwMqIpYGIgHYzqGdx6AAKNAxMN5P6+AAAAAElFTkSuQmCC\n"
+       "LOGO;TYPE=work;ALTID=90;MEDIATYPE=image/png;PID=91;PREF=92;LOGO=YUP:data:imag\n"
+       " e/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAKCAIAAADdHiL1AAAAIElEQVQoz2MUm53\n"
+       " EgApepsxF4XfaoylgYiAdjOoZ3HoAeuQD2WdxRzcAAAAASUVORK5CYII=\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