Skip to content
Permalink
Browse files

Added the possibility to unselect an optional (required="no" into int…

…erface-description of the grass module) to fix #1134.

git-svn-id: http://svn.osgeo.org/qgis/trunk@11329 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rugginoso
rugginoso committed Aug 10, 2009
1 parent 1e1c65d commit 585944040f7c4f83e41f9b41237e6b8f9d70d645
Showing with 18 additions and 0 deletions.
  1. +15 −0 src/plugins/grass/qgsgrassmodule.cpp
  2. +3 −0 src/plugins/grass/qgsgrassmodule.h
@@ -2633,6 +2633,13 @@ QgsGrassModuleGdalInput::QgsGrassModuleGdalInput(
}
adjustTitle();

// Check if this parameter is required
if (gnode.toElement().attribute("required") == "yes") {
mRequired = true;
} else {
mRequired = false;
}

QDomNode promptNode = gnode.namedItem( "gisprompt" );
QDomElement promptElem = promptNode.toElement();
QString element = promptElem.attribute( "element" );
@@ -2700,6 +2707,14 @@ void QgsGrassModuleGdalInput::updateQgisLayers()
mUri.resize( 0 );
mOgrLayers.resize( 0 );

// If not required, add an empty item to combobox and a padding item into
// layer containers.
if (!mRequired){
mUri.push_back(QString());
mOgrLayers.push_back(QString());
mLayerComboBox->addItem(tr("Select a layer"), QVariant());
}

QgsMapCanvas *canvas = mModule->qgisIface()->mapCanvas();

int nlayers = canvas->layerCount();
@@ -695,6 +695,9 @@ class QgsGrassModuleGdalInput: public QgsGrassModuleGroupBoxItem

//! Ogr where clauses
std::vector<QString> mOgrWheres;

//! Required field
bool mRequired;
};

/*********************** QgsGrassModuleField **********************/

0 comments on commit 5859440

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