Commit 6de2b281 authored by Andre Hartmann's avatar Andre Hartmann Committed by Daniel Teske
Browse files

Implemented rename file feature for generic projects.



Change-Id: I195c48c5eaa458bdb537a8de4d7b71f17a704f41
Reviewed-by: Thorbjørn Lindeijer
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent a5543b89
......@@ -190,6 +190,22 @@ bool GenericProject::setFiles(const QStringList &filePaths)
return saveRawFileList(newList);
}
bool GenericProject::renameFile(const QString &filePath, const QString &newFilePath)
{
QStringList newList = m_rawFileList;
QHash<QString, QString>::iterator i = m_rawListEntries.find(filePath);
if (i != m_rawListEntries.end()) {
int index = newList.indexOf(i.value());
if (index != -1) {
QDir baseDir(QFileInfo(m_fileName).dir());
newList.replace(index, baseDir.relativeFilePath(newFilePath));
}
}
return saveRawFileList(newList);
}
void GenericProject::parseProject(RefreshOptions options)
{
if (options & Files) {
......
......@@ -97,6 +97,7 @@ public:
bool addFiles(const QStringList &filePaths);
bool removeFiles(const QStringList &filePaths);
bool setFiles(const QStringList &filePaths);
bool renameFile(const QString &filePath, const QString &newFilePath);
enum RefreshOptions {
Files = 0x01,
......
......@@ -175,7 +175,8 @@ QList<ProjectExplorer::ProjectNode::ProjectAction> GenericProjectNode::supported
return QList<ProjectAction>()
<< AddNewFile
<< AddExistingFile
<< RemoveFile;
<< RemoveFile
<< Rename;
}
bool GenericProjectNode::canAddSubProject(const QString &proFilePath) const
......@@ -226,9 +227,8 @@ bool GenericProjectNode::renameFile(const ProjectExplorer::FileType fileType,
const QString &filePath, const QString &newFilePath)
{
Q_UNUSED(fileType)
Q_UNUSED(filePath)
Q_UNUSED(newFilePath)
return false;
return m_project->renameFile(filePath, newFilePath);
}
QList<ProjectExplorer::RunConfiguration *> GenericProjectNode::runConfigurationsFor(Node *node)
......
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