svn path=/trunk/KDE/kdepim/; revision=698625wilder-work
parent
8f1c11bc76
commit
3ce237441d
5 changed files with 5 additions and 126 deletions
@ -1,86 +0,0 @@ |
||||
// This must be first
|
||||
|
||||
#include "klistboxdialog.h" |
||||
#include <k3listbox.h> |
||||
#include <QLabel> |
||||
#include <QLayout> |
||||
//Added by qt3to4:
|
||||
#include <QVBoxLayout> |
||||
|
||||
KListBoxDialog::KListBoxDialog( QString& _selectedString, |
||||
const QString& caption, |
||||
const QString& labelText, |
||||
QWidget* parent ) |
||||
: KDialog( parent ), |
||||
selectedString( _selectedString ) |
||||
|
||||
{ |
||||
setCaption( caption ); |
||||
setButtons( Ok|Cancel ); |
||||
setObjectName( "KListBoxDialog" ); |
||||
resize( 400, 180 ); |
||||
|
||||
QWidget *page = new QWidget( this ); |
||||
setMainWidget( page ); |
||||
QVBoxLayout *topLayout = new QVBoxLayout( page ); |
||||
topLayout->setSpacing( spacingHint() ); |
||||
topLayout->setMargin( 0 ); |
||||
labelAboveLA = new QLabel( page ); |
||||
labelAboveLA->setObjectName( "labelAboveLA" ); |
||||
labelAboveLA->setText( labelText ); |
||||
|
||||
topLayout->addWidget( labelAboveLA ); |
||||
|
||||
entriesLB = new Q3ListBox( page, "entriesLB" ); |
||||
|
||||
topLayout->addWidget( entriesLB ); |
||||
|
||||
commentBelowLA = new QLabel( page ); |
||||
commentBelowLA->setObjectName( "commentBelowLA" ); |
||||
commentBelowLA->setText( "" ); |
||||
topLayout->addWidget( commentBelowLA ); |
||||
commentBelowLA->hide(); |
||||
|
||||
// signals and slots connections
|
||||
connect( entriesLB, SIGNAL( highlighted( const QString& ) ), |
||||
this, SLOT( highlighted( const QString& ) ) ); |
||||
connect( entriesLB, SIGNAL( selected(int) ), |
||||
SLOT( accept() ) ); |
||||
// buddies
|
||||
labelAboveLA->setBuddy( entriesLB ); |
||||
} |
||||
|
||||
/*
|
||||
* Destroys the object and frees any allocated resources |
||||
*/ |
||||
KListBoxDialog::~KListBoxDialog() |
||||
{ |
||||
// no need to delete child widgets, Qt does it all for us
|
||||
} |
||||
|
||||
void KListBoxDialog::setLabelAbove(const QString& label) |
||||
{ |
||||
labelAboveLA->setText( label ); |
||||
if( label.isEmpty() ) |
||||
labelAboveLA->hide(); |
||||
else |
||||
labelAboveLA->show(); |
||||
} |
||||
|
||||
void KListBoxDialog::setCommentBelow(const QString& comment) |
||||
{ |
||||
commentBelowLA->setText( comment ); |
||||
if( comment.isEmpty() ) |
||||
commentBelowLA->hide(); |
||||
else |
||||
commentBelowLA->show(); |
||||
} |
||||
|
||||
|
||||
|
||||
void KListBoxDialog::highlighted( const QString& txt ) |
||||
{ |
||||
selectedString = txt; |
||||
} |
||||
|
||||
#include "klistboxdialog.moc" |
||||
@ -1,34 +0,0 @@ |
||||
#ifndef KLISTBOXDIALOG_H |
||||
#define KLISTBOXDIALOG_H |
||||
|
||||
#include <kdialog.h> |
||||
|
||||
class QLabel; |
||||
class Q3ListBox; |
||||
|
||||
class KListBoxDialog : public KDialog |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
KListBoxDialog( QString& _selectedString, |
||||
const QString& caption, |
||||
const QString& labelText, |
||||
QWidget* parent = 0 ); |
||||
~KListBoxDialog(); |
||||
|
||||
void setLabelAbove( const QString& label ); |
||||
void setCommentBelow(const QString& comment); |
||||
|
||||
Q3ListBox* entriesLB; |
||||
|
||||
private slots: |
||||
void highlighted( const QString& ); |
||||
|
||||
protected: |
||||
QString& selectedString; |
||||
QLabel* labelAboveLA; |
||||
QLabel* commentBelowLA; |
||||
}; |
||||
|
||||
#endif |
||||
Loading…
Reference in new issue