Clear the uniqueId of diff editor when saving

Saving diff editor transforms it to patch-file
read only editor. Clearing the uniqueId
ensures we don't use it anymore for showing
e.g. current file's modifications.

Change-Id: I2010161697bbad254ce1ebe5d0bb6a1f38ae323c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2016-11-23 15:37:31 +01:00
parent 0a9414d467
commit f720daed91
3 changed files with 7 additions and 0 deletions

View File

@@ -2798,6 +2798,11 @@ bool EditorManager::skipOpeningBigTextFile(const QString &filePath)
return EditorManagerPrivate::skipOpeningBigTextFile(filePath);
}
void EditorManager::clearUniqueId(IDocument *document)
{
document->setProperty(scratchBufferKey, QVariant());
}
bool EditorManager::saveDocument(IDocument *document)
{
return EditorManagerPrivate::saveDocument(document);

View File

@@ -119,6 +119,7 @@ public:
const QString &uniqueId = QString(),
OpenEditorFlags flags = NoFlags);
static bool skipOpeningBigTextFile(const QString &filePath);
static void clearUniqueId(IDocument *document);
static bool openExternalEditor(const QString &fileName, Id editorId);
static void addCloseEditorListener(const std::function<bool(IEditor *)> &listener);

View File

@@ -215,6 +215,7 @@ bool DiffEditorDocument::save(QString *errorString, const QString &fileName, boo
setController(0);
setDescription(QString());
Core::EditorManager::clearUniqueId(this);
const QFileInfo fi(fileName);
setTemporary(false);