QCocoaFileDialogHelper: Always enable symlinks and aliases to directories

We always enable directories, so that the user can navigate into them,
so we should do the same for symlinks and aliases to directories.

This is the same behavior the native dialog has when not implementing
shouldEnableURL and relying purely on allowedFileTypes.

Fixes: QTBUG-28379
Pick-to: 5.15 6.2 6.3
Change-Id: I7ae4eb8120aa87cb685f3561d5e1c7257b0c9349
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
William Jones 2022-02-15 18:26:21 -05:00 committed by Tor Arne Vestbø
parent b142d2ad73
commit 87725ee759

View File

@ -259,7 +259,12 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
}
}
QString qtFileName = QFileInfo(QString::fromNSString(filename)).fileName();
// Treat symbolic links and aliases to directories like directories
QFileInfo fileInfo(QString::fromNSString(filename));
if (fileInfo.isSymLink() && QFileInfo(fileInfo.symLinkTarget()).isDir())
return YES;
QString qtFileName = fileInfo.fileName();
// No filter means accept everything
bool nameMatches = m_selectedNameFilter->isEmpty();
// Check if the current file name filter accepts the file: