Skip to content
Permalink
Browse files
Don't prompt multiple times to add vector/raster sublayers from a gpkg
dragged from the browser

Instead just prompt once with a unified dialog showing all sublayers
  • Loading branch information
nyalldawson committed Jul 19, 2021
1 parent 2ac6672 commit cc17c9049da35fa88fe53ca535e5d0967aa74769
@@ -2012,7 +2012,11 @@ void QgisApp::handleDropUriList( const QgsMimeDataUtils::UriList &lst )

QString uri = crsAndFormatAdjustedLayerUri( u.uri, u.supportedCrs, u.supportedFormats );

if ( u.layerType == QLatin1String( "vector" ) )
if ( u.layerType == QLatin1String( "collection" ) )
{
openLayer( uri, true );
}
else if ( u.layerType == QLatin1String( "vector" ) )
{
addVectorLayer( uri, u.name, u.providerKey );
}
@@ -399,12 +399,8 @@ bool QgsGeoPackageCollectionItem::hasDragEnabled() const

QgsMimeDataUtils::UriList QgsGeoPackageCollectionItem::mimeUris() const
{
QgsMimeDataUtils::Uri vectorUri;
vectorUri.providerKey = QStringLiteral( "ogr" );
vectorUri.uri = path().replace( QLatin1String( "gpkg:/" ), QString() );
vectorUri.layerType = QStringLiteral( "vector" );
QgsMimeDataUtils::Uri rasterUri { vectorUri };
rasterUri.layerType = QStringLiteral( "raster" );
rasterUri.providerKey = QStringLiteral( "gdal" );
return { vectorUri, rasterUri };
QgsMimeDataUtils::Uri collectionUri;
collectionUri.uri = path().replace( QLatin1String( "gpkg:/" ), QString() );
collectionUri.layerType = QStringLiteral( "collection" );
return { collectionUri };
}
@@ -457,14 +457,10 @@ bool QgsOgrDataCollectionItem::hasDragEnabled() const

QgsMimeDataUtils::UriList QgsOgrDataCollectionItem::mimeUris() const
{
QgsMimeDataUtils::Uri vectorUri;
vectorUri.providerKey = QStringLiteral( "ogr" );
vectorUri.uri = path();
vectorUri.layerType = QStringLiteral( "vector" );
QgsMimeDataUtils::Uri rasterUri { vectorUri };
rasterUri.layerType = QStringLiteral( "raster" );
rasterUri.providerKey = QStringLiteral( "gdal" );
return { vectorUri, rasterUri };
QgsMimeDataUtils::Uri collectionUri;
collectionUri.uri = path();
collectionUri.layerType = QStringLiteral( "collection" );
return { collectionUri };
}

QgsAbstractDatabaseProviderConnection *QgsOgrDataCollectionItem::databaseConnection() const

0 comments on commit cc17c90

Please sign in to comment.