forked from qt-creator/qt-creator
File renaming
Reviewed-By: con Reviewed-By: Friedemann Kleint We now support renaming files. The version control system tries first to rename, if that doesn't support or can't rename the file we do a normal rename. (Note: git, hg, perforce > 2009.02 support renaming, cvs not. (perforce untested)). We correctly notify all editors of the renamed file and tell the project manager to rename the file in the project. Note: Only the qt4projectmanager knows how to rename files. Note: renaming folders, moving files to different folders, renaming .pro/.pri files is not supported. Those things can be later added after this has proven to work correctly in the simple case. Also we don't do any actions based on the renaming like renaming classes, changing include guards or #include lines.
This commit is contained in:
@@ -591,6 +591,13 @@ bool GenericProjectFile::isSaveAsAllowed() const
|
||||
return false;
|
||||
}
|
||||
|
||||
void GenericProjectFile::rename(const QString &newName)
|
||||
{
|
||||
// Can't happen
|
||||
Q_UNUSED(newName);
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
|
||||
Core::IFile::ReloadBehavior GenericProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
||||
{
|
||||
Q_UNUSED(state)
|
||||
|
||||
@@ -161,6 +161,7 @@ public:
|
||||
virtual bool isModified() const;
|
||||
virtual bool isReadOnly() const;
|
||||
virtual bool isSaveAsAllowed() const;
|
||||
virtual void rename(const QString &newName);
|
||||
|
||||
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
|
||||
void reload(ReloadFlag flag, ChangeType type);
|
||||
|
||||
@@ -170,8 +170,9 @@ bool GenericProjectNode::hasBuildTargets() const
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::ProjectNode::ProjectAction> GenericProjectNode::supportedActions() const
|
||||
QList<ProjectExplorer::ProjectNode::ProjectAction> GenericProjectNode::supportedActions(Node *node) const
|
||||
{
|
||||
Q_UNUSED(node);
|
||||
return QList<ProjectAction>()
|
||||
<< AddFile
|
||||
<< RemoveFile;
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
|
||||
virtual bool hasBuildTargets() const;
|
||||
|
||||
virtual QList<ProjectExplorer::ProjectNode::ProjectAction> supportedActions() const;
|
||||
virtual QList<ProjectExplorer::ProjectNode::ProjectAction> supportedActions(Node *node) const;
|
||||
|
||||
virtual bool addSubProjects(const QStringList &proFilePaths);
|
||||
virtual bool removeSubProjects(const QStringList &proFilePaths);
|
||||
|
||||
Reference in New Issue
Block a user