Wt examples  3.3.0
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_
 
WAnchordownloadLink_
 Anchor referencing the file. More...
 
WCheckBoxkeep_
 The check box to keep or discard the uploaded file. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Wt::WWidget
virtual void enableAjax ()=0
 
virtual void propagateSetEnabled (bool enabled)=0
 
virtual void render (WFlags< RenderFlag > flags)
 

Detailed Description

Definition at line 73 of file AttachmentEdit.h.

Constructor & Destructor Documentation

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 
66  this);
68  downloadLink_->setLink(res);
69 }

Member Data Documentation

WAnchor* AttachmentEdit::UploadInfo::downloadLink_

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.


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

Generated on Fri May 31 2013 for the C++ Web Toolkit (Wt) by doxygen 1.8.3.1