Commit c976024c authored by Daniel Teske's avatar Daniel Teske
Browse files

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: default avatarLeena Miettinen <riitta-leena.miettinen@nokia.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent dc327294
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment