kmail
recipientseditortest.cppGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "recipientseditortest.h"
00026
00027 #include "recipientseditor.h"
00028
00029 #include <kapplication.h>
00030 #include <kdebug.h>
00031 #include <klocale.h>
00032 #include <kcmdlineargs.h>
00033 #include <kmessagebox.h>
00034 #include "aboutdata.h"
00035
00036 #include <qpushbutton.h>
00037 #include <qlayout.h>
00038 #include <qlabel.h>
00039 #include <qlineedit.h>
00040 #include <qtextedit.h>
00041
00042 Composer::Composer( QWidget *parent )
00043 : QWidget( parent )
00044 {
00045 QGridLayout *topLayout = new QGridLayout( this );
00046 topLayout->setMargin( 4 );
00047 topLayout->setSpacing( 4 );
00048
00049 QLabel *label = new QLabel( "From:", this );
00050 topLayout->addWidget( label, 0, 0 );
00051 QLineEdit *edit = new QLineEdit( this );
00052 topLayout->addWidget( edit, 0, 1 );
00053
00054 mRecipients = new RecipientsEditor( this );
00055 topLayout->addMultiCellWidget( mRecipients, 1, 1, 0, 1 );
00056
00057 kdDebug() << "SIZEHINT: " << mRecipients->sizeHint() << endl;
00058
00059
00060
00061 QTextEdit *editor = new QTextEdit( this );
00062 topLayout->addMultiCellWidget( editor, 2, 2, 0, 1 );
00063 topLayout->setRowStretch( 2, 1 );
00064
00065 QPushButton *button = new QPushButton( "&Close", this );
00066 topLayout->addMultiCellWidget( button, 3, 3, 0, 1 );
00067 connect( button, SIGNAL( clicked() ), SLOT( slotClose() ) );
00068 }
00069
00070 void Composer::slotClose()
00071 {
00072 #if 0
00073 QString text;
00074
00075 text += "<qt>";
00076
00077 Recipient::List recipients = mRecipients->recipients();
00078 Recipient::List::ConstIterator it;
00079 for( it = recipients.begin(); it != recipients.end(); ++it ) {
00080 text += "<b>" + (*it).typeLabel() + ":</b> " + (*it).email() + "<br/>";
00081 }
00082
00083 text += "</qt>";
00084
00085 KMessageBox::information( this, text );
00086 #endif
00087
00088 close();
00089 }
00090
00091 int main( int argc, char **argv )
00092 {
00093 KAboutData aboutData( "testrecipienteditor",
00094 "Test Recipient Editor", "0.1" );
00095 KCmdLineArgs::init( argc, argv, &aboutData );
00096
00097 KApplication app;
00098
00099 QObject::connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) );
00100
00101 QWidget *wid = new Composer( 0 );
00102
00103 wid->show();
00104
00105 int ret = app.exec();
00106
00107 delete wid;
00108
00109 return ret;
00110 }
00111
00112 #include "recipientseditortest.moc"
|