If we can't figure out the mimetype, fall back to text/plain.

We are after all a text editor on steroids. That is people might want to
edit text files that don't have a ending we know.
This commit is contained in:
dt
2009-06-18 14:57:52 +02:00
parent 10868e107e
commit f55632fccc

View File

@@ -992,11 +992,11 @@ IEditor *EditorManager::createEditor(const QString &editorKind,
EditorFactoryList factories;
if (editorKind.isEmpty()) {
// Find by mime type
const MimeType mimeType = m_d->m_core->mimeDatabase()->findByFile(QFileInfo(fileName));
MimeType mimeType = m_d->m_core->mimeDatabase()->findByFile(QFileInfo(fileName));
if (!mimeType) {
qWarning("%s unable to determine mime type of %s/%s.",
qWarning("%s unable to determine mime type of %s/%s. Falling back to text/plain",
Q_FUNC_INFO, fileName.toUtf8().constData(), editorKind.toUtf8().constData());
return 0;
mimeType = m_d->m_core->mimeDatabase()->findByType(QLatin1String("text/plain"));
}
factories = editorFactories(mimeType, true);
} else {