Index: /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.cpp	(revision 92489)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.cpp	(revision 92490)
@@ -44,4 +44,5 @@
     , m_fPolished(false)
     , m_iResult(QDialog::Rejected)
+    , m_fRejectByEscape(true)
 {
     /* Install event-filter: */
@@ -269,5 +270,5 @@
         case Qt::Key_Escape:
         {
-            if (pEvent->modifiers() == Qt::NoModifier)
+            if (pEvent->modifiers() == Qt::NoModifier && m_fRejectByEscape)
             {
                 reject();
@@ -330,2 +331,7 @@
     hide();
 }
+
+void QIMainDialog::setRejectByEscape(bool fRejectByEscape)
+{
+    m_fRejectByEscape = fRejectByEscape;
+}
Index: /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.h	(revision 92489)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.h	(revision 92490)
@@ -91,4 +91,7 @@
     QPushButton *searchDefaultButton() const;
 
+    /** Sets reject-by-escape-key flag. */
+    void setRejectByEscape(bool fRejectByEscape);
+
 protected slots:
 
@@ -121,4 +124,6 @@
     /** Holds dialog's size-grip. */
     QPointer<QSizeGrip>    m_pSizeGrip;
+    /** Holds reject by escape flag. When true pressing escape rejects the dialog. Default is true.*/
+    bool m_fRejectByEscape;
 };
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp	(revision 92489)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp	(revision 92490)
@@ -446,31 +446,28 @@
 void UIVisoCreatorWidget::manageEscapeShortCut()
 {
-    // /* Take the escape key from m_pButtonBox and from the panels in case treeview(s) in
-    //    host and/or content browser is open. We use the escape key to close those first: */
-    // if ((m_pHostBrowser && m_pHostBrowser->isTreeViewVisible()) ||
-    //     (m_pVISOContentBrowser && m_pVISOContentBrowser->isTreeViewVisible()))
-    // {
-    //     if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Cancel))
-    //         m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(QKeySequence());
-    //     for (int i = 0; i < m_visiblePanelsList.size(); ++i)
-    //         m_visiblePanelsList[i]->setCloseButtonShortCut(QKeySequence());
-    //     return;
-    // }
-
-    // /* if there are no visible panels then assign esc. key to cancel button of the button box: */
-    // if (m_visiblePanelsList.isEmpty())
-    // {
-    //     if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Cancel))
-    //         m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(QKeySequence(Qt::Key_Escape));
-    //     return;
-    // }
-    // if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Cancel))
-    //     m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(QKeySequence());
+    /* Take the escape key from m_pButtonBox and from the panels in case treeview(s) in
+       host and/or content browser is open. We use the escape key to close those first: */
+    if ((m_pHostBrowser && m_pHostBrowser->isTreeViewVisible()) ||
+        (m_pVISOContentBrowser && m_pVISOContentBrowser->isTreeViewVisible()))
+    {
+        emit sigSetCancelButtonShortCut(QKeySequence());
+        for (int i = 0; i < m_visiblePanelsList.size(); ++i)
+            m_visiblePanelsList[i]->setCloseButtonShortCut(QKeySequence());
+        return;
+    }
+
+    /* if there are no visible panels then assign esc. key to cancel button of the button box: */
+    if (m_visiblePanelsList.isEmpty())
+    {
+        emit sigSetCancelButtonShortCut(QKeySequence(Qt::Key_Escape));
+        return;
+    }
+    emit sigSetCancelButtonShortCut(QKeySequence());
 
     /* Just loop thru the visible panel list and set the esc key to the
        panel which made visible latest */
-    // for (int i = 0; i < m_visiblePanelsList.size() - 1; ++i)
-    //     m_visiblePanelsList[i]->setCloseButtonShortCut(QKeySequence());
-    // m_visiblePanelsList.back()->setCloseButtonShortCut(QKeySequence(Qt::Key_Escape));
+    for (int i = 0; i < m_visiblePanelsList.size() - 1; ++i)
+        m_visiblePanelsList[i]->setCloseButtonShortCut(QKeySequence());
+    m_visiblePanelsList.back()->setCloseButtonShortCut(QKeySequence(Qt::Key_Escape));
 }
 
@@ -518,4 +515,7 @@
     , m_pActionPool(pActionPool)
 {
+    /* Make sure that the base class does not close this dialog upon pressing escape.
+       we manage escape key here with special casing: */
+    setRejectByEscape(false);
     prepareWidgets();
     prepareConnections();
@@ -569,4 +569,6 @@
         menuBar()->addMenu(m_pVisoCreatorWidget->menu());
         pMainLayout->addWidget(m_pVisoCreatorWidget);
+        connect(m_pVisoCreatorWidget, &UIVisoCreatorWidget::sigSetCancelButtonShortCut,
+                this, &UIVisoCreatorDialog::sltSetCancelButtonShortCut);
     }
 
@@ -575,5 +577,5 @@
     {
         m_pButtonBox->setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
-        m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(Qt::Key_Escape);
+        m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(QKeySequence(Qt::Key_Escape));
         pMainLayout->addWidget(m_pButtonBox);
 
@@ -610,2 +612,8 @@
         m_pButtonBox->button(QDialogButtonBox::Help)->setToolTip(UIVisoCreatorWidget::tr("Opens the help browser and navigates to the related section"));
 }
+
+void UIVisoCreatorDialog::sltSetCancelButtonShortCut(QKeySequence keySequence)
+{
+    if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Cancel))
+        m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(keySequence);
+}
Index: /trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h	(revision 92489)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h	(revision 92490)
@@ -49,4 +49,8 @@
 {
     Q_OBJECT;
+
+signals:
+
+    void sigSetCancelButtonShortCut(QKeySequence keySequence);
 
 public:
@@ -184,4 +188,8 @@
     void    setCurrentPath(const QString &strPath);
 
+private slots:
+
+    void sltSetCancelButtonShortCut(QKeySequence keySequence);
+
 private:
     void prepareWidgets();
