forked from qt-creator/qt-creator
MIME: Delay resolution of mime types aliases
A MIME type can declare itself a sub-type of any other type. That may be an alias of some type not yet registered, so delay alias resolution till all MIME types are registered. Change-Id: Ie944771287f83e5439b120d12bed550266a6c954 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
@@ -1357,14 +1357,13 @@ bool MimeDatabasePrivate::addMimeType(MimeType mt)
|
||||
}
|
||||
// insert the type.
|
||||
m_typeMimeTypeMap.insert(type, MimeMapEntry(mt));
|
||||
// Register the children, resolved via alias map. Note that it is still
|
||||
// possible that aliases end up in the map if the parent classes are not inserted
|
||||
// at this point (thus their aliases not known).
|
||||
// Register the children
|
||||
// Aliases will be resolved later once all mime types are known.
|
||||
const QStringList subClassesOf = mt.subClassesOf();
|
||||
if (!subClassesOf.empty()) {
|
||||
const QStringList::const_iterator socend = subClassesOf.constEnd();
|
||||
for (QStringList::const_iterator soit = subClassesOf.constBegin(); soit != socend; ++soit)
|
||||
m_parentChildrenMap.insert(resolveAlias(*soit), type);
|
||||
m_parentChildrenMap.insert(*soit, type);
|
||||
}
|
||||
// register aliasses
|
||||
const QStringList aliases = mt.aliases();
|
||||
@@ -1391,7 +1390,9 @@ void MimeDatabasePrivate::raiseLevelRecursion(MimeMapEntry &e, int level)
|
||||
m_maxLevel = level;
|
||||
// At all events recurse over children since nodes might have been
|
||||
// added.
|
||||
const QStringList childTypes = m_parentChildrenMap.values(e.type.type());
|
||||
QStringList childTypes = m_parentChildrenMap.values(e.type.type());
|
||||
foreach (const QString &alias, e.type.aliases())
|
||||
childTypes.append(m_parentChildrenMap.values(alias));
|
||||
if (childTypes.empty())
|
||||
return;
|
||||
// look them up in the type->mime type map
|
||||
|
||||
Reference in New Issue
Block a user