forked from qt-creator/qt-creator
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>
This commit is contained in:
committed by
Michael Winkelmann
parent
2447d1d69c
commit
d5cadcfa59
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user