More fine tuning of the mime of the opened file

In fba90677fc we introduced a "if we're
told this is a text file let's check the mime of the content only since
text files never fail to open".

This extends it to anything that inherits from text now, so if you
rename a PDF file to bla.php it still tries to open as a pdf first and
if that files as a php file
remotes/origin/work/aacid/okular_ci_clangtidy
Albert Astals Cid 5 years ago
parent 33483a10fa
commit d2ae2c283d
  1. 2
      part/part.cpp

@ -1470,7 +1470,7 @@ bool Part::openFile()
mimes << pathMime << argMime;
}
if (mimes[0].name() == QLatin1String("text/plain")) {
if (mimes[0].inherits(QStringLiteral("text/plain"))) {
QMimeType contentMime = db.mimeTypeForFile(fileNameToOpen, QMimeDatabase::MatchContent);
mimes.prepend(contentMime);
}

Loading…
Cancel
Save