summaryrefslogtreecommitdiff
path: root/src/plugins/git
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2013-09-11 22:36:34 +0300
committerOrgad Shaneh <orgads@gmail.com>2013-09-13 15:45:36 +0200
commitf29ce3d9b96f859c148b4c0c35ebefb9bab27364 (patch)
tree61fcd1fdb3ed9b9944c65fa061132cef34ab7026 /src/plugins/git
parent18bba097bdc2fbec9a23aa2152e16a6c201b5929 (diff)
downloadqt-creator-f29ce3d9b96f859c148b4c0c35ebefb9bab27364.tar.gz
DiffEditor: Preserve source for state recovery
Task-number: QTCREATORBUG-10126 Change-Id: I707e7cdac84c91d52c5661718ac48e3d79fc7c91 Reviewed-by: Petar Perisin <petar.perisin@gmail.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src/plugins/git')
-rw-r--r--src/plugins/git/gitclient.cpp10
-rw-r--r--src/plugins/git/gitclient.h1
2 files changed, 10 insertions, 1 deletions
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<DiffEditor::DiffEditor *>(
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;
@@ -1069,6 +1073,7 @@ void GitClient::diff(const QString &workingDirectory,
if (!diffEditor) {
newEditor = diffEditor = createDiffEditor(propertyName,
workingDirectory,
+ workingDirectory,
title,
DiffEditor::Constants::DIFF_EDITOR_ID);
}
@@ -1189,6 +1194,7 @@ void GitClient::diff(const QString &workingDirectory,
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);
}
diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h
index 969f7983e5..5b1631c3bd 100644
--- a/src/plugins/git/gitclient.h
+++ b/src/plugins/git/gitclient.h
@@ -367,6 +367,7 @@ private:
VcsBase::VcsBaseEditorParameterWidget *configWidget) const;
DiffEditor::DiffEditor *createDiffEditor(const char *registerDynamicProperty,
const QString &dynamicPropertyValue,
+ const QString &source,
const QString &titlePattern,
const Core::Id editorId) const;