Index: /trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsHD.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsHD.h	(revision 24394)
+++ /trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsHD.h	(revision 24395)
@@ -143,5 +143,5 @@
     void setCtrType (KStorageControllerType aCtrType);
 
-    virtual DeviceTypeList deviceTypeList() const = 0;
+    DeviceTypeList deviceTypeList() const;
 
 protected:
@@ -164,6 +164,4 @@
 private:
 
-    DeviceTypeList deviceTypeList() const;
-
     KStorageControllerType first() const;
     uint size() const;
@@ -179,6 +177,4 @@
 private:
 
-    DeviceTypeList deviceTypeList() const;
-
     KStorageControllerType first() const;
     uint size() const;
@@ -194,6 +190,4 @@
 private:
 
-    DeviceTypeList deviceTypeList() const;
-
     KStorageControllerType first() const;
     uint size() const;
@@ -208,6 +202,4 @@
 
 private:
-
-    DeviceTypeList deviceTypeList() const;
 
     KStorageControllerType first() const;
@@ -421,5 +413,4 @@
         R_AttSlots,
         R_AttDevice,
-        R_AttDevices,
         R_AttMediumId,
         R_AttIsShowDiffs,
@@ -504,5 +495,5 @@
 public:
 
-    StorageDelegate (QObject *aParent, bool aDisableStaticControls);
+    StorageDelegate (QObject *aParent);
 
 private:
@@ -524,5 +515,5 @@
 public:
 
-    VBoxVMSettingsHD (bool aDisableStaticControls = false);
+    VBoxVMSettingsHD();
 
 signals:
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp	(revision 24394)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp	(revision 24395)
@@ -54,5 +54,4 @@
 #include "VBoxTakeSnapshotDlg.h"
 #include "VBoxVMFirstRunWzd.h"
-#include "VBoxVMSettingsHD.h"
 #include "VBoxVMSettingsNetwork.h"
 #include "VBoxVMSettingsSF.h"
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsHD.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsHD.cpp	(revision 24394)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsHD.cpp	(revision 24395)
@@ -226,4 +226,9 @@
 }
 
+DeviceTypeList AbstractControllerType::deviceTypeList() const
+{
+    return vboxGlobal().virtualBox().GetSystemProperties().GetDeviceTypesForStorageBus (mBusType).toList();
+}
+
 /* IDE Controller Type */
 IDEControllerType::IDEControllerType (KStorageControllerType aSubType)
@@ -232,9 +237,4 @@
 }
 
-DeviceTypeList IDEControllerType::deviceTypeList() const
-{
-    return DeviceTypeList() << KDeviceType_HardDisk << KDeviceType_DVD;
-}
-
 KStorageControllerType IDEControllerType::first() const
 {
@@ -253,9 +253,4 @@
 }
 
-DeviceTypeList SATAControllerType::deviceTypeList() const
-{
-    return DeviceTypeList() << KDeviceType_HardDisk << KDeviceType_DVD;
-}
-
 KStorageControllerType SATAControllerType::first() const
 {
@@ -274,9 +269,4 @@
 }
 
-DeviceTypeList SCSIControllerType::deviceTypeList() const
-{
-    return DeviceTypeList() << KDeviceType_HardDisk << KDeviceType_DVD;
-}
-
 KStorageControllerType SCSIControllerType::first() const
 {
@@ -293,9 +283,4 @@
     : AbstractControllerType (KStorageBus_Floppy, aSubType)
 {
-}
-
-DeviceTypeList FloppyControllerType::deviceTypeList() const
-{
-    return DeviceTypeList() << KDeviceType_Floppy;
 }
 
@@ -1132,12 +1117,4 @@
             return result;
         }
-        case R_AttDevices:
-        {
-            QVariant result (QVariant::fromValue (DeviceTypeList()));
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                    result.setValue (static_cast <AttachmentItem*> (item)->attDeviceTypes());
-            return result;
-        }
         case R_AttMediumId:
         {
@@ -1254,4 +1231,10 @@
         }
         case R_HDPixmapRect:
+        {
+            int margin = data (aIndex, R_Margin).toInt();
+            int width = data (aIndex, R_IconSize).toInt();
+            return QRect (0 - width - margin, margin, width, width);
+        }
+        case R_CDPixmapRect:
         {
             int margin = data (aIndex, R_Margin).toInt();
@@ -1259,10 +1242,4 @@
             int width = data (aIndex, R_IconSize).toInt();
             return QRect (0 - width - spacing - width - margin, margin, width, width);
-        }
-        case R_CDPixmapRect:
-        {
-            int margin = data (aIndex, R_Margin).toInt();
-            int width = data (aIndex, R_IconSize).toInt();
-            return QRect (0 - width - margin, margin, width, width);
         }
         case R_FDPixmapRect:
@@ -1436,7 +1413,6 @@
 
 /* Storage Delegate */
-StorageDelegate::StorageDelegate (QObject *aParent, bool aDisableStaticControls)
+StorageDelegate::StorageDelegate (QObject *aParent)
     : QItemDelegate (aParent)
-    , mDisableStaticControls (aDisableStaticControls)
 {
 }
@@ -1495,5 +1471,5 @@
 
     /* Draw Controller Additions */
-    if (!mDisableStaticControls && model->data (aIndex, StorageModel::R_IsController).toBool() && state & QStyle::State_Selected)
+    if (model->data (aIndex, StorageModel::R_IsController).toBool() && state & QStyle::State_Selected)
     {
         DeviceTypeList devicesList (model->data (aIndex, StorageModel::R_CtrDevices).value <DeviceTypeList>());
@@ -1547,8 +1523,7 @@
  * Used as HD Settings widget.
  */
-VBoxVMSettingsHD::VBoxVMSettingsHD (bool aDisableStaticControls /* = false */)
+VBoxVMSettingsHD::VBoxVMSettingsHD()
     : mValidator (0)
     , mIsPolished (false)
-    , mDisableStaticControls (aDisableStaticControls)
 {
     /* Apply UI decorations */
@@ -1609,5 +1584,5 @@
     /* Storage Model/View */
     mStorageModel = new StorageModel (mTwStorageTree);
-    StorageDelegate *storageDelegate = new StorageDelegate (mTwStorageTree, mDisableStaticControls);
+    StorageDelegate *storageDelegate = new StorageDelegate (mTwStorageTree);
     mTwStorageTree->setMouseTracking (true);
     mTwStorageTree->setContextMenuPolicy (Qt::CustomContextMenu);
@@ -1623,5 +1598,4 @@
     mTbStorageBar->addAction (mAddCtrAction);
     mTbStorageBar->addAction (mDelCtrAction);
-    mTbStorageBar->setHidden (mDisableStaticControls);
 
 #ifdef Q_WS_MAC
@@ -1736,69 +1710,44 @@
 void VBoxVMSettingsHD::putBackTo()
 {
-    if (mDisableStaticControls)
-    {
-        /* Just search for the currently present CD/DVD & Floppy devices to update */
-        QModelIndex rootIndex = mStorageModel->root();
-        for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++ i)
-        {
-            QModelIndex ctrIndex = rootIndex.child (i, 0);
-            QString ctrName = mStorageModel->data (ctrIndex, StorageModel::R_CtrName).toString();
-            for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++ j)
-            {
-                QModelIndex attIndex = ctrIndex.child (j, 0);
-                KDeviceType attDeviceType = mStorageModel->data (attIndex, StorageModel::R_AttDevice).value <KDeviceType>();
-                if (attDeviceType != KDeviceType_DVD && attDeviceType != KDeviceType_Floppy) continue;
-                StorageSlot attStorageSlot = mStorageModel->data (attIndex, StorageModel::R_AttSlot).value <StorageSlot>();
-                QString attMediumId = mStorageModel->data (attIndex, StorageModel::R_AttMediumId).toString();
-                const CMedium &medium = mMachine.GetMedium (ctrName, attStorageSlot.port, attStorageSlot.device);
-                if ((medium.isNull() && !QUuid (attMediumId).isNull()) ||
-                    (!medium.isNull() && medium.GetId() != attMediumId))
-                    mMachine.MountMedium (ctrName, attStorageSlot.port, attStorageSlot.device, attMediumId);
-            }
-        }
-    }
-    else
-    {
-        /* Remove currently present controllers & attachments */
-        CStorageControllerVector controllers = mMachine.GetStorageControllers();
-        foreach (const CStorageController &controller, controllers)
-        {
-            QString controllerName (controller.GetName());
-            CMediumAttachmentVector attachments = mMachine.GetMediumAttachmentsOfController (controllerName);
-            foreach (const CMediumAttachment &attachment, attachments)
-                mMachine.DetachDevice (controllerName, attachment.GetPort(), attachment.GetDevice());
-            mMachine.RemoveStorageController (controllerName);
-        }
-
-        /* Save created controllers & attachments */
-        QModelIndex rootIndex = mStorageModel->root();
-        for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++ i)
-        {
-            QModelIndex ctrIndex = rootIndex.child (i, 0);
-            QString ctrName = mStorageModel->data (ctrIndex, StorageModel::R_CtrName).toString();
-            KStorageBus ctrBusType = mStorageModel->data (ctrIndex, StorageModel::R_CtrBusType).value <KStorageBus>();
-            KStorageControllerType ctrType = mStorageModel->data (ctrIndex, StorageModel::R_CtrType).value <KStorageControllerType>();
-            CStorageController ctr = mMachine.AddStorageController (ctrName, ctrBusType);
-            ctr.SetControllerType (ctrType);
-            int maxUsedPort = -1;
-            for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++ j)
-            {
-                QModelIndex attIndex = ctrIndex.child (j, 0);
-                StorageSlot attStorageSlot = mStorageModel->data (attIndex, StorageModel::R_AttSlot).value <StorageSlot>();
-                KDeviceType attDeviceType = mStorageModel->data (attIndex, StorageModel::R_AttDevice).value <KDeviceType>();
-                QString attMediumId = mStorageModel->data (attIndex, StorageModel::R_AttMediumId).toString();
-                mMachine.AttachDevice (ctrName, attStorageSlot.port, attStorageSlot.device, attDeviceType, attMediumId);
-                if (attDeviceType == KDeviceType_DVD)
-                    mMachine.PassthroughDevice (ctrName, attStorageSlot.port, attStorageSlot.device,
-                                                mStorageModel->data (attIndex, StorageModel::R_AttIsPassthrough).toBool());
-                maxUsedPort = attStorageSlot.port > maxUsedPort ? attStorageSlot.port : maxUsedPort;
-            }
-            if (ctrBusType == KStorageBus_SATA)
-            {
-                ULONG sataPortsCount = maxUsedPort + 1;
-                sataPortsCount = qMax (sataPortsCount, ctr.GetMinPortCount());
-                sataPortsCount = qMin (sataPortsCount, ctr.GetMaxPortCount());
-                ctr.SetPortCount (sataPortsCount);
-            }
+    /* Remove currently present controllers & attachments */
+    CStorageControllerVector controllers = mMachine.GetStorageControllers();
+    foreach (const CStorageController &controller, controllers)
+    {
+        QString controllerName (controller.GetName());
+        CMediumAttachmentVector attachments = mMachine.GetMediumAttachmentsOfController (controllerName);
+        foreach (const CMediumAttachment &attachment, attachments)
+            mMachine.DetachDevice (controllerName, attachment.GetPort(), attachment.GetDevice());
+        mMachine.RemoveStorageController (controllerName);
+    }
+
+    /* Save created controllers & attachments */
+    QModelIndex rootIndex = mStorageModel->root();
+    for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++ i)
+    {
+        QModelIndex ctrIndex = rootIndex.child (i, 0);
+        QString ctrName = mStorageModel->data (ctrIndex, StorageModel::R_CtrName).toString();
+        KStorageBus ctrBusType = mStorageModel->data (ctrIndex, StorageModel::R_CtrBusType).value <KStorageBus>();
+        KStorageControllerType ctrType = mStorageModel->data (ctrIndex, StorageModel::R_CtrType).value <KStorageControllerType>();
+        CStorageController ctr = mMachine.AddStorageController (ctrName, ctrBusType);
+        ctr.SetControllerType (ctrType);
+        int maxUsedPort = -1;
+        for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++ j)
+        {
+            QModelIndex attIndex = ctrIndex.child (j, 0);
+            StorageSlot attStorageSlot = mStorageModel->data (attIndex, StorageModel::R_AttSlot).value <StorageSlot>();
+            KDeviceType attDeviceType = mStorageModel->data (attIndex, StorageModel::R_AttDevice).value <KDeviceType>();
+            QString attMediumId = mStorageModel->data (attIndex, StorageModel::R_AttMediumId).toString();
+            mMachine.AttachDevice (ctrName, attStorageSlot.port, attStorageSlot.device, attDeviceType, attMediumId);
+            if (attDeviceType == KDeviceType_DVD)
+                mMachine.PassthroughDevice (ctrName, attStorageSlot.port, attStorageSlot.device,
+                                            mStorageModel->data (attIndex, StorageModel::R_AttIsPassthrough).toBool());
+            maxUsedPort = attStorageSlot.port > maxUsedPort ? attStorageSlot.port : maxUsedPort;
+        }
+        if (ctrBusType == KStorageBus_SATA)
+        {
+            ULONG sataPortsCount = maxUsedPort + 1;
+            sataPortsCount = qMax (sataPortsCount, ctr.GetMinPortCount());
+            sataPortsCount = qMin (sataPortsCount, ctr.GetMaxPortCount());
+            ctr.SetPortCount (sataPortsCount);
         }
     }
@@ -1998,16 +1947,36 @@
     Assert (mStorageModel->data (index, StorageModel::R_IsController).toBool());
 
-    if (mStorageModel->data (index, StorageModel::R_CtrBusType).value <KStorageBus>() == KStorageBus_Floppy)
-    {
-        Assert (mAddFDAttAction->isEnabled());
-        mAddFDAttAction->trigger();
-    }
-    else
-    {
-        QMenu menu;
-        menu.addAction (mAddHDAttAction);
-        menu.addAction (mAddCDAttAction);
+    DeviceTypeList deviceTypeList (mStorageModel->data (index, StorageModel::R_CtrDevices).value <DeviceTypeList>());
+    bool justTrigger = deviceTypeList.size() == 1;
+    bool showMenu = deviceTypeList.size() > 1;
+    QMenu menu;
+    foreach (const KDeviceType &deviceType, deviceTypeList)
+    {
+        switch (deviceType)
+        {
+            case KDeviceType_HardDisk:
+                if (justTrigger)
+                    mAddHDAttAction->trigger();
+                if (showMenu)
+                    menu.addAction (mAddHDAttAction);
+                break;
+            case KDeviceType_DVD:
+                if (justTrigger)
+                    mAddCDAttAction->trigger();
+                if (showMenu)
+                    menu.addAction (mAddCDAttAction);
+                break;
+            case KDeviceType_Floppy:
+                if (justTrigger)
+                    mAddFDAttAction->trigger();
+                if (showMenu)
+                    menu.addAction (mAddFDAttAction);
+                break;
+            default:
+                break;
+        }
+    }
+    if (showMenu)
         menu.exec (QCursor::pos());
-    }
 }
 
@@ -2060,6 +2029,4 @@
                 /* Getting Controller Name */
                 mLeName->setText (mStorageModel->data (index, StorageModel::R_CtrName).toString());
-                mLbName->setEnabled (!mDisableStaticControls);
-                mLeName->setEnabled (!mDisableStaticControls);
 
                 /* Getting Controller Sub type */
@@ -2071,6 +2038,4 @@
                 int ctrPos = mCbType->findText (vboxGlobal().toString (type));
                 mCbType->setCurrentIndex (ctrPos == -1 ? 0 : ctrPos);
-                mLbType->setEnabled (!mDisableStaticControls);
-                mCbType->setEnabled (!mDisableStaticControls);
 
                 /* Showing Controller Page */
@@ -2089,11 +2054,8 @@
                 mCbSlot->setCurrentIndex (attSlotPos == -1 ? 0 : attSlotPos);
                 mCbSlot->setToolTip (mCbSlot->itemText (mCbSlot->currentIndex()));
-                mLbSlot->setEnabled (!mDisableStaticControls);
-                mCbSlot->setEnabled (!mDisableStaticControls);
 
                 /* Getting Show Diffs state */
                 bool isShowDiffs = mStorageModel->data (index, StorageModel::R_AttIsShowDiffs).toBool();
                 mCbShowDiffs->setChecked (isShowDiffs);
-                mCbShowDiffs->setEnabled (!mDisableStaticControls);
 
                 /* Getting Attachment Medium */
@@ -2103,19 +2065,10 @@
                     case KDeviceType_HardDisk:
                         mLbVdi->setText (tr ("Hard &Disk:"));
-                        mLbVdi->setEnabled (!mDisableStaticControls);
-                        mCbVdi->setEnabled (!mDisableStaticControls);
-                        mTbVmm->setEnabled (!mDisableStaticControls);
                         break;
                     case KDeviceType_DVD:
                         mLbVdi->setText (tr ("&CD/DVD Device:"));
-                        mLbVdi->setEnabled (true);
-                        mCbVdi->setEnabled (true);
-                        mTbVmm->setEnabled (true);
                         break;
                     case KDeviceType_Floppy:
                         mLbVdi->setText (tr ("&Floppy Device:"));
-                        mLbVdi->setEnabled (true);
-                        mCbVdi->setEnabled (true);
-                        mTbVmm->setEnabled (true);
                         break;
                     default:
@@ -2129,5 +2082,5 @@
                 /* Getting Passthrough state */
                 bool isHostDrive = mStorageModel->data (index, StorageModel::R_AttIsHostDrive).toBool();
-                mCbPassthrough->setEnabled (!mDisableStaticControls && isHostDrive);
+                mCbPassthrough->setEnabled (isHostDrive);
                 mCbPassthrough->setChecked (isHostDrive && mStorageModel->data (index, StorageModel::R_AttIsPassthrough).toBool());
 
@@ -2222,17 +2175,17 @@
     bool isAttachmentsPossible = mStorageModel->data (index, StorageModel::R_IsMoreAttachmentsPossible).toBool();
 
-    mAddCtrAction->setEnabled (!mDisableStaticControls && (isIDEPossible || isSATAPossible || isSCSIPossible || isFloppyPossible));
-    mAddIDECtrAction->setEnabled (!mDisableStaticControls && isIDEPossible);
-    mAddSATACtrAction->setEnabled (!mDisableStaticControls && isSATAPossible);
-    mAddSCSICtrAction->setEnabled (!mDisableStaticControls && isSCSIPossible);
-    mAddFloppyCtrAction->setEnabled (!mDisableStaticControls && isFloppyPossible);
-
-    mAddAttAction->setEnabled (!mDisableStaticControls && isController && isAttachmentsPossible);
-    mAddHDAttAction->setEnabled (!mDisableStaticControls && isController && isAttachmentsPossible);
-    mAddCDAttAction->setEnabled (!mDisableStaticControls && isController && isAttachmentsPossible);
-    mAddFDAttAction->setEnabled (!mDisableStaticControls && isController && isAttachmentsPossible);
-
-    mDelCtrAction->setEnabled (!mDisableStaticControls && isController);
-    mDelAttAction->setEnabled (!mDisableStaticControls && isAttachment);
+    mAddCtrAction->setEnabled (isIDEPossible || isSATAPossible || isSCSIPossible || isFloppyPossible);
+    mAddIDECtrAction->setEnabled (isIDEPossible);
+    mAddSATACtrAction->setEnabled (isSATAPossible);
+    mAddSCSICtrAction->setEnabled (isSCSIPossible);
+    mAddFloppyCtrAction->setEnabled (isFloppyPossible);
+
+    mAddAttAction->setEnabled (isController && isAttachmentsPossible);
+    mAddHDAttAction->setEnabled (isController && isAttachmentsPossible);
+    mAddCDAttAction->setEnabled (isController && isAttachmentsPossible);
+    mAddFDAttAction->setEnabled (isController && isAttachmentsPossible);
+
+    mDelCtrAction->setEnabled (isController);
+    mDelAttAction->setEnabled (isAttachment);
 }
 
