• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

  • kate
  • app
kateconfigplugindialogpage.cpp
1 /* This file is part of the KDE project
2  Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
3  Copyright (C) 2002 Joseph Wenninger <jowenn@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "kateconfigplugindialogpage.h"
21 #include "kateconfigplugindialogpage.moc"
22 
23 #include "katepluginmanager.h"
24 #include "kateconfigdialog.h"
25 #include <tdelistbox.h>
26 #include "kateapp.h"
27 #include <tqstringlist.h>
28 #include <tqhbox.h>
29 #include <tqlabel.h>
30 #include <tdelocale.h>
31 #include <tqpushbutton.h>
32 #include <tqtooltip.h>
33 #include <kiconloader.h>
34 #include <tqwhatsthis.h>
35 
36 class KatePluginListItem : public TQCheckListItem
37 {
38  public:
39  KatePluginListItem(bool checked, KatePluginInfo *info, TQListView *parent);
40  KatePluginInfo *info() const { return mInfo; }
41 
42  protected:
43  void stateChange(bool);
44 
45  private:
46  KatePluginInfo *mInfo;
47  bool silentStateChange;
48 };
49 
50 KatePluginListItem::KatePluginListItem(bool checked, KatePluginInfo *info, TQListView *parent)
51  : TQCheckListItem(parent, info->service->name(), CheckBox)
52  , mInfo(info)
53  , silentStateChange(false)
54 {
55  silentStateChange = true;
56  setOn(checked);
57  silentStateChange = false;
58 }
59 
60 void KatePluginListItem::stateChange(bool b)
61 {
62  if(!silentStateChange)
63  static_cast<KatePluginListView *>(listView())->stateChanged(this, b);
64 }
65 
66 KatePluginListView::KatePluginListView(TQWidget *parent, const char *name)
67  : TDEListView(parent, name)
68 {
69 }
70 
71 void KatePluginListView::stateChanged(KatePluginListItem *item, bool b)
72 {
73  emit stateChange(item, b);
74 }
75 
76 KateConfigPluginPage::KateConfigPluginPage(TQWidget *parent, KateConfigDialog *dialog):TQVBox(parent)
77 {
78  myDialog=dialog;
79 
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."));
84 
85  connect(listView, TQT_SIGNAL(stateChange(KatePluginListItem *, bool)), this, TQT_SLOT(stateChange(KatePluginListItem *, bool)));
86 
87  KatePluginList &pluginList (KatePluginManager::self()->pluginList());
88  for (unsigned int i=0; i < pluginList.size(); ++i)
89  {
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());
93  }
94 }
95 
96  void KateConfigPluginPage::stateChange(KatePluginListItem *item, bool b)
97 {
98  if(b)
99  loadPlugin(item);
100  else
101  unloadPlugin(item);
102 
103  emit changed();
104 }
105 
106 void KateConfigPluginPage::loadPlugin (KatePluginListItem *item)
107 {
108  KatePluginManager::self()->loadPlugin (item->info());
109  KatePluginManager::self()->enablePluginGUI (item->info());
110  myDialog->addPluginPage (item->info()->plugin);
111 
112  item->setOn(true);
113 }
114 
115 void KateConfigPluginPage::unloadPlugin (KatePluginListItem *item)
116 {
117  myDialog->removePluginPage (item->info()->plugin);
118  KatePluginManager::self()->unloadPlugin (item->info());
119 
120  item->setOn(false);
121 }

kate

Skip menu "kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kate

Skip menu "kate"
  • kate
  • libkonq
  • twin
  •   lib
Generated for kate by doxygen 1.8.1.2
This website is maintained by Timothy Pearson.