Skip to content

Commit

Permalink
Browser layer item: don't propose 'File Properties' for a non-file item
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and nyalldawson committed Nov 15, 2020
1 parent 872793e commit 48f4574
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/app/browser/qgsinbuiltdataitemproviders.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -547,19 +547,7 @@ void QgsLayerItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu *men


if ( QgsGui::nativePlatformInterface()->capabilities() & QgsNative::NativeFilePropertiesDialog ) if ( QgsGui::nativePlatformInterface()->capabilities() & QgsNative::NativeFilePropertiesDialog )
{ {
bool isFile = false; if ( QFileInfo::exists( item->path() ) )
if ( layerItem )
{
// Also check for postgres layers (rasters are handled by GDAL)
isFile = ( layerItem->providerKey() == QLatin1String( "ogr" ) ||
layerItem->providerKey() == QLatin1String( "gdal" ) ) &&
! layerItem->uri().startsWith( QLatin1String( "PG:" ) );
}
else
{
isFile = QFileInfo::exists( item->path() );
}
if ( isFile )
{ {
QAction *action = menu->addAction( tr( "File Properties…" ) ); QAction *action = menu->addAction( tr( "File Properties…" ) );
connect( action, &QAction::triggered, this, [ = ] connect( action, &QAction::triggered, this, [ = ]
Expand Down

0 comments on commit 48f4574

Please sign in to comment.