20#include "kateconfigplugindialogpage.h"
21#include "kateconfigplugindialogpage.moc"
23#include "katepluginmanager.h"
24#include "kateconfigdialog.h"
25#include <tdelistbox.h>
27#include <tqstringlist.h>
31#include <tqpushbutton.h>
33#include <kiconloader.h>
34#include <tqwhatsthis.h>
36class KatePluginListItem :
public TQCheckListItem
39 KatePluginListItem(
bool checked, KatePluginInfo *info, TQListView *parent);
40 KatePluginInfo *info()
const {
return mInfo; }
43 void stateChange(
bool);
46 KatePluginInfo *mInfo;
47 bool silentStateChange;
50KatePluginListItem::KatePluginListItem(
bool checked, KatePluginInfo *info, TQListView *parent)
51 : TQCheckListItem(parent, info->service->name(), CheckBox)
53 , silentStateChange(false)
55 silentStateChange =
true;
57 silentStateChange =
false;
60void KatePluginListItem::stateChange(
bool b)
62 if(!silentStateChange)
63 static_cast<KatePluginListView *
>(listView())->stateChanged(
this, b);
66KatePluginListView::KatePluginListView(TQWidget *parent,
const char *name)
67 : TDEListView(parent, name)
71void KatePluginListView::stateChanged(KatePluginListItem *item,
bool b)
73 emit stateChange(item, b);
76KateConfigPluginPage::KateConfigPluginPage(TQWidget *parent, KateConfigDialog *dialog):TQVBox(parent)
80 KatePluginListView* listView =
new KatePluginListView(
this);
81 listView->addColumn(i18n(
"Name"));
82 listView->addColumn(i18n(
"Comment"));
83 TQWhatsThis::add(listView,i18n(
"Here you can see all available Kate plugins. Those with a check mark are loaded, and will be loaded again the next time Kate is started."));
85 connect(listView, TQ_SIGNAL(stateChange(KatePluginListItem *,
bool)),
this, TQ_SLOT(stateChange(KatePluginListItem *,
bool)));
87 KatePluginList &pluginList (KatePluginManager::self()->pluginList());
88 for (
unsigned int i=0; i < pluginList.size(); ++i)
90 KatePluginListItem *item =
new KatePluginListItem(pluginList[i].load, &pluginList[i], listView);
91 item->setText(0, pluginList[i].service->name());
92 item->setText(1, pluginList[i].service->comment());
96 void KateConfigPluginPage::stateChange(KatePluginListItem *item,
bool b)
106void KateConfigPluginPage::loadPlugin (KatePluginListItem *item)
108 KatePluginManager::self()->loadPlugin (item->info());
109 KatePluginManager::self()->enablePluginGUI (item->info());
110 myDialog->addPluginPage (item->info()->plugin);
115void KateConfigPluginPage::unloadPlugin (KatePluginListItem *item)
117 myDialog->removePluginPage (item->info()->plugin);
118 KatePluginManager::self()->unloadPlugin (item->info());