diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch) | |
tree | 67208f7c145782a7e90b123b982ca78d88cc2c87 /kmail/klistboxdialog.cpp | |
download | tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmail/klistboxdialog.cpp')
-rw-r--r-- | kmail/klistboxdialog.cpp | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/kmail/klistboxdialog.cpp b/kmail/klistboxdialog.cpp new file mode 100644 index 000000000..030ca3b0a --- /dev/null +++ b/kmail/klistboxdialog.cpp @@ -0,0 +1,83 @@ +// This must be first +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "klistboxdialog.h" + +#include <qlabel.h> +#include <qlayout.h> + +KListBoxDialog::KListBoxDialog( QString& _selectedString, + const QString& caption, + const QString& labelText, + QWidget* parent, + const char* name, + bool modal ) + : KDialogBase( parent, name, modal, caption, Ok|Cancel, Ok, true ), + selectedString( _selectedString ) + +{ + if ( !name ) + setName( "KListBoxDialog" ); + resize( 400, 180 ); + + QFrame *page = makeMainWidget(); + QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); + labelAboveLA = new QLabel( page, "labelAboveLA" ); + labelAboveLA->setText( labelText ); + + topLayout->addWidget( labelAboveLA ); + + entriesLB = new QListBox( page, "entriesLB" ); + + topLayout->addWidget( entriesLB ); + + commentBelowLA = new QLabel( page, "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( slotOk() ) ); + // 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" |