Commit 136f58c1 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

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: default avatarDaniel Teske <daniel.teske@digia.com>
parent 3804de50
......@@ -313,24 +313,6 @@ void FolderNode::setIcon(const QIcon &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)
{
if (projectNode())
......
......@@ -174,9 +174,6 @@ public:
void setDisplayName(const QString &name);
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 removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
virtual bool deleteFiles(const QStringList &filePaths);
......
......@@ -424,7 +424,14 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root,
// Handle files:
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) {
filesToRemove.removeOne(fn);
if (updateExisting)
......@@ -435,7 +442,14 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root,
}
continue;
} 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) {
fn = new FolderNode(c->path());
root->addFolderNodes(QList<FolderNode *>() << fn);
......
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