forked from qt-creator/qt-creator
Nodes: Remove findFile and findFolder methods
There may be more than one matching node, so these methods provided a false sense of reliability. Change-Id: I6471b74a1d2dd4e8afc7e836fec45355696a0741 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -313,24 +313,6 @@ void FolderNode::setIcon(const QIcon &icon)
|
|||||||
m_icon = icon;
|
m_icon = icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileNode *FolderNode::findFile(const QString &path)
|
|
||||||
{
|
|
||||||
foreach (FileNode *n, fileNodes()) {
|
|
||||||
if (n->path() == path)
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
FolderNode *FolderNode::findSubFolder(const QString &path)
|
|
||||||
{
|
|
||||||
foreach (FolderNode *n, subFolderNodes()) {
|
|
||||||
if (n->path() == path)
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FolderNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
|
bool FolderNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
|
||||||
{
|
{
|
||||||
if (projectNode())
|
if (projectNode())
|
||||||
|
|||||||
@@ -174,9 +174,6 @@ public:
|
|||||||
void setDisplayName(const QString &name);
|
void setDisplayName(const QString &name);
|
||||||
void setIcon(const QIcon &icon);
|
void setIcon(const QIcon &icon);
|
||||||
|
|
||||||
FileNode *findFile(const QString &path);
|
|
||||||
FolderNode *findSubFolder(const QString &path);
|
|
||||||
|
|
||||||
virtual bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
|
virtual bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
|
||||||
virtual bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
|
virtual bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
|
||||||
virtual bool deleteFiles(const QStringList &filePaths);
|
virtual bool deleteFiles(const QStringList &filePaths);
|
||||||
|
|||||||
@@ -424,7 +424,14 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root,
|
|||||||
|
|
||||||
// Handle files:
|
// Handle files:
|
||||||
if (c->isFile()) {
|
if (c->isFile()) {
|
||||||
ProjectExplorer::FileNode *fn = root->findFile(path);
|
ProjectExplorer::FileNode *fn = 0;
|
||||||
|
foreach (ProjectExplorer::FileNode *f, root->fileNodes()) {
|
||||||
|
// There can be one match only here!
|
||||||
|
if (f->path() != path)
|
||||||
|
continue;
|
||||||
|
fn = f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (fn) {
|
if (fn) {
|
||||||
filesToRemove.removeOne(fn);
|
filesToRemove.removeOne(fn);
|
||||||
if (updateExisting)
|
if (updateExisting)
|
||||||
@@ -435,7 +442,14 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root,
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
FolderNode *fn = root->findSubFolder(c->path());
|
ProjectExplorer::FolderNode *fn = 0;
|
||||||
|
foreach (ProjectExplorer::FolderNode *f, root->subFolderNodes()) {
|
||||||
|
// There can be one match only here!
|
||||||
|
if (f->path() != path)
|
||||||
|
continue;
|
||||||
|
fn = f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!fn) {
|
if (!fn) {
|
||||||
fn = new FolderNode(c->path());
|
fn = new FolderNode(c->path());
|
||||||
root->addFolderNodes(QList<FolderNode *>() << fn);
|
root->addFolderNodes(QList<FolderNode *>() << fn);
|
||||||
|
|||||||
Reference in New Issue
Block a user