Skip to content

Commit

Permalink
Added the possibility to unselect an optional (required="no" into int…
Browse files Browse the repository at this point in the history
…erface-description of the grass module) to fix #1134.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11329 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rugginoso committed Aug 10, 2009
1 parent ee75633 commit d5e0f5a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/plugins/grass/qgsgrassmodule.cpp
Expand Up @@ -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" );
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/grass/qgsgrassmodule.h
Expand Up @@ -695,6 +695,9 @@ class QgsGrassModuleGdalInput: public QgsGrassModuleGroupBoxItem

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

//! Required field
bool mRequired;
};

/*********************** QgsGrassModuleField **********************/
Expand Down

0 comments on commit d5e0f5a

Please sign in to comment.