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::send (  )  [private]

Definition at line 53 of file ComposeExample.C.

00054 {
00055   WContainerWidget *feedback = new WContainerWidget(this);
00056   feedback->setStyleClass(L"feedback");
00057 
00058   WContainerWidget *horiz = new WContainerWidget(feedback);
00059   new WText(L"<p>We could have, but did not send the following email:</p>",
00060             horiz);
00061 
00062   std::vector<Contact> contacts = composer_->to();
00063   if (!contacts.empty())
00064     horiz = new WContainerWidget(feedback);
00065   for (unsigned i = 0; i < contacts.size(); ++i) {
00066     new WText(L"To: \"" + contacts[i].name + L"\" <"
00067               + contacts[i].email + L">", PlainText, horiz);
00068     new WBreak(horiz);
00069   }
00070 
00071   contacts = composer_->cc();
00072   if (!contacts.empty())
00073     horiz = new WContainerWidget(feedback);
00074   for (unsigned i = 0; i < contacts.size(); ++i) {
00075     new WText(L"Cc: \"" + contacts[i].name + L"\" <"
00076               + contacts[i].email + L">", PlainText, horiz);
00077     new WBreak(horiz);
00078   }
00079   
00080   contacts = composer_->bcc();
00081   if (!contacts.empty())
00082     horiz = new WContainerWidget(feedback);
00083   for (unsigned i = 0; i < contacts.size(); ++i) {
00084     new WText(L"Bcc: \"" + contacts[i].name + L"\" <"
00085               + contacts[i].email + L">", PlainText, horiz);
00086     new WBreak(horiz);
00087   }
00088 
00089   horiz = new WContainerWidget(feedback);
00090   WText *t = new WText("Subject: \"" + composer_->subject() + "\"",
00091                        PlainText, horiz);
00092 
00093   std::vector<Attachment> attachments = composer_->attachments();
00094   if (!attachments.empty())
00095     horiz = new WContainerWidget(feedback);
00096   for (unsigned i = 0; i < attachments.size(); ++i) {
00097     new WText(L"Attachment: \""
00098               + attachments[i].fileName
00099               + L"\" (" + attachments[i].contentDescription
00100               + L")", PlainText, horiz);
00101 
00102     unlink(attachments[i].spoolFileName.c_str());
00103 
00104     new WText(", was in spool file: "
00105               + attachments[i].spoolFileName, horiz);
00106     new WBreak(horiz);
00107   }
00108 
00109   std::wstring message = composer_->message();
00110 
00111   horiz = new WContainerWidget(feedback);
00112   t = new WText("Message body: ", horiz);
00113   new WBreak(horiz);
00114 
00115   if (!message.empty()) {
00116     t = new WText(message, PlainText, horiz);
00117   } else
00118     t = new WText("<i>(empty)</i>", horiz);
00119 
00120   delete composer_;
00121   delete details_;
00122 
00123   wApp->quit();
00124 }

void ComposeExample::discard (  )  [private]

Definition at line 126 of file ComposeExample.C.

00127 {
00128   WContainerWidget *feedback = new WContainerWidget(this);
00129   feedback->setStyleClass("feedback");
00130 
00131   WContainerWidget *horiz = new WContainerWidget(feedback);
00132   new WText("<p>Wise decision! Everyone's mailbox is already full anyway.</p>",
00133             horiz);
00134 
00135   delete composer_;
00136   delete details_;
00137 
00138   wApp->quit();
00139 }


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 Thu May 20 18:14:56 2010 for Wt by doxygen 1.5.6