diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2019-06-21 14:28:00 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2019-06-21 14:05:17 +0000 |
commit | 7ceadd4c3fc9e2ee55036cfbfe2b883a0b027043 (patch) | |
tree | fa82beef36a02453630ae20d6936d6c1f6782566 | |
parent | a5402165499830416b70f290e680cb44e93193d1 (diff) |
ProjectExplorer: Respect pinned documents
...when closing the files of a project.
Also remove unused member IDocumentPrivate::pinned.
Amends fe21a7a77e.
Change-Id: I15fa06bcde2022c559c4bd7234625c5ea06ba26e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r-- | src/plugins/coreplugin/idocument.cpp | 1 | ||||
-rw-r--r-- | src/plugins/projectexplorer/projectexplorer.cpp | 10 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/plugins/coreplugin/idocument.cpp b/src/plugins/coreplugin/idocument.cpp index 8fde404064..aab9845f1a 100644 --- a/src/plugins/coreplugin/idocument.cpp +++ b/src/plugins/coreplugin/idocument.cpp @@ -79,7 +79,6 @@ public: bool hasWriteWarning = false; bool restored = false; bool isSuspendAllowed = false; - bool pinned = false; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 01b5bba1f7..834fd26b53 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1902,15 +1902,15 @@ void ProjectExplorerPluginPrivate::setStartupProject(Project *project) bool ProjectExplorerPluginPrivate::closeAllFilesInProject(const Project *project) { QTC_ASSERT(project, return false); - QList<IDocument *> openFiles = DocumentModel::openedDocuments(); - Utils::erase(openFiles, [project](const IDocument *doc) { - return !project->isKnownFile(doc->filePath()); + QList<DocumentModel::Entry *> openFiles = DocumentModel::entries(); + Utils::erase(openFiles, [project](const DocumentModel::Entry *entry) { + return entry->pinned || !project->isKnownFile(entry->fileName()); }); for (const Project * const otherProject : SessionManager::projects()) { if (otherProject == project) continue; - Utils::erase(openFiles, [otherProject](const IDocument *doc) { - return otherProject->isKnownFile(doc->filePath()); + Utils::erase(openFiles, [otherProject](const DocumentModel::Entry *entry) { + return otherProject->isKnownFile(entry->fileName()); }); } return EditorManager::closeDocuments(openFiles); |