forked from qt-creator/qt-creator
File renaming: Show a warning message if a project could not be changed
Except if we expect the changing to do nothing, e.g. if the file is added via a folder deployment. Change-Id: Ic6a8caa27e6ce3e779ac9cd13a43a6898360bfea Reviewed-by: Leena Miettinen <riitta-leena.miettinen@nokia.com> Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -2844,8 +2844,13 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &to)
|
||||
Core::DocumentManager::renamedFile(orgFilePath, newFilePath);
|
||||
// Tell the project plugin about it
|
||||
ProjectNode *projectNode = fileNode->projectNode();
|
||||
projectNode->renameFile(fileNode->fileType(), orgFilePath, newFilePath);
|
||||
// TODO emit a signal?
|
||||
if (!projectNode->renameFile(fileNode->fileType(), orgFilePath, newFilePath)) {
|
||||
QMessageBox::warning(Core::ICore::mainWindow(), tr("Project Editing Failed"),
|
||||
tr("The file %1 was renamed to %2, but the project file %3 could not be automatically changed.")
|
||||
.arg(orgFilePath)
|
||||
.arg(newFilePath)
|
||||
.arg(projectNode->displayName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -992,12 +992,14 @@ bool Qt4PriFileNode::renameFile(const FileType fileType, const QString &filePath
|
||||
if (newFilePath.isEmpty())
|
||||
return false;
|
||||
|
||||
bool changeProFileOptional = deploysFolder(QFileInfo(filePath).absolutePath());
|
||||
|
||||
QStringList dummy;
|
||||
changeFiles(fileType, QStringList() << filePath, &dummy, RemoveFromProFile);
|
||||
if (!dummy.isEmpty())
|
||||
if (!dummy.isEmpty() && !changeProFileOptional)
|
||||
return false;
|
||||
changeFiles(fileType, QStringList() << newFilePath, &dummy, AddToProFile);
|
||||
if (!dummy.isEmpty())
|
||||
if (!dummy.isEmpty() && !changeProFileOptional)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user