From 45f5035031c22d005c0b5085e00f7b12013edc9c Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Date: Fri, 7 May 2010 14:49:57 +0200
Subject: [PATCH] Design mode: Avoid mimedatabase run on currentfile.

Use IFile::mimetype instead to find editors that
use design mode.
Acked-by: Lasse Holmstedt <lasse.holmstedt@nokia.com>
---
 src/plugins/coreplugin/designmode.cpp | 31 ++++++++++++---------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/src/plugins/coreplugin/designmode.cpp b/src/plugins/coreplugin/designmode.cpp
index 419c255882b..211961662b9 100644
--- a/src/plugins/coreplugin/designmode.cpp
+++ b/src/plugins/coreplugin/designmode.cpp
@@ -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)
-- 
GitLab