25 #include "recipientseditortest.h"
27 #include "recipientseditor.h"
29 #include <tdeapplication.h>
31 #include <tdelocale.h>
32 #include <tdecmdlineargs.h>
33 #include <tdemessagebox.h>
34 #include "aboutdata.h"
36 #include <tqpushbutton.h>
39 #include <tqlineedit.h>
40 #include <tqtextedit.h>
42 Composer::Composer( TQWidget *parent )
45 TQGridLayout *topLayout = new TQGridLayout( this );
46 topLayout->setMargin( 4 );
47 topLayout->setSpacing( 4 );
49 TQLabel *label = new TQLabel( "From:", this );
50 topLayout->addWidget( label, 0, 0 );
51 TQLineEdit *edit = new TQLineEdit( this );
52 topLayout->addWidget( edit, 0, 1 );
54 mRecipients = new RecipientsEditor( this );
55 topLayout->addMultiCellWidget( mRecipients, 1, 1, 0, 1 );
57 kdDebug() << "SIZEHINT: " << mRecipients->sizeHint() << endl;
61 TQTextEdit *editor = new TQTextEdit( this );
62 topLayout->addMultiCellWidget( editor, 2, 2, 0, 1 );
63 topLayout->setRowStretch( 2, 1 );
65 TQPushButton *button = new TQPushButton( "&Close", this );
66 topLayout->addMultiCellWidget( button, 3, 3, 0, 1 );
67 connect( button, TQ_SIGNAL( clicked() ), TQ_SLOT( slotClose() ) );
70 void Composer::slotClose()
77 Recipient::List recipients = mRecipients->recipients();
78 Recipient::List::ConstIterator it;
79 for( it = recipients.begin(); it != recipients.end(); ++it ) {
80 text += "<b>" + (*it).typeLabel() + ":</b> " + (*it).email() + "<br/>";
85 KMessageBox::information( this, text );
91 int main( int argc, char **argv )
93 TDEAboutData aboutData( "testrecipienteditor",
94 "Test Recipient Editor", "0.1" );
95 TDECmdLineArgs::init( argc, argv, &aboutData );
99 TQObject::connect( &app, TQ_SIGNAL( lastWindowClosed() ), &app, TQ_SLOT( quit() ) );
101 TQWidget *wid = new Composer( 0 );
105 int ret = app.exec();
112 #include "recipientseditortest.moc"
|