Skip to content

Commit

Permalink
Persist default attribute action between sessions
Browse files Browse the repository at this point in the history
Refs #15027
  • Loading branch information
m-kuhn committed Jun 14, 2016
1 parent 0db9556 commit 717e8c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/app/qgisapp.cpp
Expand Up @@ -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 );
Expand Down Expand Up @@ -5599,8 +5600,6 @@ void QgisApp::updateDefaultFeatureAction( QAction *action )
QgsMapLayerActionRegistry::instance()->setDefaultActionForLayer( vlayer, nullptr );
}
}

doFeatureAction();
}

void QgisApp::refreshFeatureActions()
Expand Down Expand Up @@ -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 )
Expand Down
3 changes: 3 additions & 0 deletions src/core/qgsactionmanager.cpp
Expand Up @@ -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 )
{
Expand All @@ -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 )
{
Expand Down

0 comments on commit 717e8c9

Please sign in to comment.