Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h	(revision 24143)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h	(revision 24147)
@@ -147,5 +147,4 @@
 
     void devicesSwitchVrdp (bool aOn);
-    void devicesOpenStorageDialog();
     void devicesOpenNetworkDialog();
     void devicesOpenSFDialog();
@@ -156,4 +155,5 @@
     void prepareSFMenu();
 
+    void mountMedium();
     void switchUSB (QAction *aAction);
 
@@ -237,5 +237,6 @@
     QMenu *mVMMenuMini;
     QMenu *mDevicesMenu;
-    QMenu *mDevicesStorageMenu;
+    QMenu *mDevicesCDMenu;
+    QMenu *mDevicesFDMenu;
     QMenu *mDevicesNetworkMenu;
     QMenu *mDevicesSFMenu;
@@ -272,5 +273,4 @@
 
     /* Devices actions */
-    QAction *mDevicesStorageDialogAction;
     QAction *mDevicesNetworkDialogAction;
     QAction *mDevicesSFDialogAction;
@@ -379,34 +379,4 @@
 
 class VBoxSettingsPage;
-class VBoxStorageDialog : public QIWithRetranslateUI <QDialog>
-{
-    Q_OBJECT;
-
-public:
-
-    VBoxStorageDialog (QWidget *aParent, CSession &aSession);
-
-protected:
-
-    void retranslateUi();
-
-protected slots:
-
-    virtual void accept();
-
-    void revalidate (QIWidgetValidator *aValidator);
-    void enableOk (const QIWidgetValidator *aValidator);
-
-protected:
-
-    void showEvent (QShowEvent *aEvent);
-
-private:
-
-    VBoxSettingsPage *mSettings;
-    QIDialogButtonBox *mButtonBox;
-    CSession &mSession;
-};
-
 class VBoxNetworkDialog : public QIWithRetranslateUI <QDialog>
 {
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaManagerDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaManagerDlg.h	(revision 24143)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaManagerDlg.h	(revision 24147)
@@ -56,5 +56,6 @@
                 const CMachine &aSessionMachine = CMachine(),
                 const QString &aSelectId = QString::null,
-                bool aShowDiffs = true);
+                bool aShowDiffs = true,
+                const QStringList &aUsedMediaIds = QStringList());
 
     static void showModeless (QWidget *aParent = NULL, bool aRefresh = true);
@@ -171,4 +172,5 @@
     QString mCDSelectedId;
     QString mFDSelectedId;
+    QStringList mUsedMediaIds;
 };
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp	(revision 24143)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp	(revision 24147)
@@ -197,4 +197,21 @@
 };
 
+struct MountTarget
+{
+    MountTarget() : name (QString ("")), port (0), device (0), id (QString ("")), type (VBoxDefs::MediumType_Invalid) {}
+    MountTarget (const QString &aName, LONG aPort, LONG aDevice)
+        : name (aName), port (aPort), device (aDevice), id (QString ("")), type (VBoxDefs::MediumType_Invalid) {}
+    MountTarget (const QString &aName, LONG aPort, LONG aDevice, const QString &aId)
+        : name (aName), port (aPort), device (aDevice), id (aId), type (VBoxDefs::MediumType_Invalid) {}
+    MountTarget (const QString &aName, LONG aPort, LONG aDevice, const QString &aId, VBoxDefs::MediumType aType)
+        : name (aName), port (aPort), device (aDevice), id (aId), type (aType) {}
+    QString name;
+    LONG port;
+    LONG device;
+    QString id;
+    VBoxDefs::MediumType type;
+};
+Q_DECLARE_METATYPE (MountTarget);
+
 /** \class VBoxConsoleWnd
  *
@@ -225,5 +242,6 @@
     , mVMMenuMini (0)
     , mDevicesMenu (0)
-    , mDevicesStorageMenu (0)
+    , mDevicesCDMenu (0)
+    , mDevicesFDMenu (0)
     , mDevicesNetworkMenu (0)
     , mDevicesSFMenu (0)
@@ -258,5 +276,4 @@
     , mVmCloseAction (0)
     /* Device Menu Actions */
-    , mDevicesStorageDialogAction (0)
     , mDevicesNetworkDialogAction (0)
     , mDevicesSFDialogAction (0)
@@ -402,8 +419,4 @@
 
     /* Devices menu actions */
-    mDevicesStorageDialogAction = new QAction (mRunningOrPausedActions);
-    mDevicesStorageDialogAction->setIcon (VBoxGlobal::iconSet (
-        ":/attachment_16px.png", ":/attachment_disabled_16px.png"));
-
     mDevicesNetworkDialogAction = new QAction (mRunningOrPausedActions);
     mDevicesNetworkDialogAction->setIcon (VBoxGlobal::iconSet (
@@ -451,7 +464,9 @@
     /* Menu Items */
     mMainMenu = new QIMenu (this);
-    mDevicesStorageMenu = new QMenu (this);
+    mDevicesCDMenu = new QMenu (this);
+    mDevicesFDMenu = new QMenu (this);
     mDevicesNetworkMenu = new QMenu (this);
     mDevicesSFMenu = new QMenu (this);
+    mDevicesUSBMenu = new VBoxUSBMenu (this);
 
     /* Machine submenu */
@@ -491,9 +506,10 @@
     mMainMenu->addMenu (mDevicesMenu);
 
-    mDevicesUSBMenu = new VBoxUSBMenu (mDevicesMenu);
-    mDevicesUSBMenu->setIcon (VBoxGlobal::iconSet (
-        ":/usb_16px.png", ":/usb_disabled_16px.png"));
-
-    mDevicesMenu->addAction (mDevicesStorageDialogAction);
+    mDevicesCDMenu->setIcon (VBoxGlobal::iconSet (":/cd_16px.png", ":/cd_disabled_16px.png"));
+    mDevicesFDMenu->setIcon (VBoxGlobal::iconSet (":/fd_16px.png", ":/fd_disabled_16px.png"));
+    mDevicesUSBMenu->setIcon (VBoxGlobal::iconSet (":/usb_16px.png", ":/usb_disabled_16px.png"));
+
+    mDevicesMenu->addMenu (mDevicesCDMenu);
+    mDevicesMenu->addMenu (mDevicesFDMenu);
     mDevicesMenu->addAction (mDevicesNetworkDialogAction);
     mDevicesMenu->addAction (mDevicesSFDialogAction);
@@ -508,7 +524,4 @@
     mDevicesMenu->addSeparator();
     mDevicesMenu->addAction (mDevicesInstallGuestToolsAction);
-
-    /* Reset the "context menu" flag */
-    mDevicesUSBMenu->menuAction()->setData (false);
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
@@ -665,10 +678,10 @@
     connect (mVmCloseAction, SIGNAL (triggered()), this, SLOT (vmClose()));
 
-    connect (mDevicesStorageMenu, SIGNAL (aboutToShow()), this, SLOT (prepareStorageMenu()));
+    connect (mDevicesCDMenu, SIGNAL (aboutToShow()), this, SLOT (prepareStorageMenu()));
+    connect (mDevicesFDMenu, SIGNAL (aboutToShow()), this, SLOT (prepareStorageMenu()));
     connect (mDevicesNetworkMenu, SIGNAL (aboutToShow()), this, SLOT (prepareNetworkMenu()));
     connect (mDevicesSFMenu, SIGNAL (aboutToShow()), this, SLOT (prepareSFMenu()));
     connect (mDevicesUSBMenu, SIGNAL(triggered (QAction *)), this, SLOT(switchUSB (QAction *)));
 
-    connect (mDevicesStorageDialogAction, SIGNAL (triggered()), this, SLOT (devicesOpenStorageDialog()));
     connect (mDevicesNetworkDialogAction, SIGNAL (triggered()), this, SLOT (devicesOpenNetworkDialog()));
     connect (mDevicesSFDialogAction, SIGNAL (triggered()), this, SLOT (devicesOpenSFDialog()));
@@ -676,6 +689,4 @@
     connect (mDevicesInstallGuestToolsAction, SIGNAL (triggered()), this, SLOT (devicesInstallGuestAdditions()));
 
-    connect (mHDLed, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
-             this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *)));
     connect (mCDLed, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
              this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *)));
@@ -901,4 +912,20 @@
             mConsole->requestToResize (QSize (w, h - menuBar()->height() - statusBar()->height()));
     }
+
+    /* initialize storage stuff */
+    int cdDevicesCount = 0;
+    int fdDevicesCount = 0;
+    const CMediumAttachmentVector &attachments = machine.GetMediumAttachments();
+    foreach (const CMediumAttachment &attachment, attachments)
+    {
+        if (attachment.GetType() == KDeviceType_DVD)
+            ++ cdDevicesCount;
+        if (attachment.GetType() == KDeviceType_Floppy)
+            ++ fdDevicesCount;
+    }
+    mDevicesCDMenu->menuAction()->setData (cdDevicesCount);
+    mDevicesFDMenu->menuAction()->setData (fdDevicesCount);
+    mDevicesCDMenu->menuAction()->setVisible (cdDevicesCount);
+    mDevicesFDMenu->menuAction()->setVisible (fdDevicesCount);
 
     /* initialize usb stuff */
@@ -1605,6 +1632,6 @@
 
     /* Devices actions */
-    mDevicesStorageDialogAction->setText (tr ("&Storage Devices..."));
-    mDevicesStorageDialogAction->setStatusTip (tr ("Open the dialog to change settings of the storage devices"));
+    mDevicesCDMenu->setTitle (tr ("&CD/DVD Devices"));
+    mDevicesFDMenu->setTitle (tr ("&Floppy Devices"));
 
     mDevicesNetworkDialogAction->setText (tr ("&Network Adapters..."));
@@ -1614,5 +1641,5 @@
     mDevicesSFDialogAction->setStatusTip (tr ("Open the dialog to operate on shared folders"));
 
-    mDevicesSwitchVrdpAction->setText (tr ("Remote Dis&play"));
+    mDevicesSwitchVrdpAction->setText (tr ("&Remote Display"));
     mDevicesSwitchVrdpAction->setStatusTip (tr ("Enable or disable remote desktop (RDP) connections to this machine"));
 #if 0 /* TODO: Allow to setup status-bar! */
@@ -2047,12 +2074,4 @@
 }
 
-void VBoxConsoleWnd::devicesOpenStorageDialog()
-{
-    if (!mConsole) return;
-
-    VBoxStorageDialog dlg (mConsole, mSession);
-    dlg.exec();
-}
-
 void VBoxConsoleWnd::devicesOpenNetworkDialog()
 {
@@ -2119,6 +2138,155 @@
 void VBoxConsoleWnd::prepareStorageMenu()
 {
-    mDevicesStorageMenu->clear();
-    mDevicesStorageMenu->addAction (mDevicesStorageDialogAction);
+    QMenu *menu = qobject_cast <QMenu*> (sender());
+    Assert (menu);
+    menu->clear();
+
+    KDeviceType deviceType = menu == mDevicesCDMenu ? KDeviceType_DVD :
+                             menu == mDevicesFDMenu ? KDeviceType_Floppy :
+                                                      KDeviceType_Null;
+    Assert (deviceType != KDeviceType_Null);
+
+    VBoxDefs::MediumType mediumType = menu == mDevicesCDMenu ? VBoxDefs::MediumType_DVD :
+                                      menu == mDevicesFDMenu ? VBoxDefs::MediumType_Floppy :
+                                                               VBoxDefs::MediumType_Invalid;
+    Assert (mediumType != VBoxDefs::MediumType_Invalid);
+
+    const CMediumAttachmentVector &attachments = mSession.GetMachine().GetMediumAttachments();
+    foreach (const CMediumAttachment &attachment, attachments)
+    {
+        if (attachment.GetType() == deviceType)
+        {
+            /* Attachment menu item */
+            QMenu *attachmentMenu = 0;
+            if (menu->menuAction()->data().toInt() > 1)
+            {
+                attachmentMenu = new QMenu (menu);
+                attachmentMenu->setTitle (QString ("%1 (%2)").arg (attachment.GetController().GetName())
+                                          .arg (vboxGlobal().toString (StorageSlot (attachment.GetController().GetBus(),
+                                                                                    attachment.GetPort(),
+                                                                                    attachment.GetDevice()))));
+                switch (attachment.GetController().GetBus())
+                {
+                    case KStorageBus_IDE:
+                        attachmentMenu->setIcon (QIcon (":/ide_16px.png")); break;
+                    case KStorageBus_SATA:
+                        attachmentMenu->setIcon (QIcon (":/sata_16px.png")); break;
+                    case KStorageBus_SCSI:
+                        attachmentMenu->setIcon (QIcon (":/scsi_16px.png")); break;
+                    case KStorageBus_Floppy:
+                        attachmentMenu->setIcon (QIcon (":/floppy_16px.png")); break;
+                    default:
+                        break;
+                }
+                menu->addMenu (attachmentMenu);
+            }
+            else attachmentMenu = menu;
+
+            /* Related VBoxMedium item */
+            VBoxMedium vboxMediumCurrent;
+            vboxGlobal().findMedium (attachment.GetMedium(), vboxMediumCurrent);
+
+            /* Mount Medium actions */
+            int addedIntoList = 0;
+            const VBoxMediaList &vboxMediums = vboxGlobal().currentMediaList();
+            foreach (const VBoxMedium &vboxMedium, vboxMediums)
+            {
+                if (vboxMedium.type() == mediumType)
+                {
+                    bool isMediumUsed = false;
+                    foreach (const CMediumAttachment &otherAttachment, attachments)
+                    {
+                        if (otherAttachment != attachment)
+                        {
+                            CMedium otherMedium = otherAttachment.GetMedium();
+                            if (!otherMedium.isNull() && otherMedium.GetId() == vboxMedium.id())
+                            {
+                                isMediumUsed = true;
+                                break;
+                            }
+                        }
+                    }
+                    if (!isMediumUsed)
+                    {
+                        QAction *mountMediumAction = new QAction (vboxMedium.name(), attachmentMenu);
+                        mountMediumAction->setCheckable (true);
+                        mountMediumAction->setChecked (vboxMedium.id() == vboxMediumCurrent.id());
+                        mountMediumAction->setData (QVariant::fromValue (MountTarget (attachment.GetController().GetName(),
+                                                                                      attachment.GetPort(),
+                                                                                      attachment.GetDevice(),
+                                                                                      vboxMedium.id())));
+                        connect (mountMediumAction, SIGNAL (triggered (bool)), this, SLOT (mountMedium()));
+                        attachmentMenu->addAction (mountMediumAction);
+                        ++ addedIntoList;
+                        if (addedIntoList == 5)
+                            break;
+                    }
+                }
+            }
+
+            /* Virtual Media Manager action */
+            QAction *callVMMAction = new QAction (attachmentMenu);
+            callVMMAction->setIcon (QIcon (":/diskimage_16px.png"));
+            callVMMAction->setData (QVariant::fromValue (MountTarget (attachment.GetController().GetName(),
+                                                                      attachment.GetPort(),
+                                                                      attachment.GetDevice(),
+                                                                      QString (""),
+                                                                      mediumType)));
+            connect (callVMMAction, SIGNAL (triggered (bool)), this, SLOT (mountMedium()));
+            attachmentMenu->addAction (callVMMAction);
+
+            /* Separator */
+            attachmentMenu->addSeparator();
+
+            /* Unmount Medium action */
+            QAction *unmountMediumAction = new QAction (attachmentMenu);
+            unmountMediumAction->setEnabled (!vboxMediumCurrent.isNull());
+            unmountMediumAction->setData (QVariant::fromValue (MountTarget (attachment.GetController().GetName(),
+                                                                            attachment.GetPort(),
+                                                                            attachment.GetDevice())));
+            connect (unmountMediumAction, SIGNAL (triggered (bool)), this, SLOT (mountMedium()));
+            attachmentMenu->addAction (unmountMediumAction);
+
+            /* Switch CD/FD naming */
+            switch (deviceType)
+            {
+                case KDeviceType_DVD:
+                    callVMMAction->setText (tr ("More CD/DVD Images..."));
+                    unmountMediumAction->setText (tr ("Unmount CD/DVD Device"));
+                    unmountMediumAction->setIcon (VBoxGlobal::iconSet (":/cd_unmount_16px.png",
+                                                                       ":/cd_unmount_disabled_16px.png"));
+                    break;
+                case KDeviceType_Floppy:
+                    callVMMAction->setText (tr ("More Floppy Images..."));
+                    unmountMediumAction->setText (tr ("Unmount Floppy Device"));
+                    unmountMediumAction->setIcon (VBoxGlobal::iconSet (":/fd_unmount_16px.png",
+                                                                       ":/fd_unmount_disabled_16px.png"));
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+
+    if (menu->menuAction()->data().toInt() == 0)
+    {
+        /* Empty menu item */
+        Assert (menu->isEmpty());
+        QAction *emptyMenuAction = new QAction (menu);
+        emptyMenuAction->setEnabled (false);
+        switch (deviceType)
+        {
+            case KDeviceType_DVD:
+                emptyMenuAction->setText (tr ("No CD/DVD Devices Attached"));
+                break;
+            case KDeviceType_Floppy:
+                emptyMenuAction->setText (tr ("No Floppy Devices Attached"));
+                break;
+            default:
+                break;
+        }
+        emptyMenuAction->setIcon (VBoxGlobal::iconSet (":/delete_16px.png", ":/delete_disabled_16px.png"));
+        menu->addAction (emptyMenuAction);
+    }
 }
 
@@ -2133,4 +2301,38 @@
     mDevicesSFMenu->clear();
     mDevicesSFMenu->addAction (mDevicesSFDialogAction);
+}
+
+void VBoxConsoleWnd::mountMedium()
+{
+    QAction *action = qobject_cast <QAction*> (sender());
+    Assert (action);
+
+    MountTarget target = action->data().value <MountTarget>();
+    CMachine machine = mSession.GetMachine();
+    CMediumAttachment attachment = machine.GetMediumAttachment (target.name, target.port, target.device);
+    CMedium medium = attachment.GetMedium();
+
+    if (target.type != VBoxDefs::MediumType_Invalid)
+    {
+        /* Search for already used images */
+        QStringList usedImages;
+        const CMediumAttachmentVector &attachments = mSession.GetMachine().GetMediumAttachments();
+        foreach (const CMediumAttachment &index, attachments)
+        {
+            if (index != attachment && !index.GetMedium().isNull() && !index.GetMedium().GetHostDrive())
+                usedImages << index.GetMedium().GetId();
+        }
+        /* Open VMM Dialog */
+        VBoxMediaManagerDlg dlg (this);
+        dlg.setup (target.type, true /* do select? */, false /* do refresh? */,
+                   mSession.GetMachine(), QString(), true, usedImages);
+        if (dlg.exec() == QDialog::Accepted)
+            target.id = dlg.selectedId();
+        else return;
+    }
+
+    machine.MountMedium (target.name, target.port, target.device,
+                         target.id.isEmpty() || medium.isNull() || medium.GetId() != target.id ||
+                         target.type != VBoxDefs::MediumType_Invalid ? target.id : QString (""));
 }
 
@@ -2174,34 +2376,12 @@
 void VBoxConsoleWnd::showIndicatorContextMenu (QIStateIndicator *aInd, QContextMenuEvent *aEvent)
 {
-    if (aInd == mHDLed)
-    {
-        if (mDevicesStorageMenu->isEnabled())
-        {
-            /* set "this is a context menu" flag */
-            mDevicesStorageMenu->menuAction()->setData (true);
-            mDevicesStorageMenu->exec (aEvent->globalPos());
-            mDevicesStorageMenu->menuAction()->setData (false);
-        }
-    }
-    else if (aInd == mCDLed)
-    {
-        if (mDevicesStorageMenu->isEnabled())
-        {
-            /* set "this is a context menu" flag */
-            mDevicesStorageMenu->menuAction()->setData (true);
-            mDevicesStorageMenu->exec (aEvent->globalPos());
-            mDevicesStorageMenu->menuAction()->setData (false);
-        }
+    if (aInd == mCDLed)
+    {
+        mDevicesCDMenu->exec (aEvent->globalPos());
     }
 #if 0 /* TODO: Allow to setup status-bar! */
     else if (aInd == mFDLed)
     {
-        if (mDevicesStorageMenu->isEnabled())
-        {
-            /* set "this is a context menu" flag */
-            mDevicesStorageMenu->menuAction()->setData (true);
-            mDevicesStorageMenu->exec (aEvent->globalPos());
-            mDevicesStorageMenu->menuAction()->setData (false);
-        }
+        mDevicesFDMenu->exec (aEvent->globalPos());
     }
 #endif
@@ -2209,28 +2389,15 @@
     {
         if (mDevicesNetworkMenu->isEnabled())
-        {
-            mDevicesNetworkMenu->menuAction()->setData (true);
             mDevicesNetworkMenu->exec (aEvent->globalPos());
-            mDevicesNetworkMenu->menuAction()->setData (false);
-        }
     }
     else if (aInd == mUSBLed)
     {
         if (mDevicesUSBMenu->isEnabled())
-        {
-            /* set "this is a context menu" flag */
-            mDevicesUSBMenu->menuAction()->setData (true);
             mDevicesUSBMenu->exec (aEvent->globalPos());
-            mDevicesUSBMenu->menuAction()->setData (false);
-        }
     }
     else if (aInd == mSFLed)
     {
         if (mDevicesSFMenu->isEnabled())
-        {
-            mDevicesSFMenu->menuAction()->setData (true);
             mDevicesSFMenu->exec (aEvent->globalPos());
-            mDevicesSFMenu->menuAction()->setData (false);
-        }
     }
     else if (aInd == mMouseLed)
@@ -3414,80 +3581,4 @@
 #endif /* VBOX_WITH_DEBUGGER_GUI */
 
-VBoxStorageDialog::VBoxStorageDialog (QWidget *aParent, CSession &aSession)
-    : QIWithRetranslateUI <QDialog> (aParent)
-    , mSettings (0)
-    , mButtonBox (0)
-    , mSession (aSession)
-{
-    setModal (true);
-    /* Setup Dialog's options */
-    setWindowIcon (QIcon (":/attachment_16px.png"));
-    setSizeGripEnabled (true);
-
-    /* Setup main dialog's layout */
-    QVBoxLayout *mainLayout = new QVBoxLayout (this);
-    VBoxGlobal::setLayoutMargin (mainLayout, 10);
-    mainLayout->setSpacing (10);
-
-    /* Setup settings layout */
-    mSettings = new VBoxVMSettingsHD (true);
-    VBoxGlobal::setLayoutMargin (mSettings->layout(), 0);
-    mainLayout->addWidget (mSettings);
-    mSettings->getFrom (aSession.GetMachine());
-
-    /* Setup validation */
-    QIWidgetValidator *validator = new QIWidgetValidator (mSettings, this);
-    mSettings->setValidator (validator);
-
-    /* Setup button's layout */
-    mButtonBox = new QIDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help);
-    mainLayout->addWidget (mButtonBox);
-
-    connect (mButtonBox, SIGNAL (helpRequested()), &vboxProblem(), SLOT (showHelpHelpDialog()));
-    connect (mButtonBox, SIGNAL (accepted()), this, SLOT (accept()));
-    connect (mButtonBox, SIGNAL (rejected()), this, SLOT (reject()));
-    connect (validator, SIGNAL (isValidRequested (QIWidgetValidator*)),
-             this, SLOT (revalidate (QIWidgetValidator*)));
-    connect (validator, SIGNAL (validityChanged (const QIWidgetValidator*)),
-             this, SLOT (enableOk (const QIWidgetValidator*)));
-
-    retranslateUi();
-}
-
-void VBoxStorageDialog::retranslateUi()
-{
-    setWindowTitle (tr ("Storage Devices"));
-}
-
-void VBoxStorageDialog::accept()
-{
-    mSettings->putBackTo();
-    CMachine machine = mSession.GetMachine();
-    machine.SaveSettings();
-    if (!machine.isOk())
-        vboxProblem().cannotSaveMachineSettings (machine);
-    QDialog::accept();
-}
-
-void VBoxStorageDialog::revalidate (QIWidgetValidator *aValidator)
-{
-    QString warning, title;
-    bool valid = mSettings->revalidate (warning, title);
-    aValidator->setOtherValid (valid);
-}
-
-void VBoxStorageDialog::enableOk (const QIWidgetValidator *aValidator)
-{
-    mButtonBox->button (QDialogButtonBox::Ok)->setEnabled (aValidator->isValid());
-}
-
-void VBoxStorageDialog::showEvent (QShowEvent *aEvent)
-{
-    resize (450, 300);
-    VBoxGlobal::centerWidget (this, parentWidget());
-    setMinimumWidth (400);
-    QDialog::showEvent (aEvent);
-}
-
 VBoxNetworkDialog::VBoxNetworkDialog (QWidget *aParent, CSession &aSession)
     : QIWithRetranslateUI <QDialog> (aParent)
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp	(revision 24143)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp	(revision 24147)
@@ -394,4 +394,6 @@
  *                          (ignored if @a aSessionMachine is null assuming
  *                          @c true).
+ * @param aUsedMediaIds     List containing IDs of mediums used in other
+ *                          attachments to restrict selection.
  */
 void VBoxMediaManagerDlg::setup (VBoxDefs::MediumType aType, bool aDoSelect,
@@ -399,5 +401,6 @@
                                  const CMachine &aSessionMachine /* = CMachine() */,
                                  const QString &aSelectId /* = QString() */,
-                                 bool aShowDiffs /* = true */)
+                                 bool aShowDiffs /* = true */,
+                                 const QStringList &aUsedMediaIds /* = QStringList() */)
 {
     mSetupMode = true;
@@ -432,4 +435,5 @@
 
     mDoSelect = aDoSelect;
+    mUsedMediaIds = aUsedMediaIds;
 
     mButtonBox->button (QDialogButtonBox::Cancel)->setVisible (mDoSelect);
@@ -1666,7 +1670,7 @@
         case Action_Select:
         {
-            /* In the current implementation, any known media can be attached
-             * (either directly, or indirectly), so always return true */
-            return true;
+            /* Restrict selecting mediums
+             * already used by other attachments */
+            return !mUsedMediaIds.contains (aItem->id());
         }
         case Action_Edit:
