[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdevelop/lib/interfaces
From:       Andras Mantia <amantia () kde ! org>
Date:       2007-03-28 13:35:42
Message-ID: 1175088942.167534.16282.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 647485 by amantia:

Convenience function to access and extension interface in one step.

 M  +11 -0     iplugincontroller.cpp  
 M  +15 -1     iplugincontroller.h  


--- trunk/KDE/kdevelop/lib/interfaces/iplugincontroller.cpp #647484:647485
@@ -23,6 +23,8 @@
 */
 #include "iplugincontroller.h"
 
+#include <QtDesigner/QExtensionManager>
+
 #include <kservicetypetrader.h>
 #include "iplugin.h"
 
@@ -39,6 +41,15 @@
 {
 }
 
+template<class Extension> Extension* IPluginController::extensionForPlugin( const \
QString &extension, const QString &pluginname) +{
+    IPlugin *plugin = pluginForExtension(extension, pluginname);
+    if (plugin)
+        return plugin->extension<Extension*>();
+    else
+        return 0L;
+}
+
 KPluginInfo::List IPluginController::query( const QString &serviceType,
         const QString &constraint )
 {
--- trunk/KDE/kdevelop/lib/interfaces/iplugincontroller.h #647484:647485
@@ -73,7 +73,8 @@
     /**
      * @brief Unloads the plugin specified by @p plugin
      *
-     * @param plugin The name of the plugin as specified by the
+     * @param plugin The name of the pl#include <QtDesigner/QExtensionManager>
+    ugin as specified by the
      * X-KDE-PluginInfo-Name key of the .desktop file for the plugin
      */
     virtual void unloadPlugin( const QString & plugin ) = 0;
@@ -98,7 +99,20 @@
     virtual IPlugin *pluginForExtension(const QString &extension, const QString& \
pluginname = "" ) = 0;  
     virtual QList<IPlugin*> allPluginsForExtension(const QString &extension, const \
QStringList &constraints) = 0; +    
+     /**
+     * Queries for the plugin which supports given extension interface and returns a \
pointer to the extension interface. +     * This is the difference between this \
method and pluginForExtension, what returns the plugin itself. +     * All already \
loaded plugins will be queried and the first one to support the extension interface + \
* will be returned. Any plugin can be an extension, only "ServiceTypes=..." entry is \
+     * required in .desktop file for that plugin. +     * @param extension The \
extension interface +     * @param pluginname The name of the plugin to load if \
multiple plugins for the extension exist, corresponds to the X-KDE-PluginInfo-Name +  \
* @return Pointer to the extension interface or 0 if no plugin supports it +      */
+    template<class Extension> Extension* extensionForPlugin( const QString \
&extension, const QString &pluginname);  
+
     /**
      * Queries KDevelop services. Version is checked automatically
      * by adding proper X-KDevelop-Version=N statement into the query.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic