Don't show error message if file added to qmlproject is picked up

Check for the case that a new file to be added to a .qmlproject
is also automatically covered e.g. by a wildcard filter. In this
case we don't have to do anything.
This commit is contained in:
Kai Koehne
2010-02-17 11:20:35 +01:00
parent 24a225de40
commit b5646d35da
8 changed files with 115 additions and 7 deletions

View File

@@ -115,6 +115,26 @@ QStringList QmlProjectItem::files() const
return files;
}
/**
Check whether the project would include a file path
- regardless whether the file already exists or not.
@param filePath: absolute file path to check
*/
bool QmlProjectItem::matchesFile(const QString &filePath) const
{
const Q_D(QmlProjectItem);
for (int i = 0; i < d->content.size(); ++i) {
QmlProjectContentItem *contentElement = d->content.at(i);
FileFilterBaseItem *fileFilter = qobject_cast<FileFilterBaseItem*>(contentElement);
if (fileFilter) {
if (fileFilter->matchesFile(filePath))
return true;
}
}
return false;
}
} // namespace QmlProjectManager
QML_DEFINE_NOCREATE_TYPE(QmlProjectManager::QmlProjectContentItem)