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
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 74e4a70
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/app/browser/qgsinbuiltdataitemproviders.cpp
Expand Up @@ -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, [ = ]
Expand Down

0 comments on commit 74e4a70

Please sign in to comment.