Utils: Allow mimetype deep-scan for remote files

Text editors need to know the actual mimetype of a file to be able to
open the correct editor view. Just checking the extension is not
enough. Especially on linux there are many text files without
an extension.

Change-Id: I7e5c935b0619f5d86e97f10bfd7ff9b65da62f4b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Marcus Tillmanns
2022-11-03 12:35:37 +01:00
parent 8de9892c4e
commit 7e0d545e64
7 changed files with 21 additions and 8 deletions

View File

@@ -949,7 +949,8 @@ void MainWindow::openFile()
static IDocumentFactory *findDocumentFactory(const QList<IDocumentFactory*> &fileFactories,
const FilePath &filePath)
{
const QString typeName = Utils::mimeTypeForFile(filePath).name();
const QString typeName = Utils::mimeTypeForFile(filePath, MimeMatchMode::MatchDefaultAndRemote)
.name();
return Utils::findOrDefault(fileFactories, [typeName](IDocumentFactory *f) {
return f->mimeTypes().contains(typeName);
});