diff options
author | Fawzi Mohamed <fawzi.mohamed@digia.com> | 2014-04-02 03:17:41 +0200 |
---|---|---|
committer | Fawzi Mohamed <fawzi.mohamed@digia.com> | 2014-04-02 12:49:12 +0200 |
commit | 0c68cbbaa926d48068cc30c766e202f1eb6c7360 (patch) | |
tree | d3176fed73464744630f92f0f3a7b1047400a372 | |
parent | 2326cf7d9631a999eef1bf10f66324fcf7d53b16 (diff) | |
download | qt-creator-0c68cbbaa926d48068cc30c766e202f1eb6c7360.tar.gz |
ios: fix refactoring (adding to qrc) in the common case
Task-number:QTCREATORBUG-11548
Change-Id: I6224b8745bf87981f5b305328294437cc51a7e7f
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
-rw-r--r-- | src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp index eeb2d535c1..0e1eac979e 100644 --- a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp +++ b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp @@ -40,6 +40,9 @@ #include <qmljs/qmljsdocument.h> #include <qmljs/qmljsutils.h> #include <qmljstools/qmljsrefactoringchanges.h> +#include <projectexplorer/session.h> +#include <projectexplorer/projectnodes.h> +#include <projectexplorer/project.h> #include <QCoreApplication> #include <QDir> @@ -108,6 +111,16 @@ public: if (!refactoring.createFile(newFileName, txt)) return; + if (path == QFileInfo(fileName()).path()) { + // hack for the common case, next version should use the wizard + ProjectExplorer::Node * oldFileNode = ProjectExplorer::SessionManager::nodeForFile(fileName()); + if (oldFileNode) { + ProjectExplorer::FolderNode *containingFolder = oldFileNode->parentFolderNode(); + if (containingFolder) + containingFolder->addFiles(QStringList(newFileName)); + } + } + Core::IVersionControl *versionControl = Core::VcsManager::findVersionControlForDirectory(path); if (versionControl && versionControl->supportsOperation(Core::IVersionControl::AddOperation)) { |