CMake: Fix startup warning

Accessing MimeDatabase for text/x-cmake before plugins are initialized

There is not much use for using QMimeType internally anyway, since they
are effectively only used as strings.

Amends ac2ca7244a

Change-Id: I4d7b1bb2f0ad4e857409e3ef287f5b9abe052193
Reviewed-by: Xavier BESSON <developer@xavi-b.fr>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Eike Ziller
2022-12-12 14:51:33 +01:00
parent bc7eed8c62
commit 92ab0c7f13
3 changed files with 14 additions and 24 deletions

View File

@@ -43,8 +43,7 @@ using namespace Utils;
namespace CMakeProjectManager::Internal {
bool isAutoFormatApplicable(const Core::IDocument *document,
const QList<Utils::MimeType> &allowedMimeTypes)
bool isAutoFormatApplicable(const Core::IDocument *document, const QStringList &allowedMimeTypes)
{
if (!document)
return false;
@@ -53,8 +52,8 @@ bool isAutoFormatApplicable(const Core::IDocument *document,
return true;
const Utils::MimeType documentMimeType = Utils::mimeTypeForName(document->mimeType());
return Utils::anyOf(allowedMimeTypes, [&documentMimeType](const Utils::MimeType &mime) {
return documentMimeType.inherits(mime.name());
return Utils::anyOf(allowedMimeTypes, [&documentMimeType](const QString &mime) {
return documentMimeType.inherits(mime);
});
}