/usr/lib/Wt/examples/composer/AttachmentEdit.h is in witty-examples 3.3.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef ATTACHMENT_EDIT_H_
#define ATTACHMENT_EDIT_H_
#include <Wt/WContainerWidget>
namespace Wt {
class WFileUpload;
class WText;
class WCheckBox;
}
class Attachment;
class Composer;
class Option;
using namespace Wt;
/**
* @addtogroup composerexample
*/
/*@{*/
/*! \brief An edit field for an email attachment.
*
* This widget managements one attachment edit: it shows a file upload
* control, handles the upload, and gives feed-back on the file
* uploaded.
*
* This widget is part of the %Wt composer example.
*/
class AttachmentEdit : public WContainerWidget
{
public:
/*! \brief Creates an attachment edit field.
*/
AttachmentEdit(Composer *composer, WContainerWidget *parent = 0);
/*! \brief Updates the file now.
*
* Returns whether a new file will be uploaded. If so, the uploadDone
* signal will be signalled when the file is uploaded (or failed to
* upload).
*/
bool uploadNow();
/*! \brief Returns whether the upload failed.
*/
bool uploadFailed() const { return uploadFailed_; }
/*! \brief Returns the attachment.
*/
std::vector<Attachment> attachments();
/*! \brief Signal emitted when new attachment(s) have been uploaded (or failed
* to upload.
*/
Signal<void>& uploadDone() { return uploadDone_; }
private:
Composer *composer_;
Signal<void> uploadDone_;
//! The WFileUpload control.
WFileUpload *upload_;
class UploadInfo : public WContainerWidget
{
public:
UploadInfo(const Http::UploadedFile& f, WContainerWidget *parent = 0);
Http::UploadedFile info_;
//! Anchor referencing the file.
WAnchor *downloadLink_;
//! The check box to keep or discard the uploaded file.
WCheckBox *keep_;
};
std::vector<UploadInfo *> uploadInfo_;
//! The text box to display an error (empty or too big file)
WText *error_;
//! The option to cancel the file upload
Option *remove_;
//! The state of the last upload process.
bool uploadFailed_;
//! Slot triggered when the WFileUpload completed an upload.
void uploaded();
//! Slot triggered when the WFileUpload received an oversized file.
void fileTooLarge(::int64_t size);
//! Slot triggered when the users wishes to remove this attachment edit.
void remove();
};
/*@}*/
#endif // ATTACHMENT_EDIT_H_
|