Public Member Functions | Private Member Functions | Private Attributes

ComposeExample Class Reference
[Composer example]

Main widget of the Composer example. More...

#include <ComposeExample.h>

List of all members.

Public Member Functions

 ComposeExample (WContainerWidget *parent=0)
 create a new Composer example.

Private Member Functions

void send ()
void discard ()

Private Attributes

Composercomposer_
WContainerWidget * details_

Detailed Description

Main widget of the Composer example.

Definition at line 25 of file ComposeExample.h.


Constructor & Destructor Documentation

ComposeExample::ComposeExample ( WContainerWidget *  parent = 0 )

create a new Composer example.


Member Function Documentation

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();
}

Member Data Documentation

Definition at line 33 of file ComposeExample.h.

WContainerWidget* ComposeExample::details_ [private]

Definition at line 34 of file ComposeExample.h.


The documentation for this class was generated from the following files:

Generated on Fri Feb 4 2011 for the C++ Web Toolkit (Wt) by doxygen 1.7.2