From f29ce3d9b96f859c148b4c0c35ebefb9bab27364 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 11 Sep 2013 22:36:34 +0300 Subject: DiffEditor: Preserve source for state recovery Task-number: QTCREATORBUG-10126 Change-Id: I707e7cdac84c91d52c5661718ac48e3d79fc7c91 Reviewed-by: Petar Perisin Reviewed-by: Tobias Hunger --- src/plugins/git/gitclient.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/plugins/git/gitclient.cpp') diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 33cecb85d2..fa190062fe 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -997,13 +997,17 @@ DiffEditor::DiffEditor *GitClient::findExistingDiffEditor(const char *registerDy } DiffEditor::DiffEditor *GitClient::createDiffEditor(const char *registerDynamicProperty, - const QString &dynamicPropertyValue, const QString &titlePattern, const Core::Id editorId) const + const QString &dynamicPropertyValue, + const QString &source, + const QString &titlePattern, + const Core::Id editorId) const { QString title = titlePattern; DiffEditor::DiffEditor *diffEditor = qobject_cast( Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait.toUtf8())); QTC_ASSERT(diffEditor, return 0); diffEditor->document()->setProperty(registerDynamicProperty, dynamicPropertyValue); + diffEditor->editorWidget()->setSource(source); Core::EditorManager::activateEditor(diffEditor); return diffEditor; @@ -1068,6 +1072,7 @@ void GitClient::diff(const QString &workingDirectory, DiffEditor::DiffEditor *diffEditor = findExistingDiffEditor(propertyName, workingDirectory); if (!diffEditor) { newEditor = diffEditor = createDiffEditor(propertyName, + workingDirectory, workingDirectory, title, DiffEditor::Constants::DIFF_EDITOR_ID); @@ -1188,6 +1193,7 @@ void GitClient::diff(const QString &workingDirectory, DiffEditor::DiffEditor *diffEditor = findExistingDiffEditor(propertyName, sourceFile); if (!diffEditor) { newEditor = diffEditor = createDiffEditor(propertyName, + sourceFile, sourceFile, title, DiffEditor::Constants::DIFF_EDITOR_ID); @@ -1252,6 +1258,7 @@ void GitClient::diffBranch(const QString &workingDirectory, if (!diffEditor) { newEditor = diffEditor = createDiffEditor(propertyName, branchName, + workingDirectory, title, DiffEditor::Constants::DIFF_EDITOR_ID); } @@ -1413,6 +1420,7 @@ void GitClient::show(const QString &source, const QString &id, if (!diffEditor) { newEditor = diffEditor = createDiffEditor(propertyName, id, + source, title, DiffEditor::Constants::DIFF_SHOW_EDITOR_ID); } -- cgit v1.2.1