| Wt examples
    3.3.0
    | 
Main widget of the Composer example. More...
#include <ComposeExample.h>
| Public Member Functions | |
| ComposeExample (WContainerWidget *parent=0) | |
| create a new Composer example. | |
| Private Member Functions | |
| void | send () | 
| void | discard () | 
| Private Attributes | |
| Composer * | composer_ | 
| WContainerWidget * | details_ | 
Main widget of the Composer example.
Definition at line 25 of file ComposeExample.h.
| ComposeExample::ComposeExample | ( | WContainerWidget * | parent = 0 | ) | 
create a new Composer example.
Definition at line 21 of file ComposeExample.C.
: WContainerWidget(parent) { composer_ = new Composer(this); std::vector<Contact> addressBook; addressBook.push_back(Contact(L"Koen Deforche", L"koen.deforche@gmail.com")); addressBook.push_back(Contact(L"Koen alias1", L"koen.alias1@yahoo.com")); addressBook.push_back(Contact(L"Koen alias2", L"koen.alias2@yahoo.com")); addressBook.push_back(Contact(L"Koen alias3", L"koen.alias3@yahoo.com")); addressBook.push_back(Contact(L"Bartje", L"jafar@hotmail.com")); composer_->setAddressBook(addressBook); std::vector<Contact> contacts; contacts.push_back(Contact(L"Koen Deforche", L"koen.deforche@gmail.com")); composer_->setTo(contacts); composer_->setSubject("That's cool! Want to start your own google?"); composer_->send.connect(this, &ComposeExample::send); composer_->discard.connect(this, &ComposeExample::discard); details_ = new WContainerWidget(this); new WText(tr("example.info"), details_); }
| void ComposeExample::discard | ( | ) |  [private] | 
Definition at line 126 of file ComposeExample.C.
{
  WContainerWidget *feedback = new WContainerWidget(this);
  feedback->setStyleClass("feedback");
  WContainerWidget *horiz = new WContainerWidget(feedback);
  new WText("<p>Wise decision! Everyone's mailbox is already full anyway.</p>",
            horiz);
  delete composer_;
  delete details_;
  wApp->quit();
}
| void ComposeExample::send | ( | ) |  [private] | 
Definition at line 53 of file ComposeExample.C.
{
  WContainerWidget *feedback = new WContainerWidget(this);
  feedback->setStyleClass(L"feedback");
  WContainerWidget *horiz = new WContainerWidget(feedback);
  new WText(L"<p>We could have, but did not send the following email:</p>",
            horiz);
  std::vector<Contact> contacts = composer_->to();
  if (!contacts.empty())
    horiz = new WContainerWidget(feedback);
  for (unsigned i = 0; i < contacts.size(); ++i) {
    new WText(L"To: \"" + contacts[i].name + L"\" <"
              + contacts[i].email + L">", PlainText, horiz);
    new WBreak(horiz);
  }
  contacts = composer_->cc();
  if (!contacts.empty())
    horiz = new WContainerWidget(feedback);
  for (unsigned i = 0; i < contacts.size(); ++i) {
    new WText(L"Cc: \"" + contacts[i].name + L"\" <"
              + contacts[i].email + L">", PlainText, horiz);
    new WBreak(horiz);
  }
  
  contacts = composer_->bcc();
  if (!contacts.empty())
    horiz = new WContainerWidget(feedback);
  for (unsigned i = 0; i < contacts.size(); ++i) {
    new WText(L"Bcc: \"" + contacts[i].name + L"\" <"
              + contacts[i].email + L">", PlainText, horiz);
    new WBreak(horiz);
  }
  horiz = new WContainerWidget(feedback);
  WText *t = new WText("Subject: \"" + composer_->subject() + "\"",
                       PlainText, horiz);
  std::vector<Attachment> attachments = composer_->attachments();
  if (!attachments.empty())
    horiz = new WContainerWidget(feedback);
  for (unsigned i = 0; i < attachments.size(); ++i) {
    new WText(L"Attachment: \""
              + attachments[i].fileName
              + L"\" (" + attachments[i].contentDescription
              + L")", PlainText, horiz);
    unlink(attachments[i].spoolFileName.c_str());
    new WText(", was in spool file: "
              + attachments[i].spoolFileName, horiz);
    new WBreak(horiz);
  }
  std::wstring message = composer_->message();
  horiz = new WContainerWidget(feedback);
  t = new WText("Message body: ", horiz);
  new WBreak(horiz);
  if (!message.empty()) {
    t = new WText(message, PlainText, horiz);
  } else
    t = new WText("<i>(empty)</i>", horiz);
  delete composer_;
  delete details_;
  wApp->quit();
}
| Composer* ComposeExample::composer_  [private] | 
Definition at line 33 of file ComposeExample.h.
| WContainerWidget* ComposeExample::details_  [private] | 
Definition at line 34 of file ComposeExample.h.
 1.7.5.1
 1.7.5.1