11#include <boost/lexical_cast.hpp>
16#include <Wt/WApplication>
17#include <Wt/WCheckBox>
18#include <Wt/WCssDecorationStyle>
19#include <Wt/WFileResource>
20#include <Wt/WFileUpload>
21#include <Wt/WProgressBar>
43 std::streamsize fsize = 0;
46 theFile.seekg(0, std::ios_base::end);
47 fsize = theFile.tellg();
52 size = boost::lexical_cast<std::wstring>(fsize) + L
" bytes";
54 size = boost::lexical_cast<std::wstring>((
int)(fsize / 1024))
57 std::wstring fn =
static_cast<std::wstring
>
62 + L
"</i>) " + size,
this);
149 if (!files.empty()) {
160 for (
unsigned i = 0; i < files.size(); ++i)
182 .arg(WApplication::instance()->maximumRequestSize() / 1024));
193 std::vector<Attachment> result;
195 for (
unsigned i = 0; i <
uploadInfo_.size(); ++i) {
WCheckBox * keep_
The check box to keep or discard the uploaded file.
WAnchor * downloadLink_
Anchor referencing the file.
UploadInfo(const Http::UploadedFile &f, WContainerWidget *parent=0)
bool uploadNow()
Updates the file now.
Signal< void > uploadDone_
void remove()
Slot triggered when the users wishes to remove this attachment edit.
WText * error_
The text box to display an error (empty or too big file)
Option * remove_
The option to cancel the file upload.
bool uploadFailed_
The state of the last upload process.
void uploaded()
Slot triggered when the WFileUpload completed an upload.
std::vector< Attachment > attachments()
Returns the attachment.
WFileUpload * upload_
The WFileUpload control.
std::vector< UploadInfo * > uploadInfo_
void fileTooLarge(::int64_t size)
Slot triggered when the WFileUpload received an oversized file.
AttachmentEdit(Composer *composer, WContainerWidget *parent=0)
Creates an attachment edit field.
An E-mail composer widget.
void attachmentDone()
Slotcalled when an attachment has been uploaded.
void removeAttachment(AttachmentEdit *attachment)
Remove the given attachment edit.
WInteractWidget * item()
Returns the clickable part.
Wt::Signals::connection connect(const F &function)
const std::string & spoolFileName() const
const std::string & clientFileName() const
void stealSpoolFile() const
const std::string & contentType() const
void emit(A1 a1=NoClass::none, A2 a2=NoClass::none, A3 a3=NoClass::none, A4 a4=NoClass::none, A5 a5=NoClass::none, A6 a6=NoClass::none) const
virtual Wt::Signals::connection connect(WObject *target, WObject::Method method)
void setLink(const WLink &link)
void setMultiple(bool multiple)
JSignal< ::int64_t > & fileTooLarge()
void setProgressBar(WProgressBar *progressBar)
const std::vector< Http::UploadedFile > & uploadedFiles() const
void setFileTextSize(int chars)
void setSize(Size size, const WLength &length)
void setFormat(const WString &format)
void suggestFileName(const Wt::WString &name, DispositionType dispositionType=Attachment)
static WString fromUTF8(const std::string &value, bool checkValid=false)
static const WString Empty
bool setText(const WString &text)