ResourceEditor/Node: Add 'Remove missing files' feature

Change-Id: I081ec83b8cdb4f7c29e754b95370b58865ca2993
Task-number: QTCREATORBUG-13941
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Daniel Teske
2015-05-21 15:32:12 +02:00
parent 47660a8f09
commit d7fbe79c1f
14 changed files with 147 additions and 1 deletions

View File

@@ -256,6 +256,29 @@ bool ResourceTopLevelNode::removePrefix(const QString &prefix, const QString &la
return false;
}
bool ResourceTopLevelNode::removeNonExistingFiles()
{
ResourceFile file(path().toString());
if (!file.load())
return false;
QFileInfo fi;
for (int i = 0; i < file.prefixCount(); ++i) {
int fileCount = file.fileCount(i);
for (int j = fileCount -1; j >= 0; --j) {
fi.setFile(file.file(i, j));
if (!fi.exists())
file.removeFile(i, j);
}
}
Core::DocumentManager::expectFileChange(path().toString());
file.save();
Core::DocumentManager::unexpectFileChange(path().toString());
return true;
}
ProjectExplorer::FolderNode::AddNewInformation ResourceTopLevelNode::addNewInformation(const QStringList &files, Node *context) const
{
QString name = QCoreApplication::translate("ResourceTopLevelNode", "%1 Prefix: %2")