1 #include "frmContactEditor.h"
2 #include "frmContactEditorPicture.h"
3 #include "../common/base64.h"
5 void frmContactEditor::LoadLogo( wxListEvent& event )
8 long longSelected = -1;
9 int intSelectedData = 0;
11 if (!GetSelectedItem(lboLogos,
17 std::string base64dec;
19 std::map<int,std::string>::iterator initier;
21 initier = LogosList.find(intSelectedData);
23 base64dec = base64_decode(initier->second);
26 wxMemoryInputStream istream(base64dec.c_str(), (size_t)base64dec.size());
28 //wxMemoryInputStream istream(base64dec, (size_t)base64dec.size());
30 if (!photo.LoadFile(istream, wxBITMAP_TYPE_ANY)){
37 LogoImage = (wxBitmap)photo;
38 imgLogo->SetBitmap(LogoImage);
42 void frmContactEditor::AddLogo( wxCommandEvent& event )
46 frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
47 frameCELogo->SetEditorMode(FALSE);
48 intResult = GetLastInt(&LogosList);
49 frameCELogo->SetupPointers(&LogosList,
54 &LogosListPictureType,
60 frameCELogo->ShowModal();
65 void frmContactEditor::ModifyLogo( wxCommandEvent& event )
67 long longSelected = -1;
68 int intSelectedData = 0;
70 if (!GetSelectedItem(lboLogos,
76 frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
77 frameCELogo->SetupPointers(&LogosList,
82 &LogosListPictureType,
88 frameCELogo->SetEditorMode(TRUE);
89 frameCELogo->ShowModal();
94 void frmContactEditor::DeleteLogo( wxCommandEvent& event )
96 long longSelected = -1;
97 int intSelectedData = 0;
99 if (!GetSelectedItem(lboLogos,
105 lboLogos->DeleteItem(longSelected);
107 DeleteMapData(intSelectedData,
108 &LogosList, &LogosListAltID, &LogosListPID, &LogosListType,
109 &LogosListPicEncType, &LogosListPictureType, &LogosListTokens,
110 &LogosListMediatype, &LogosListPref);
112 wxMemoryInputStream istream(misc_emptyimage_png, sizeof(misc_emptyimage_png));
113 wxImage misc_emptyimage_png(istream, wxBITMAP_TYPE_PNG);
114 LogoImage = (wxBitmap)misc_emptyimage_png;
116 imgLogo->SetBitmap(LogoImage);