16 #include <Wt/WContainerWidget> 18 #include <Wt/WLineEdit> 19 #include <Wt/WPushButton> 22 #include <Wt/WTableCell> 23 #include <Wt/WStringUtil> 26 : WCompositeWidget(parent),
30 setImplementation(
layout_ =
new WContainerWidget());
80 std::vector<Attachment> toadd =
attachments_[i]->attachments();
82 attachments.insert(attachments.end(), toadd.begin(), toadd.end());
95 setStyleClass(
"darker");
98 WContainerWidget *horiz;
103 horiz =
new WContainerWidget(
layout_);
104 horiz->setPadding(5);
121 edits_->setStyleClass(
"lighter");
122 edits_->resize(WLength(100, WLength::Percentage), WLength::Auto);
123 edits_->elementAt(0, 0)->resize(WLength(1, WLength::Percentage),
132 edits_->elementAt(0, 1)->setMargin(5, Top);
163 new Label(tr(
"msg.subject"),
edits_->elementAt(4, 0));
165 subject_->resize(WLength(99, WLength::Percentage), WLength::Auto);
170 new WImage(
"icons/paperclip.png",
edits_->elementAt(5, 0));
171 edits_->elementAt(5, 0)->setContentAlignment(AlignRight | AlignTop);
172 edits_->elementAt(5, 0)->setPadding(3);
187 attachOtherFile_->hide();
200 horiz =
new WContainerWidget(
layout_);
201 horiz->setPadding(5);
228 addbcc_->
item()->clicked().connect(bccEdit_, &WWidget::show);
231 addbcc_->
item()->clicked().connect(bccEdit_, &WWidget::setFocus);
243 attachFile_->
item()->clicked().connect(attachOtherFile_, &WWidget::show);
269 std::vector<AttachmentEdit *>::iterator i
314 for (
unsigned i = 0; i <
attachments_.size() - 1; ++i) {
325 setStatus(tr(
"msg.uploading"),
"status");
354 bool attachmentsFailed =
false;
357 attachmentsFailed =
true;
361 if (attachmentsFailed) {
362 setStatus(tr(
"msg.attachment.failed"),
"error");
369 strftime(buffer, 100,
"%H:%M", &td);
371 char buffer[] =
"server";
374 statusMsg_->setText(std::string(
"Draft saved at ") + buffer);
const WString & subject() const
Get the subject.
std::vector< Contact > cc() const
Get the Cc: contacts.
std::vector< Attachment > attachments() const
Get the list of attachments.
AddresseeEdit * bccEdit_
Bcc: Addressees edit.
WInteractWidget * item()
Returns the clickable part.
AddresseeEdit * toEdit_
To: Addressees edit.
const WString & message() const
Get the message.
void discardIt()
Slot attached to the Discard button.
WContainerWidget * layout_
Option * attachOtherFile_
Option for attaching another file.
Option * addbcc_
Option for editing Bcc:
An edit field for an email attachment.
Composer(WContainerWidget *parent=0)
Construct a new Composer.
void saved()
All attachments have been processed, determine the result of saving the message.
WPushButton * botSaveNowButton_
std::vector< AttachmentEdit * > attachments_
Array which holds all the attachments, including one extra invisible one.
WTextArea * message_
WTextArea for the main message.
Wt::Signal< void > send
The message is ready to be sent...
Wt::Signal< void > discard
The message must be discarded.
void setSubject(const WString &subject)
Set subject.
void removeAttachment(AttachmentEdit *attachment)
Remove the given attachment edit.
void saveNow()
Slot attached to the Save now button.
void update()
Updates the stateless implementations after an Option has been hidden or shown.
WPushButton * botSendButton_
WPushButton * topDiscardButton_
void sendIt()
Slot attached to the Send button.
A list of options, separated by '|'.
void setAddressBook(const std::vector< Contact > &addressBook)
Set the address book, for autocomplete suggestions.
void setAddressees(const std::vector< Contact > &contacts)
Set a list of addressees.
An edit field for an email addressee.
WPushButton * botDiscardButton_
std::vector< Contact > bcc() const
Get the Bc: contacts.
bool saving_
state when waiting asyncrhonously for attachments to be uploaded
Option * attachFile_
Option for attaching a file.
std::vector< Contact > to() const
Get the To: contacts.
WPushButton * topSaveNowButton_
friend class AttachmentEdit
WLineEdit * subject_
The subject line edit.
WPushButton * topSendButton_
std::vector< Contact > addressees() const
Get a list of addressees.
void attachmentDone()
Slotcalled when an attachment has been uploaded.
Option * addcc_
Option for editing Cc:
ContactSuggestions * contactSuggestions_
The suggestions popup for the addressee edits.
void setMessage(const WString &message)
Set the message.
void setTo(const std::vector< Contact > &to)
Set message To: contacts.
void attachMore()
Add an attachment edit.
AddresseeEdit * ccEdit_
Cc: Addressees edit.
int attachmentsPending_
number of attachments waiting to be uploaded during saving
OptionList * options_
OptionsList for editing Cc or Bcc.
void add(Option *option)
Add an Option to the list.
void setStatus(const WString &text, const WString &style)
Set the status, and apply the given style.