ProjectExplorer: Check if the project can rename a specific file

before renaming the file.

This adds a new api:
FolderNode::canRename(oldFileName, newFileName) that asks the
project manager if a specific file renaming could be applied to
the project file.

Change-Id: I77bae56db06d81fd03e590285d6079abea2c514b
Task-number: QTCREATORBUG-14521
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Daniel Teske
2015-09-14 15:33:50 +02:00
parent 366e89e9cf
commit 798fa669bf
5 changed files with 104 additions and 18 deletions

View File

@@ -357,6 +357,13 @@ bool FolderNode::deleteFiles(const QStringList &filePaths)
return false;
}
bool FolderNode::canRenameFile(const QString &filePath, const QString &newFilePath)
{
if (projectNode())
return projectNode()->canRenameFile(filePath, newFilePath);
return false;
}
bool FolderNode::renameFile(const QString &filePath, const QString &newFilePath)
{
if (projectNode())
@@ -629,6 +636,13 @@ bool ProjectNode::deleteFiles(const QStringList &filePaths)
return false;
}
bool ProjectNode::canRenameFile(const QString &filePath, const QString &newFilePath)
{
Q_UNUSED(filePath);
Q_UNUSED(newFilePath);
return true;
}
bool ProjectNode::renameFile(const QString &filePath, const QString &newFilePath)
{
Q_UNUSED(filePath)