recipientseditortest.cpp
00001 /* 00002 This file is part of KMail. 00003 00004 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 00020 As a special exception, permission is given to link this program 00021 with any edition of TQt, and distribute the resulting executable, 00022 without including the source code for TQt in the source distribution. 00023 */ 00024 00025 #include "recipientseditortest.h" 00026 00027 #include "recipientseditor.h" 00028 00029 #include <tdeapplication.h> 00030 #include <kdebug.h> 00031 #include <tdelocale.h> 00032 #include <tdecmdlineargs.h> 00033 #include <tdemessagebox.h> 00034 #include "aboutdata.h" 00035 00036 #include <tqpushbutton.h> 00037 #include <tqlayout.h> 00038 #include <tqlabel.h> 00039 #include <tqlineedit.h> 00040 #include <tqtextedit.h> 00041 00042 Composer::Composer( TQWidget *parent ) 00043 : TQWidget( parent ) 00044 { 00045 TQGridLayout *topLayout = new TQGridLayout( this ); 00046 topLayout->setMargin( 4 ); 00047 topLayout->setSpacing( 4 ); 00048 00049 TQLabel *label = new TQLabel( "From:", this ); 00050 topLayout->addWidget( label, 0, 0 ); 00051 TQLineEdit *edit = new TQLineEdit( 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 // mRecipients->setFixedHeight( 10 ); 00060 00061 TQTextEdit *editor = new TQTextEdit( this ); 00062 topLayout->addMultiCellWidget( editor, 2, 2, 0, 1 ); 00063 topLayout->setRowStretch( 2, 1 ); 00064 00065 TQPushButton *button = new TQPushButton( "&Close", this ); 00066 topLayout->addMultiCellWidget( button, 3, 3, 0, 1 ); 00067 connect( button, TQT_SIGNAL( clicked() ), TQT_SLOT( slotClose() ) ); 00068 } 00069 00070 void Composer::slotClose() 00071 { 00072 #if 0 00073 TQString 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 TDEAboutData aboutData( "testrecipienteditor", 00094 "Test Recipient Editor", "0.1" ); 00095 TDECmdLineArgs::init( argc, argv, &aboutData ); 00096 00097 TDEApplication app; 00098 00099 TQObject::connect( &app, TQT_SIGNAL( lastWindowClosed() ), &app, TQT_SLOT( quit() ) ); 00100 00101 TQWidget *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"