Skip to content
Permalink
Browse files
Fix sublayer group name handling for sources which are directories
not files (e.g. .gdb databases)

Fixes #44181
  • Loading branch information
nyalldawson committed Jul 19, 2021
1 parent 0dc4870 commit cfbc2279a74d5162364602893ba1111ec0807b26
Showing with 4 additions and 5 deletions.
  1. +4 −4 src/app/qgsprovidersublayersdialog.cpp
  2. +0 −1 src/app/qgsprovidersublayersdialog.h
@@ -99,14 +99,14 @@ QgsProviderSublayersDialog::QgsProviderSublayersDialog( const QString &uri, cons
QgsGui::enableAutoGeometryRestore( this );

const QFileInfo fileInfo( filePath );
mFilePath = fileInfo.isFile() && fileInfo.exists() ? filePath : QString();
mFileName = !mFilePath.isEmpty() ? fileInfo.fileName() : QString();
mFilePath = ( fileInfo.isFile() || fileInfo.isDir() ) && fileInfo.exists() ? filePath : QString();
const QString fileName = !mFilePath.isEmpty() ? QgsProviderUtils::suggestLayerNameFromFilePath( mFilePath ) : QString();

setWindowTitle( mFileName.isEmpty() ? tr( "Select Items to Add" ) : QStringLiteral( "%1 | %2" ).arg( tr( "Select Items to Add" ), mFileName ) );
setWindowTitle( fileName.isEmpty() ? tr( "Select Items to Add" ) : QStringLiteral( "%1 | %2" ).arg( tr( "Select Items to Add" ), fileName ) );

mLblFilePath->setText( QStringLiteral( "<a href=\"%1\">%2</a>" )
.arg( QUrl::fromLocalFile( mFilePath ).toString(), QDir::toNativeSeparators( QFileInfo( mFilePath ).canonicalFilePath() ) ) );
mLblFilePath->setVisible( !mFileName.isEmpty() );
mLblFilePath->setVisible( !mFilePath.isEmpty() );
mLblFilePath->setWordWrap( true );
mLblFilePath->setTextInteractionFlags( Qt::TextBrowserInteraction );
connect( mLblFilePath, &QLabel::linkActivated, this, [ = ]( const QString & link )
@@ -78,7 +78,6 @@ class QgsProviderSublayersDialog : public QDialog, private Ui::QgsProviderSublay
QgsProviderSublayerProxyModel *mProxyModel = nullptr;
QPointer< QgsProviderSublayerTask > mTask;
QString mFilePath;
QString mFileName;
bool mBlockSelectionChanges = false;

};

0 comments on commit cfbc227

Please sign in to comment.