Index: trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 71869)
+++ trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 71870)
@@ -441,5 +441,4 @@
 	src/UITakeSnapshotDialog.h \
 	src/extensions/QIFlowLayout.h \
-	src/extensions/QIMainDialog.h \
 	src/extensions/QIManagerDialog.h \
 	src/extensions/QIMenu.h \
@@ -659,4 +658,5 @@
 	src/extensions/QILabelSeparator.h \
 	src/extensions/QILineEdit.h \
+	src/extensions/QIMainDialog.h \
 	src/extensions/QIMainWindow.h \
 	src/extensions/QIMessageBox.h \
@@ -735,4 +735,5 @@
 	src/extensions/QILabelSeparator.h \
 	src/extensions/QILineEdit.h \
+	src/extensions/QIMainDialog.h \
 	src/extensions/QIMainWindow.h \
 	src/extensions/QIMessageBox.h \
@@ -909,5 +910,4 @@
 	src/UITakeSnapshotDialog.cpp \
 	src/extensions/QIFlowLayout.cpp \
-	src/extensions/QIMainDialog.cpp \
 	src/extensions/QIManagerDialog.cpp \
 	src/extensions/QIMenu.cpp \
@@ -1159,4 +1159,5 @@
 	src/extensions/QILabelSeparator.cpp \
 	src/extensions/QILineEdit.cpp \
+	src/extensions/QIMainDialog.cpp \
 	src/extensions/QIMainWindow.cpp \
 	src/extensions/QIMessageBox.cpp \
@@ -1262,4 +1263,5 @@
 	src/extensions/QILabelSeparator.cpp \
 	src/extensions/QILineEdit.cpp \
+	src/extensions/QIMainDialog.cpp \
 	src/extensions/QIMainWindow.cpp \
 	src/extensions/QIMessageBox.cpp \
Index: trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.cpp	(revision 71869)
+++ trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.cpp	(revision 71870)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2008-2017 Oracle Corporation
+ * Copyright (C) 2008-2018 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -21,13 +21,13 @@
 
 /* Qt includes: */
+# include <QApplication>
+# include <QDialogButtonBox>
 # include <QDir>
-# include <QUrl>
+# include <QEventLoop>
 # include <QMenu>
 # include <QProcess>
+# include <QPushButton>
 # include <QSizeGrip>
-# include <QEventLoop>
-# include <QPushButton>
-# include <QApplication>
-# include <QDialogButtonBox>
+# include <QUrl>
 
 /* GUI includes: */
@@ -41,8 +41,9 @@
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
+
 QIMainDialog::QIMainDialog(QWidget *pParent /* = 0 */,
-                           Qt::WindowFlags enmFlags /* = Qt::Dialog */,
+                           Qt::WindowFlags fFlags /* = Qt::Dialog */,
                            bool fIsAutoCentering /* = true */)
-    : QMainWindow(pParent, enmFlags)
+    : QMainWindow(pParent, fFlags)
     , m_fIsAutoCentering(fIsAutoCentering)
     , m_fPolished(false)
@@ -109,5 +110,5 @@
 }
 
-QPushButton* QIMainDialog::defaultButton() const
+QPushButton *QIMainDialog::defaultButton() const
 {
     return m_pDefaultButton;
@@ -152,9 +153,59 @@
 }
 
-bool QIMainDialog::event(QEvent *pEvent)
-{
+bool QIMainDialog::eventFilter(QObject *pObject, QEvent *pEvent)
+{
+    /* Skip for inactive window: */
+    if (!isActiveWindow())
+        return QMainWindow::eventFilter(pObject, pEvent);
+
+    /* Skip for children of other than this one window: */
+    if (qobject_cast<QWidget*>(pObject) &&
+        qobject_cast<QWidget*>(pObject)->window() != this)
+        return QMainWindow::eventFilter(pObject, pEvent);
+
     /* Depending on event-type: */
     switch (pEvent->type())
     {
+        /* Auto-default-button focus-in processor used to move the "default"
+         * button property into the currently focused button. */
+        case QEvent::FocusIn:
+        {
+            if (qobject_cast<QPushButton*>(pObject) &&
+                (pObject->parent() == centralWidget() ||
+                 qobject_cast<QDialogButtonBox*>(pObject->parent())))
+            {
+                qobject_cast<QPushButton*>(pObject)->setDefault(pObject != m_pDefaultButton);
+                if (m_pDefaultButton)
+                    m_pDefaultButton->setDefault(pObject == m_pDefaultButton);
+            }
+            break;
+        }
+        /* Auto-default-button focus-out processor used to remove the "default"
+         * button property from the previously focused button. */
+        case QEvent::FocusOut:
+        {
+            if (qobject_cast<QPushButton*>(pObject) &&
+                (pObject->parent() == centralWidget() ||
+                 qobject_cast<QDialogButtonBox*>(pObject->parent())))
+            {
+                if (m_pDefaultButton)
+                    m_pDefaultButton->setDefault(pObject != m_pDefaultButton);
+                qobject_cast<QPushButton*>(pObject)->setDefault(pObject == m_pDefaultButton);
+            }
+            break;
+        }
+        default:
+            break;
+    }
+
+    /* Call to base-class: */
+    return QMainWindow::eventFilter(pObject, pEvent);
+}
+
+bool QIMainDialog::event(QEvent *pEvent)
+{
+    /* Depending on event-type: */
+    switch (pEvent->type())
+    {
         case QEvent::Polish:
         {
@@ -172,4 +223,13 @@
 
 void QIMainDialog::showEvent(QShowEvent *pEvent)
+{
+    /* Call to polish-event: */
+    polishEvent(pEvent);
+
+    /* Call to base-class: */
+    QMainWindow::showEvent(pEvent);
+}
+
+void QIMainDialog::polishEvent(QShowEvent *)
 {
     /* Make sure we should polish dialog: */
@@ -177,16 +237,10 @@
         return;
 
-    /* Call to polish-event: */
-    polishEvent(pEvent);
-
-    /* Mark dialog as polished: */
-    m_fPolished = true;
-}
-
-void QIMainDialog::polishEvent(QShowEvent*)
-{
     /* Explicit centering according to our parent: */
     if (m_fIsAutoCentering)
         VBoxGlobal::centerWidget(this, parentWidget(), false);
+
+    /* Mark dialog as polished: */
+    m_fPolished = true;
 }
 
@@ -262,58 +316,8 @@
 
     /* Call to base-class: */
-    return QMainWindow::keyPressEvent(pEvent);
-}
-
-bool QIMainDialog::eventFilter(QObject *pObject, QEvent *pEvent)
-{
-    /* Skip for inactive window: */
-    if (!isActiveWindow())
-        return QMainWindow::eventFilter(pObject, pEvent);
-
-    /* Skip for children of other than this one window: */
-    if (qobject_cast<QWidget*>(pObject) &&
-        qobject_cast<QWidget*>(pObject)->window() != this)
-        return QMainWindow::eventFilter(pObject, pEvent);
-
-    /* Depending on event-type: */
-    switch (pEvent->type())
-    {
-        /* Auto-default-button focus-in processor used to move the "default"
-         * button property into the currently focused button. */
-        case QEvent::FocusIn:
-        {
-            if (qobject_cast<QPushButton*>(pObject) &&
-                (pObject->parent() == centralWidget() ||
-                 qobject_cast<QDialogButtonBox*>(pObject->parent())))
-            {
-                qobject_cast<QPushButton*>(pObject)->setDefault(pObject != m_pDefaultButton);
-                if (m_pDefaultButton)
-                    m_pDefaultButton->setDefault(pObject == m_pDefaultButton);
-            }
-            break;
-        }
-        /* Auto-default-button focus-out processor used to remove the "default"
-         * button property from the previously focused button. */
-        case QEvent::FocusOut:
-        {
-            if (qobject_cast<QPushButton*>(pObject) &&
-                (pObject->parent() == centralWidget() ||
-                 qobject_cast<QDialogButtonBox*>(pObject->parent())))
-            {
-                if (m_pDefaultButton)
-                    m_pDefaultButton->setDefault(pObject != m_pDefaultButton);
-                qobject_cast<QPushButton*>(pObject)->setDefault(pObject == m_pDefaultButton);
-            }
-            break;
-        }
-        default:
-            break;
-    }
-
-    /* Call to base-class: */
-    return QMainWindow::eventFilter(pObject, pEvent);
-}
-
-QPushButton* QIMainDialog::searchDefaultButton() const
+    QMainWindow::keyPressEvent(pEvent);
+}
+
+QPushButton *QIMainDialog::searchDefaultButton() const
 {
     /* Search for the first default-button in the dialog: */
@@ -334,3 +338,2 @@
     hide();
 }
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.h	(revision 71869)
+++ trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.h	(revision 71870)
@@ -1,9 +1,9 @@
 /* $Id$ */
 /** @file
- * VBox Qt GUI - Qt extensions: QIMainDialog class implementation.
+ * VBox Qt GUI - Qt extensions: QIMainDialog class declaration.
  */
 
 /*
- * Copyright (C) 2008-2017 Oracle Corporation
+ * Copyright (C) 2008-2018 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -20,7 +20,10 @@
 
 /* Qt includes: */
+#include <QDialog>
 #include <QMainWindow>
 #include <QPointer>
-#include <QDialog>
+
+/* GUI includes: */
+#include "UILibraryDefs.h"
 
 /* Forward declarations: */
@@ -30,5 +33,5 @@
 
 /** QDialog analog based on QMainWindow. */
-class QIMainDialog: public QMainWindow
+class SHARED_LIBRARY_STUFF QIMainDialog : public QMainWindow
 {
     Q_OBJECT;
@@ -36,10 +39,8 @@
 public:
 
-    /** Constructor.
-      * @param pParent           holds the parent widget passed to the base-class,
-      * @param enmFlags          holds the cumulative window flags passed to the base-class,
-      * @param fIsAutoCentering  defines whether this dialog should be centered according it's parent. */
+    /** Constructs main-dialog passing @a pParent and @a fFlags to the base-class.
+      * @param  fIsAutoCentering  Brigs whether this dialog should be centered according it's parent. */
     QIMainDialog(QWidget *pParent = 0,
-                 Qt::WindowFlags enmFlags = Qt::Dialog,
+                 Qt::WindowFlags fFlags = Qt::Dialog,
                  bool fIsAutoCentering = true);
 
@@ -51,7 +52,7 @@
     QDialog::DialogCode exec(bool fApplicationModal = true);
 
-    /** Returns dialog's default-button. */
-    QPushButton* defaultButton() const;
-    /** Defines dialog's default-button. */
+    /** Returns dialog's default button. */
+    QPushButton *defaultButton() const;
+    /** Defines dialog's default @a pButton. */
     void setDefaultButton(QPushButton *pButton);
 
@@ -68,19 +69,22 @@
 protected:
 
-    /** General event handler. */
-    virtual bool event(QEvent *pEvent);
-    /** Show event handler. */
-    virtual void showEvent(QShowEvent *pEvent);
-    /** Our own polish event handler. */
+    /** Preprocesses any Qt @a pEvent for passed @a pObject. */
+    virtual bool eventFilter(QObject *pObject, QEvent *pEvent) /* override */;
+    /** Handles any Qt @a pEvent. */
+    virtual bool event(QEvent *pEvent) /* override */;
+
+    /** Handles show @a pEvent. */
+    virtual void showEvent(QShowEvent *pEvent) /* override */;
+    /** Handles first show @a pEvent. */
     virtual void polishEvent(QShowEvent *pEvent);
-    /** Resize event handler. */
-    virtual void resizeEvent(QResizeEvent *pEvent);
-    /** Key-press event handler. */
-    virtual void keyPressEvent(QKeyEvent *pEvent);
-    /** General event filter. */
-    virtual bool eventFilter(QObject *aObject, QEvent *pEvent);
 
-    /** Function to search for dialog's default-button. */
-    QPushButton* searchDefaultButton() const;
+    /** Handles resize @a pEvent. */
+    virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
+
+    /** Handles key-press @a pEvent. */
+    virtual void keyPressEvent(QKeyEvent *pEvent) /* override */;
+
+    /** Searches for dialog's default button. */
+    QPushButton *searchDefaultButton() const;
 
 protected slots:
@@ -101,17 +105,17 @@
 
     /** Holds whether this dialog should be centered according it's parent. */
-    const bool m_fIsAutoCentering;
+    const bool  m_fIsAutoCentering;
     /** Holds whether this dialog is polished. */
-    bool m_fPolished;
+    bool        m_fPolished;
 
     /** Holds modal dialog's result code. */
-    QDialog::DialogCode m_enmResult;
+    QDialog::DialogCode   m_enmResult;
     /** Holds modal dialog's event-loop. */
-    QPointer<QEventLoop> m_pEventLoop;
+    QPointer<QEventLoop>  m_pEventLoop;
 
-    /** Holds dialog's default-button. */
-    QPointer<QPushButton> m_pDefaultButton;
+    /** Holds dialog's default button. */
+    QPointer<QPushButton>  m_pDefaultButton;
     /** Holds dialog's size-grip. */
-    QPointer<QSizeGrip> m_pSizeGrip;
+    QPointer<QSizeGrip>    m_pSizeGrip;
 };
 
