mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
parent
5ec3d5d990
commit
e62c4eb941
@ -32,6 +32,7 @@
|
|||||||
#include "qgsvectorlayerexporter.h"
|
#include "qgsvectorlayerexporter.h"
|
||||||
#include "qgsgeopackagerasterwritertask.h"
|
#include "qgsgeopackagerasterwritertask.h"
|
||||||
#include "qgstaskmanager.h"
|
#include "qgstaskmanager.h"
|
||||||
|
#include "qgsproviderregistry.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
@ -357,15 +358,16 @@ bool QgsGeoPackageCollectionItem::deleteGeoPackageRasterLayer( const QString &ur
|
|||||||
// Better safe than sorry
|
// Better safe than sorry
|
||||||
if ( ! uri.isEmpty( ) )
|
if ( ! uri.isEmpty( ) )
|
||||||
{
|
{
|
||||||
QStringList pieces( uri.split( ':' ) );
|
QVariantMap pieces( QgsProviderRegistry::instance()->decodeUri( QStringLiteral( "gdal" ), uri ) );
|
||||||
if ( pieces.size() != 3 )
|
QString baseUri = pieces[QStringLiteral( "path" )].toString();
|
||||||
|
QString layerName = pieces[QStringLiteral( "layerName" )].toString();
|
||||||
|
|
||||||
|
if ( baseUri.isEmpty() || layerName.isEmpty() )
|
||||||
{
|
{
|
||||||
errCause = QStringLiteral( "Layer URI is malformed: layer <b>%1</b> cannot be deleted!" ).arg( uri );
|
errCause = QStringLiteral( "Layer URI is malformed: layer <b>%1</b> cannot be deleted!" ).arg( uri );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QString baseUri = pieces.at( 1 );
|
|
||||||
QString layerName = pieces.at( 2 );
|
|
||||||
sqlite3_database_unique_ptr database;
|
sqlite3_database_unique_ptr database;
|
||||||
int status = database.open_v2( baseUri, SQLITE_OPEN_READWRITE, nullptr );
|
int status = database.open_v2( baseUri, SQLITE_OPEN_READWRITE, nullptr );
|
||||||
if ( status != SQLITE_OK )
|
if ( status != SQLITE_OK )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user