Index: /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp	(revision 92439)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp	(revision 92440)
@@ -36,4 +36,5 @@
 #include "UIMediumSelector.h"
 #include "UIMessageCenter.h"
+#include "UIModalWindowManager.h"
 #include "UIIconPool.h"
 #include "UIMedium.h"
@@ -81,4 +82,5 @@
     , m_uMachineID(uMachineID)
     , m_pActionPool(pActionPool)
+    , m_iGeometrySaveTimerId(-1)
 {
     /* Start full medium-enumeration (if necessary): */
@@ -88,4 +90,5 @@
     finalize();
     selectMedium(uCurrentMediumId);
+    loadSettings();
 }
 
@@ -128,4 +131,25 @@
         m_pTreeWidget->headerItem()->setText(2, tr("Actual Size"));
     }
+}
+
+bool UIMediumSelector::event(QEvent *pEvent)
+{
+    if (pEvent->type() == QEvent::Resize || pEvent->type() == QEvent::Move)
+    {
+        if (m_iGeometrySaveTimerId != -1)
+            killTimer(m_iGeometrySaveTimerId);
+        m_iGeometrySaveTimerId = startTimer(300);
+    }
+    else if (pEvent->type() == QEvent::Timer)
+    {
+        QTimerEvent *pTimerEvent = static_cast<QTimerEvent*>(pEvent);
+        if (pTimerEvent->timerId() == m_iGeometrySaveTimerId)
+        {
+            killTimer(m_iGeometrySaveTimerId);
+            m_iGeometrySaveTimerId = -1;
+            saveDialogGeometry();
+        }
+    }
+    return QIWithRetranslateUI<QIWithRestorableGeometry<QIMainDialog> >::event(pEvent);
 }
 
@@ -561,27 +585,4 @@
     Q_UNUSED(pEvent);
 
-    /* Try to determine the initial size: */
-    QSize proposedSize;
-    int iHostScreen = 0;
-    if (m_pParent)
-        iHostScreen = gpDesktop->screenNumber(m_pParent);
-    else
-        iHostScreen = gpDesktop->screenNumber(this);
-    if (iHostScreen >= 0 && iHostScreen < gpDesktop->screenCount())
-    {
-        /* On the basis of current host-screen geometry if possible: */
-        const QRect screenGeometry = gpDesktop->screenGeometry(iHostScreen);
-        if (screenGeometry.isValid())
-            proposedSize = screenGeometry.size() / 2.5;
-    }
-    /* Fallback to default size if we failed: */
-    if (proposedSize.isNull())
-        proposedSize = QSize(800, 600);
-    /* Resize to initial size: */
-    resize(proposedSize);
-
-    if (m_pParent)
-        UIDesktopWidgetWatchdog::centerWidget(this, m_pParent, false);
-
     if (m_pTreeWidget)
         m_pTreeWidget->setFocus();
@@ -722,2 +723,26 @@
     }
 }
+
+void UIMediumSelector::saveDialogGeometry()
+{
+    const QRect geo = currentGeometry();
+    LogRel2(("GUI: UIMediumSelector: Saving geometry as: Origin=%dx%d, Size=%dx%d\n",
+             geo.x(), geo.y(), geo.width(), geo.height()));
+    gEDataManager->setMediumSelectorDialogGeometry(geo, isCurrentlyMaximized());
+}
+
+void UIMediumSelector::loadSettings()
+{
+    const QRect availableGeo = gpDesktop->availableGeometry(this);
+    int iDefaultWidth = availableGeo.width() / 2;
+    int iDefaultHeight = availableGeo.height() * 3 / 4;
+    QRect defaultGeo(0, 0, iDefaultWidth, iDefaultHeight);
+
+    QWidget *pParent = windowManager().realParentWindow(m_pParent ? m_pParent : windowManager().mainWindowShown());
+    /* Load geometry from extradata: */
+    const QRect geo = gEDataManager->mediumSelectorDialogGeometry(this, pParent, defaultGeo);
+    LogRel2(("GUI: UISoftKeyboard: Restoring geometry to: Origin=%dx%d, Size=%dx%d\n",
+             geo.x(), geo.y(), geo.width(), geo.height()));
+
+    restoreGeometry(geo);
+}
Index: /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.h	(revision 92439)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.h	(revision 92440)
@@ -69,6 +69,11 @@
 protected:
 
-    void showEvent(QShowEvent *pEvent);
-
+    /** @name Event-handling stuff.
+      * @{ */
+        /** Handles translation event. */
+        virtual void retranslateUi() final override;
+        void showEvent(QShowEvent *pEvent) final override;
+        bool event(QEvent *pEvent) final override;
+    /** @} */
 
 private slots:
@@ -92,11 +97,4 @@
 
 private:
-
-
-    /** @name Event-handling stuff.
-      * @{ */
-        /** Handles translation event. */
-        virtual void retranslateUi() /* override */;
-    /** @} */
 
     /** @name Prepare/cleanup cascade.
@@ -124,4 +122,6 @@
     void          selectMedium(const QUuid &uMediumID);
     void          setTitle();
+    void          saveDialogGeometry();
+    void          loadSettings();
     QWidget              *m_pCentralWidget;
     QVBoxLayout          *m_pMainLayout;
@@ -156,4 +156,5 @@
     QUuid                 m_uCurrentMediumId;
     UIActionPool         *m_pActionPool;
+    int                   m_iGeometrySaveTimerId;
 };
 
