Skip to content
Permalink
Browse files

disable query change while editing

git-svn-id: http://svn.osgeo.org/qgis/trunk@14393 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Oct 18, 2010
1 parent cde5a06 commit aacf2f7dfdf160e093f3955300fc0936463562d4
Showing with 17 additions and 3 deletions.
  1. +5 −2 src/app/qgisapp.cpp
  2. +1 −0 src/app/qgsquerybuilder.cpp
  3. +11 −1 src/app/qgsvectorlayerproperties.cpp
@@ -5867,7 +5867,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
if ( layer->type() == QgsMapLayer::VectorLayer )
{
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( layer );
const QgsVectorDataProvider* dprovider = vlayer->dataProvider();
QgsVectorDataProvider* dprovider = vlayer->dataProvider();
bool layerHasSelection = vlayer->selectedFeatureCount() != 0;

mActionSelect->setEnabled( true );
@@ -5881,7 +5881,6 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionLayerSaveAs->setEnabled( true );
mActionLayerSelectionSaveAs->setEnabled( true );
mActionCopyFeatures->setEnabled( layerHasSelection );
mActionLayerSubsetString->setEnabled( true );

if ( !vlayer->isEditable() && mMapCanvas->mapTool() && mMapCanvas->mapTool()->isEditTool() )
{
@@ -5890,6 +5889,8 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )

if ( dprovider )
{
mActionLayerSubsetString->setEnabled( dprovider->supportsSubsetString() && !vlayer->isEditable() );

//start editing/stop editing
if ( dprovider->capabilities() & QgsVectorDataProvider::EditingCapabilities )
{
@@ -6088,6 +6089,8 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
}
return;
}

mActionLayerSubsetString->setEnabled( false );
}
/*************Raster layers*************/
else if ( layer->type() == QgsMapLayer::RasterLayer )
@@ -284,6 +284,7 @@ void QgsQueryBuilder::on_btnOr_clicked()
void QgsQueryBuilder::clear()
{
txtSQL->clear();
mLayer->setSubsetString( "" );
}

void QgsQueryBuilder::on_btnILike_clicked()
@@ -289,6 +289,12 @@ void QgsVectorLayerProperties::attributeTypeDialog( )
void QgsVectorLayerProperties::toggleEditing()
{
emit toggleEditing( layer );

pbnQueryBuilder->setEnabled( layer && layer->dataProvider() && layer->dataProvider()->supportsSubsetString() && !layer->isEditable() );
if ( layer->isEditable() )
{
pbnQueryBuilder->setToolTip( tr( "Stop editing mode to enable this." ) );
}
}

void QgsVectorLayerProperties::attributeAdded( int idx )
@@ -462,7 +468,11 @@ void QgsVectorLayerProperties::reset( void )
// on the builder. If the ability to enter a query directly into the box is required,
// a mechanism to check it must be implemented.
txtSubsetSQL->setEnabled( false );
pbnQueryBuilder->setEnabled( layer && layer->dataProvider() && layer->dataProvider()->supportsSubsetString() );
pbnQueryBuilder->setEnabled( layer && layer->dataProvider() && layer->dataProvider()->supportsSubsetString() && !layer->isEditable() );
if ( layer->isEditable() )
{
pbnQueryBuilder->setToolTip( tr( "Stop editing mode to enable this." ) );
}

//get field list for display field combo
const QgsFieldMap& myFields = layer->pendingFields();

0 comments on commit aacf2f7

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