forked from qt-creator/qt-creator
ProjectManagers: Avoid deletion of special files
Do not allow deletion or rename of files that are used to define or manage projects. This fixes issues of being able to remove or rename pri and pro files of qmake based projects as well as special files used by the GenericProjectManager. Change-Id: Ib173abf04368f0625a9e481bb7290aa11933e62f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -217,17 +217,8 @@ static bool supportsNodeAction(ProjectAction action, const Node *node)
|
||||
const QbsProject * const project = parentQbsProjectNode(node)->project();
|
||||
if (!project->isProjectEditable())
|
||||
return false;
|
||||
|
||||
auto equalsNodeFilePath = [node](const QString &str)
|
||||
{
|
||||
return str == node->filePath().toString();
|
||||
};
|
||||
|
||||
if (action == RemoveFile || action == Rename) {
|
||||
if (node->asFileNode())
|
||||
return !Utils::contains(project->qbsProject().buildSystemFiles(), equalsNodeFilePath);
|
||||
}
|
||||
|
||||
if (action == RemoveFile || action == Rename)
|
||||
return node->asFileNode();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user