Skip to content

Commit

Permalink
Add formats extensions/protocol already supported by GDAL/OGR.
Browse files Browse the repository at this point in the history
This should fix bugs:

* #3799 on CouchDB support.
* #4362 on ovr and ovf for VRT files.
* #5242 on KMZ support.
* #6197 on SQLite file extensions support.
  • Loading branch information
Médéric RIBREUX committed Dec 12, 2015
1 parent 62f90d0 commit 72c5e37
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 9 deletions.
8 changes: 8 additions & 0 deletions src/app/ogr/qgsogrhelperfunctions.cpp
Expand Up @@ -197,6 +197,14 @@ QString createProtocolURI( const QString& type, const QString& url )
{
uri = url;
}
else if ( type == "CouchDB" )
{
uri = QString( "couchdb:%1" ).arg( url );
}
else if ( type == "DODS/OPeNDAP" )
{
uri = QString( "DODS:%1" ).arg( url );
}
QgsDebugMsg( "Connection type is=" + type + " and uri=" + uri );
return uri;
}
2 changes: 1 addition & 1 deletion src/app/qgsnewspatialitelayerdialog.cpp
Expand Up @@ -112,7 +112,7 @@ void QgsNewSpatialiteLayerDialog::on_toolButtonNewDatabase_clicked()
{
QString fileName = QFileDialog::getSaveFileName( this, tr( "New SpatiaLite Database File" ),
QDir::homePath(),
tr( "SpatiaLite" ) + " (*.sqlite *.db)" );
tr( "SpatiaLite" ) + " (*.sqlite *.db *.sqlite3 *.db3 *.s3db)" );

if ( fileName.isEmpty() )
return;
Expand Down
5 changes: 5 additions & 0 deletions src/providers/gdal/qgsgdalprovider.cpp
Expand Up @@ -2086,6 +2086,11 @@ void buildSupportedRasterFileFilterAndExtensions( QString & theFileFiltersString
glob += " *.jpeg";
theExtensions << "jpeg";
}
else if ( myGdalDriverDescription == "VRT" )
{
glob += " *.ovr";
theExtensions << "ovr";
}

theFileFiltersString += createFileFilter_( myGdalDriverLongName, glob );

Expand Down
16 changes: 10 additions & 6 deletions src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -1701,6 +1701,10 @@ QString createFilters( QString type )
{
myProtocolDrivers += "DODS/OPeNDAP,DODS;";
}
else if ( driverName.startsWith( QObject::tr( "CouchDB" ) ) )
{
myProtocolDrivers += "CouchDB;";
}
else if ( driverName.startsWith( "FileGDB" ) )
{
myDirectoryDrivers += QObject::tr( "ESRI FileGDB" ) + ",FileGDB;";
Expand Down Expand Up @@ -1782,8 +1786,8 @@ QString createFilters( QString type )
}
else if ( driverName.startsWith( "KML" ) )
{
myFileFilters += createFileFilter_( QObject::tr( "Keyhole Markup Language [KML]" ), "*.kml" );
myExtensions << "kml";
myFileFilters += createFileFilter_( QObject::tr( "Keyhole Markup Language [KML]" ), "*.kml *.kmz" );
myExtensions << "kml" << "kmz";
}
else if ( driverName.startsWith( "MapInfo File" ) )
{
Expand Down Expand Up @@ -1842,8 +1846,8 @@ QString createFilters( QString type )
}
else if ( driverName.startsWith( "SQLite" ) )
{
myFileFilters += createFileFilter_( QObject::tr( "SQLite/SpatiaLite" ), "*.sqlite *.db" );
myExtensions << "sqlite" << "db";
myFileFilters += createFileFilter_( QObject::tr( "SQLite/SpatiaLite" ), "*.sqlite *.db *.sqlite3 *.db3 *.s3db *.sl3" );
myExtensions << "sqlite" << "db" << "sqlite3" << "db3" << "s3db" << "sl3";
}
else if ( driverName.startsWith( "SXF" ) )
{
Expand All @@ -1861,8 +1865,8 @@ QString createFilters( QString type )
else if ( driverName.startsWith( "VRT" ) )
{
myFileFilters += createFileFilter_( QObject::tr( "VRT - Virtual Datasource" ),
"*.vrt" );
myExtensions << "vrt";
"*.vrt *.ovf" );
myExtensions << "vrt" << "ovf";
}
else if ( driverName.startsWith( "XPlane" ) )
{
Expand Down
2 changes: 1 addition & 1 deletion src/providers/spatialite/qgsspatialitedataitems.cpp
Expand Up @@ -321,7 +321,7 @@ void QgsSLRootItem::createDatabase()

QString filename = QFileDialog::getSaveFileName( 0, tr( "New SpatiaLite Database File" ),
lastUsedDir,
tr( "SpatiaLite" ) + " (*.sqlite *.db)" );
tr( "SpatiaLite" ) + " (*.sqlite *.db *.sqlite3 *.db3 *.s3db)" );
if ( filename.isEmpty() )
return;

Expand Down
2 changes: 1 addition & 1 deletion src/providers/spatialite/qgsspatialitesourceselect.cpp
Expand Up @@ -273,7 +273,7 @@ bool QgsSpatiaLiteSourceSelect::newConnection( QWidget* parent )

QString myFile = QFileDialog::getOpenFileName( parent,
tr( "Choose a SpatiaLite/SQLite DB to open" ),
lastUsedDir, tr( "SpatiaLite DB" ) + " (*.sqlite *.db);;" + tr( "All files" ) + " (*)" );
lastUsedDir, tr( "SpatiaLite DB" ) + " (*.sqlite *.db *.sqlite3 *.db3 *.s3db);;" + tr( "All files" ) + " (*)" );

if ( myFile.isEmpty() )
return false;
Expand Down

0 comments on commit 72c5e37

Please sign in to comment.