forked from qt-creator/qt-creator
		
	Switch less often to edit mode
This change * Removes IMode::type, ModeManager::activateModeType, and IEditor::preferredModeType, and adds IEditor::isDesignModePreferred instead * Adapts the mode switching code in EditorManager to handle multiple windows, for example switching to edit mode should only happen if the editor/view is in the main window. Otherwise the editor window should be raised and focused * Renames EditorManager::NoActivate --> DoNotChangeCurrentEditor * Reverts the EditorManager::ModeSwitch logic to switch mode or make the current editor visible by default, introducing DoNotMakeVisible flag instead * Fixes a few instances where EditorManager::ModeSwitch should have been used One non-trivial problem left: If you open a .ui file and switch to an external editor window, edit mode is activated, because the current editor no longer is a .ui file, which means that the design mode gets deactivated. Change-Id: I76c5c2391eb4090143b778fb103acff3a5a1ff41 Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
		@@ -649,8 +649,7 @@ void PerforcePlugin::startSubmitProject()
 | 
			
		||||
 | 
			
		||||
Core::IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames)
 | 
			
		||||
{
 | 
			
		||||
    Core::IEditor *editor = Core::EditorManager::openEditor(fileName, Constants::PERFORCE_SUBMIT_EDITOR_ID,
 | 
			
		||||
                                                      Core::EditorManager::ModeSwitch);
 | 
			
		||||
    Core::IEditor *editor = Core::EditorManager::openEditor(fileName, Constants::PERFORCE_SUBMIT_EDITOR_ID);
 | 
			
		||||
    PerforceSubmitEditor *submitEditor = static_cast<PerforceSubmitEditor*>(editor);
 | 
			
		||||
    setSubmitEditor(submitEditor);
 | 
			
		||||
    submitEditor->restrictToProjectFiles(depotFileNames);
 | 
			
		||||
@@ -1180,7 +1179,7 @@ Core::IEditor *PerforcePlugin::showOutputInEditor(const QString &title, const QS
 | 
			
		||||
    if (codec)
 | 
			
		||||
        e->setCodec(codec);
 | 
			
		||||
    Core::IEditor *ie = e->editor();
 | 
			
		||||
    Core::EditorManager::activateEditor(ie, Core::EditorManager::ModeSwitch);
 | 
			
		||||
    Core::EditorManager::activateEditor(ie);
 | 
			
		||||
    return ie;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1262,7 +1261,7 @@ void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
 | 
			
		||||
 | 
			
		||||
    if (existingEditor) {
 | 
			
		||||
        existingEditor->createNew(result.stdOut);
 | 
			
		||||
        Core::EditorManager::activateEditor(existingEditor, Core::EditorManager::ModeSwitch);
 | 
			
		||||
        Core::EditorManager::activateEditor(existingEditor);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    // Create new editor
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user