Wt examples: composer/Composer.h Source File

Wt examples 4.10.4

Loading...
Searching...
No Matches
Composer.h
Go to the documentation of this file.
1// This may look like C code, but it's really -*- C++ -*-
2/*
3 * Copyright (C) 2008 Emweb bv, Herent, Belgium.
4 *
5 * See the LICENSE file for terms of use.
6 */
7#ifndef COMPOSER_H_
8#define COMPOSER_H_
9
10#include <Wt/WCompositeWidget.h>
11
12#include "Contact.h"
13#include "Attachment.h"
14
15namespace Wt {
16class WLineEdit;
17class WPushButton;
18class WTable;
19class WText;
20class WTextArea;
21}
22
23class AddresseeEdit;
24class AttachmentEdit;
25class ContactSuggestions;
26class OptionList;
27class Option;
28
29using namespace Wt;
30
35
40 class Composer : public WCompositeWidget
41{
42public:
45 Composer();
46
49 void setTo(const std::vector<Contact>& to);
50
53 void setSubject(const WString& subject);
54
57 void setMessage(const WString& message);
58
61 void setAddressBook(const std::vector<Contact>& addressBook);
62
65 std::vector<Contact> to() const;
66
69 std::vector<Contact> cc() const;
70
73 std::vector<Contact> bcc() const;
74
77 const WString& subject() const;
78
84 std::vector<Attachment> attachments() const;
85
88 const WString& message() const;
89
90public:
93 Wt::Signal<> send;
94
97 Wt::Signal<> discard;
98
99private:
100 WContainerWidget *layout_;
101
102 WPushButton *topSendButton_, *topSaveNowButton_, *topDiscardButton_;
103 WPushButton *botSendButton_, *botSaveNowButton_, *botDiscardButton_;
104 WText *statusMsg_;
105
106 WTable *edits_;
107
109 AddresseeEdit *toEdit_;
111 AddresseeEdit *ccEdit_;
113 AddresseeEdit *bccEdit_;
114
116 ContactSuggestions *contactSuggestions_;
117
119 WLineEdit *subject_;
120
122 OptionList *options_;
123
125 Option *addcc_;
127 Option *addbcc_;
129 Option *attachFile_;
131 Option *attachOtherFile_;
132
134 std::vector<AttachmentEdit *> attachments_;
135
137 WTextArea *message_;
138
140 bool saving_, sending_;
141
143 int attachmentsPending_;
144
147 void attachMore();
148
151 void removeAttachment(AttachmentEdit *attachment);
152
157 void sendIt();
158
164 void saveNow();
165
170 void discardIt();
171
179 void attachmentDone();
180
181private:
182 // create the user-interface
183 void createUi();
184
188 void saved();
189
192 void setStatus(const WString& text, const WString& style);
193
194 friend class AttachmentEdit;
195};
196
198
199#endif // COMPOSER_H_
Attachment.h
Contact.h
AddresseeEdit
An edit field for an email addressee.
Definition AddresseeEdit.h:32
AttachmentEdit
An edit field for an email attachment.
Definition AttachmentEdit.h:38
Composer
An E-mail composer widget.
Definition Composer.h:41
Composer::botSaveNowButton_
WPushButton * botSaveNowButton_
Definition Composer.h:103
Composer::sendIt
void sendIt()
Slot attached to the Send button.
Definition Composer.C:296
Composer::statusMsg_
WText * statusMsg_
Definition Composer.h:104
Composer::attachOtherFile_
Option * attachOtherFile_
Option for attaching another file.
Definition Composer.h:131
Composer::setMessage
void setMessage(const WString &message)
Set the message.
Definition Composer.C:50
Composer::saved
void saved()
All attachments have been processed, determine the result of saving the message.
Definition Composer.C:355
Composer::message_
WTextArea * message_
WTextArea for the main message.
Definition Composer.h:137
Composer::topSaveNowButton_
WPushButton * topSaveNowButton_
Definition Composer.h:102
Composer::send
Wt::Signal send
The message is ready to be sent...
Definition Composer.h:93
Composer::bcc
std::vector< Contact > bcc() const
Get the Bc: contacts.
Definition Composer.C:65
Composer::discard
Wt::Signal discard
The message must be discarded.
Definition Composer.h:97
Composer::message
const WString & message() const
Get the message.
Definition Composer.C:93
Composer::topSendButton_
WPushButton * topSendButton_
Definition Composer.h:102
Composer::setStatus
void setStatus(const WString &text, const WString &style)
Set the status, and apply the given style.
Definition Composer.C:349
Composer::toEdit_
AddresseeEdit * toEdit_
To: Addressees edit.
Definition Composer.h:109
Composer::discardIt
void discardIt()
Slot attached to the Discard button.
Definition Composer.C:385
Composer::to
std::vector< Contact > to() const
Get the To: contacts.
Definition Composer.C:55
Composer::attachMore
void attachMore()
Add an attachment edit.
Definition Composer.C:254
Composer::saveNow
void saveNow()
Slot attached to the Save now button.
Definition Composer.C:309
Composer::botSendButton_
WPushButton * botSendButton_
Definition Composer.h:103
Composer::saving_
bool saving_
state when waiting asyncrhonously for attachments to be uploaded
Definition Composer.h:140
Composer::subject_
WLineEdit * subject_
The subject line edit.
Definition Composer.h:119
Composer::topDiscardButton_
WPushButton * topDiscardButton_
Definition Composer.h:102
Composer::attachmentsPending_
int attachmentsPending_
number of attachments waiting to be uploaded during saving
Definition Composer.h:143
Composer::setTo
void setTo(const std::vector< Contact > &to)
Set message To: contacts.
Definition Composer.C:40
Composer::contactSuggestions_
ContactSuggestions * contactSuggestions_
The suggestions popup for the addressee edits.
Definition Composer.h:116
Composer::Composer
Composer()
Construct a new Composer.
Definition Composer.C:27
Composer::attachFile_
Option * attachFile_
Option for attaching a file.
Definition Composer.h:129
Composer::botDiscardButton_
WPushButton * botDiscardButton_
Definition Composer.h:103
Composer::attachments_
std::vector< AttachmentEdit * > attachments_
Array which holds all the attachments, including one extra invisible one.
Definition Composer.h:134
Composer::edits_
WTable * edits_
Definition Composer.h:106
Composer::addbcc_
Option * addbcc_
Option for editing Bcc:
Definition Composer.h:127
Composer::ccEdit_
AddresseeEdit * ccEdit_
Cc: Addressees edit.
Definition Composer.h:111
Composer::sending_
bool sending_
Definition Composer.h:140
Composer::attachmentDone
void attachmentDone()
Slotcalled when an attachment has been uploaded.
Definition Composer.C:338
Composer::layout_
WContainerWidget * layout_
Definition Composer.h:100
Composer::setSubject
void setSubject(const WString &subject)
Set subject.
Definition Composer.C:45
Composer::removeAttachment
void removeAttachment(AttachmentEdit *attachment)
Remove the given attachment edit.
Definition Composer.C:271
Composer::subject
const WString & subject() const
Get the subject.
Definition Composer.C:75
Composer::addcc_
Option * addcc_
Option for editing Cc:
Definition Composer.h:125
Composer::setAddressBook
void setAddressBook(const std::vector< Contact > &addressBook)
Set the address book, for autocomplete suggestions.
Definition Composer.C:70
Composer::cc
std::vector< Contact > cc() const
Get the Cc: contacts.
Definition Composer.C:60
Composer::createUi
void createUi()
Definition Composer.C:98
Composer::bccEdit_
AddresseeEdit * bccEdit_
Bcc: Addressees edit.
Definition Composer.h:113
Composer::options_
OptionList * options_
OptionsList for editing Cc or Bcc.
Definition Composer.h:122
Composer::attachments
std::vector< Attachment > attachments() const
Get the list of attachments.
Definition Composer.C:80
ContactSuggestions
A suggestion popup suggesting contacts from an addressbook.
Definition ContactSuggestions.h:33
OptionList
A list of options, separated by '|'.
Definition OptionList.h:41
Option
A clickable option.
Definition Option.h:32
Wt
Definition AddresseeEdit.h:16