Kate
katepartpluginmanager.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright 2001 Christoph Cullmann <cullmann@kde.org> 00003 Copyright 2001 Joseph Wenninger <jowenn@kde.org> 00004 Copyright 2001 Anders Lund <anders.lund@lund.tdcadsl.dk> 00005 Copyright 2007 Dominik Haumann <dhaumann kde org> 00006 00007 Taken from kdesdk/kate/app/katepluginmanager.cpp/h and adapted 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Library General Public 00011 License version 2 as published by the Free Software Foundation. 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 private: 00049 KPluginInfo m_pluginInfo; 00050 QString m_saveName; 00051 }; 00052 00053 typedef QList<KatePartPluginInfo> KatePartPluginList; 00054 00055 class KatePartPluginManager : public QObject 00056 { 00057 Q_OBJECT 00058 00059 public: 00060 KatePartPluginManager(); 00061 ~KatePartPluginManager(); 00062 00063 static KatePartPluginManager *self(); 00064 00065 void loadConfig (); 00066 void writeConfig (); 00067 00068 void addDocument(KTextEditor::Document *doc); 00069 void removeDocument(KTextEditor::Document *doc); 00070 00071 void addView(KTextEditor::View *view); 00072 void removeView(KTextEditor::View *view); 00073 00074 void loadAllPlugins (); 00075 void unloadAllPlugins (); 00076 00077 void loadPlugin (KatePartPluginInfo &item); 00078 void unloadPlugin (KatePartPluginInfo &item); 00079 00080 void enablePlugin (KatePartPluginInfo &item); 00081 void disablePlugin (KatePartPluginInfo &item); 00082 00083 inline KatePartPluginList & pluginList () 00084 { 00085 return m_pluginList; 00086 } 00087 00088 private: 00089 void setupPluginList (); 00090 00091 KConfig *m_config; 00092 KatePartPluginList m_pluginList; 00093 }; 00094 00095 #endif // KATEPARTPLUGINMANAGER_H 00096 00097 // kate: space-indent on; indent-width 2; replace-tabs on;