diff --git a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp index 4292b49c48f..92c1df8b4b5 100644 --- a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp +++ b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp @@ -103,7 +103,10 @@ public: { QString componentName = m_componentName; QString path = QFileInfo(fileName()).path(); - ComponentNameDialog::go(&componentName, &path, Core::ICore::dialogParent()); + bool confirm = ComponentNameDialog::go(&componentName, &path, Core::ICore::dialogParent()); + + if (!confirm) + return; if (componentName.isEmpty() || path.isEmpty()) return; diff --git a/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp b/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp index cdab84acfd1..85048aeacdc 100644 --- a/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp +++ b/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp @@ -54,7 +54,7 @@ ComponentNameDialog::~ComponentNameDialog() delete ui; } -void ComponentNameDialog::go(QString *proposedName, +bool ComponentNameDialog::go(QString *proposedName, QString *proposedPath, QWidget *parent) { @@ -73,7 +73,10 @@ void ComponentNameDialog::go(QString *proposedName, if (QDialog::Accepted == d.exec()) { *proposedName = d.ui->componentNameEdit->text(); *proposedPath = d.ui->pathEdit->path(); + return true; } + + return false; } void ComponentNameDialog::choosePath() diff --git a/src/plugins/qmljseditor/qmljscomponentnamedialog.h b/src/plugins/qmljseditor/qmljscomponentnamedialog.h index 30bb2b8ced3..4a6cd0938b7 100644 --- a/src/plugins/qmljseditor/qmljscomponentnamedialog.h +++ b/src/plugins/qmljseditor/qmljscomponentnamedialog.h @@ -46,7 +46,7 @@ public: explicit ComponentNameDialog(QWidget *parent = 0); ~ComponentNameDialog(); - static void go(QString *proposedName, QString *proposedPath, QWidget *parent = 0); + static bool go(QString *proposedName, QString *proposedPath, QWidget *parent = 0); public slots: void choosePath();