summaryrefslogtreecommitdiff
path: root/src/plugins/diffeditor
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2015-02-25 14:36:03 +0200
committerOrgad Shaneh <orgads@gmail.com>2015-02-26 14:56:25 +0000
commitaee35662a2b2b65ba31797a970edaf9bcd0fb05b (patch)
tree9aeb21e92f9b95694c135c0e188fc9d8a05110cd /src/plugins/diffeditor
parent991cf8499106e1e6a35efd35bcd62cfb2387552c (diff)
downloadqt-creator-aee35662a2b2b65ba31797a970edaf9bcd0fb05b.tar.gz
Prefix duplicate names in Open Documents to make them unique
If a document has a file name associated with it then the prefix is composed from path components (subdirectories), starting from the one where the file is located and going up the parents until the resulting name becomes unique among other open documents. If a document doesn't have an associated file name, then a sequential number (starting from 1) is appended to the display name of the document. This feature is useful when working with big projects that have lots of idendical file names across different subdirectories (e.g. Makefile.in, main.cpp, etc.) that need to be edited at the same time. It allows to easily recognize such a file when switching between documents in the editor, w/o the need to place the mouse pointer over the name entry to get its full path. Started-by: Dmitriy Kuminov <coding@dmik.org> Task-number: QTCREATORBUG-10185 Change-Id: I633ea6d9b9b4fce8b67335dbcce1bda29254efde Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Diffstat (limited to 'src/plugins/diffeditor')
-rw-r--r--src/plugins/diffeditor/diffeditordocument.cpp2
-rw-r--r--src/plugins/diffeditor/diffeditormanager.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/diffeditor/diffeditordocument.cpp b/src/plugins/diffeditor/diffeditordocument.cpp
index 0049abe8ff..262e2e9c09 100644
--- a/src/plugins/diffeditor/diffeditordocument.cpp
+++ b/src/plugins/diffeditor/diffeditordocument.cpp
@@ -88,7 +88,7 @@ bool DiffEditorDocument::save(QString *errorString, const QString &fileName, boo
const QFileInfo fi(fileName);
setTemporary(false);
setFilePath(Utils::FileName::fromString(fi.absoluteFilePath()));
- setDisplayName(QString());
+ setPreferredDisplayName(QString());
return true;
}
diff --git a/src/plugins/diffeditor/diffeditormanager.cpp b/src/plugins/diffeditor/diffeditormanager.cpp
index 4462193936..06ec139e99 100644
--- a/src/plugins/diffeditor/diffeditormanager.cpp
+++ b/src/plugins/diffeditor/diffeditormanager.cpp
@@ -98,7 +98,7 @@ Core::IDocument *DiffEditorManager::findOrCreate(const QString &vcsId, const QSt
document = qobject_cast<Internal::DiffEditorDocument *>(diffEditor->document());
QTC_ASSERT(diffEditor, return 0);
- document->setDisplayName(displayName);
+ document->setPreferredDisplayName(displayName);
m_instance->m_idToDocument.insert(vcsId, document);