kmail

tdelistboxdialog.cpp
1// This must be first
2#ifdef HAVE_CONFIG_H
3#include <config.h>
4#endif
5
6#include "tdelistboxdialog.h"
7
8#include <tqlabel.h>
9#include <tqlayout.h>
10
11TDEListBoxDialog::TDEListBoxDialog( TQString& _selectedString,
12 const TQString& caption,
13 const TQString& labelText,
14 TQWidget* parent,
15 const char* name,
16 bool modal )
17 : KDialogBase( parent, name, modal, caption, Ok|Cancel, Ok, true ),
18 selectedString( _selectedString )
19
20{
21 if ( !name )
22 setName( "TDEListBoxDialog" );
23 resize( 400, 180 );
24
25 TQFrame *page = makeMainWidget();
26 TQVBoxLayout *topLayout = new TQVBoxLayout( page, 0, spacingHint() );
27 labelAboveLA = new TQLabel( page, "labelAboveLA" );
28 labelAboveLA->setText( labelText );
29
30 topLayout->addWidget( labelAboveLA );
31
32 entriesLB = new TQListBox( page, "entriesLB" );
33
34 topLayout->addWidget( entriesLB );
35
36 commentBelowLA = new TQLabel( page, "commentBelowLA" );
37 commentBelowLA->setText( "" );
38 topLayout->addWidget( commentBelowLA );
39 commentBelowLA->hide();
40
41 // signals and slots connections
42 connect( entriesLB, TQ_SIGNAL( highlighted( const TQString& ) ),
43 this, TQ_SLOT( highlighted( const TQString& ) ) );
44 connect( entriesLB, TQ_SIGNAL( selected(int) ),
45 TQ_SLOT( slotOk() ) );
46 // buddies
47 labelAboveLA->setBuddy( entriesLB );
48}
49
50/*
51 * Destroys the object and frees any allocated resources
52 */
53TDEListBoxDialog::~TDEListBoxDialog()
54{
55 // no need to delete child widgets, TQt does it all for us
56}
57
58void TDEListBoxDialog::setLabelAbove(const TQString& label)
59{
60 labelAboveLA->setText( label );
61 if( label.isEmpty() )
62 labelAboveLA->hide();
63 else
64 labelAboveLA->show();
65}
66
67void TDEListBoxDialog::setCommentBelow(const TQString& comment)
68{
69 commentBelowLA->setText( comment );
70 if( comment.isEmpty() )
71 commentBelowLA->hide();
72 else
73 commentBelowLA->show();
74}
75
76
77
78void TDEListBoxDialog::highlighted( const TQString& txt )
79{
80 selectedString = txt;
81}
82
83#include "tdelistboxdialog.moc"
@ Ok
The user rights/ACL have been fetched from the server sucessfully.
Definition: acljobs.h:66