diff options
author | Eike Ziller <eike.ziller@digia.com> | 2014-06-03 15:06:16 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2014-06-04 10:41:58 +0200 |
commit | 6c473db09772c4626e046fd692f53d55ecb275da (patch) | |
tree | c8c97ab9debd20a4408ba99fb41e2fe454d36e29 /src | |
parent | d455f5f6dcc1be1d2346bb5c112c96ddbfe47ce5 (diff) | |
download | qt-creator-6c473db09772c4626e046fd692f53d55ecb275da.tar.gz |
Fix setting DocumentManager::currentFile when clicking into split
This broke when introducing delayed setting of the currentEditor when
the context changes. Simply move the logic from the document manager to
the editor manager, where it arguably belongs to anyway, and also set
the currentFile delayed in that case.
Task-number: QTCREATORBUG-12264
Change-Id: I67ee3f9a02e62cfa67671629c956a4290361cba8
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: David Schulz <david.schulz@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/coreplugin/documentmanager.cpp | 18 | ||||
-rw-r--r-- | src/plugins/coreplugin/documentmanager.h | 1 | ||||
-rw-r--r-- | src/plugins/coreplugin/editormanager/editormanager.cpp | 5 |
3 files changed, 5 insertions, 19 deletions
diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index 7e68576cc1..384e9f4070 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -216,8 +216,6 @@ DocumentManager::DocumentManager(QObject *parent) { d = new DocumentManagerPrivate; m_instance = this; - connect(ICore::instance(), SIGNAL(contextChanged(QList<Core::IContext*>,Core::Context)), - this, SLOT(syncWithEditor(QList<Core::IContext*>))); qApp->installEventFilter(this); readSettings(); @@ -1129,22 +1127,6 @@ void DocumentManager::checkForReload() // dump(); } -void DocumentManager::syncWithEditor(const QList<Core::IContext *> &context) -{ - if (context.isEmpty()) - return; - - Core::IEditor *editor = Core::EditorManager::currentEditor(); - if (!editor || editor->document()->isTemporary()) - return; - foreach (IContext *c, context) { - if (editor->widget() == c->widget()) { - setCurrentFile(editor->document()->filePath()); - break; - } - } -} - /*! Adds the \a fileName to the list of recent files. Associates the file to be reopened with the editor that has the specified \a editorId, if possible. diff --git a/src/plugins/coreplugin/documentmanager.h b/src/plugins/coreplugin/documentmanager.h index 1144a15d29..8fe47ba508 100644 --- a/src/plugins/coreplugin/documentmanager.h +++ b/src/plugins/coreplugin/documentmanager.h @@ -163,7 +163,6 @@ private slots: void checkForNewFileName(); void checkForReload(); void changedFile(const QString &file); - void syncWithEditor(const QList<Core::IContext *> &context); private: explicit DocumentManager(QObject *parent); diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 3b130c5120..172f98f3cc 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -526,6 +526,8 @@ void EditorManager::handleContextChange(const QList<Core::IContext *> &context) d->m_scheduledCurrentEditor = editor; QTimer::singleShot(0, m_instance, SLOT(setCurrentEditorFromContextChange())); } else { + if (editor && !editor->document()->isTemporary()) + DocumentManager::setCurrentFile(editor->document()->filePath()); updateActions(); } } @@ -1027,6 +1029,9 @@ void EditorManager::setCurrentEditorFromContextChange() IEditor *newCurrent = d->m_scheduledCurrentEditor; d->m_scheduledCurrentEditor = 0; setCurrentEditor(newCurrent); + if (!newCurrent->document()->isTemporary()) + DocumentManager::setCurrentFile(newCurrent->document()->filePath()); + } void EditorManager::closeEditor(Core::IEditor *editor, bool askAboutModifiedEditors) |