Skip to content
Permalink
Browse files

Additional fix for # 5879

- Adjust QgsApplication::pkgDataPath temporarily for restoring core plugins when running from build directory
  • Loading branch information
dakcarto committed Oct 25, 2012
1 parent c4cc9d3 commit e31fb3c9f29a168f7f7777b2d299cb620d7efb8a
Showing with 29 additions and 15 deletions.
  1. +29 −15 src/app/qgspluginregistry.cpp
@@ -23,6 +23,7 @@
#include <QSettings>

#include "qgis.h"
#include "qgsapplication.h"
#include "qgisinterface.h"
#include "qgspluginregistry.h"
#include "qgspluginmetadata.h"
@@ -414,28 +415,37 @@ void QgsPluginRegistry::restoreSessionPlugins( QString thePluginDirString )
QStringList pluginList = mPythonUtils->pluginList();
QgsDebugMsg( "Loading python plugins" );

// make the plugin installer and the fTools enabled by default:
if ( !mySettings.contains( "/PythonPlugins/plugin_installer" ) )
{
mySettings.setValue( "/PythonPlugins/plugin_installer", true );
}
if ( !mySettings.contains( "/PythonPlugins/fTools" ) )
{
mySettings.setValue( "/PythonPlugins/fTools", true );
}
if ( !mySettings.contains( "/PythonPlugins/GdalTools" ) )
{
mySettings.setValue( "/PythonPlugins/GdalTools", true );
}
if ( !mySettings.contains( "/PythonPlugins/db_manager" ) )
QStringList corePlugins = QStringList();
corePlugins << "plugin_installer";
corePlugins << "fTools";
corePlugins << "GdalTools";
corePlugins << "db_manager";

// make the required core plugins enabled by default:
for ( int i = 0; i < corePlugins.size(); i++ )
{
mySettings.setValue( "/PythonPlugins/db_manager", true );
if ( !mySettings.contains( "/PythonPlugins/" + corePlugins[i] ) )
{
mySettings.setValue( "/PythonPlugins/" + corePlugins[i], true );
}
}

for ( int i = 0; i < pluginList.size(); i++ )
{
QString packageName = pluginList[i];

if ( QgsApplication::isRunningFromBuildDir() )
{
if ( corePlugins.contains( packageName ) )
{
QgsApplication::setPkgDataPath( QgsApplication::buildOutputPath() );
}
else
{
QgsApplication::setPkgDataPath( QgsApplication::buildSourcePath() );
}
}

if ( checkPythonPlugin( packageName ) )
{
// check if the plugin was active on last session
@@ -446,6 +456,10 @@ void QgsPluginRegistry::restoreSessionPlugins( QString thePluginDirString )
}
}
}
if ( QgsApplication::isRunningFromBuildDir() )
{
QgsApplication::setPkgDataPath( QgsApplication::buildSourcePath() );
}
}

QgsDebugMsg( "Plugin loading completed" );

0 comments on commit e31fb3c

Please sign in to comment.
You can’t perform that action at this time.