kmail Library API Documentation

klistboxdialog.cpp

00001 // This must be first 00002 #ifdef HAVE_CONFIG_H 00003 #include <config.h> 00004 #endif 00005 00006 #include "klistboxdialog.h" 00007 00008 #include <qlabel.h> 00009 #include <qlayout.h> 00010 00011 KListBoxDialog::KListBoxDialog( QString& _selectedString, 00012 const QString& caption, 00013 const QString& labelText, 00014 QWidget* parent, 00015 const char* name, 00016 bool modal ) 00017 : KDialogBase( parent, name, modal, caption, Ok|Cancel, Ok, true ), 00018 selectedString( _selectedString ) 00019 00020 { 00021 if ( !name ) 00022 setName( "KListBoxDialog" ); 00023 resize( 400, 180 ); 00024 00025 QFrame *page = makeMainWidget(); 00026 QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); 00027 labelAboveLA = new QLabel( page, "labelAboveLA" ); 00028 labelAboveLA->setText( labelText ); 00029 00030 topLayout->addWidget( labelAboveLA ); 00031 00032 entriesLB = new QListBox( page, "entriesLB" ); 00033 00034 topLayout->addWidget( entriesLB ); 00035 00036 commentBelowLA = new QLabel( page, "commentBelowLA" ); 00037 commentBelowLA->setText( "" ); 00038 topLayout->addWidget( commentBelowLA ); 00039 commentBelowLA->hide(); 00040 00041 // signals and slots connections 00042 connect( entriesLB, SIGNAL( highlighted( const QString& ) ), 00043 this, SLOT( highlighted( const QString& ) ) ); 00044 connect( entriesLB, SIGNAL( selected(int) ), 00045 SLOT( slotOk() ) ); 00046 // buddies 00047 labelAboveLA->setBuddy( entriesLB ); 00048 } 00049 00050 /* 00051 * Destroys the object and frees any allocated resources 00052 */ 00053 KListBoxDialog::~KListBoxDialog() 00054 { 00055 // no need to delete child widgets, Qt does it all for us 00056 } 00057 00058 void KListBoxDialog::setLabelAbove(const QString& label) 00059 { 00060 labelAboveLA->setText( label ); 00061 if( label.isEmpty() ) 00062 labelAboveLA->hide(); 00063 else 00064 labelAboveLA->show(); 00065 } 00066 00067 void KListBoxDialog::setCommentBelow(const QString& comment) 00068 { 00069 commentBelowLA->setText( comment ); 00070 if( comment.isEmpty() ) 00071 commentBelowLA->hide(); 00072 else 00073 commentBelowLA->show(); 00074 } 00075 00076 00077 00078 void KListBoxDialog::highlighted( const QString& txt ) 00079 { 00080 selectedString = txt; 00081 } 00082 00083 #include "klistboxdialog.moc"
KDE Logo
This file is part of the documentation for kmail Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 21 19:46:46 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003