3 #include <Wt/WPushButton.h> 5 #include "AttachmentEditor.h" 7 Wtx::Eml::AttachmentEditor::AttachmentEditor(
int count )
8 :
Wt::WContainerWidget()
13 text = addNew< Wt::WText >( Wt::WString::tr(
"wtx.eml.composer.attachfile") );
15 text = addNew< Wt::WText >( Wt::WString::tr(
"wtx.eml.composer.attachanother") );
17 text-> setAttributeValue(
"style",
"text-decoration: underline" );
18 text-> clicked().connect(
this, &Wtx::Eml::AttachmentEditor::do_upload );
22 Wtx::Eml::AttachmentEditor::AttachmentEditor(
const std::string &
fileName )
26 Wt::Signal<> & Wtx::Eml::AttachmentEditor::attached()
31 Wt::Signal<> & Wtx::Eml::AttachmentEditor::removed()
36 void Wtx::Eml::AttachmentEditor::do_upload()
40 m_fileUpload = addNew< Wt::WFileUpload >();
48 m_fileUpload-> changed().connect( m_fileUpload, &Wt::WFileUpload::upload );
51 m_fileUpload-> uploaded().connect(
this, &Wtx::Eml::AttachmentEditor::do_uploaded );
54 m_fileUpload-> fileTooLarge().connect(
this, &Wtx::Eml::AttachmentEditor::do_fileTooLarge );
65 void Wtx::Eml::AttachmentEditor::do_uploaded()
68 std::vector< std::string > files;
70 for(
auto uploadedFile : m_fileUpload-> uploadedFiles() )
72 std::cout << __FILE__ <<
":" << __LINE__
73 <<
" " << uploadedFile.spoolFileName()
74 <<
" " << uploadedFile.clientFileName()
77 files.push_back( uploadedFile.clientFileName() );
83 for(
auto file : files )
85 auto pbRemove = addNew< Wt::WPushButton >(
"X" );
86 addNew< Wt::WText >( file );
88 pbRemove-> setStyleClass(
"btn-xs" );
89 pbRemove-> clicked().connect(
this, &Wtx::Eml::AttachmentEditor::do_removed );
97 void Wtx::Eml::AttachmentEditor::do_fileTooLarge()
99 std::cout << __FILE__ <<
":" << __LINE__ <<
" " << std::endl;
103 void Wtx::Eml::AttachmentEditor::do_removed()
std::u32string fileName
The file name.