Skip to content
Permalink
Browse files

add "All supported" file filter for OGR and GDAL providers allowing to

view all supported file types at once (fix #13239)
  • Loading branch information
alexbruy authored and nyalldawson committed May 7, 2020
1 parent 154c892 commit 1b41377693c170abc4135980fcb21fcada3549e2
Showing with 13 additions and 1 deletion.
  1. +6 −0 src/core/providers/gdal/qgsgdalprovider.cpp
  2. +7 −1 src/core/providers/ogr/qgsogrprovider.cpp
@@ -2286,6 +2286,12 @@ void buildSupportedRasterFileFilterAndExtensions( QString &fileFiltersString, QS
extensions << QStringLiteral( "zip" ) << QStringLiteral( "gz" ) << QStringLiteral( "tar" ) << QStringLiteral( "tar.gz" ) << QStringLiteral( "tgz" );
}

// can't forget the all supported case
QStringList exts;
for ( const QString &ext : qgis::as_const( extensions ) )
exts << QStringLiteral( "*.%1 *.%2" ).arg( ext, ext.toUpper() );
fileFiltersString.prepend( QObject::tr( "All supported files" ) + QStringLiteral( " (%1);;" ).arg( exts.join( QStringLiteral( " " ) ) ) );

// can't forget the default case - first
fileFiltersString.prepend( QObject::tr( "All files" ) + " (*);;" );

@@ -3306,12 +3306,18 @@ QString createFilters( const QString &type )
{
sFileFilters.prepend( createFileFilter_( QObject::tr( "GDAL/OGR VSIFileHandler" ), QStringLiteral( "*.zip *.gz *.tar *.tar.gz *.tgz" ) ) );
sExtensions << QStringLiteral( "zip" ) << QStringLiteral( "gz" ) << QStringLiteral( "tar" ) << QStringLiteral( "tar.gz" ) << QStringLiteral( "tgz" );

}

// can't forget the all supported case
QStringList exts;
for ( const QString &ext : qgis::as_const( sExtensions ) )
exts << QStringLiteral( "*.%1 *.%2" ).arg( ext, ext.toUpper() );
sFileFilters.prepend( QObject::tr( "All supported files" ) + QStringLiteral( " (%1);;" ).arg( exts.join( QStringLiteral( " " ) ) ) );

// can't forget the default case - first
sFileFilters.prepend( QObject::tr( "All files" ) + " (*);;" );


// cleanup
if ( sFileFilters.endsWith( QLatin1String( ";;" ) ) ) sFileFilters.chop( 2 );

0 comments on commit 1b41377

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