|
Wt examples
3.3.5
|
Public Member Functions | |
| UploadInfo (const Http::UploadedFile &f, WContainerWidget *parent=0) | |
Public Attributes | |
| Http::UploadedFile | info_ |
| WAnchor * | downloadLink_ |
| Anchor referencing the file. | |
| WCheckBox * | keep_ |
| The check box to keep or discard the uploaded file. | |
Definition at line 73 of file AttachmentEdit.h.
| AttachmentEdit::UploadInfo::UploadInfo | ( | const Http::UploadedFile & | f, |
| WContainerWidget * | parent = 0 |
||
| ) |
Definition at line 29 of file AttachmentEdit.C.
: WContainerWidget(parent),
info_(f)
{
/*
* Include the file ?
*/
keep_ = new WCheckBox(this);
keep_->setChecked();
/*
* Give information on the file uploaded.
*/
std::streamsize fsize = 0;
{
std::ifstream theFile(info_.spoolFileName().c_str());
theFile.seekg(0, std::ios_base::end);
fsize = theFile.tellg();
theFile.seekg(0);
}
std::wstring size;
if (fsize < 1024)
size = boost::lexical_cast<std::wstring>(fsize) + L" bytes";
else
size = boost::lexical_cast<std::wstring>((int)(fsize / 1024))
+ L"kb";
std::wstring fn = static_cast<std::wstring>
(escapeText(WString::fromUTF8(info_.clientFileName())));
downloadLink_
= new WAnchor("", fn + L" (<i>" + WString::fromUTF8(info_.contentType())
+ L"</i>) " + size, this);
WFileResource *res = new WFileResource(info_.contentType(),
info_.spoolFileName(),
this);
res->suggestFileName(info_.clientFileName());
downloadLink_->setLink(res);
}
Anchor referencing the file.
Definition at line 81 of file AttachmentEdit.h.
| Http::UploadedFile AttachmentEdit::UploadInfo::info_ |
Definition at line 78 of file AttachmentEdit.h.
| WCheckBox* AttachmentEdit::UploadInfo::keep_ |
The check box to keep or discard the uploaded file.
Definition at line 84 of file AttachmentEdit.h.
1.7.6.1