EditorManager: Change openEditor/activateEditor to not do mode switching

Also introduce a indirection, modes have now types, edit and debug have
the same type, and editors do have a prefered type of modes instead of a
prefered mode.

That fixes the bug that if the prefered qml editing mode was set to
design, then in switching between qml editors would
- in Edit Mode: stay in edit mode
- in Debug Mode: switch to debug mode
This commit is contained in:
dt
2010-09-14 15:15:57 +02:00
parent f068e11596
commit 08ccda5862
52 changed files with 139 additions and 79 deletions

View File

@@ -657,14 +657,14 @@ static bool openInDesignMode()
return bool(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT);
}
QString QmlJSEditorEditable::preferredMode() const
QString QmlJSEditorEditable::preferredModeType() const
{
Core::ModeManager *modeManager = Core::ModeManager::instance();
if (modeManager->currentMode()
&& (modeManager->currentMode()->id() == Core::Constants::MODE_DESIGN
|| modeManager->currentMode()->id() == Core::Constants::MODE_EDIT))
&& (modeManager->currentMode()->type() == Core::Constants::MODE_DESIGN_TYPE
|| modeManager->currentMode()->type() == Core::Constants::MODE_EDIT_TYPE))
{
return modeManager->currentMode()->id();
return modeManager->currentMode()->type();
}
// if we are in other mode than edit or design, use the hard-coded default.
@@ -672,7 +672,7 @@ QString QmlJSEditorEditable::preferredMode() const
// have the user also access to this failsafe setting.
if (editor()->mimeType() == QLatin1String(QmlJSEditor::Constants::QML_MIMETYPE)
&& openInDesignMode())
return QLatin1String(Core::Constants::MODE_DESIGN);
return QLatin1String(Core::Constants::MODE_DESIGN_TYPE);
return QString();
}