Hide some diff editor controls when diff editor is bound to a file.

Remove unnecessary anymore "ignoreWhitespace" argument
from functions which read a patch file.

Transfer the ownership of reloader into controller.

Task-number: QTCREATORBUG-13250
Change-Id: I68183005b845d6ece9ea2be9888abc8597310426
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
jkobus
2014-10-24 14:11:12 +02:00
committed by Jarek Kobus
parent f406a38ca7
commit 2a9c9f2d70
12 changed files with 52 additions and 68 deletions

View File

@@ -31,6 +31,8 @@
#include "diffeditordocument.h"
#include "diffeditorconstants.h"
#include "diffeditorcontroller.h"
#include "diffeditormanager.h"
#include "diffeditorreloader.h"
#include "diffutils.h"
#include <coreplugin/editormanager/editormanager.h>
@@ -83,6 +85,10 @@ bool DiffEditorDocument::save(QString *errorString, const QString &fileName, boo
if (!ok)
return false;
if (m_controller->reloader())
m_controller->setReloader(0);
DiffEditorManager::removeDocument(this);
const QFileInfo fi(fileName);
setTemporary(false);
setFilePath(QDir::cleanPath(fi.absoluteFilePath()));
@@ -105,10 +111,7 @@ bool DiffEditorDocument::open(QString *errorString, const QString &fileName)
return false;
bool ok = false;
QList<FileData> fileDataList
= DiffUtils::readPatch(patch,
m_controller->isIgnoreWhitespace(),
&ok);
QList<FileData> fileDataList = DiffUtils::readPatch(patch, &ok);
if (!ok) {
*errorString = tr("Could not parse patch file \"%1\". "
"The content is not of unified diff format.")