1 #include "kde_pluginsbox.h"
2 #include "kde_preferences.h"
9 #include <kbuttonbox.h>
11 KPluginsBox::KPluginsBox(intf_thread_t *p_intf,
12 QString text, QString value, QWidget *parent,
13 int spacing, KPreferences *pref) :
14 QGroupBox( 1, Vertical, text, parent )
17 this->p_intf = p_intf;
18 QVBox *item_vbox = new QVBox( this );
19 item_vbox->setSpacing(spacing);
21 listView = new KListView(item_vbox);
22 listView->setAllColumnsShowFocus(true);
23 listView->addColumn(_("Name"));
24 listView->addColumn(_("Description"));
25 KButtonBox *item_bbox = new KButtonBox(item_vbox);
26 configure = item_bbox->addButton( _("Configure") );
27 configure->setEnabled(false);
28 selectButton = item_bbox->addButton( _("Select") );
29 QHBox *item_hbox = new QHBox(item_vbox);
30 item_hbox->setSpacing(spacing);
31 new QLabel( _("Selected:"), item_hbox );
32 line = new KLineEdit( value, item_hbox );
33 connect(selectButton, SIGNAL(clicked()), this, SLOT(selectClicked()));
34 connect(configure, SIGNAL(clicked()), this, SLOT(configureClicked()));
35 connect(listView, SIGNAL(selectionChanged( QListViewItem *)),
36 this, SLOT( selectionChanged( QListViewItem *)));
39 KPluginsBox::~KPluginsBox()
44 QListView* KPluginsBox::getListView()
49 void KPluginsBox::selectClicked()
51 if (listView->selectedItem()) {
52 line->setText(listView->selectedItem()->text(0));
53 emit selectionChanged(listView->selectedItem()->text(0));
57 void KPluginsBox::configureClicked()
59 if (listView->selectedItem()) {
60 new KPreferences(p_intf, listView->selectedItem()->text(0), this);
63 void KPluginsBox::selectionChanged( QListViewItem *item )
65 selectButton->setEnabled(true);
66 /* look for module 'psz_name' */
67 configure->setEnabled(owner->isConfigureable(item->text(0)));