Skip to content

Commit a9b7395

Browse files
senthilauto2023GitHub Enterprise
authored and
GitHub Enterprise
committed
MAYA-130936: Disabled mime based file type determination (qt#94)
Using file extension to determine the file type instead of mime-type.
1 parent 34e72dc commit a9b7395

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/gui/image/qabstractfileiconprovider.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,15 @@ QString QAbstractFileIconProvider::type(const QFileInfo &info) const
239239
if (QFileSystemEntry::isRootPath(info.absoluteFilePath()))
240240
return QGuiApplication::translate("QAbstractFileIconProvider", "Drive");
241241
if (info.isFile()) {
242-
#if QT_CONFIG(mimetype)
242+
#if 0 //QT_CONFIG(mimetype)
243243
const QMimeType mimeType = d->mimeDatabase.mimeTypeForFile(info);
244244
return mimeType.comment().isEmpty() ? mimeType.name() : mimeType.comment();
245245
#else
246-
Q_UNUSED(d);
247-
return QGuiApplication::translate("QAbstractFileIconProvider", "File");
246+
if (!info.suffix().isEmpty()) {
247+
//: %1 is a file name suffix, for example txt
248+
return QGuiApplication::translate("QAbstractFileIconProvider", "%1 File").arg(info.suffix());
249+
}
250+
return QGuiApplication::translate("QAbstractFileIconProvider", "File");
248251
#endif
249252
}
250253

0 commit comments

Comments
 (0)