Skip to content
Permalink
Browse files

Persist default attribute action between sessions

Refs #15027
  • Loading branch information
m-kuhn committed Jun 14, 2016
1 parent 0db9556 commit 717e8c9ae587cf4d534381c18a496aa19c224f82
Showing with 5 additions and 6 deletions.
  1. +2 −6 src/app/qgisapp.cpp
  2. +3 −0 src/core/qgsactionmanager.cpp
@@ -2035,6 +2035,7 @@ void QgisApp::createToolBars()
bt->setDefaultAction( mActionFeatureAction );
mFeatureActionMenu = new QMenu( bt );
connect( mFeatureActionMenu, SIGNAL( triggered( QAction * ) ), this, SLOT( updateDefaultFeatureAction( QAction * ) ) );
connect( mFeatureActionMenu, SIGNAL( triggered( QAction * ) ), this, SLOT( doFeatureAction() ) );
connect( mFeatureActionMenu, SIGNAL( aboutToShow() ), this, SLOT( refreshFeatureActions() ) );
bt->setMenu( mFeatureActionMenu );
QAction* featureActionAction = mAttributesToolBar->insertWidget( selectAction, bt );
@@ -5599,8 +5600,6 @@ void QgisApp::updateDefaultFeatureAction( QAction *action )
QgsMapLayerActionRegistry::instance()->setDefaultActionForLayer( vlayer, nullptr );
}
}

doFeatureAction();
}

void QgisApp::refreshFeatureActions()
@@ -10588,17 +10587,14 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
}

mActionOpenFieldCalc->setEnabled( true );

return;
}
else
{
mUndoDock->widget()->setEnabled( false );
mActionUndo->setEnabled( false );
mActionRedo->setEnabled( false );
mActionLayerSubsetString->setEnabled( false );
}

mActionLayerSubsetString->setEnabled( false );
} //end vector layer block
/*************Raster layers*************/
else if ( layer->type() == QgsMapLayer::RasterLayer )
@@ -293,6 +293,7 @@ QString QgsActionManager::expandAction( const QString& action, QgsFeature &feat,
bool QgsActionManager::writeXML( QDomNode& layer_node, QDomDocument& doc ) const
{
QDomElement aActions = doc.createElement( "attributeactions" );
aActions.setAttribute( "default", mDefaultAction );

Q_FOREACH ( const QgsAction& action, mActions )
{
@@ -319,6 +320,8 @@ bool QgsActionManager::readXML( const QDomNode& layer_node )

if ( !aaNode.isNull() )
{
mDefaultAction = aaNode.toElement().attribute( "default", 0 ).toInt();

QDomNodeList actionsettings = aaNode.childNodes();
for ( int i = 0; i < actionsettings.size(); ++i )
{

0 comments on commit 717e8c9

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