Commit f933602c authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Fall back to default editors if none is found by Id

 * Fall back to the default editor for a the file's
   mime type when it fails to open by editor id.

   This fixes opening editors in a session with invalid
   ids.

Reviewed-by: dt
parent 9c845a2a
......@@ -1131,6 +1131,10 @@ IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QStri
}
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
IEditor *editor = createEditor(editorId, fileName);
// If we could not open the file in the requested editor, fall
// back to the default editor:
if (!editor)
editor = createEditor(QString(), fileName);
if (!editor || !editor->open(fileName)) {
QApplication::restoreOverrideCursor();
QMessageBox::critical(m_d->m_core->mainWindow(), tr("Opening File"), tr("Cannot open file %1!").arg(QDir::toNativeSeparators(fileName)));
......
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