Skip to content

Commit

Permalink
Fix bug in plugin manager introduced by recent changes I made that ca…
Browse files Browse the repository at this point in the history
…uses it to not remember loaded plugns properly

git-svn-id: http://svn.osgeo.org/qgis/trunk@8792 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jul 16, 2008
1 parent 82971f4 commit e40991e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/app/qgspluginmanager.cpp
Expand Up @@ -161,8 +161,7 @@ void QgsPluginManager::getPythonPluginDescriptions()
//myData.setIcon(pixmap); //todo use a python logo here
myData.setCheckable(true);
myData.setRenderAsWidget(false);
QVariant myVariant = qVariantFromValue(myData);
mypDetailItem->setData(myVariant,PLUGIN_DATA_ROLE);
myData.setChecked(false); //start off assuming false

// check to see if the plugin is loaded and set the checkbox accordingly
QgsPluginRegistry *pRegistry = QgsPluginRegistry::instance();
Expand All @@ -177,9 +176,11 @@ void QgsPluginManager::getPythonPluginDescriptions()
if (libName == packageName)
{
// set the checkbox
mypDetailItem->setCheckState(Qt::Checked);
myData.setChecked(true);
}
}
QVariant myVariant = qVariantFromValue(myData);
mypDetailItem->setData(myVariant,PLUGIN_DATA_ROLE);
// Add item to model
mModelPlugins->appendRow(mypDetailItem);
}
Expand Down Expand Up @@ -358,7 +359,9 @@ void QgsPluginManager::unload()
{
// FPV - I want to use index. You can do evrething with item.
QModelIndex myIndex=mModelPlugins->index(row,0);
if (mModelPlugins->data(myIndex,Qt::CheckStateRole).toInt() == 0)
QgsDetailedItemData myData =
qVariantValue<QgsDetailedItemData>(mModelPlugins->data(myIndex,PLUGIN_DATA_ROLE));
if (!myData.isChecked())
{
// iThe plugin name without version string in its data PLUGIN_LIB [ts]
myIndex=mModelPlugins->index(row,0);
Expand Down Expand Up @@ -402,7 +405,10 @@ std::vector < QgsPluginItem > QgsPluginManager::getSelectedPlugins()
// FPV - I want to use item here. You can do everything with index if you want.
for (int row=0;row < mModelPlugins->rowCount();row++)
{
if (mModelPlugins->item(row,0)->checkState() == Qt::Checked)
QgsDetailedItemData myData =
qVariantValue<QgsDetailedItemData>(mModelPlugins->item(row,0)->data(PLUGIN_DATA_ROLE));

if (myData.isChecked())
{
QString pluginName = mModelPlugins->item(row,0)->data(PLUGIN_LIBRARY_NAME_ROLE).toString();
bool pythonic = false;
Expand Down

0 comments on commit e40991e

Please sign in to comment.