Wt examples  3.3.6
Public Member Functions | Public Attributes | List of all members
AttachmentEdit::UploadInfo Class Reference
Inheritance diagram for AttachmentEdit::UploadInfo:
Inheritance graph
[legend]

Public Member Functions

 UploadInfo (const Http::UploadedFile &f, WContainerWidget *parent=0)
 

Public Attributes

Http::UploadedFile info_
 
WAnchor * downloadLink_
 Anchor referencing the file. More...
 
WCheckBox * keep_
 The check box to keep or discard the uploaded file. More...
 

Detailed Description

Definition at line 73 of file AttachmentEdit.h.

Constructor & Destructor Documentation

◆ UploadInfo()

AttachmentEdit::UploadInfo::UploadInfo ( const Http::UploadedFile &  f,
WContainerWidget *  parent = 0 
)

Definition at line 29 of file AttachmentEdit.C.

31  : WContainerWidget(parent),
32  info_(f)
33 {
34  /*
35  * Include the file ?
36  */
37  keep_ = new WCheckBox(this);
38  keep_->setChecked();
39 
40  /*
41  * Give information on the file uploaded.
42  */
43  std::streamsize fsize = 0;
44  {
45  std::ifstream theFile(info_.spoolFileName().c_str());
46  theFile.seekg(0, std::ios_base::end);
47  fsize = theFile.tellg();
48  theFile.seekg(0);
49  }
50  std::wstring size;
51  if (fsize < 1024)
52  size = boost::lexical_cast<std::wstring>(fsize) + L" bytes";
53  else
54  size = boost::lexical_cast<std::wstring>((int)(fsize / 1024))
55  + L"kb";
56 
57  std::wstring fn = static_cast<std::wstring>
58  (escapeText(WString::fromUTF8(info_.clientFileName())));
59 
61  = new WAnchor("", fn + L" (<i>" + WString::fromUTF8(info_.contentType())
62  + L"</i>) " + size, this);
63 
64  WFileResource *res = new WFileResource(info_.contentType(),
65  info_.spoolFileName(),
66  this);
67  res->suggestFileName(info_.clientFileName());
68  downloadLink_->setLink(res);
69 }
WAnchor * downloadLink_
Anchor referencing the file.
Http::UploadedFile info_
WCheckBox * keep_
The check box to keep or discard the uploaded file.

Member Data Documentation

◆ downloadLink_

WAnchor* AttachmentEdit::UploadInfo::downloadLink_

Anchor referencing the file.

Definition at line 81 of file AttachmentEdit.h.

◆ info_

Http::UploadedFile AttachmentEdit::UploadInfo::info_

Definition at line 78 of file AttachmentEdit.h.

◆ keep_

WCheckBox* AttachmentEdit::UploadInfo::keep_

The check box to keep or discard the uploaded file.

Definition at line 84 of file AttachmentEdit.h.


The documentation for this class was generated from the following files:

Generated on Thu Jan 12 2017 for the C++ Web Toolkit (Wt) by doxygen 1.8.13