From 86e59fa1abce8b345c52270a4f755692a561eb49 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 29 Apr 2016 13:24:12 +0200 Subject: [PATCH] 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 --- .../qmljseditor/qmljscomponentfromobjectdef.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp index eca12dc55f7..f0116d28c24 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)