forked from qt-creator/qt-creator
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:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user