QAbstractFileIconProvider: Fix compilation without feature mimetype
Change-Id: I3aecc1ab97ed549511bc9a5cbc8eb780f5e9a4dd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
a4ea58bf04
commit
3b281f6693
@ -43,7 +43,9 @@
|
|||||||
#include <private/qguiapplication_p.h>
|
#include <private/qguiapplication_p.h>
|
||||||
#include <qpa/qplatformtheme.h>
|
#include <qpa/qplatformtheme.h>
|
||||||
#include <qicon.h>
|
#include <qicon.h>
|
||||||
|
#if QT_CONFIG(mimetype)
|
||||||
#include <qmimedatabase.h>
|
#include <qmimedatabase.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <private/qabstractfileiconprovider_p.h>
|
#include <private/qabstractfileiconprovider_p.h>
|
||||||
@ -151,7 +153,11 @@ QIcon QAbstractFileIconProviderPrivate::getIconThemeIcon(const QFileInfo &info)
|
|||||||
return getIconThemeIcon(QAbstractFileIconProvider::Drive);
|
return getIconThemeIcon(QAbstractFileIconProvider::Drive);
|
||||||
if (info.isDir())
|
if (info.isDir())
|
||||||
return getIconThemeIcon(QAbstractFileIconProvider::Folder);
|
return getIconThemeIcon(QAbstractFileIconProvider::Folder);
|
||||||
|
#if QT_CONFIG(mimetype)
|
||||||
return QIcon::fromTheme(mimeDatabase.mimeTypeForFile(info).iconName());
|
return QIcon::fromTheme(mimeDatabase.mimeTypeForFile(info).iconName());
|
||||||
|
#else
|
||||||
|
return QIcon::fromTheme(QLatin1String("text-x-generic"));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -267,8 +273,13 @@ QString QAbstractFileIconProvider::type(const QFileInfo &info) const
|
|||||||
if (QFileSystemEntry::isRootPath(info.absoluteFilePath()))
|
if (QFileSystemEntry::isRootPath(info.absoluteFilePath()))
|
||||||
return QGuiApplication::translate("QAbstractFileIconProvider", "Drive");
|
return QGuiApplication::translate("QAbstractFileIconProvider", "Drive");
|
||||||
if (info.isFile()) {
|
if (info.isFile()) {
|
||||||
|
#if QT_CONFIG(mimetype)
|
||||||
const QMimeType mimeType = d->mimeDatabase.mimeTypeForFile(info);
|
const QMimeType mimeType = d->mimeDatabase.mimeTypeForFile(info);
|
||||||
return mimeType.comment().isEmpty() ? mimeType.name() : mimeType.comment();
|
return mimeType.comment().isEmpty() ? mimeType.name() : mimeType.comment();
|
||||||
|
#else
|
||||||
|
Q_UNUSED(d);
|
||||||
|
return QGuiApplication::translate("QAbstractFileIconProvider", "File");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.isDir())
|
if (info.isDir())
|
||||||
|
@ -52,7 +52,9 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include <QtGui/private/qtguiglobal_p.h>
|
#include <QtGui/private/qtguiglobal_p.h>
|
||||||
|
#if QT_CONFIG(mimetype)
|
||||||
#include <QtCore/QMimeDatabase>
|
#include <QtCore/QMimeDatabase>
|
||||||
|
#endif
|
||||||
#include "qabstractfileiconprovider.h"
|
#include "qabstractfileiconprovider.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@ -75,7 +77,9 @@ public:
|
|||||||
QAbstractFileIconProvider *q_ptr = nullptr;
|
QAbstractFileIconProvider *q_ptr = nullptr;
|
||||||
QAbstractFileIconProvider::Options options = {};
|
QAbstractFileIconProvider::Options options = {};
|
||||||
|
|
||||||
|
#if QT_CONFIG(mimetype)
|
||||||
QMimeDatabase mimeDatabase;
|
QMimeDatabase mimeDatabase;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user