00001
00002 #ifdef HAVE_CONFIG_H
00003 #include <config.h>
00004 #endif
00005
00006 #include "tdelistboxdialog.h"
00007
00008 #include <tqlabel.h>
00009 #include <tqlayout.h>
00010
00011 TDEListBoxDialog::TDEListBoxDialog( TQString& _selectedString,
00012 const TQString& caption,
00013 const TQString& labelText,
00014 TQWidget* 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( "TDEListBoxDialog" );
00023 resize( 400, 180 );
00024
00025 TQFrame *page = makeMainWidget();
00026 TQVBoxLayout *topLayout = new TQVBoxLayout( page, 0, spacingHint() );
00027 labelAboveLA = new TQLabel( page, "labelAboveLA" );
00028 labelAboveLA->setText( labelText );
00029
00030 topLayout->addWidget( labelAboveLA );
00031
00032 entriesLB = new TQListBox( page, "entriesLB" );
00033
00034 topLayout->addWidget( entriesLB );
00035
00036 commentBelowLA = new TQLabel( page, "commentBelowLA" );
00037 commentBelowLA->setText( "" );
00038 topLayout->addWidget( commentBelowLA );
00039 commentBelowLA->hide();
00040
00041
00042 connect( entriesLB, TQT_SIGNAL( highlighted( const TQString& ) ),
00043 this, TQT_SLOT( highlighted( const TQString& ) ) );
00044 connect( entriesLB, TQT_SIGNAL( selected(int) ),
00045 TQT_SLOT( slotOk() ) );
00046
00047 labelAboveLA->setBuddy( entriesLB );
00048 }
00049
00050
00051
00052
00053 TDEListBoxDialog::~TDEListBoxDialog()
00054 {
00055
00056 }
00057
00058 void TDEListBoxDialog::setLabelAbove(const TQString& label)
00059 {
00060 labelAboveLA->setText( label );
00061 if( label.isEmpty() )
00062 labelAboveLA->hide();
00063 else
00064 labelAboveLA->show();
00065 }
00066
00067 void TDEListBoxDialog::setCommentBelow(const TQString& comment)
00068 {
00069 commentBelowLA->setText( comment );
00070 if( comment.isEmpty() )
00071 commentBelowLA->hide();
00072 else
00073 commentBelowLA->show();
00074 }
00075
00076
00077
00078 void TDEListBoxDialog::highlighted( const TQString& txt )
00079 {
00080 selectedString = txt;
00081 }
00082
00083 #include "tdelistboxdialog.moc"