Wt examples  4.9.0
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
AttachmentEdit::UploadInfo Class Reference
Inheritance diagram for AttachmentEdit::UploadInfo:
[legend]

Public Member Functions

 UploadInfo (const Http::UploadedFile &f)
 

Public Attributes

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

Detailed Description

Definition at line 73 of file AttachmentEdit.h.

Constructor & Destructor Documentation

◆ UploadInfo()

AttachmentEdit::UploadInfo::UploadInfo ( const Http::UploadedFile &  f)

Definition at line 29 of file AttachmentEdit.C.

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

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: