diff --git a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp index eeb2d535c15..0e1eac979e4 100644 --- a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp +++ b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp @@ -40,6 +40,9 @@ #include #include #include +#include +#include +#include #include #include @@ -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)) {