Mimetypes v3: Reimplement MimeType matchesName

This makes Qt Creator set the right default editor again.
Visible in the MIME Types setting, before this change everything is
opened in the text editor.

Change-Id: I88ffc2e41688c2395925821e1d5d8ffee0d127eb
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Eike Ziller
2022-02-25 10:10:04 +01:00
parent 179f393f88
commit 3922db8ca9

View File

@@ -521,10 +521,11 @@ bool MimeType::inherits(const QString &mimeTypeName) const
*/ */
bool MimeType::matchesName(const QString &nameOrAlias) const bool MimeType::matchesName(const QString &nameOrAlias) const
{ {
// if (d->name == nameOrAlias) if (d->name == nameOrAlias)
// return true; return true;
// return MimeDatabasePrivate::instance()->provider()->resolveAlias(nameOrAlias) == d->name; auto dbp = MimeDatabasePrivate::instance();
return true; QMutexLocker locker(&dbp->mutex);
return MimeDatabasePrivate::instance()->resolveAlias(nameOrAlias) == d->name;
} }
/*! /*!