Skip to content

Commit

Permalink
disable query change while editing
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14393 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Oct 18, 2010
1 parent 5855d77 commit 408d227
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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() )
{
Expand All @@ -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 )
{
Expand Down Expand Up @@ -6088,6 +6089,8 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
}
return;
}

mActionLayerSubsetString->setEnabled( false );
}
/*************Raster layers*************/
else if ( layer->type() == QgsMapLayer::RasterLayer )
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsquerybuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ void QgsQueryBuilder::on_btnOr_clicked()
void QgsQueryBuilder::clear()
{
txtSQL->clear();
mLayer->setSubsetString( "" );
}

void QgsQueryBuilder::on_btnILike_clicked()
Expand Down
12 changes: 11 additions & 1 deletion src/app/qgsvectorlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 408d227

Please sign in to comment.