Skip to content
Permalink
Browse files

Don't show 'None' for provider column in handle bad layers dialog for…

… non-vector layers
  • Loading branch information
nyalldawson committed Mar 9, 2021
1 parent 1bef866 commit 62b8f08b8e4aa0a40ea2a9385163131315c7ab86
Showing with 13 additions and 11 deletions.
  1. +12 −11 src/app/qgshandlebadlayers.cpp
  2. +1 −0 src/app/qgshandlebadlayers.h
@@ -123,24 +123,24 @@ QgsHandleBadLayers::QgsHandleBadLayers( const QList<QDomNode> &layers )
{
const QDomNode &node = mLayers[i];

QString name = node.namedItem( QStringLiteral( "layername" ) ).toElement().text();
QString type = node.toElement().attribute( QStringLiteral( "type" ) );
QString id = node.namedItem( QStringLiteral( "id" ) ).toElement().text();
QString datasource = node.namedItem( QStringLiteral( "datasource" ) ).toElement().text();
const QString name = node.namedItem( QStringLiteral( "layername" ) ).toElement().text();
const QString type = node.toElement().attribute( QStringLiteral( "type" ) );
const QString layerId = node.namedItem( QStringLiteral( "id" ) ).toElement().text();
const QString datasource = node.namedItem( QStringLiteral( "datasource" ) ).toElement().text();
const QString provider = node.namedItem( QStringLiteral( "provider" ) ).toElement().text();

bool providerFileBased = false;
if ( const QgsProviderMetadata *metadata = QgsProviderRegistry::instance()->providerMetadata( provider ) )
providerFileBased = metadata->providerCapabilities() & QgsProviderMetadata::FileBasedUris;

const QString basepath = QFileInfo( datasource ).absolutePath();
mOriginalFileBase[ node.namedItem( QStringLiteral( "id" ) ).toElement().text() ].append( basepath );
mOriginalFileBase[ layerId ].append( basepath );

QgsDebugMsg( QStringLiteral( "name=%1 type=%2 provider=%3 datasource='%4'" )
.arg( name,
type,
vectorProvider,
datasource ) );
QgsDebugMsgLevel( QStringLiteral( "name=%1 type=%2 provider=%3 datasource='%4'" )
.arg( name,
type,
provider,
datasource ), 2 );

mLayerList->setRowCount( j + 1 );

@@ -153,10 +153,11 @@ QgsHandleBadLayers::QgsHandleBadLayers( const QList<QDomNode> &layers )

item = new QTableWidgetItem( type );
item->setData( static_cast< int >( CustomRoles::ProviderIsFileBased ), providerFileBased );
item->setData( static_cast< int >( CustomRoles::LayerId ), layerId );
item->setFlags( item->flags() & ~Qt::ItemIsEditable );
mLayerList->setItem( j, 1, item );

item = new QTableWidgetItem( vectorProvider );
item = new QTableWidgetItem( provider );
item->setFlags( item->flags() & ~Qt::ItemIsEditable );
mLayerList->setItem( j, 2, item );

@@ -77,6 +77,7 @@ class APP_EXPORT QgsHandleBadLayers
Index = Qt::UserRole,
ProviderIsFileBased,
DataSourceIsChanged,
LayerId,
};

QPushButton *mBrowseButton = nullptr;

0 comments on commit 62b8f08

Please sign in to comment.