Commit cf9d12ed authored by Christian Kandeler's avatar Christian Kandeler
Browse files

QbsProjectManager: Do not offer to add and remove files during a build.



The build graph is locked then. Disabling the action in the first place
is nicer than letting the respective qbs API call fail.

Change-Id: Icfb89b454a240253c9ddc7681b452d06ff0393dd
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@digia.com>
parent fc24fe72
......@@ -324,6 +324,17 @@ bool QbsBaseProjectNode::renameFile(const QString &filePath, const QString &newF
return false;
}
static QList<ProjectExplorer::ProjectAction> supportedNodeActions(ProjectExplorer::Node *node)
{
QList<ProjectExplorer::ProjectAction> actions;
if (parentQbsProjectNode(node)->project()->isProjectEditable()) {
actions << ProjectExplorer::AddNewFile << ProjectExplorer::AddExistingFile
<< ProjectExplorer::RemoveFile;
}
return actions;
}
// --------------------------------------------------------------------
// QbsGroupNode:
// --------------------------------------------------------------------
......@@ -355,9 +366,7 @@ bool QbsGroupNode::isEnabled() const
QList<ProjectExplorer::ProjectAction> QbsGroupNode::supportedActions(ProjectExplorer::Node *node) const
{
Q_UNUSED(node);
return QList<ProjectExplorer::ProjectAction>() << ProjectExplorer::AddNewFile << ProjectExplorer::AddExistingFile
<< ProjectExplorer::RemoveFile;
return supportedNodeActions(node);
}
bool QbsGroupNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
......@@ -563,9 +572,7 @@ bool QbsProductNode::showInSimpleTree() const
QList<ProjectExplorer::ProjectAction> QbsProductNode::supportedActions(ProjectExplorer::Node *node) const
{
Q_UNUSED(node);
return QList<ProjectExplorer::ProjectAction>() << ProjectExplorer::AddNewFile << ProjectExplorer::AddExistingFile
<< ProjectExplorer::RemoveFile;
return supportedNodeActions(node);
}
bool QbsProductNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
......
......@@ -189,6 +189,11 @@ QStringList QbsProject::files(Project::FilesMode fileMode) const
return result.toList();
}
bool QbsProject::isProjectEditable() const
{
return m_qbsProject.isValid() && !isParsing() && !ProjectExplorer::BuildManager::isBuilding();
}
class ChangeExpector
{
public:
......
......@@ -70,6 +70,7 @@ public:
QStringList files(FilesMode fileMode) const;
bool isProjectEditable() const;
bool addFilesToProduct(QbsBaseProjectNode *node, const QStringList &filePaths,
const qbs::ProductData &productData, const qbs::GroupData &groupData,
QStringList *notAdded);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment