diff --git a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
index 3f08786114f5275d6075b7f38538692788d48c86..85c5d679c6042ef11b3d2dc65573f02d0f4f2a67 100644
--- a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
+++ b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
@@ -28,6 +28,7 @@
 **************************************************************************/
 
 #include "qmljscomponentfromobjectdef.h"
+#include "qmljscomponentnamedialog.h"
 #include "qmljsrefactoringchanges.h"
 
 #include <coreplugin/ifile.h>
@@ -86,16 +87,30 @@ public:
         Q_ASSERT(m_objDef != 0);
 
         m_componentName = getIdProperty(m_objDef);
-        m_componentName[0] = m_componentName.at(0).toUpper();
 
-        setDescription(QCoreApplication::translate("QmlJSEditor::ComponentFromObjectDef",
-                                                   "Move Component into '%1.qml'").arg(m_componentName));
+        if (m_componentName.isEmpty()) {
+            setDescription(QCoreApplication::translate("QmlJSEditor::ComponentFromObjectDef",
+                                                       "Move Component into separate file'"));
+        } else {
+            m_componentName[0] = m_componentName.at(0).toUpper();
+            setDescription(QCoreApplication::translate("QmlJSEditor::ComponentFromObjectDef",
+                                                       "Move Component into '%1.qml'").arg(m_componentName));
+        }
     }
 
     virtual void performChanges(QmlJSRefactoringFile *currentFile, QmlJSRefactoringChanges *refactoring)
     {
-        const QString newFileName = QFileInfo(fileName()).path()
-                + QDir::separator() + m_componentName + QLatin1String(".qml");
+        QString componentName = m_componentName;
+        QString path = QFileInfo(fileName()).path();
+        if (componentName.isEmpty()) {
+            ComponentNameDialog::go(&componentName, &path, state().editor());
+        }
+
+        if (componentName.isEmpty() || path.isEmpty())
+            return;
+
+        const QString newFileName = path + QDir::separator() + componentName
+                + QLatin1String(".qml");
 
         QString imports;
         UiProgram *prog = currentFile->qmljsDocument()->qmlProgram();
@@ -115,7 +130,7 @@ public:
             return;
 
         Utils::ChangeSet changes;
-        changes.replace(start, end, m_componentName + QLatin1String(" {\n"));
+        changes.replace(start, end, componentName + QLatin1String(" {\n"));
         currentFile->change(changes);
         currentFile->indent(Range(start, end + 1));
     }
@@ -134,10 +149,8 @@ QList<QmlJSQuickFixOperation::Ptr> ComponentFromObjectDef::match(const QmlJSQuic
         if (UiObjectDefinition *objDef = cast<UiObjectDefinition *>(node)) {
              // check that the node is not the root node
             if (i > 0 && !cast<UiProgram*>(path.at(i - 1))) {
-                if (!getIdProperty(objDef).isEmpty()) {
-                    result.append(QmlJSQuickFixOperation::Ptr(new Operation(state, objDef)));
-                    return result;
-                }
+                result.append(QmlJSQuickFixOperation::Ptr(new Operation(state, objDef)));
+                return result;
             }
         }
     }
diff --git a/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp b/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..54afa2a6a6a0e7dbfc84b97297d9a357522a5c59
--- /dev/null
+++ b/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp
@@ -0,0 +1,100 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "qmljscomponentnamedialog.h"
+#include "ui_qmljscomponentnamedialog.h"
+
+#include <QtCore/QFileInfo>
+#include <QtGui/QFileDialog>
+
+using namespace QmlJSEditor::Internal;
+
+ComponentNameDialog::ComponentNameDialog(QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::ComponentNameDialog)
+{
+    ui->setupUi(this);
+
+    connect(ui->choosePathButton, SIGNAL(clicked()),
+            this, SLOT(choosePath()));
+    connect(ui->pathEdit, SIGNAL(textChanged(QString)),
+            this, SLOT(validate()));
+    connect(ui->componentNameEdit, SIGNAL(textChanged(QString)),
+            this, SLOT(validate()));
+}
+
+ComponentNameDialog::~ComponentNameDialog()
+{
+    delete ui;
+}
+
+void ComponentNameDialog::go(QString *proposedName,
+                             QString *proposedPath,
+                             QWidget *parent)
+{
+    Q_ASSERT(proposedName);
+    Q_ASSERT(proposedPath);
+
+    ComponentNameDialog d(parent);
+    d.ui->componentNameEdit->setText(*proposedName);
+    d.ui->pathEdit->setText(*proposedPath);
+
+    if (QDialog::Accepted == d.exec()) {
+        *proposedName = d.ui->componentNameEdit->text();
+        *proposedPath = d.ui->pathEdit->text();
+    }
+}
+
+void ComponentNameDialog::choosePath()
+{
+    QString dir = QFileDialog::getExistingDirectory(this, tr("Choose a path"),
+                                                    ui->pathEdit->text());
+    if (!dir.isEmpty())
+        ui->pathEdit->setText(dir);
+}
+
+void ComponentNameDialog::validate()
+{
+    const QString msg = isValid();
+    ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(msg.isEmpty());
+    ui->messageLabel->setText(msg);
+}
+
+QString ComponentNameDialog::isValid() const
+{
+    QString compName = ui->componentNameEdit->text();
+    if (compName.isEmpty() || !compName[0].isUpper())
+        return tr("Invalid component name");
+
+    QString path = ui->pathEdit->text();
+    if (path.isEmpty() || !QFileInfo(path).isDir())
+        return tr("Invalid path");
+
+    return QString::null;
+}
diff --git a/src/plugins/qmljseditor/qmljscomponentnamedialog.h b/src/plugins/qmljseditor/qmljscomponentnamedialog.h
new file mode 100644
index 0000000000000000000000000000000000000000..d9523584d31bc406088ec7994b038a4a4848f7da
--- /dev/null
+++ b/src/plugins/qmljseditor/qmljscomponentnamedialog.h
@@ -0,0 +1,68 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef QMLJSCOMPONENTNAMEDIALOG_H
+#define QMLJSCOMPONENTNAMEDIALOG_H
+
+#include <QtGui/QDialog>
+
+QT_BEGIN_NAMESPACE
+namespace Ui {
+    class ComponentNameDialog;
+}
+QT_END_NAMESPACE
+
+namespace QmlJSEditor {
+namespace Internal {
+
+class ComponentNameDialog : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit ComponentNameDialog(QWidget *parent = 0);
+    ~ComponentNameDialog();
+
+    static void go(QString *proposedName, QString *proposedPath, QWidget *parent = 0);
+
+public slots:
+    void choosePath();
+    void validate();
+
+protected:
+    QString isValid() const;
+
+private:
+    Ui::ComponentNameDialog *ui;
+};
+
+} // namespace Internal
+} // namespace QmlJSEditor
+
+#endif // QMLJSCOMPONENTNAMEDIALOG_H
diff --git a/src/plugins/qmljseditor/qmljscomponentnamedialog.ui b/src/plugins/qmljseditor/qmljscomponentnamedialog.ui
new file mode 100644
index 0000000000000000000000000000000000000000..3b9171ceec633626b1a4a7b4f6c9e996fa248d01
--- /dev/null
+++ b/src/plugins/qmljseditor/qmljscomponentnamedialog.ui
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ComponentNameDialog</class>
+ <widget class="QDialog" name="ComponentNameDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>495</width>
+    <height>130</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <item>
+    <layout class="QGridLayout" name="gridLayout">
+     <property name="horizontalSpacing">
+      <number>8</number>
+     </property>
+     <property name="verticalSpacing">
+      <number>10</number>
+     </property>
+     <item row="0" column="0">
+      <widget class="QLabel" name="componentNameLabel">
+       <property name="text">
+        <string>Component name:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="1">
+      <widget class="QLineEdit" name="componentNameEdit"/>
+     </item>
+     <item row="1" column="0">
+      <widget class="QLabel" name="choosePathLabel">
+       <property name="text">
+        <string>Path:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="1">
+      <widget class="QLineEdit" name="pathEdit"/>
+     </item>
+     <item row="1" column="2">
+      <widget class="QPushButton" name="choosePathButton">
+       <property name="text">
+        <string>Choose...</string>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="1" colspan="2">
+      <widget class="QLabel" name="messageLabel">
+       <property name="text">
+        <string/>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>0</width>
+       <height>0</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>ComponentNameDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>ComponentNameDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/plugins/qmljseditor/qmljseditor.pro b/src/plugins/qmljseditor/qmljseditor.pro
index f51e277e55b9c4451a3acab2887efbff2718ea9a..976a82928192343d6b481115c65bd709762b66ea 100644
--- a/src/plugins/qmljseditor/qmljseditor.pro
+++ b/src/plugins/qmljseditor/qmljseditor.pro
@@ -30,7 +30,8 @@ HEADERS += \
     qmljseditorcodeformatter.h \
     qmljsoutlinetreeview.h \
     quicktoolbarsettingspage.h \
-    quicktoolbar.h
+    quicktoolbar.h \
+    qmljscomponentnamedialog.h
 
 SOURCES += \
     qmljscodecompletion.cpp \
@@ -54,10 +55,12 @@ SOURCES += \
     qmljseditorcodeformatter.cpp \
     qmljsoutlinetreeview.cpp \
     quicktoolbarsettingspage.cpp \
-    quicktoolbar.cpp
+    quicktoolbar.cpp \
+    qmljscomponentnamedialog.cpp
 
 RESOURCES += qmljseditor.qrc
 OTHER_FILES += QmlJSEditor.pluginspec QmlJSEditor.mimetypes.xml
 
 FORMS += \
-    quicktoolbarsettingspage.ui
+    quicktoolbarsettingspage.ui \
+    qmljscomponentnamedialog.ui