summaryrefslogtreecommitdiff
path: root/src/plugins/qmljseditor
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@theqtcompany.com>2016-04-29 13:24:12 +0200
committerThomas Hartmann <Thomas.Hartmann@theqtcompany.com>2016-05-02 07:41:12 +0000
commit86e59fa1abce8b345c52270a4f755692a561eb49 (patch)
treeb369c99e79aaa24c6ea357678700c550145b26e7 /src/plugins/qmljseditor
parentbb331566bdacf1545a6083baafbdc37306d19241 (diff)
downloadqt-creator-86e59fa1abce8b345c52270a4f755692a561eb49.tar.gz
QmlJSEditor: Do not use fileName()
The method fileName() is rendundant and the QmlJSQuickFixInterface does not have to be valid. Change-Id: Id91ed4c1adb26cf91d33be73689aec4f34034499 Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmljseditor')
-rw-r--r--src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
index eca12dc55f..f0116d28c2 100644
--- a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
+++ b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
@@ -102,7 +102,9 @@ public:
const QmlJSRefactoringChanges &refactoring)
{
QString componentName = m_componentName;
- QString path = QFileInfo(fileName()).path();
+
+ const QString currentFileName = currentFile->qmljsDocument()->fileName();
+ QString path = QFileInfo(currentFileName).path();
QmlJS::PropertyReader propertyReader(currentFile->qmljsDocument(), m_initializer);
QStringList result;
@@ -127,7 +129,7 @@ public:
bool confirm = ComponentNameDialog::go(&componentName, &path,
sortedPropertiesWithoutId,
sourcePreview,
- QFileInfo(fileName()).fileName(),
+ QFileInfo(currentFileName).fileName(),
&result,
Core::ICore::dialogParent());
if (!confirm)
@@ -182,10 +184,10 @@ public:
if (!refactoring.createFile(newFileName, newComponentSource))
return;
- if (path == QFileInfo(fileName()).path()) {
+ if (path == QFileInfo(currentFileName).path()) {
// hack for the common case, next version should use the wizard
ProjectExplorer::Node * oldFileNode =
- ProjectExplorer::SessionManager::nodeForFile(Utils::FileName::fromString(fileName()));
+ ProjectExplorer::SessionManager::nodeForFile(Utils::FileName::fromString(currentFileName));
if (oldFileNode) {
ProjectExplorer::FolderNode *containingFolder = oldFileNode->parentFolderNode();
if (containingFolder)