Skip to content
Permalink
Browse files

regroup duplicated code

  • Loading branch information
3nids committed Apr 8, 2016
1 parent 85d472e commit 3c5381798880e7c68e1feca427de15cb9b72bec3
Showing with 20 additions and 18 deletions.
  1. +18 −18 src/app/qgsvectorlayerproperties.cpp
  2. +2 −0 src/app/qgsvectorlayerproperties.h
@@ -317,12 +317,7 @@ void QgsVectorLayerProperties::toggleEditing()

emit toggleEditing( layer );

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

void QgsVectorLayerProperties::setLabelCheckBox()
@@ -405,12 +400,7 @@ void QgsVectorLayerProperties::syncToLayer()
// 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->dataProvider() && layer->dataProvider()->supportsSubsetString() &&
!layer->isEditable() );
if ( layer->isEditable() )
{
pbnQueryBuilder->setToolTip( tr( "Stop editing mode to enable this." ) );
}
setPbnQueryBuilderEnabled();

setDisplayField( layer->displayField() );

@@ -1094,8 +1084,7 @@ void QgsVectorLayerProperties::on_mButtonAddJoin_clicked()
}
layer->addJoin( info );
addJoinToTreeWidget( info );
pbnQueryBuilder->setEnabled( layer && layer->dataProvider() && layer->dataProvider()->supportsSubsetString() &&
!layer->isEditable() );
setPbnQueryBuilderEnabled();
mFieldsPropertiesDialog->init();
}
}
@@ -1155,8 +1144,7 @@ void QgsVectorLayerProperties::on_mButtonEditJoin_clicked()
layer->addJoin( info );
addJoinToTreeWidget( info, idx );

pbnQueryBuilder->setEnabled( layer && layer->dataProvider() && layer->dataProvider()->supportsSubsetString() &&
!layer->isEditable() );
setPbnQueryBuilderEnabled();
mFieldsPropertiesDialog->init();
}
}
@@ -1234,8 +1222,7 @@ void QgsVectorLayerProperties::on_mButtonRemoveJoin_clicked()

layer->removeJoin( currentJoinItem->data( 0, Qt::UserRole ).toString() );
mJoinTreeWidget->takeTopLevelItem( mJoinTreeWidget->indexOfTopLevelItem( currentJoinItem ) );
pbnQueryBuilder->setEnabled( layer && layer->dataProvider() && layer->dataProvider()->supportsSubsetString() &&
!layer->isEditable() );
setPbnQueryBuilderEnabled();
mFieldsPropertiesDialog->init();
}

@@ -1273,6 +1260,19 @@ void QgsVectorLayerProperties::updateSymbologyPage()
}
}

void QgsVectorLayerProperties::setPbnQueryBuilderEnabled()
{
pbnQueryBuilder->setEnabled( layer->dataProvider() &&
layer->dataProvider()->supportsSubsetString() &&
!layer->isEditable() );

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

}

void QgsVectorLayerProperties::on_pbnUpdateExtents_clicked()
{
layer->updateExtents();
@@ -159,6 +159,8 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private

void updateSymbologyPage();

void setPbnQueryBuilderEnabled();

QgsVectorLayer *layer;

bool mMetadataFilled;

0 comments on commit 3c53817

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