Skip to content
Permalink
Browse files
fix #2682
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13469 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed May 12, 2010
1 parent 72d2f43 commit 2e41442f7fcbb0c0843c4a15b13bbee0a008f4da
Showing with 10 additions and 7 deletions.
  1. +10 −7 src/app/qgsidentifyresults.cpp
@@ -378,7 +378,10 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
QTreeWidgetItem *featItem = featureItem( item );
if ( featItem )
{
mActionPopup->addAction( vlayer->isEditable() ? tr( "Edit feature form" ) : tr( "View feature form" ), this, SLOT( featureForm() ) );
mActionPopup->addAction(
QgisApp::getThemeIcon( vlayer->isEditable() ? "/mIconEditable.png" : "/mIconEditable.png" ),
vlayer->isEditable() ? tr( "Edit feature form" ) : tr( "View feature form" ),
this, SLOT( featureForm() ) );
mActionPopup->addAction( tr( "Zoom to feature" ), this, SLOT( zoomToFeature() ) );
mActionPopup->addAction( tr( "Copy attribute value" ), this, SLOT( copyAttributeValue() ) );
mActionPopup->addAction( tr( "Copy feature attributes" ), this, SLOT( copyFeatureAttributes() ) );
@@ -393,26 +396,23 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
mActionPopup->addAction( tr( "Expand all" ), this, SLOT( expandAll() ) );
mActionPopup->addAction( tr( "Collapse all" ), this, SLOT( collapseAll() ) );

if ( vlayer->actions()->size() > 0 )
if ( featItem && vlayer->actions()->size() > 0 )
{
mActionPopup->addSeparator();

// The assumption is made that an instance of QgsIdentifyResults is
// created for each new Identify Results dialog box, and that the
// contents of the popup menu doesn't change during the time that
// such a dialog box is around.
QAction *a = mActionPopup->addAction( tr( "Run action" ) );
a->setEnabled( false );

for ( int i = 0; i < vlayer->actions()->size(); i++ )
{
const QgsAction &action = vlayer->actions()->at( i );

if ( !action.runable() )
continue;

QgsFeatureAction *a = new QgsFeatureAction( action.name(), this, vlayer, i, featureItem( item ) );
mActionPopup->addAction( action.name(), a, SLOT( execute() ) );
QgsFeatureAction *a = new QgsFeatureAction( action.name(), this, vlayer, i, featItem );
mActionPopup->addAction( QgisApp::getThemeIcon( "/mAction.png" ), action.name(), a, SLOT( execute() ) );
}
}

@@ -525,6 +525,9 @@ void QgsIdentifyResults::doAction( QTreeWidgetItem *item, int action )

QTreeWidgetItem *QgsIdentifyResults::featureItem( QTreeWidgetItem *item )
{
if ( !item )
return 0;

QTreeWidgetItem *featItem;
if ( item->parent() )
{

0 comments on commit 2e41442

Please sign in to comment.