38
38
39
39
// these are defined in qgsogrprovider.cpp
40
40
QGISEXTERN QStringList fileExtensions ();
41
+ QGISEXTERN QStringList directoryExtensions ();
41
42
QGISEXTERN QStringList wildcards ();
42
43
43
44
QGISEXTERN bool deleteLayer ( const QString &uri, const QString &errCause );
@@ -506,11 +507,13 @@ QGISEXTERN QgsDataItem *dataItem( QString path, QgsDataItem *parentItem )
506
507
QgsDebugMsgLevel ( " thePath= " + path + " tmpPath= " + tmpPath + " name= " + name
507
508
+ " suffix= " + suffix + " vsiPrefix= " + vsiPrefix, 3 );
508
509
509
- // allow only normal files or VSIFILE items to continue
510
- if ( !info.isFile () && vsiPrefix == QLatin1String ( " " ) )
511
- return nullptr ;
512
-
513
510
QStringList myExtensions = fileExtensions ();
511
+ QStringList dirExtensions = directoryExtensions ();
512
+
513
+ // allow only normal files, supported directories, or VSIFILE items to continue
514
+ bool isOgrSupportedDirectory = info.isDir () && dirExtensions.contains ( suffix );
515
+ if ( !isOgrSupportedDirectory && !info.isFile () && vsiPrefix == QLatin1String ( " " ) )
516
+ return nullptr ;
514
517
515
518
// skip *.aux.xml files (GDAL auxiliary metadata files),
516
519
// *.shp.xml files (ESRI metadata) and *.tif.xml files (TIFF metadata)
@@ -527,7 +530,7 @@ QGISEXTERN QgsDataItem *dataItem( QString path, QgsDataItem *parentItem )
527
530
528
531
// We have to filter by extensions, otherwise e.g. all Shapefile files are displayed
529
532
// because OGR drive can open also .dbf, .shx.
530
- if ( myExtensions.indexOf ( suffix ) < 0 )
533
+ if ( myExtensions.indexOf ( suffix ) < 0 && !dirExtensions. contains ( suffix ) )
531
534
{
532
535
bool matches = false ;
533
536
Q_FOREACH ( const QString &wildcard, wildcards () )
@@ -577,9 +580,9 @@ QGISEXTERN QgsDataItem *dataItem( QString path, QgsDataItem *parentItem )
577
580
// class
578
581
// TODO: add more OGR supported multiple layers formats here!
579
582
QStringList ogrSupportedDbLayersExtensions;
580
- ogrSupportedDbLayersExtensions << QLatin1String ( " gpkg" ) << QLatin1String ( " sqlite" ) << QLatin1String ( " db" );
583
+ ogrSupportedDbLayersExtensions << QLatin1String ( " gpkg" ) << QLatin1String ( " sqlite" ) << QLatin1String ( " db" ) << QStringLiteral ( " gdb " ) ;
581
584
QStringList ogrSupportedDbDriverNames;
582
- ogrSupportedDbDriverNames << QLatin1String ( " GPKG" ) << QLatin1String ( " db" );
585
+ ogrSupportedDbDriverNames << QLatin1String ( " GPKG" ) << QLatin1String ( " db" ) << QStringLiteral ( " gdb " ) ;
583
586
584
587
// Fast track: return item without testing if:
585
588
// scanExtSetting or zipfile and scan zip == "Basic scan"
0 commit comments