Commit f5be10b1 authored by Ahmad Samir's avatar Ahmad Samir Committed by Kurt Hindenburg
Browse files

FileFilterHotspot: use QMimeDataBase::mimeTypeForFile()

It seems there is no way around checking for the extension then falling
back to letting QMimeDataBase examine the file contents; e.g. a file
named konsolerc, doesn't have an extension, but it is still a text file.
parent 3b06b6f2
......@@ -131,12 +131,10 @@ void FileFilterHotSpot::openWithEditorFromProfile(const QString &fullCmd, const
// Here we are mostly interested in text-based files, e.g. if it's a
// PDF we should let the system default app open it.
QMimeDatabase mdb;
const auto mimeList = mdb.mimeTypesForFileName(path);
qCDebug(KonsoleDebug) << "FileFilterHotSpot: mime types for" << path << ":" << mimeList;
const auto mimeType = mdb.mimeTypeForFile(path);
qCDebug(KonsoleDebug) << "FileFilterHotSpot: mime type for" << path << ":" << mimeType;
// If mimeList is empty, then it's not a recognized mime type, e.g.
// a text file without an extension
if (mimeList.isEmpty() || !"text/plain"))) {
if (!mimeType.inherits(QStringLiteral("text/plain"))) {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment