diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 1b4f04093fdccfe8e74141ab0ae436fa923322ea..44d05e3b685d13da05cf4caf8aeb77091fc81b74 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -871,6 +871,7 @@ IEditor *EditorManager::openEditor(const QString &fileName, const QString &edito restoreEditorState(editor); QApplication::restoreOverrideCursor(); ensureEditorManagerVisible(); + setCurrentEditor(editor); return editor; } @@ -1351,6 +1352,8 @@ bool EditorManager::restoreState(const QByteArray &state) if (!success) return false; + QApplication::setOverrideCursor(Qt::WaitCursor); + bool editorChangesSuppressed = m_d->m_suppressEditorChanges; m_d->m_suppressEditorChanges = true; @@ -1366,6 +1369,8 @@ bool EditorManager::restoreState(const QByteArray &state) m_d->m_suppressEditorChanges = editorChangesSuppressed; if (currentEditor()) setCurrentEditor(currentEditor());// looks like a null-op but is not + + QApplication::restoreOverrideCursor(); return true; } diff --git a/src/plugins/coreplugin/editormanager/stackededitorgroup.cpp b/src/plugins/coreplugin/editormanager/stackededitorgroup.cpp index e39be9b8a18908c8b53b0961d94e081d1acc1675..4e95697856b9857cf340d415364986190485cc7f 100644 --- a/src/plugins/coreplugin/editormanager/stackededitorgroup.cpp +++ b/src/plugins/coreplugin/editormanager/stackededitorgroup.cpp @@ -225,12 +225,11 @@ void StackedEditorGroup::insertEditor(int index, IEditor *editor) m_widgetEditorMap.insert(editor->widget(), editor); QToolBar *toolBar = editor->toolBar(); - if (toolBar) + if (toolBar) { + toolBar->setVisible(false); // will be made visible in setCurrentEditor m_toolBar->layout()->addWidget(toolBar); - connect(editor, SIGNAL(changed()), this, SLOT(updateEditorStatus())); - - updateEditorStatus(editor); - updateToolBar(editor); + } + connect(editor, SIGNAL(changed()), this, SLOT(checkEditorStatus())); emit editorAdded(editor); } @@ -284,23 +283,26 @@ void StackedEditorGroup::setCurrentEditor(IEditor *editor) const bool block = m_editorList->blockSignals(true); m_editorList->setCurrentIndex(indexOf(editor)); m_editorList->blockSignals(block); - - updateEditorStatus(editor); - updateToolBar(editor); } setEditorFocus(idx); + + updateEditorStatus(editor); + updateToolBar(editor); if (editor != m_editorForInfoWidget) { m_infoWidget->hide(); m_editorForInfoWidget = 0; } } -void StackedEditorGroup::updateEditorStatus(IEditor *editor) +void StackedEditorGroup::checkEditorStatus() { - if (!editor) - editor = qobject_cast<IEditor *>(sender()); - QTC_ASSERT(editor, return); + IEditor *editor = qobject_cast<IEditor *>(sender()); + if (editor == currentEditor()) + updateEditorStatus(editor); +} +void StackedEditorGroup::updateEditorStatus(IEditor *editor) +{ static const QIcon lockedIcon(QLatin1String(":/qworkbench/images/locked.png")); static const QIcon unlockedIcon(QLatin1String(":/qworkbench/images/unlocked.png")); @@ -325,8 +327,8 @@ void StackedEditorGroup::updateToolBar(IEditor *editor) toolBar = m_defaultToolBar; if (m_activeToolBar == toolBar) return; - m_activeToolBar->setVisible(false); toolBar->setVisible(true); + m_activeToolBar->setVisible(false); m_activeToolBar = toolBar; } diff --git a/src/plugins/coreplugin/editormanager/stackededitorgroup.h b/src/plugins/coreplugin/editormanager/stackededitorgroup.h index 1b93ec4732a37708343327a0e4c299813c62784e..40edfc0168c70726b8650bc15d31f912baafdf73 100644 --- a/src/plugins/coreplugin/editormanager/stackededitorgroup.h +++ b/src/plugins/coreplugin/editormanager/stackededitorgroup.h @@ -80,6 +80,7 @@ protected: private slots: void sendCloseRequest(); void updateEditorStatus(Core::IEditor *editor = 0); + void checkEditorStatus(); void setEditorFocus(int index); void makeEditorWritable(); void listSelectionChanged(int index);