Kate
katepartpluginmanager.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries and the Kate part. 00002 * 00003 * Copyright (C) 2001-2010 Christoph Cullmann <cullmann@kde.org> 00004 * Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org> 00005 * Copyright (C) 2001 Anders Lund <anders.lund@lund.tdcadsl.dk> 00006 * Copyright (C) 2007 Dominik Haumann <dhaumann kde org> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Library General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Library General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Library General Public License 00019 * along with this library; see the file COPYING.LIB. If not, write to 00020 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 * Boston, MA 02110-1301, USA. 00022 */ 00023 00024 #ifndef KATEPARTPLUGINMANAGER_H 00025 #define KATEPARTPLUGINMANAGER_H 00026 00027 #include <kplugininfo.h> 00028 #include <kservice.h> 00029 00030 #include <QObject> 00031 #include <QList> 00032 00033 namespace KTextEditor { 00034 class Plugin; 00035 class Document; 00036 class View; 00037 } 00038 00039 class KatePartPluginInfo 00040 { 00041 public: 00042 KatePartPluginInfo(KService::Ptr service); 00043 mutable bool load; 00044 KTextEditor::Plugin *plugin; 00045 QString saveName() const; 00046 KService::Ptr service() const { return m_pluginInfo.service(); } 00047 QStringList dependencies() const { return m_pluginInfo.dependencies(); } 00048 bool isEnabledByDefault() const { return m_pluginInfo.isPluginEnabledByDefault(); } 00049 private: 00050 KPluginInfo m_pluginInfo; 00051 QString m_saveName; 00052 }; 00053 00054 typedef QList<KatePartPluginInfo> KatePartPluginList; 00055 00056 class KatePartPluginManager : public QObject 00057 { 00058 Q_OBJECT 00059 00060 public: 00061 KatePartPluginManager(); 00062 ~KatePartPluginManager(); 00063 00064 static KatePartPluginManager *self(); 00065 00066 void loadConfig (); 00067 void writeConfig (); 00068 00069 void addDocument(KTextEditor::Document *doc); 00070 void removeDocument(KTextEditor::Document *doc); 00071 00072 void addView(KTextEditor::View *view); 00073 void removeView(KTextEditor::View *view); 00074 00075 void loadAllPlugins (); 00076 void unloadAllPlugins (); 00077 00078 void loadPlugin (KatePartPluginInfo &item); 00079 void unloadPlugin (KatePartPluginInfo &item); 00080 00081 void enablePlugin (KatePartPluginInfo &item); 00082 void disablePlugin (KatePartPluginInfo &item); 00083 00084 inline KatePartPluginList & pluginList () 00085 { 00086 return m_pluginList; 00087 } 00088 00089 private: 00090 void setupPluginList (); 00091 00092 KConfig *m_config; 00093 KatePartPluginList m_pluginList; 00094 }; 00095 00096 #endif // KATEPARTPLUGINMANAGER_H 00097 00098 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE 4.6 API Reference