kate Library API Documentation

plugin.cpp

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00016    Boston, MA 02111-1307, USA.
00017 */
00018 
00019  #include "application.h"
00020  #include "project.h"
00021 
00022 #include "plugin.h"
00023 #include "plugin.moc"
00024 
00025 #include <kparts/componentfactory.h>
00026 
00027 namespace Kate
00028 {
00029 
00030   class PrivatePlugin
00031   {
00032   public:
00033     PrivatePlugin ()
00034     {
00035     }
00036 
00037     ~PrivatePlugin ()
00038     {
00039     }
00040   };
00041 
00042   class PrivateProjectPlugin
00043   {
00044   public:
00045     PrivateProjectPlugin ()
00046     {
00047     }
00048 
00049     ~PrivateProjectPlugin ()
00050     {
00051     }
00052 
00053     Project *m_project;
00054   };
00055 
00056   class PrivateInitPlugin
00057   {
00058   public:
00059     PrivateInitPlugin ()
00060     {
00061     }
00062 
00063     ~PrivateInitPlugin ()
00064     {
00065     }
00066 
00067     KURL m_configScript;
00068   };
00069 
00070   class PrivatePluginViewInterface
00071   {
00072   public:
00073     PrivatePluginViewInterface ()
00074     {
00075     }
00076 
00077     ~PrivatePluginViewInterface ()
00078     {
00079     }
00080 
00081   };
00082 
00083 unsigned int Plugin::globalPluginNumber = 0;
00084 unsigned int ProjectPlugin::globalProjectPluginNumber = 0;
00085 unsigned int InitPlugin::globalInitPluginNumber = 0;
00086 unsigned int PluginViewInterface::globalPluginViewInterfaceNumber = 0;
00087 
00088 Plugin::Plugin( Application *application, const char *name ) : QObject (application, name )
00089 {
00090   globalPluginNumber++;
00091   myPluginNumber = globalPluginNumber;
00092 }
00093 
00094 Plugin::~Plugin()
00095 {
00096 }
00097 
00098 unsigned int Plugin::pluginNumber () const
00099 {
00100   return myPluginNumber;
00101 }
00102 
00103 Application *Plugin::application () const
00104 {
00105   return Kate::application();
00106 }
00107 
00108 ProjectPlugin::ProjectPlugin( Project *project, const char *name ) : Plugin (Kate::application(), name )
00109 {
00110   globalProjectPluginNumber++;
00111   myProjectPluginNumber = globalProjectPluginNumber;
00112 
00113   d = new PrivateProjectPlugin ();
00114   d->m_project = project;
00115 }
00116 
00117 ProjectPlugin::~ProjectPlugin()
00118 {
00119   delete d;
00120 }
00121 
00122 unsigned int ProjectPlugin::projectPluginNumber () const
00123 {
00124   return myProjectPluginNumber;
00125 }
00126 
00127  Project *ProjectPlugin::project () const
00128 {
00129   return d->m_project;
00130 }
00131 
00132 bool ProjectPlugin::save ()
00133 {
00134   return true;
00135 }
00136 
00137 bool ProjectPlugin::queryClose ()
00138 {
00139   return true;
00140 }
00141 
00142 bool ProjectPlugin::close ()
00143 {
00144   return true;
00145 }
00146 
00147 void ProjectPlugin::addDirs (const QString &, QStringList &)
00148 {
00149 }
00150 
00151 void ProjectPlugin::removeDirs (const QString &, QStringList &)
00152 {
00153 }
00154 
00155 void ProjectPlugin::addFiles (const QString &, QStringList &)
00156 {
00157 }
00158 
00159 void ProjectPlugin::removeFiles (const QString &, QStringList &)
00160 {
00161 }
00162 
00163 InitPlugin :: InitPlugin(Application *application, const char *name):Plugin(application,name)
00164 {
00165   globalInitPluginNumber++;
00166   myInitPluginNumber = globalInitPluginNumber;
00167 
00168   d = new PrivateInitPlugin ();
00169   d->m_configScript = KURL();
00170 }
00171 
00172 InitPlugin::~InitPlugin()
00173 {
00174   delete d;
00175 }
00176 
00177 unsigned int InitPlugin::initPluginNumber () const
00178 {
00179   return myInitPluginNumber;
00180 }
00181 
00182 void InitPlugin::activate(const KURL &initScript)
00183 {
00184   d->m_configScript=initScript;
00185 }
00186 
00187 int InitPlugin::actionsKateShouldNotPerformOnRealStartup()
00188 {
00189   return 0;
00190 }
00191 
00192 const KURL InitPlugin::configScript() const
00193 {
00194   return d->m_configScript;
00195 }
00196 
00197 
00198 int InitPlugin::initKate()
00199 {
00200 return 0;
00201 }
00202 
00203 PluginViewInterface::PluginViewInterface()
00204 {
00205   globalPluginViewInterfaceNumber++;
00206   myPluginViewInterfaceNumber = globalPluginViewInterfaceNumber;
00207 }
00208 
00209 PluginViewInterface::~PluginViewInterface()
00210 {
00211 }
00212 
00213 unsigned int PluginViewInterface::pluginViewInterfaceNumber () const
00214 {
00215   return myPluginViewInterfaceNumber;
00216 }
00217 
00218 Plugin *createPlugin ( const char* libname, Application *application, const char *name, const QStringList &args )
00219 {
00220   return KParts::ComponentFactory::createInstanceFromLibrary<Plugin>( libname, application, name, args);
00221 }
00222 
00223 ProjectPlugin *createProjectPlugin ( const char* libname, Project *project, const char *name, const QStringList &args )
00224 {
00225   return KParts::ComponentFactory::createInstanceFromLibrary<ProjectPlugin>( libname, project, name, args);
00226 }
00227 
00228 PluginViewInterface *pluginViewInterface (Plugin *plugin)
00229 {
00230   if (!plugin)
00231     return 0;
00232 
00233   return static_cast<PluginViewInterface*>(plugin->qt_cast("Kate::PluginViewInterface"));
00234 }
00235 
00236 }
00237 
KDE Logo
This file is part of the documentation for kate Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Aug 20 13:39:06 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003