7 #include <Wt/WApplication> 10 #include <Wt/WPushButton> 11 #include <Wt/WContainerWidget> 12 #include <Wt/WStringUtil> 26 std::vector<Contact> addressBook;
27 addressBook.push_back(
Contact(L
"Koen Deforche",
28 L
"koen.deforche@gmail.com"));
29 addressBook.push_back(
Contact(L
"Koen alias1",
30 L
"koen.alias1@yahoo.com"));
31 addressBook.push_back(
Contact(L
"Koen alias2",
32 L
"koen.alias2@yahoo.com"));
33 addressBook.push_back(
Contact(L
"Koen alias3",
34 L
"koen.alias3@yahoo.com"));
35 addressBook.push_back(
Contact(L
"Bartje",
36 L
"jafar@hotmail.com"));
39 std::vector<Contact> contacts;
40 contacts.push_back(
Contact(L
"Koen Deforche", L
"koen.deforche@gmail.com"));
59 new WText(L
"<p>We could have, but did not send the following email:</p>",
63 if (!contacts.empty())
65 for (
unsigned i = 0; i < contacts.size(); ++i) {
66 new WText(L
"To: \"" + contacts[i].name + L
"\" <" 67 + contacts[i].email + L
">",
PlainText, horiz);
72 if (!contacts.empty())
74 for (
unsigned i = 0; i < contacts.size(); ++i) {
75 new WText(L
"Cc: \"" + contacts[i].name + L
"\" <" 76 + contacts[i].email + L
">",
PlainText, horiz);
81 if (!contacts.empty())
83 for (
unsigned i = 0; i < contacts.size(); ++i) {
84 new WText(L
"Bcc: \"" + contacts[i].name + L
"\" <" 85 + contacts[i].email + L
">",
PlainText, horiz);
93 if (!attachments.empty())
95 for (
unsigned i = 0; i < attachments.size(); ++i) {
96 new WText(L
"Attachment: \"" 97 + attachments[i].fileName
98 + L
"\" (" + attachments[i].contentDescription
101 unlink(attachments[i].spoolFileName.c_str());
103 new WText(
", was in spool file: " 104 + attachments[i].spoolFileName, horiz);
111 new WText(
"Message body: ", horiz);
114 if (!message.empty()) {
117 new WText(
"<i>(empty)</i>", horiz);
131 new WText(
"<p>Wise decision! Everyone's mailbox is already full anyway.</p>",
159 int main(
int argc,
char **argv)
std::vector< Contact > to() const
Get the To: contacts.
WMessageResourceBundle & messageResourceBundle()
An E-mail composer widget.
void setTitle(const WString &title)
std::vector< Contact > cc() const
Get the Cc: contacts.
Wt::Signal< void > send
The message is ready to be sent...
const WString & subject() const
Get the subject.
ComposeExample(WContainerWidget *parent=0)
create a new Composer example.
Wt::Signal< void > discard
The message must be discarded.
void setSubject(const WString &subject)
Set subject.
WContainerWidget * details_
void setAddressBook(const std::vector< Contact > &addressBook)
Set the address book, for autocomplete suggestions.
void use(const std::string &path, bool loadInMemory=true)
std::vector< Contact > bcc() const
Get the Bc: contacts.
WApplication * createApplication(const WEnvironment &env)
const WString & message() const
Get the message.
std::vector< Attachment > attachments() const
Get the list of attachments.
void useStyleSheet(const WLink &link, const std::string &media="all")
WContainerWidget * root() const
void setTo(const std::vector< Contact > &to)
Set message To: contacts.
virtual Wt::Signals::connection connect(WObject *target, WObject::Method method)
int main(int argc, char **argv)