Skip to content
Permalink
Browse files

Browser layer item: don't propose 'File Properties' for a non-file item

The special case for GDAL/OGR wasn't right. There are many cases where the
path() isn't a file, not only for PG: raster. So simplify the code to
always call QFileInfo::exists()
  • Loading branch information
rouault authored and nyalldawson committed Nov 15, 2020
1 parent 72fea56 commit 74e4a7000c5de6fe00bbc2c612666a234ef448ac
Showing with 1 addition and 13 deletions.
  1. +1 −13 src/app/browser/qgsinbuiltdataitemproviders.cpp
@@ -548,19 +548,7 @@ void QgsLayerItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu *men

if ( QgsGui::nativePlatformInterface()->capabilities() & QgsNative::NativeFilePropertiesDialog )
{
bool isFile = false;
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 )
if ( QFileInfo::exists( item->path() ) )
{
QAction *action = menu->addAction( tr( "File Properties…" ) );
connect( action, &QAction::triggered, this, [ = ]

0 comments on commit 74e4a70

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