Commit 939513de authored by Friedemann Kleint's avatar Friedemann Kleint Committed by con
Browse files

Design mode: Avoid mimedatabase run on currentfile.



Use IFile::mimetype instead to find editors that
use design mode.
Acked-by: default avatarLasse Holmstedt <lasse.holmstedt@nokia.com>
(cherry picked from commit 45f50350)
parent 64042c32
......@@ -214,24 +214,21 @@ void DesignMode::currentEditorChanged(Core::IEditor *editor)
Core::ICore *core = Core::ICore::instance();
if (editor && editor->file()) {
MimeType type = core->mimeDatabase()->findByFile(QFileInfo(editor->file()->fileName()));
QString mimeType = editor->file()->mimeType();
if (type && !type.type().isEmpty())
mimeType = type.type();
foreach (DesignEditorInfo *editorInfo, d->m_editors) {
foreach (const QString &mime, editorInfo->mimeTypes) {
if (mime == mimeType) {
d->m_stackWidget->setCurrentIndex(editorInfo->widgetIndex);
setActiveContext(editorInfo->context);
mimeEditorAvailable = true;
setEnabled(true);
const QString mimeType = editor->file()->mimeType();
if (!mimeType.isEmpty()) {
foreach (DesignEditorInfo *editorInfo, d->m_editors) {
foreach (const QString &mime, editorInfo->mimeTypes) {
if (mime == mimeType) {
d->m_stackWidget->setCurrentIndex(editorInfo->widgetIndex);
setActiveContext(editorInfo->context);
mimeEditorAvailable = true;
setEnabled(true);
break;
}
} // foreach mime
if (mimeEditorAvailable)
break;
}
}
if (mimeEditorAvailable)
break;
} // foreach editorInfo
}
}
if (d->m_currentEditor)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment