ProjectExplorer: Add special handling for removing files

... from a project which are pulled in via wildcards.
Such files cannot be removed from a project file, because they are
not listed verbatim. This kind of failure should not be reported to the
user if the file is also deleted, as the file list will have the correct
state after the next reparse.

Fixes: QTCREATORBUG-22586
Done-with: Christian Kandeler <christian.kandeler@qt.io>
Change-Id: I3dc66fe9a6594be7d0b86f46d830cd099ee49fd7
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ville Nummela
2019-06-18 14:39:38 +03:00
committed by Christian Kandeler
parent 90ad2797eb
commit 63e4180242
20 changed files with 138 additions and 59 deletions

View File

@@ -276,7 +276,8 @@ bool QbsGroupNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
m_qbsGroupData, notAdded);
}
bool QbsGroupNode::removeFiles(const QStringList &filePaths, QStringList *notRemoved)
RemovedFilesFromProject QbsGroupNode::removeFiles(const QStringList &filePaths,
QStringList *notRemoved)
{
QStringList notRemovedDummy;
if (!notRemoved)
@@ -285,13 +286,13 @@ bool QbsGroupNode::removeFiles(const QStringList &filePaths, QStringList *notRem
const QbsProjectNode *prjNode = parentQbsProjectNode(this);
if (!prjNode || !prjNode->qbsProject().isValid()) {
*notRemoved += filePaths;
return false;
return RemovedFilesFromProject::Error;
}
const QbsProductNode *prdNode = parentQbsProductNode(this);
if (!prdNode || !prdNode->qbsProductData().isValid()) {
*notRemoved += filePaths;
return false;
return RemovedFilesFromProject::Error;
}
return prjNode->project()->removeFilesFromProduct(filePaths, prdNode->qbsProductData(),
@@ -361,7 +362,8 @@ bool QbsProductNode::addFiles(const QStringList &filePaths, QStringList *notAdde
QTC_ASSERT(false, return false);
}
bool QbsProductNode::removeFiles(const QStringList &filePaths, QStringList *notRemoved)
RemovedFilesFromProject QbsProductNode::removeFiles(const QStringList &filePaths,
QStringList *notRemoved)
{
QStringList notRemovedDummy;
if (!notRemoved)
@@ -370,7 +372,7 @@ bool QbsProductNode::removeFiles(const QStringList &filePaths, QStringList *notR
const QbsProjectNode *prjNode = parentQbsProjectNode(this);
if (!prjNode || !prjNode->qbsProject().isValid()) {
*notRemoved += filePaths;
return false;
return RemovedFilesFromProject::Error;
}
qbs::GroupData grp = findMainQbsGroup(m_qbsProductData);
@@ -379,7 +381,7 @@ bool QbsProductNode::removeFiles(const QStringList &filePaths, QStringList *notR
notRemoved);
}
QTC_ASSERT(false, return false);
QTC_ASSERT(false, return RemovedFilesFromProject::Error);
}
bool QbsProductNode::renameFile(const QString &filePath, const QString &newFilePath)