- return;
- }
-
- lboLogos->DeleteItem(longSelected);
-
- DeleteMapData(intSelectedData,
- &LogosList, &LogosListAltID, &LogosListPID, &LogosListType,
- &LogosListPicEncType, &LogosListPictureType, &LogosListTokens,
- &LogosListMediatype, &LogosListPref);
-
- wxMemoryInputStream istream(misc_emptyimage_png, sizeof(misc_emptyimage_png));
- wxImage misc_emptyimage_png(istream, wxBITMAP_TYPE_PNG);
- LogoImage = (wxBitmap)misc_emptyimage_png;
-
- imgLogo->SetBitmap(LogoImage);
-}
+
+ return;
+
+ }
+
+ wxString FileTypes;
+
+ wxString FinalFilename;
+
+ std::map<int,std::string>::iterator initier;
+ std::map<int,wxString>::iterator logotypeiter;
+
+ initier = ContactEditorData.LogosList.find(intSelectedData);
+ logotypeiter = ContactEditorData.LogosListPictureType.find(intSelectedData);
+
+ if (logotypeiter->second == wxT("image/jpeg")){
+
+ FileTypes.Append("JPEG Image (*.jpeg)|*.jpeg");
+
+ } else if (logotypeiter->second == wxT("image/png")){
+
+ FileTypes.Append("PNG Image (*.png)|*.png");
+
+ } else if (logotypeiter->second == wxT("image/gif")){
+
+ FileTypes.Append("GIF Image (*.gif)|*.gif");
+
+ } else {
+
+ wxMessageBox(_("Picture format for saving is not supported."), _("Picture format unsupported"), wxOK, this);
+ return;
+
+ }
+
+ // Open up the dialog to save the picture.
+
+ wxFileDialog ExportDlg(this, wxT("Save Logo"), wxT(""), wxT(""),
+ FileTypes, wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
+
+ if (ExportDlg.ShowModal() == wxID_CANCEL){
+
+ return;
+
+ }
+
+ // Write out the picture to the file.
+
+ wxFile LogoFile;
+
+ if (LogoFile.Open(ExportDlg.GetPath(), wxFile::write)){
+
+ std::string base64dec;
+
+ initier = ContactEditorData.LogosList.find(intSelectedData);
+ base64dec = base64_decode(initier->second);
+
+ LogoFile.Write(base64dec.c_str(), (size_t)base64dec.size());