Commit 45f50350 authored by Friedemann Kleint's avatar Friedemann Kleint
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>
parent d7d4c982
...@@ -214,24 +214,21 @@ void DesignMode::currentEditorChanged(Core::IEditor *editor) ...@@ -214,24 +214,21 @@ void DesignMode::currentEditorChanged(Core::IEditor *editor)
Core::ICore *core = Core::ICore::instance(); Core::ICore *core = Core::ICore::instance();
if (editor && editor->file()) { if (editor && editor->file()) {
MimeType type = core->mimeDatabase()->findByFile(QFileInfo(editor->file()->fileName())); const QString mimeType = editor->file()->mimeType();
QString mimeType = editor->file()->mimeType(); if (!mimeType.isEmpty()) {
foreach (DesignEditorInfo *editorInfo, d->m_editors) {
if (type && !type.type().isEmpty()) foreach (const QString &mime, editorInfo->mimeTypes) {
mimeType = type.type(); if (mime == mimeType) {
d->m_stackWidget->setCurrentIndex(editorInfo->widgetIndex);
foreach (DesignEditorInfo *editorInfo, d->m_editors) { setActiveContext(editorInfo->context);
foreach (const QString &mime, editorInfo->mimeTypes) { mimeEditorAvailable = true;
if (mime == mimeType) { setEnabled(true);
d->m_stackWidget->setCurrentIndex(editorInfo->widgetIndex); break;
setActiveContext(editorInfo->context); }
mimeEditorAvailable = true; } // foreach mime
setEnabled(true); if (mimeEditorAvailable)
break; break;
} } // foreach editorInfo
}
if (mimeEditorAvailable)
break;
} }
} }
if (d->m_currentEditor) 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