KDE/kdevelop/lib
Andreas Pakulat
apaku at gmx.de
Tue Mar 6 14:35:44 UTC 2007
SVN commit 640009 by apaku:
Allow plugins to depend on other plugins by providing their X-KDE-PluginInfo-Name.
IMHO this is better than creating multiple equally looking extension interfaces.
This is needed for example to have the QMake support depend on a QMake Builder without
the need of a special QMakeBuilder extension interface that would mostly look like the
IProjectBuilder one.
CCMAIL:kdevelop-devel at kdevelop.org
M +3 -0 interfaces/kdevelopplugin.desktop
M +27 -2 shell/plugincontroller.cpp
--- trunk/KDE/kdevelop/lib/interfaces/kdevelopplugin.desktop #640008:640009
@@ -62,3 +62,6 @@
[PropertyDef::X-KDevelop-IOptional]
Type=QStringList
+[PropertyDef::X-KDevelop-DependsPlugins]
+Type=QStringList
+
--- trunk/KDE/kdevelop/lib/shell/plugincontroller.cpp #640008:640009
@@ -365,11 +365,26 @@
///@todo plugin load operation should be O(n)
bool PluginController::checkForDependencies( KPluginInfo* info, QStringList& missing ) const
{
- QVariant prop = info->property( "X-KDevelop-IRequired" );
bool result = true;
+ QVariant prop = info->property( "X-KDevelop-DependsPlugins" );
if( prop.canConvert<QStringList>() )
{
QStringList deps = prop.toStringList();
+ foreach( QString name, deps )
+ {
+ KPluginInfo::List l = queryPlugins( QString("'%1' in [X-KDE-PluginInfo-Name]").arg(name) );
+ if( l.isEmpty() )
+ {
+ result = false;
+ missing << name;
+ }
+ }
+ }
+
+ prop = info->property( "X-KDevelop-IRequired" );
+ if( prop.canConvert<QStringList>() )
+ {
+ QStringList deps = prop.toStringList();
foreach( QString iface, deps )
{
KPluginInfo::List l = queryPlugins( QString("'%1' in [X-KDevelop-Interfaces]").arg(iface) );
@@ -385,10 +400,20 @@
void PluginController::loadDependencies( KPluginInfo* info )
{
- QVariant prop = info->property( "X-KDevelop-IRequired" );
+ QVariant prop = info->property( "X-KDevelop-DependsPlugin" );
if( prop.canConvert<QStringList>() )
{
QStringList deps = prop.toStringList();
+ foreach( QString pname, deps )
+ {
+ loadPluginInternal( pname );
+ }
+ }
+
+ prop = info->property( "X-KDevelop-IRequired" );
+ if( prop.canConvert<QStringList>() )
+ {
+ QStringList deps = prop.toStringList();
foreach( QString iface, deps )
{
KPluginInfo* info = queryPlugins( QString("'%1' in [X-KDevelop-Interfaces]").arg(iface) ).first();
More information about the KDevelop-devel
mailing list