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>
This commit is contained in:
Thomas Hartmann
2016-04-29 13:24:12 +02:00
parent bb331566bd
commit 86e59fa1ab

View File

@@ -102,7 +102,9 @@ public:
const QmlJSRefactoringChanges &refactoring) const QmlJSRefactoringChanges &refactoring)
{ {
QString componentName = m_componentName; 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); QmlJS::PropertyReader propertyReader(currentFile->qmljsDocument(), m_initializer);
QStringList result; QStringList result;
@@ -127,7 +129,7 @@ public:
bool confirm = ComponentNameDialog::go(&componentName, &path, bool confirm = ComponentNameDialog::go(&componentName, &path,
sortedPropertiesWithoutId, sortedPropertiesWithoutId,
sourcePreview, sourcePreview,
QFileInfo(fileName()).fileName(), QFileInfo(currentFileName).fileName(),
&result, &result,
Core::ICore::dialogParent()); Core::ICore::dialogParent());
if (!confirm) if (!confirm)
@@ -182,10 +184,10 @@ public:
if (!refactoring.createFile(newFileName, newComponentSource)) if (!refactoring.createFile(newFileName, newComponentSource))
return; return;
if (path == QFileInfo(fileName()).path()) { if (path == QFileInfo(currentFileName).path()) {
// hack for the common case, next version should use the wizard // hack for the common case, next version should use the wizard
ProjectExplorer::Node * oldFileNode = ProjectExplorer::Node * oldFileNode =
ProjectExplorer::SessionManager::nodeForFile(Utils::FileName::fromString(fileName())); ProjectExplorer::SessionManager::nodeForFile(Utils::FileName::fromString(currentFileName));
if (oldFileNode) { if (oldFileNode) {
ProjectExplorer::FolderNode *containingFolder = oldFileNode->parentFolderNode(); ProjectExplorer::FolderNode *containingFolder = oldFileNode->parentFolderNode();
if (containingFolder) if (containingFolder)