summaryrefslogtreecommitdiff
path: root/src/plugins/projectexplorer/project.cpp
diff options
context:
space:
mode:
authorTapani Mattila <tapani.mattila@qt.io>2021-05-03 14:47:13 +0300
committerMichael Winkelmann <michael.winkelmann@qt.io>2021-05-05 11:07:40 +0000
commitd5cadcfa599c4b523c28204552fe0a9d52742404 (patch)
tree51c118aed3859f62232e7f0a2c8b55b9ac0d0c9d /src/plugins/projectexplorer/project.cpp
parent2447d1d69ca941947c0df5cf32c6798f4cce1306 (diff)
downloadqt-creator-d5cadcfa599c4b523c28204552fe0a9d52742404.tar.gz
ProjectExplorer: Enable to easily check if a project has dirty files
Task-number: QDS-4241 Change-Id: I2fec5f411cdff9fabfa31bbd73971c0308df0783 Reviewed-by: Michael Winkelmann <michael.winkelmann@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/project.cpp')
-rw-r--r--src/plugins/projectexplorer/project.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index 908438b862..bbf35c342a 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -49,6 +49,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/iversioncontrol.h>
#include <coreplugin/vcsmanager.h>
+#include <coreplugin/editormanager/documentmodel.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/kitmanager.h>
@@ -1061,6 +1062,23 @@ QStringList Project::availableQmlPreviewTranslations(QString *errorMessage)
});
}
+QList<Core::IDocument *> Project::modifiedDocuments() const
+{
+ QList<Core::IDocument *> modifiedProjectDocuments;
+
+ for (Core::IDocument *doc : Core::DocumentModel::openedDocuments()) {
+ if (doc->isModified() && isKnownFile(doc->filePath()))
+ modifiedProjectDocuments.append(doc);
+ }
+
+ return modifiedProjectDocuments;
+}
+
+bool Project::isModified() const
+{
+ return !modifiedDocuments().isEmpty();
+}
+
#if defined(WITH_TESTS)
} // namespace ProjectExplorer