summaryrefslogtreecommitdiffstats
path: root/kmail/tdelistboxdialog.cpp
blob: eaa627bb7e98bcd1b61117b8e47a14c5e37efedb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// This must be first
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "klistboxdialog.h"

#include <tqlabel.h>
#include <tqlayout.h>

TDEListBoxDialog::TDEListBoxDialog( TQString& _selectedString,
                                const TQString& caption,
                                const TQString& labelText,
                                TQWidget* parent,
                                const char* name,
                                bool modal )
    : KDialogBase( parent, name, modal, caption, Ok|Cancel, Ok, true ),
      selectedString( _selectedString )

{
    if ( !name )
      setName( "TDEListBoxDialog" );
    resize( 400, 180 );

    TQFrame *page = makeMainWidget();
    TQVBoxLayout *topLayout = new TQVBoxLayout( page, 0, spacingHint() );
    labelAboveLA = new TQLabel( page, "labelAboveLA" );
    labelAboveLA->setText( labelText );

    topLayout->addWidget( labelAboveLA );

    entriesLB = new TQListBox( page, "entriesLB" );

    topLayout->addWidget( entriesLB );

    commentBelowLA = new TQLabel( page, "commentBelowLA" );
    commentBelowLA->setText( "" );
    topLayout->addWidget( commentBelowLA );
    commentBelowLA->hide();

    // signals and slots connections
    connect( entriesLB, TQT_SIGNAL( highlighted( const TQString& ) ),
             this,      TQT_SLOT(   highlighted( const TQString& ) ) );
    connect( entriesLB, TQT_SIGNAL( selected(int) ),
                        TQT_SLOT(   slotOk() ) );
    // buddies
    labelAboveLA->setBuddy( entriesLB );
}

/*
 *  Destroys the object and frees any allocated resources
 */
TDEListBoxDialog::~TDEListBoxDialog()
{
    // no need to delete child widgets, TQt does it all for us
}

void TDEListBoxDialog::setLabelAbove(const TQString& label)
{
    labelAboveLA->setText( label );
    if( label.isEmpty() )
        labelAboveLA->hide();
    else
        labelAboveLA->show();
}

void TDEListBoxDialog::setCommentBelow(const TQString& comment)
{
    commentBelowLA->setText( comment );
    if( comment.isEmpty() )
        commentBelowLA->hide();
    else
        commentBelowLA->show();
}



void TDEListBoxDialog::highlighted( const TQString& txt )
{
    selectedString = txt;
}

#include "klistboxdialog.moc"